TET_MESH_QUALITY
Interactive Program for
Tet Mesh Quality
TET_MESH_QUALITY
is a C++ program which
computes and prints a variety
of quality measures for a given tet mesh of a set of
points in 3D.
The tet mesh is defined by a node file containing
the coordinates of nodes, and a tetra file containing
quadruples of node indices. For more information on this format,
see
the order4 tet mesh format.
The quality measures computed include:

Measure 1, the minimum, over all tetrahedrons, of 3 times
the radius of the insphere divided by the radius of the circumsphere.

Measure 2, the minimum, over all tetrahedrons, of 2 times
sqrt ( 6 ) times the radius of the insphere divided by the
length of the longest side of the tetrahedron.

Measure 3, the minimum, over all tetrahedrons, of
12 * ( 3 * volume )**(2/3) / (sum of squares of edge lengths);

Measure 4, the minimum solid angle in any tetrahedron;

Measure 5, a uniformity measure, the ratio of the
maximum to minimum tetrahedron volume;
Each quality measure is defined as the minimum of its value
over each tetrahedron. The maximum and best possible value is 1, and
the minimum and worst value is 0.
Usage:
tet_mesh_quality prefix
where prefix is the common file prefix:

prefix_nodes.txt contains the node coordinates;

prefix_elements.txt or
the node indices forming each element.
The element definition file will list node indices. In C++, it may be
more natural to use 0based indices. This program will accept an element
definition file that is 0based or 1based, and will convert a 1based
input file so that it becomes 0based internal to the program. The detection
of 1based data is determined by the absence of the use of a 0 index, and
the use of an index equal to the number of nodes. This is an implicit
and fallible, but reasonable, way to handle this problem.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
TET_MESH_QUALITY is available in
a C++ version and
a FORTRAN90 version and
a MATLAB version.
Related Programs:
CVT_TET_MESH,
a FORTRAN90 library which
uses CVT methods to compute a tet mesh in a region.
GEOMPACK,
a C++ library which
includes a routine DTRIS3 to compute the tet mesh of a set
of points in 3D.
TABLE_QUALITY,
a FORTRAN90 program which
computes quality measures for
an arbitrary (untriangulated) pointset in any dimension.
TABLE_TET_MESH,
a FORTRAN90 program which
computes the tet mesh of a set of points in 3D.
TEST_TET_MESH,
a FORTRAN90 library which
defines a few test regions for the generation of a tet mesh.
TET_MESH,
a C++ library which
carries out computations with
a tet mesh.
TET_MESH_BOUNDARY,
a C++ program which
returns the nodes and faces of the boundary of a tetrahedral mesh,
which themselves form a 3D triangular mesh or "TRI_SURFACE".
TET_MESH_DISPLAY,
a MATLAB program which
can read in the node and tetra files defining a tet mesh and display a wireframe
image.
TET_MESH_DISPLAY_OPENGL,
a C++ program which
reads a tet mesh and displays the nodes and edges using OpenGL.
TET_MESH_L2Q,
a C++ program which
converts a linear to quadratic tet mesh.
TET_MESH_Q2L,
a C++ program which
converts a quadratic to linear tet mesh.
TET_MESH_RCM,
a C++ program which
takes a tet mesh and
relabels the nodes to reduce the bandwidth of the
corresponding adjacency matrix.
TET_MESH_REFINE,
a C++ program which
refines a tet mesh.
TET_MESH_TET_NEIGHBORS,
a C++ program which
computes the tetrahedral adjacency information.
TET_MESH_VOLUMES,
a C++ program which
computes the volume of each tetrahedron in a tet mesh.
TRIANGULATION_QUALITY,
a C++ program which
computes trianglebased quality
measures for a triangulation of a set of points in 2D.
Reference:

Herbert Edelsbrunner,
Geometry and Topology for Mesh Generation,
Cambridge, 2001,
ISBN: 0521793092,
LC: QA377.E36.

David Field,
Qualitative Measures for Initial Meshes,
International Journal of Numerical Methods in Engineering,
Volume 47, 2000, pages 887906.

Barry Joe,
GEOMPACK  a software package for the generation of meshes
using geometric algorithms,
Advances in Engineering Software,
Volume 13, 1991, pages 325331.

PerOlof Persson, Gilbert Strang,
A Simple Mesh Generator in MATLAB,
SIAM Review,
Volume 46, Number 2, June 2004, pages 329345.
Source Code
Tests and Examples
CUBE is a simple example of 8 nodes in a cube.
Test files you may copy include:
List of Routines:

MAIN is the main program for TET_MESH_QUALITY.

CH_CAP capitalizes a single character.

CH_EQI is true if two characters are equal, disregarding case.

CH_TO_DIGIT returns the integer value of a base 10 digit.

FILE_COLUMN_COUNT counts the columns in the first line of a file.

FILE_ROW_COUNT counts the number of row records in a file.

I4MAT_DATA_READ reads data from an I4MAT file.

I4MAT_HEADER_READ reads the header from an I4MAT file.

I4MAT_TRANSPOSE_PRINT prints an I4MAT, transposed.

I4MAT_TRANSPOSE_PRINT_SOME prints some of an I4MAT, transposed.

I4_MAX returns the maximum of two I4's.

I4_MIN returns the smaller of two I4's.

I4VEC_HISTOGRAM computes a histogram of the elements of an I4VEC.

I4VEC_MAX returns the value of the maximum element in an I4VEC.

I4VEC_PRINT prints an I4VEC.

I4VEC_ZERO zeroes an I4VEC.

R8_HUGE returns a "huge" double precision value.

R8_MAX returns the maximum of two R8's.

R8_MIN returns the minimum of two R8's.

R8_SWAP switches two R8's.

R8MAT_DATA_READ reads the data from an R8MAT file.

R8MAT_DET_4D computes the determinant of a 4 by 4 R8MAT.

R8MAT_HEADER_READ reads the header from an R8MAT file.

R8MAT_SOLVE uses GaussJordan elimination to solve an N by N linear system.

R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed.

R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed.

R8VEC_CROSS_3D computes the cross product of two R8VEC's in 3D.

R8VEC_LENGTH returns the Euclidean length of a vector.

R8VEC_MAX returns the maximum element in an R8VEC.

R8VEC_MEAN returns the mean of an R8VEC.

R8VEC_MIN returns the minimum element in an R8VEC.

R8VEC_VARIANCE returns the variance of an R8VEC.

R8VEC_ZERO zeroes an R8VEC.

S_LEN_TRIM returns the length of a string to the last nonblank.

S_TO_I4 reads an I4 from a string.

S_TO_I4VEC reads an I4VEC from a string.

S_TO_R8 reads an R8 from a string.

S_TO_R8VEC reads an R8VEC from a string.

S_WORD_COUNT counts the number of "words" in a string.

TET_MESH_NODE_ORDER: determines the order of nodes.

TET_MESH_QUALITY1 returns a tet mesh quality factor.

TET_MESH_QUALITY2 returns a tet mesh quality factor.

TET_MESH_QUALITY3 returns a tet mesh quality factor.

TET_MESH_QUALITY4 returns a tet mesh quality factor.

TET_MESH_QUALITY5 returns a tet mesh quality factor.

TETRAHEDRON_CIRCUMSPHERE_3D computes the circumsphere of a tetrahedron in 3D.

TETRAHEDRON_EDGE_LENGTH_3D returns edge lengths of a tetrahedron in 3D.

TETRAHEDRON_INSPHERE_3D finds the insphere of a tetrahedron in 3D.

TETRAHEDRON_QUALITY1_3D: "quality" of a tetrahedron in 3D.

TETRAHEDRON_QUALITY2_3D: "quality" of a tetrahedron in 3D.

TETRAHEDRON_QUALITY3_3D computes the mean ratio of a tetrahedron.

TETRAHEDRON_QUALITY4_3D computes the minimum solid angle of a tetrahedron.

TETRAHEDRON_VOLUME_3D computes the volume of a tetrahedron in 3D.

TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C++ source codes.
Last revised on 12 August 2009.