pyvista / tetgen

A Python interface to the C++ TetGen library to generate tetrahedral meshes of any 3D polyhedral domains
http://tetgen.pyvista.org
Other
219 stars 32 forks source link

Get region attributes when regionattrib flag is 1 #22

Open Togela opened 3 years ago

Togela commented 3 years ago

Hello everyone. When the regionattrib flag (or -A in tetgen) is set to 1, tetgen should return the region attributes for each created tetrahedron. As far as I can comprehend it, no such data is created.

In the following is an example code to create a nested body which should result in a mesh with two different regions. import pyvista as pv import tetgen spherebig = pv.Sphere(1, (0,0,0)) spheresmall = pv.Sphere(0.5, (0,0,0)) allspheres = spherebig.boolean_add(spheresmall) v = allspheres.points f = allspheres.faces.reshape(-1, 4)[:, 1:] tet = tetgen.TetGen(v, f) nodes, elems = tet.tetrahedralize(regionattrib=1)