H2Lib  3.0
Data Structures | Typedefs | Functions
tet3d

Three-dimensional tetrahedral meshes. More...

Data Structures

struct  _tet3d
 Representation of a three-dimensional tetrahedral mesh. More...
 
struct  _tet3dref
 Representation of the refinement relationship between two meshes. More...
 

Typedefs

typedef struct _tet3d tet3d
 Three-dimensional tetrahedral mesh.
 
typedef tet3dptet3d
 Pointer to tet3d object.
 
typedef const tet3dpctet3d
 Pointer to constant tet3d object.
 
typedef struct _tet3dref tet3dref
 Refinement data for tetrahedral meshes.
 
typedef tet3drefptet3dref
 Pointer to tet3dref object.
 
typedef const tet3drefpctet3dref
 Pointer to constant tet3dref object.
 
typedef struct _tet3dbuilder tet3dbuilder
 Tool for constructing tet3d meshes.
 
typedef tet3dbuilderptet3dbuilder
 Pointer to tet3dbuilder object.
 

Functions

ptet3d new_tet3d (uint vertices, uint edges, uint faces, uint tetrahedra)
 Create a partially initialized tet3d mesh. More...
 
void del_tet3d (ptet3d gr)
 Delete a tet3d object. More...
 
ptet3d new_axis_tet3d ()
 Create a mesh for a tetrahedron with three edges aligned with the coordinate axes. More...
 
ptet3d new_regular_tet3d ()
 Create a mesh for a regular tetrahedron. More...
 
ptet3d new_unitcube_tet3d ()
 Create a mesh containing six tetrahedra representing the unit cube $[0,1] \times [0,1] \times [0,1]$. More...
 
void write_tet3d (pctet3d gr, const char *name)
 Write a tetrahedral mesh to a file. More...
 
ptet3d read_tet3d (const char *name)
 Read a tetrahedral mesh from a file. More...
 
void getvertices_byface_tet3d (pctet3d gr, uint tn, uint fl, uint v[])
 Find the vertices of a tetrahedron corresponding to a given face. More...
 
void getvertices_tet3d (pctet3d gr, uint tn, uint v[])
 Find the vertices of a tetrahedron. More...
 
void getedges_tet3d (pctet3d gr, uint tn, uint e[])
 Find the edges of a tetrahedron. More...
 
void getvertices_face_tet3d (pctet3d t3, uint nf, uint v[])
 Find the vertices of a face. More...
 
uint fixnormals_tet3d (ptet3d gr)
 Ensure that the edges of boundary faces are in counter-clockwise order as seen from outside of the mesh. More...
 
void check_tet3d (pctet3d gr)
 Perform various consistency checks. More...
 
void statistics_tet3d (pctet3d gr, preal hmin, preal hmax, preal volmin, preal volmax, preal relvolmin, preal relvolmax)
 Compute various statistices of a mesh. More...
 
ptet3d refine_tet3d (pctet3d gr, ptet3dref *grr)
 Regular refinement of a tetrahedral mesh. More...
 
void del_tet3dref (ptet3dref grr)
 Delete a tet3dref object. More...
 
ptet3dbuilder new_tet3dbuilder (uint vertices)
 Create a new tet3dbuilder object. More...
 
void del_tet3dbuilder (ptet3dbuilder tb)
 Delete a tet3dbuilder object. More...
 
real(* getx_tet3dbuilder (ptet3dbuilder tb))[3]
 Obtain array of vertex coordinates in tet3dbuilder object. More...
 
void addtetrahedron_tet3dbuilder (ptet3dbuilder tb, uint v0, uint v1, uint v2, uint v3)
 Add a tetrahedron to a tet3dbuilder object. More...
 
ptet3d buildmesh_tet3dbuilder (ptet3dbuilder tb)
 Create a tet3d mesh from the geometrical and topological information stored in a tet3dbuilder object. More...
 

Detailed Description

Three-dimensional tetrahedral meshes.

Function Documentation

void addtetrahedron_tet3dbuilder ( ptet3dbuilder  tb,
uint  v0,
uint  v1,
uint  v2,
uint  v3 
)

Add a tetrahedron to a tet3dbuilder object.

Parameters
tbTarget tet3dbuilder object.
v0Index of first vertex.
v1Index of second vertex.
v2Index of third vertex.
v3Index of fourth vertex.
ptet3d buildmesh_tet3dbuilder ( ptet3dbuilder  tb)

Create a tet3d mesh from the geometrical and topological information stored in a tet3dbuilder object.

Once the mesh has been created, the corresponding tet3dbuilder object can be deleted.

Parameters
tbSource tet3dbuilder object.
Returns
tet3d mesh.
void check_tet3d ( pctet3d  gr)

Perform various consistency checks.

Parameters
grMesh
void del_tet3d ( ptet3d  gr)

Delete a tet3d object.

Parameters
grObject to be deleted
void del_tet3dbuilder ( ptet3dbuilder  tb)

Delete a tet3dbuilder object.

Parameters
tbObject to be deleted.
void del_tet3dref ( ptet3dref  grr)

Delete a tet3dref object.

Parameters
grrObject to be deleted
uint fixnormals_tet3d ( ptet3d  gr)

Ensure that the edges of boundary faces are in counter-clockwise order as seen from outside of the mesh.

Parameters
grMesh, offending boundary faces will be reordered
Returns
Number of faces that have been fixed.
void getedges_tet3d ( pctet3d  gr,
uint  tn,
uint  e[] 
)

Find the edges of a tetrahedron.

Due to the hierarchical representation of geometric objects, we cannot access the edges of a tetrahedron directly. This function finds the edges and returns them in a specific order:

  • e[0] is the intersection of the faces 1 and 2.
  • e[1] is the intersection of the faces 2 and 3.
  • e[2] is the intersection of the faces 3 and 1.
  • e[3] is the intersection of the faces 0 and 1.
  • e[4] is the intersection of the faces 0 and 2.
  • e[5] is the intersection of the faces 0 and 3.
Parameters
grMesh
tnNumber of the tetrahedron
eWill be filled with the edge numbers
void getvertices_byface_tet3d ( pctet3d  gr,
uint  tn,
uint  fl,
uint  v[] 
)

Find the vertices of a tetrahedron corresponding to a given face.

Due to the hierarchical representation of geometric objects, we cannot access the vertices of a tetrahedron directly. This function finds the vertices and returns them in a specific order: v[0] is the vertex opposite the local face fl of the tetrahedron, and v[1], v[2] and v[3] are the vertices on this face such that v[i+1] is opposite the i-th edge gr->f[gr->t[tn][fl]][i]. This feature is important if the order of the edges is relevant, e.g., if we want to compute outward normal vectors for a boundary face.

Parameters
grMesh
tnNumber of the tetrahedron
flLocal index of the face, can only be 0, 1, 2, or 3.
vWill be filled with the vertex numbers
void getvertices_face_tet3d ( pctet3d  t3,
uint  nf,
uint  v[] 
)

Find the vertices of a face.

Due to the hierarchical representation of geometric objects, we cannot access the vertices of a face directly. This function finds the vertices and returns them.

Parameters
t3Mesh.
nfGlobal number of the face.
vwill be filled with the vertex numbers.
void getvertices_tet3d ( pctet3d  gr,
uint  tn,
uint  v[] 
)

Find the vertices of a tetrahedron.

Due to the hierarchical representation of geometric objects, we cannot access the vertices of a tetrahedron directly. This function finds the vertices and returns them in a specific order: v[i] is the vertex opposite the i-th face.

Parameters
grMesh
tnNumber of the tetrahedron
vWill be filled with the vertex numbers
real(* getx_tet3dbuilder ( ptet3dbuilder  tb) )[3]

Obtain array of vertex coordinates in tet3dbuilder object.

Since tet3dbuilder is an opaque class, this function is provided for setting the coordinates of the vertices.

Parameters
tbtet3dbuilder object.
Returns
Pointer to array of with tb->vertices entries of type real [3] representing the vertex coordinates.
ptet3d new_axis_tet3d ( )

Create a mesh for a tetrahedron with three edges aligned with the coordinate axes.

Returns
tet3d mesh representing the tetrahedron.
ptet3d new_regular_tet3d ( )

Create a mesh for a regular tetrahedron.

Returns
tet3d mesh representing a regular tetrahedron.
ptet3d new_tet3d ( uint  vertices,
uint  edges,
uint  faces,
uint  tetrahedra 
)

Create a partially initialized tet3d mesh.

All arrays are created, but are not filled with meaningful values.

Parameters
verticesNumber of vertices
edgesNumber of edges
facesNumber of faces
tetrahedraNumber of tetrahedra
Returns
Partially initialized tet3d mesh
ptet3dbuilder new_tet3dbuilder ( uint  vertices)

Create a new tet3dbuilder object.

Parameters
verticesNumber of vertices of the new mesh.
Returns
tet3dbuilder object with no edges, faces, or triangles.
ptet3d new_unitcube_tet3d ( )

Create a mesh containing six tetrahedra representing the unit cube $[0,1] \times [0,1] \times [0,1]$.

Returns
tet3d mesh representing the unit cube.
ptet3d read_tet3d ( const char *  name)

Read a tetrahedral mesh from a file.

Parameters
nameFilename
Returns
tet3d object describing the mesh
ptet3d refine_tet3d ( pctet3d  gr,
ptet3dref grr 
)

Regular refinement of a tetrahedral mesh.

The mesh is globally refined using Bey's algorithm.

Parameters
grCoarse mesh
grrIf not null, the target pointer will be set to a new tet3dref object describing the refinement relationship
Returns
Refined mesh
void statistics_tet3d ( pctet3d  gr,
preal  hmin,
preal  hmax,
preal  volmin,
preal  volmax,
preal  relvolmin,
preal  relvolmax 
)

Compute various statistices of a mesh.

Parameters
grMesh
hminWill be overwritten by the minimal edge length
hmaxWill be overwritten by the maximal edge length
volminWill be overwritten by the minimal volume of a tetrahedron
volmaxWill be overwritten by the maximal volume of a tetrahedron
relvolminWill be overwritten by the minimal relative volume of a tetrahedron (relative with respect to the local mesh parameter)
relvolmaxWill be overwritten by the maximal relative volume of a tetrahedron (relative with respect to the local mesh parameter)
void write_tet3d ( pctet3d  gr,
const char *  name 
)

Write a tetrahedral mesh to a file.

Parameters
grSource mesh
nameFilename