scallop dome pyformex logo

Previous topic

55. sectionize — sectionize.py

Next topic

57. tools — tools.py

[FSF Associate Member]

Valid XHTML 1.0 Transitional

56. tetgen — Interface with tetgen

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

tetgen.readNodeFile(fn)

Read a tetgen .node file.

Returns a tuple as described in readNodesBlock.

tetgen.readEleFile(fn)

Read a tetgen .ele file.

Returns a tuple as described in readElemsBlock.

tetgen.readFaceFile(fn)

Read a tetgen .face file.

Returns a tuple as described in readFacesBlock.

tetgen.readSmeshFile(fn)

Read a tetgen .smesh file.

Returns an array of triangle elements.

tetgen.readPolyFile(fn)

Read a tetgen .poly file.

Returns an array of triangle elements.

tetgen.readSurface(fn)

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).

tetgen.skipComments(fil)

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.

tetgen.stripLine(line)

Strip blanks, newline and comments from a line of text.

tetgen.getInts(line, nint)

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.

tetgen.addElem(elems, nrs, e, n, nplex)

Add an element to a collection.

tetgen.readNodesBlock(fil, npts, ndim, nattr, nbmark)

Read a tetgen nodes block.

Returns a tuple with:

  • coords: Coords array with nodal coordinates
  • nrs: node numbers
  • attr: node attributes
  • bmrk: node boundary marker

The last two may be None.

tetgen.readElemsBlock(fil, nelems, nplex, nattr)

Read a tetgen elems block.

Returns a tuple with:

  • elems: Connectivity of type ‘tet4’ or ‘tet10’
  • nrs: the element numbers
  • attr: the element attributes

The last can be None.

tetgen.readFacesBlock(fil, nelems, nbmark)

Read a tetgen faces block.

Returns a a tuple with:

  • elems: Connectivity of type ‘tri3’
  • nrs: face numbers
  • bmrk: face boundary marker

The last can be None.

tetgen.readSmeshFacetsBlock(fil, nfacets, nbmark)

Read a tetgen .smesh facets bock.

Returns a tuple of dictionaries with plexitudes as keys:

  • elems: for each plexitude a Connectivity array
  • nrs: for each plexitude a list of element numbers in corresponding elems
tetgen.readNeigh(fn)

Read a tetgen .neigh file.

Returns an arrays containing the tetrahedra neighbours:

tetgen.writeNodes(fn, coords, offset=0)

Write a tetgen .node file.

tetgen.writeSmesh(fn, facets, coords=None, holes=None, regions=None)

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.

tetgen.writeSurface(fn, coords, elems)

Write a tetgen surface model to .node and .smesh files.

The provided file name is the .node or the .smesh filename.

tetgen.nextFilename(fn)

Returns the next file name in a family of tetgen file names.

tetgen.runTetgen(fn, options='')

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.

tetgen.readTetgen(fn)

Read and draw a tetgen file.

This is an experimental function for the geometry import menu.

tetgen.checkSelfIntersectionsWithTetgen(self, verbose=False)

check self intersections using tetgen

Returns couples of intersecting triangles