Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::geometry::Tetrahedralization Class Reference

Performs tetrahedralization of a 3D cell using the TetGen library. More...

#include <simplexify.hpp>

Collaboration diagram for vulpes::geometry::Tetrahedralization:
[legend]

Public Types

using float_t = tetgen::REAL
 Defines the floating-point type used in the TetGen library.
using index_t = int32_t
 Defines the integer type used in the TetGen library.
using PointType = const Eigen::Vector<float_t, dim>
using PointsType = const Eigen::Matrix<float_t, dim, -1>
using SimplexesType = const Eigen::Matrix<index_t, dim + 1, -1>
using SubsimplexesType = const Eigen::Matrix<index_t, dim, -1>
using PointsViewType = Eigen::Map<PointsType>
using SimplexesViewType = Eigen::Map<SimplexesType>
using SubsimplexesViewType = Eigen::Map<SubsimplexesType>

Public Member Functions

 Tetrahedralization (const geometry::Cell3D< float_t, index_t > &cell, bool reconstruct_boundary=false, tetgen::tetgenbehavior options=s_tetgen_default_options)
 Constructs a Tetrahedralization object for a given 3D cell.
index_t getNumPoints () const
 Gets the number of points in the tetrahedralization.
index_t getNumTetrahedra () const
 Gets the number of tetrahedra in the tetrahedralization.
const PointsViewType & getPointList () const
 Gets the list of points in the tetrahedralization.
const SimplexesViewType & getTetrahedronList () const
 Gets the list of tetrahedra in the tetrahedralization.
const auto & cell () const
 Gets a reference to the cell.
const auto getTriangleListFacet (index_t face_id) const
 Gets the list of triangles of the boundary of the tetrahedralization for a certain face.

Static Public Attributes

static constexpr int32_t dim = 3
static const tetgen::tetgenbehavior s_tetgen_default_options
static constexpr index_t s_static_buffer_size = 256
 Static constant defining the size of the static buffer for avoiding dynamic allocation of facet and polygon lists.

Protected Member Functions

void reconstructBoundaries ()
 Find out which faces (triangles) of the tetrahedrons that compose the tetrahedralization are on the boundary of the cell.

Protected Attributes

const geometry::Cell3D< float_t, index_t > & m_cell
 The input 3D geometric cell for tetrahedralization.
tetgen::tetgenio m_in
 Input structure for the TetGen library.
tetgen::tetgenio m_out
 Output structure for the TetGen library.
std::vector< tetgen::tetgenio::facet > m_facelist
 Dynamic buffer for storing the list of facets in the tetrahedralization. This is used only if the static buffer is not large enough.
std::vector< tetgen::tetgenio::polygon > m_polygons
 Dynamic buffer for storing the list of polygons in the tetrahedralization. This is used only if the static buffer is not large enough.
std::vector< int32_t > m_facetmarkerlist
 Boundary markers are tags (integers) used mainly to identify which entities are associated with which boundary element of the input PLC. We use it to reconstruct to which face each triface belongs to.
std::unique_ptr< PointsViewType > m_point_list
 Unique pointer to an Eigen::Map representing the list of points in the tetrahedralization. The data is generated by TetGen in m_out.
std::unique_ptr< SimplexesViewType > m_tetrahedra_list
 Unique pointer to an Eigen::Map representing the list of tetrahedra in the tetrahedralization. The data is generated by TetGen in m_out.
std::vector< index_t > m_num_subfaces_per_face
 Number of triangles in each face of the cell.
std::vector< index_t > m_num_subfaces_per_face_cumsum
 Cumulative number of triangles in each face of the cell.
Eigen::Matrix< index_t, 3, -1 > m_faces_subsimplexes
 Triangles in each face of the cell.

Static Protected Attributes

static tetgen::tetgenio::facet s_facelist [s_static_buffer_size] = {}
 Static buffer for storing the list of facets in the tetrahedralization.
static tetgen::tetgenio::polygon s_polygons [s_static_buffer_size] = {}
 Static buffer for storing the list of polygons in the tetrahedralization.

Detailed Description

Performs tetrahedralization of a 3D cell using the TetGen library.

This class generates a tetrahedral mesh for a given 3D cell and provides access to the resulting points and tetrahedra. It leverages the TetGen library [http://wias-berlin.de/software/tetgen/] under the hood for 3D computational geometry operations.

Member Typedef Documentation

◆ float_t

Defines the floating-point type used in the TetGen library.

◆ index_t

Defines the integer type used in the TetGen library.

◆ PointsType

◆ PointsViewType

◆ PointType

◆ SimplexesType

using vulpes::geometry::Tetrahedralization::SimplexesType = const Eigen::Matrix<index_t, dim + 1, -1>

◆ SimplexesViewType

◆ SubsimplexesType

◆ SubsimplexesViewType

Constructor & Destructor Documentation

◆ Tetrahedralization()

vulpes::geometry::Tetrahedralization::Tetrahedralization ( const geometry::Cell3D< float_t, index_t > & cell,
bool reconstruct_boundary = false,
tetgen::tetgenbehavior options = s_tetgen_default_options )
explicit

Constructs a Tetrahedralization object for a given 3D cell.

Initializes the tetrahedralization process for the provided 3D geometric cell.

Parameters
cellA 3D cell to be tetrahedralized, represented by geometry::Cell3D.
reconstruct_boundaryFor every triangular face of each tetrahedron in the tessellation, identify the corresponding face of the cell to which it belongs.
optionsTetgen library options

Member Function Documentation

◆ cell()

const auto & vulpes::geometry::Tetrahedralization::cell ( ) const
inline

Gets a reference to the cell.

◆ getNumPoints()

index_t vulpes::geometry::Tetrahedralization::getNumPoints ( ) const
inline

Gets the number of points in the tetrahedralization.

Returns
The total number of points in the tetrahedralization.

◆ getNumTetrahedra()

index_t vulpes::geometry::Tetrahedralization::getNumTetrahedra ( ) const
inline

Gets the number of tetrahedra in the tetrahedralization.

Returns
The total number of tetrahedra generated.

◆ getPointList()

const PointsViewType & vulpes::geometry::Tetrahedralization::getPointList ( ) const
inline

Gets the list of points in the tetrahedralization.

The points are represented as a 3xN Eigen matrix where each column is a point (x, y, z).

Returns
A reference to an Eigen::Map representing the point list.

◆ getTetrahedronList()

const SimplexesViewType & vulpes::geometry::Tetrahedralization::getTetrahedronList ( ) const
inline

Gets the list of tetrahedra in the tetrahedralization.

The tetrahedra are represented as a 4xM Eigen matrix where each column contains the indices of the four vertices of a tetrahedron.

Returns
A reference to an Eigen::Map representing the tetrahedron list.

◆ getTriangleListFacet()

const auto vulpes::geometry::Tetrahedralization::getTriangleListFacet ( index_t face_id) const
inline

Gets the list of triangles of the boundary of the tetrahedralization for a certain face.

Note
this information is available only after reconstructBoundaries has been called

◆ reconstructBoundaries()

void vulpes::geometry::Tetrahedralization::reconstructBoundaries ( )
protected

Find out which faces (triangles) of the tetrahedrons that compose the tetrahedralization are on the boundary of the cell.

Member Data Documentation

◆ dim

int32_t vulpes::geometry::Tetrahedralization::dim = 3
staticconstexpr

◆ m_cell

const geometry::Cell3D<float_t, index_t>& vulpes::geometry::Tetrahedralization::m_cell
protected

The input 3D geometric cell for tetrahedralization.

◆ m_facelist

std::vector<tetgen::tetgenio::facet> vulpes::geometry::Tetrahedralization::m_facelist
protected

Dynamic buffer for storing the list of facets in the tetrahedralization. This is used only if the static buffer is not large enough.

◆ m_faces_subsimplexes

Eigen::Matrix<index_t, 3, -1> vulpes::geometry::Tetrahedralization::m_faces_subsimplexes
protected

Triangles in each face of the cell.

For sake of performance the triangles are saved as indices in a contiguous buffer, to extract them we use m_num_subfaces_per_face and m_num_subfaces_per_face_cumsum

◆ m_facetmarkerlist

std::vector<int32_t> vulpes::geometry::Tetrahedralization::m_facetmarkerlist
protected

Boundary markers are tags (integers) used mainly to identify which entities are associated with which boundary element of the input PLC. We use it to reconstruct to which face each triface belongs to.

◆ m_in

tetgen::tetgenio vulpes::geometry::Tetrahedralization::m_in
protected

Input structure for the TetGen library.

◆ m_num_subfaces_per_face

std::vector<index_t> vulpes::geometry::Tetrahedralization::m_num_subfaces_per_face
protected

Number of triangles in each face of the cell.

◆ m_num_subfaces_per_face_cumsum

std::vector<index_t> vulpes::geometry::Tetrahedralization::m_num_subfaces_per_face_cumsum
protected

Cumulative number of triangles in each face of the cell.

Needed to create the Eigen::Map from a contiguous buffer

◆ m_out

tetgen::tetgenio vulpes::geometry::Tetrahedralization::m_out
protected

Output structure for the TetGen library.

◆ m_point_list

std::unique_ptr<PointsViewType> vulpes::geometry::Tetrahedralization::m_point_list
protected

Unique pointer to an Eigen::Map representing the list of points in the tetrahedralization. The data is generated by TetGen in m_out.

◆ m_polygons

std::vector<tetgen::tetgenio::polygon> vulpes::geometry::Tetrahedralization::m_polygons
protected

Dynamic buffer for storing the list of polygons in the tetrahedralization. This is used only if the static buffer is not large enough.

◆ m_tetrahedra_list

std::unique_ptr<SimplexesViewType> vulpes::geometry::Tetrahedralization::m_tetrahedra_list
protected

Unique pointer to an Eigen::Map representing the list of tetrahedra in the tetrahedralization. The data is generated by TetGen in m_out.

◆ s_facelist

tetgen::tetgenio::facet vulpes::geometry::Tetrahedralization::s_facelist = {}
staticprotected

Static buffer for storing the list of facets in the tetrahedralization.

◆ s_polygons

tetgen::tetgenio::polygon vulpes::geometry::Tetrahedralization::s_polygons = {}
staticprotected

Static buffer for storing the list of polygons in the tetrahedralization.

◆ s_static_buffer_size

index_t vulpes::geometry::Tetrahedralization::s_static_buffer_size = 256
staticconstexpr

Static constant defining the size of the static buffer for avoiding dynamic allocation of facet and polygon lists.

◆ s_tetgen_default_options

const tetgen::tetgenbehavior vulpes::geometry::Tetrahedralization::s_tetgen_default_options
static
Initial value:
=
[]() {
tetgen::tetgenbehavior options;
options.plc = 1;
options.zeroindex = 1;
options.quality = 1;
options.minratio = 2.0;
options.mindihedral = 3.5;
options.opt_max_flip_level = 3;
options.opt_scheme = 7;
options.opt_iterations = 3;
options.quiet = 1;
return options;
}()

The documentation for this class was generated from the following files: