A collection of functions to read/write tetgen files and to run the tetgen program
tetgen is a quality tetrahedral mesh generator and a 3D Delaunay triangulator. See http://tetgen.org
Classes defined in module tetgen
Functions defined in module tetgen
Read a tetgen .node file.
Returns a tuple as described in readNodesBlock.
Read a tetgen .ele file.
Returns a tuple as described in readElemsBlock.
Read a tetgen .face file.
Returns a tuple as described in readFacesBlock.
Read a tetgen .smesh file.
Returns an array of triangle elements.
Read a tetgen .poly file.
Returns an array of triangle elements.
Read a tetgen surface from a .node/.face file pair.
The given filename is either the .node or .face file. Returns a tuple of (nodes,elems).
Skip comments and blank lines on a tetgen file.
Reads from a file until the first non-comment and non-empty line. Then returns the non-empty, non-comment line, stripped from possible trailing comments. Returns None if end of file is reached.
Strip blanks, newline and comments from a line of text.
Read a number of ints from a line, adding zero for omitted values.
line is a string with b;anks separated integer values. Returns a list of nint integers. The trailing ones are set to zero if the strings contains less values.
Add an element to a collection.
Read a tetgen nodes block.
Returns a tuple with:
The last two may be None.
Read a tetgen elems block.
Returns a tuple with:
The last can be None.
Read a tetgen faces block.
Returns a a tuple with:
The last can be None.
Read a tetgen .smesh facets bock.
Returns a tuple of dictionaries with plexitudes as keys:
Read a tetgen .neigh file.
Returns an arrays containing the tetrahedra neighbours:
Write a tetgen .node file.
Write a tetgen .smesh file.
Currently it only writes the facets of a triangular surface mesh. Coords should be written independently to a .node file.
Write a tetgen .ele file.
Writes elements of a tet4 mesh.
Write a tetgen surface model to .node and .smesh files.
The provided file name is either the .node or the .smesh filename, or else it is the basename where .node and .smesh extensions will be appended.
Write a tetgen tetrahedral mesh model to .node and .ele files.
The provided file name is either the .node or the .smesh filename, or else it is the basename where .node and .ele extensions will be appended.
Returns the next file name in a family of tetgen file names.
Run tetgen mesher on the specified file.
The input file is a closed triangulated surface. tetgen will generate a volume tetraeder mesh inside the surface, and create a new approximation of the surface as a by-product.
Read and draw a tetgen file.
This is an experimental function for the geometry import menu.
Tetralize the convex hull of some points.
Finds the convex hull some points and returns a tet mesh of the convex hull and the convex hull (tri3 mesh).
If all points are on the same plane there is no convex hull.
This could be made an example:
from simple import regularGrid X = Coords(regularGrid([0., 0., 0.], [1., 1., 1.], [10, 10, 10]).reshape(-1, 3)).addNoise(rsize=0.05,asize=0.5) draw(X) from plugins.tetgen import tetgenConvexHull tch, ch =tetgenConvexHull( X) draw(ch, color=’red’, marksize=10)
check self intersections using tetgen
Returns couples of intersecting triangles
Create a tetrahedral mesh inside a surface
If the creation of the tetrahedral model is succesful, the results are read back using readTetgen and returned.