TetGenTetrahedralize[expr,settings]
tetrahedralizes a TetGen expression using settings and returns the result in a new TetGen expression.
TetGenTetrahedralize
TetGenTetrahedralize[expr,settings]
tetrahedralizes a TetGen expression using settings and returns the result in a new TetGen expression.
Details and Options
- To use TetGenTetrahedralize, you first need to load it using Needs["TetGenLink`"].
- The settings given to TetGenTetrahedralize are a string of different commands:
-
"p" tetrahedralize a piecewise linear complex (PLC) "q" quality mesh generation; a minimum radius-edge ratio may be specified (default 2.0) "a" apply a maximum tetrahedron volume constraint "A" assign attributes to identify tetrahedra in certain regions "r" reconstruct/refine a previously generated mesh "Y" suppress splitting of boundary facets/segments "YY" suppress splitting of exterior and interior boundary facets/segments "i" insert a list of additional points into mesh "M" do not merge coplanar facets "T" set a tolerance for coplanar test (default
)"d" detect intersections of PLC facets "o2" generate second-order subparametric elements "C" check the consistency of the final mesh "Q" quiet: no terminal output except error - An empty string " " given to TetGenTetrahedralize creates a Delaunay tetrahedralization.
- TetGenTetrahedralize has the following options:
-
"TetrahedronRefinement" None function to refine a tetrahedron
Examples
open all close allBasic Examples (1)
Needs["TetGenLink`"]This creates an instance of a TetGen expression:
inst = TetGenCreate[]This sets up points and facets to use:
pts = {{0., 0., 0.}, {2., 0., 0.}, {2., 0., 2.}, {0., 0., 2.}, {0., 12., 0.}, {2., 12., 0.}, {2., 12., 2.}, {0., 12., 2.}};
facets = {{{1, 2, 3, 4}}, {{5, 6, 7, 8}}, {{1, 5, 6, 2}}, {{2, 6, 7, 3}}, {{3, 7, 8, 4}}, {{4, 8, 5, 1}}};This sets the points and facets in the TetGen instance:
TetGenSetPoints[inst, pts];
TetGenSetFacets[inst, facets];This carries out the tetrahedralization, returning a new TetGen instance:
inst1 = TetGenTetrahedralize[ inst, "pq1.414a0.1"]This extracts the points and faces from the tetrahedralization:
elemPts = TetGenGetPoints[inst1];
elemFaces = TetGenGetFaces[inst1];Graphics3D[GraphicsComplex[elemPts, Polygon[elemFaces]]]Set the "r" string in place of "p" to refine an existing TetGen instance:
inst2 = TetGenTetrahedralize[ inst1, "rq1.414a0.01"]This extracts the points and faces from the tetrahedralization:
elemPts = TetGenGetPoints[inst2];
elemFaces = TetGenGetFaces[inst2];Graphics3D[GraphicsComplex[elemPts, Polygon[elemFaces]]]Options (1)
"TetrahedronRefinement" (1)
Needs["TetGenLink`"]This creates an instance of a TetGen expression:
inst = TetGenCreate[]This sets up points and facets to use:
pts = {{0., 0., 0.}, {2., 0., 0.}, {2., 0., 2.}, {0., 0., 2.}, {0., 12., 0.}, {2., 12., 0.}, {2., 12., 2.}, {0., 12., 2.}};
facets = {{{1, 2, 3, 4}}, {{5, 6, 7, 8}}, {{1, 5, 6, 2}}, {{2, 6, 7, 3}}, {{3, 7, 8, 4}}, {{4, 8, 5, 1}}};This sets the points and facets in the TetGen instance:
TetGenSetPoints[inst, pts];
TetGenSetFacets[inst, facets];This carries out the tetrahedralization, returning a new TetGen instance:
inst1 = TetGenTetrahedralize[ inst, "pq1.414"]This extracts the points and faces from the tetrahedralization:
elemPts = TetGenGetPoints[inst1];
elemFaces = TetGenGetFaces[inst1];Graphics3D[GraphicsComplex[elemPts, Polygon[elemFaces]]]This sets up a compiled function that returns True if a tetrahedron should be refined and False otherwise:
cf = Compile[{{coordinates, _Real, 2}, {volume, _Real, 0}},
If[volume > 0.1, True, False]
];This carries out the tetrahedralization with the refinement function, returning a new TetGen instance:
inst2 = TetGenTetrahedralize[inst, "pq1.414", "TetrahedronRefinement" -> cf]In this case the "p" string is used as the refinement operates on the initial TetGen instance.
This extracts the points and faces from the tetrahedralization:
elemPts = TetGenGetPoints[inst2];
elemFaces = TetGenGetFaces[inst2];Graphics3D[GraphicsComplex[elemPts, Polygon[elemFaces]]]Refine the already tetrahedralized TetGen instance:
inst2 = TetGenTetrahedralize[inst1, "rq1.414", "TetrahedronRefinement" -> cf]In this case the "r" string is used as the refinement operates on an already tetrahedralized TetGen instance.
This extracts the points and faces from the tetrahedralization:
elemPts = TetGenGetPoints[inst2];
elemFaces = TetGenGetFaces[inst2];Graphics3D[GraphicsComplex[elemPts, Polygon[elemFaces]]]Possible Issues (1)
Refinement of an already tetrahedralized TetGen instance needs to be done with the "r" string.
Needs["TetGenLink`"]Set up and tetrahedralize an initial TetGen instance:
coordinates = {{0., 0., 0.}, {2., 0., 0.}, {2., 0., 2.}, {0., 0., 2.}, {0., 12., 0.}, {2., 12., 0.}, {2., 12., 2.}, {0., 12., 2.}};
facets = {{{1, 2, 3, 4}}, {{5, 6, 7, 8}}, {{1, 5, 6, 2}}, {{2, 6, 7, 3}}, {{3, 7, 8, 4}}, {{4, 8, 5, 1}}};geometry = TetGenCreate[];
TetGenSetPoints[geometry, coordinates];
TetGenSetFacets[geometry, facets];
discretization = TetGenTetrahedralize[geometry, "pq"];Inspect the number of tetrahedra in the tetrahedralized instance:
TetGenGetElements[discretization]//LengthTetrahedralization of an already tetrahedralized TetGen instance as a piecewise linear complex (PLC) does not work. No new elements are generated:
refinement = TetGenTetrahedralize[discretization, "pqa.01"];
TetGenGetElements[refinement]//LengthRefinement of an already tetrahedralized TetGen instance needs to be done with the "r" string:
discretization = TetGenTetrahedralize[geometry, "pq"];
refinement = TetGenTetrahedralize[discretization, "rqa.01"];TetGenGetElements[refinement]//LengthTech Notes
Related Guides
Text
Wolfram Research (2010), TetGenTetrahedralize, Wolfram Language function, https://reference.wolfram.com/language/TetGenLink/ref/TetGenTetrahedralize.html (updated 2014).
CMS
Wolfram Language. 2010. "TetGenTetrahedralize." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/TetGenLink/ref/TetGenTetrahedralize.html.
APA
Wolfram Language. (2010). TetGenTetrahedralize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/TetGenLink/ref/TetGenTetrahedralize.html
BibTeX
@misc{reference.wolfram_2026_tetgentetrahedralize, author="Wolfram Research", title="{TetGenTetrahedralize}", year="2014", howpublished="\url{https://reference.wolfram.com/language/TetGenLink/ref/TetGenTetrahedralize.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_tetgentetrahedralize, organization={Wolfram Research}, title={TetGenTetrahedralize}, year={2014}, url={https://reference.wolfram.com/language/TetGenLink/ref/TetGenTetrahedralize.html}, note=[Accessed: 15-June-2026]}