test_mesh3D.py 1021 Bytes
Newer Older
1
2
3
4
5
6
import tfields
import numpy as np
import unittest
import sympy  # NOQA: F401
import os
import sys
dboe's avatar
dboe committed
7
from .test_core import Base_Check
8
9
10
THIS_DIR = os.path.dirname(
    os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(THIS_DIR)))
11
12
13
14
15
16
17
18
19
20
21
22
23
24


class Sphere_Test(Base_Check, unittest.TestCase):
    def setUp(self):
        self._inst = tfields.Mesh3D.grid(
                (1, 1, 1),
                (-np.pi, np.pi, 12),
                (-np.pi / 2, np.pi / 2, 12),
                coord_sys='spherical')
        self._inst.transform('cartesian')
        self._inst[:, 1] += 2

    def test_cut_split(self):
        x, y, z = sympy.symbols('x y z')
25
        self._inst.cut(x + 1./100*y > 0, at_intersection='split')
Daniel Boeckenhoff's avatar
Daniel Boeckenhoff committed
26
27


28
class IO_Stl_test(unittest.TestCase):
Daniel Boeckenhoff's avatar
Daniel Boeckenhoff committed
29
    def setUp(self):
30
31
32
        self._inst = tfields.Mesh3D.load(os.path.join(THIS_DIR,
                                                      '../data/baffle.stl'))

33
34

if __name__ == '__main__':
35
    unittest.main()