netgen/tests/pytest/test_csg.py
Matthias Hochsteger 97dfecd040 fix test
2020-10-16 17:58:52 +02:00

27 lines
860 B
Python

from netgen.csg import *
def test_2_polyhedra():
geo = CSGeometry()
first = Polyhedron([(0,0,0), (0,1,0), (3,1,0), (3,0,0),
(0,1,1), (3,1,1), (3,0,1), (0,0,1)],
[(0,1,2,3), (1,4,5,2), (2,5,6,3), (3,6,7,0),
(0,7,4,1), (7,6,5,4)])
# TODO: height = 0.1 not working!
height = 0.3
second = Polyhedron([(0,0,1), (0,1,1), (3,1,1), (3,0,1),
(0,1,1+height), (3,1,1+height),
(3,0,1+height), (0,0,1+height)],
[(0,1,2,3), (1,4,5,2), (2,5,6,3), (3,6,7,0),
(0,7,4,1), (7,6,5,4)])
geo.Add(first)
geo.Add(second)
mesh = geo.GenerateMesh()
return mesh
if __name__ == "__main__":
from ngsolve import Mesh, Draw
mesh = Mesh(test_2_polyhedra())
Draw(mesh)