23#ifndef VULPES_GEOMETRY_SIMPLEXIFY_HPP_
24#define VULPES_GEOMETRY_SIMPLEXIFY_HPP_
61 static constexpr int32_t
dim = 2;
62 using PointType =
const Eigen::Vector<float_t, dim>;
148 struct triangle::triangulateio
m_in;
152 struct triangle::triangulateio
m_out;
163 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
164 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15,
165 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
166 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30,
167 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37,
168 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45,
169 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52,
170 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60,
171 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67,
172 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75,
173 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82,
174 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90,
175 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97,
176 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105,
177 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112,
178 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120,
179 120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127,
226 static constexpr int32_t
dim = 3;
257 bool reconstruct_boundary =
false,
306 return Eigen::Map<
const Eigen::Matrix<
index_t,
dim, -1>>(
308 static_cast<std::ptrdiff_t
>(
410 typename = std::enable_if_t<(Dim == 2) || (Dim == 3)>>
421 std::conditional_t<Dim == 2, Triangulation, Tetrahedralization>;
425 static constexpr int32_t
dim = SimplexifyEngine::dim;
441 template <
typename T =
void,
typename = std::enable_if_t<Dim == 2, T>>
458 template <
typename T =
void,
typename = std::enable_if_t<Dim == 3, T>>
461 bool reconstruct_boundaries =
false)
462 :
m_engine(cell, reconstruct_boundaries) {}
469 if constexpr (Dim == 2) {
472 return Eigen::Vector2i{face_id, (face_id + 1) %
m_engine.cell().nfaces()};
474 if constexpr (Dim == 3) {
475 return m_engine.getTriangleListFacet(face_id);
496 if constexpr (Dim == 2) {
498 }
else if constexpr (Dim == 3) {
501 static_assert(Dim * 0,
"Not Implemented");
529 if constexpr (Dim == 2) {
531 }
else if constexpr (Dim == 3) {
532 return m_engine.getTetrahedronList();
534 static_assert(Dim * 0,
"Not Implemented");
const PointsViewType & getPointList() const
Gets the list of points in the simplexification.
Definition simplexify.hpp:514
const SimplexesViewType & getSimplexesList() const
Gets the list of simplices in the simplexification.
Definition simplexify.hpp:528
static constexpr int32_t dim
Definition simplexify.hpp:425
SimplexifyEngine::PointsType PointsType
Definition simplexify.hpp:426
index_t getNumPoints() const
Gets the number of points in the simplexification.
Definition simplexify.hpp:484
auto getSubsimplexesListFacet(index_t face_id) const
List the sub-simplexes (segments in 2D or triangles in 3D) that make a certain face in the simplixifi...
Definition simplexify.hpp:468
SimplexifyEngine::SimplexesType SimplexesType
Definition simplexify.hpp:427
SimplexifyEngine::SimplexesViewType SimplexesViewType
Definition simplexify.hpp:429
SimplexifyEngine m_engine
Definition simplexify.hpp:539
std::conditional_t< Dim==2, Triangulation, Tetrahedralization > SimplexifyEngine
The engine used for simplex generation, determined by the dimension.
Definition simplexify.hpp:420
SimplexifyEngine::float_t float_t
Definition simplexify.hpp:423
SimplexifyEngine::PointsViewType PointsViewType
Definition simplexify.hpp:428
index_t getNumSimplexes() const
Gets the number of simplices in the simplexification.
Definition simplexify.hpp:495
SimplexifyEngine::index_t index_t
Definition simplexify.hpp:424
Simplexify(const geometry::Cell< 3, float_t, index_t > &cell, bool reconstruct_boundaries=false)
Constructs a simplexification for the given geometric cell.
Definition simplexify.hpp:459
Simplexify(const geometry::Cell< 2, float_t, index_t > &cell, bool=false)
Constructs a simplexification for the given geometric cell.
Definition simplexify.hpp:442
const auto getTriangleListFacet(index_t face_id) const
Gets the list of triangles of the boundary of the tetrahedralization for a certain face.
Definition simplexify.hpp:305
Eigen::Matrix< index_t, 3, -1 > m_faces_subsimplexes
Triangles in each face of the cell.
Definition simplexify.hpp:390
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.
Definition simplexify.cpp:176
static tetgen::tetgenio::polygon s_polygons[s_static_buffer_size]
Static buffer for storing the list of polygons in the tetrahedralization.
Definition simplexify.hpp:360
tetgen::REAL float_t
Defines the floating-point type used in the TetGen library.
Definition simplexify.hpp:220
tetgen::tetgenio m_out
Output structure for the TetGen library.
Definition simplexify.hpp:331
Eigen::Map< SubsimplexesType > SubsimplexesViewType
Definition simplexify.hpp:233
Eigen::Map< SimplexesType > SimplexesViewType
Definition simplexify.hpp:232
std::vector< tetgen::tetgenio::facet > m_facelist
Dynamic buffer for storing the list of facets in the tetrahedralization. This is used only if the sta...
Definition simplexify.hpp:338
const PointsViewType & getPointList() const
Gets the list of points in the tetrahedralization.
Definition simplexify.hpp:280
const Eigen::Matrix< index_t, dim+1, -1 > SimplexesType
Definition simplexify.hpp:229
static constexpr int32_t dim
Definition simplexify.hpp:226
std::vector< index_t > m_num_subfaces_per_face_cumsum
Cumulative number of triangles in each face of the cell.
Definition simplexify.hpp:382
tetgen::tetgenio m_in
Input structure for the TetGen library.
Definition simplexify.hpp:327
const Eigen::Matrix< index_t, dim, -1 > SubsimplexesType
Definition simplexify.hpp:230
std::unique_ptr< SimplexesViewType > m_tetrahedra_list
Unique pointer to an Eigen::Map representing the list of tetrahedra in the tetrahedralization....
Definition simplexify.hpp:371
index_t getNumPoints() const
Gets the number of points in the tetrahedralization.
Definition simplexify.hpp:265
const geometry::Cell3D< float_t, index_t > & m_cell
The input 3D geometric cell for tetrahedralization.
Definition simplexify.hpp:322
const Eigen::Matrix< float_t, dim, -1 > PointsType
Definition simplexify.hpp:228
int32_t index_t
Defines the integer type used in the TetGen library.
Definition simplexify.hpp:225
std::vector< index_t > m_num_subfaces_per_face
Number of triangles in each face of the cell.
Definition simplexify.hpp:376
Eigen::Map< PointsType > PointsViewType
Definition simplexify.hpp:231
static tetgen::tetgenio::facet s_facelist[s_static_buffer_size]
Static buffer for storing the list of facets in the tetrahedralization.
Definition simplexify.hpp:355
const SimplexesViewType & getTetrahedronList() const
Gets the list of tetrahedra in the tetrahedralization.
Definition simplexify.hpp:289
const Eigen::Vector< float_t, dim > PointType
Definition simplexify.hpp:227
std::vector< tetgen::tetgenio::polygon > m_polygons
Dynamic buffer for storing the list of polygons in the tetrahedralization. This is used only if the s...
Definition simplexify.hpp:344
static const tetgen::tetgenbehavior s_tetgen_default_options
Definition simplexify.hpp:235
const auto & cell() const
Gets a reference to the cell.
Definition simplexify.hpp:296
static constexpr index_t s_static_buffer_size
Static constant defining the size of the static buffer for avoiding dynamic allocation of facet and p...
Definition simplexify.hpp:240
index_t getNumTetrahedra() const
Gets the number of tetrahedra in the tetrahedralization.
Definition simplexify.hpp:271
std::vector< int32_t > m_facetmarkerlist
Boundary markers are tags (integers) used mainly to identify which entities are associated with which...
Definition simplexify.hpp:350
std::unique_ptr< PointsViewType > m_point_list
Unique pointer to an Eigen::Map representing the list of points in the tetrahedralization....
Definition simplexify.hpp:366
void reconstructBoundaries()
Find out which faces (triangles) of the tetrahedrons that compose the tetrahedralization are on the b...
Definition simplexify.cpp:249
struct triangle::triangulateio m_out
Output structure for the Triangle library.
Definition simplexify.hpp:152
int32_t index_t
Defines the integer type used in the Triangle library.
Definition simplexify.hpp:60
const SimplexesViewType & getTriangleList() const
Gets the list of triangles in the triangulation.
Definition simplexify.hpp:125
std::unique_ptr< PointsViewType > m_point_list
Unique pointer to an Eigen::Map representing the list of points in the triangulation.
Definition simplexify.hpp:188
triangle::REAL float_t
Defines the floating-point type used in the Triangle library.
Definition simplexify.hpp:55
const PointsViewType & getPointList() const
Gets the list of points in the triangulation.
Definition simplexify.hpp:116
std::unique_ptr< SubsimplexesViewType > m_surface_segment_list
Unique pointer to an Eigen::Map representing the list of edges in the boundary of the triangulation.
Definition simplexify.hpp:202
index_t getNumTriangles() const
Gets the number of triangles in the triangulation.
Definition simplexify.hpp:101
const Eigen::Matrix< float_t, dim, -1 > PointsType
Definition simplexify.hpp:63
const auto & cell() const
Gets a reference to the cell.
Definition simplexify.hpp:137
std::vector< index_t > m_segmentlist
Dynamic buffer where we store the segment list. It is used only if the static buffer is not large eno...
Definition simplexify.hpp:158
static constexpr int32_t dim
Definition simplexify.hpp:61
Eigen::Map< SubsimplexesType > SubsimplexesViewType
Definition simplexify.hpp:68
index_t m_static_segmentlist[s_buffer_size]
Static buffer where we store the segment list.
Definition simplexify.hpp:162
std::unique_ptr< SimplexesViewType > m_triangle_list
Unique pointer to an Eigen::Map representing the list of triangles in the triangulation.
Definition simplexify.hpp:195
const geometry::Cell2D< float_t > & m_cell
The input 2D geometric cell for triangulation.
Definition simplexify.hpp:143
const Eigen::Matrix< index_t, dim+1, -1 > SimplexesType
Definition simplexify.hpp:64
Triangulation(const geometry::Cell2D< float_t > &cell, triangle::behavior options=s_triangle_default_options)
Constructs a Triangulation object for a given 2D cell.
Definition simplexify.cpp:47
const Eigen::Vector< float_t, dim > PointType
Definition simplexify.hpp:62
static constexpr index_t s_buffer_size
Static constant defining the size of the static buffer for avoiding dynamic allocation of segment lis...
Definition simplexify.hpp:77
Eigen::Map< SimplexesType > SimplexesViewType
Definition simplexify.hpp:67
struct triangle::triangulateio m_in
Input structure for the Triangle library.
Definition simplexify.hpp:148
~Triangulation()
Destructor for the Triangulation class.
Definition simplexify.cpp:132
const Eigen::Matrix< index_t, dim, -1 > SubsimplexesType
Definition simplexify.hpp:65
Eigen::Map< PointsType > PointsViewType
Definition simplexify.hpp:66
index_t getNumPoints() const
Gets the number of points in the triangulation.
Definition simplexify.hpp:107
const SubsimplexesViewType & getSurfaceSegmentList() const
Gets the list of edges of the boundary of the triangulation.
Definition simplexify.hpp:130
static const triangle::behavior s_triangle_default_options
Definition simplexify.hpp:70
Definition abs_agg_model.cpp:40
std::conditional_t< Dim==2, Cell2D< FloatType, IndexType >, Cell3D< FloatType, IndexType > > Cell
Definition cell.hpp:267
Definition cell_manager.hpp:38