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

Performs triangulation of a 2D cell using the Triangle library. More...

#include <simplexify.hpp>

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

Public Types

using float_t = triangle::REAL
 Defines the floating-point type used in the Triangle library.
using index_t = int32_t
 Defines the integer type used in the Triangle 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

 Triangulation (const geometry::Cell2D< float_t > &cell, triangle::behavior options=s_triangle_default_options)
 Constructs a Triangulation object for a given 2D cell.
 ~Triangulation ()
 Destructor for the Triangulation class.
index_t getNumTriangles () const
 Gets the number of triangles in the triangulation.
index_t getNumPoints () const
 Gets the number of points in the triangulation.
const PointsViewType & getPointList () const
 Gets the list of points in the triangulation.
const SimplexesViewType & getTriangleList () const
 Gets the list of triangles in the triangulation.
const SubsimplexesViewType & getSurfaceSegmentList () const
 Gets the list of edges of the boundary of the triangulation.
const auto & cell () const
 Gets a reference to the cell.

Static Public Attributes

static constexpr int32_t dim = 2
static const triangle::behavior s_triangle_default_options
static constexpr index_t s_buffer_size = 256
 Static constant defining the size of the static buffer for avoiding dynamic allocation of segment lists. The enumeration is always the same since the cell already provides the vertices in the correct order.

Protected Attributes

const geometry::Cell2D< float_t > & m_cell
 The input 2D geometric cell for triangulation.
struct triangle::triangulateio m_in
 Input structure for the Triangle library.
struct triangle::triangulateio m_out
 Output structure for the Triangle library.
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 enough.
index_t m_static_segmentlist [s_buffer_size]
 Static buffer where we store the segment list.
std::unique_ptr< PointsViewType > m_point_list
 Unique pointer to an Eigen::Map representing the list of points in the triangulation.
std::unique_ptr< SimplexesViewType > m_triangle_list
 Unique pointer to an Eigen::Map representing the list of triangles in the triangulation.
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.

Detailed Description

Performs triangulation of a 2D cell using the Triangle library.

This class handles the generation of a triangulation for a given 2D cell and provides access to the resulting points and triangles. It leverages the Triangle library [https://www.cs.cmu.edu/~quake/triangle.html] under the hood for computational geometry operations.

Member Typedef Documentation

◆ float_t

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

◆ index_t

Defines the integer type used in the Triangle library.

◆ PointsType

using vulpes::geometry::Triangulation::PointsType = const Eigen::Matrix<float_t, dim, -1>

◆ PointsViewType

◆ PointType

◆ SimplexesType

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

◆ SimplexesViewType

◆ SubsimplexesType

◆ SubsimplexesViewType

Constructor & Destructor Documentation

◆ Triangulation()

vulpes::geometry::Triangulation::Triangulation ( const geometry::Cell2D< float_t > & cell,
triangle::behavior options = s_triangle_default_options )
explicit

Constructs a Triangulation object for a given 2D cell.

Parameters
cellA 2D cell to be triangulated, represented by geometry::Cell2D.
optionsTriangle library options

◆ ~Triangulation()

vulpes::geometry::Triangulation::~Triangulation ( )

Destructor for the Triangulation class.

Cleans up the resources allocated by the Triangle library.

Member Function Documentation

◆ cell()

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

Gets a reference to the cell.

◆ getNumPoints()

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

Gets the number of points in the triangulation.

Returns
The total number of points in the triangulation.

◆ getNumTriangles()

index_t vulpes::geometry::Triangulation::getNumTriangles ( ) const
inline

Gets the number of triangles in the triangulation.

Returns
The total number of triangles generated.

◆ getPointList()

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

Gets the list of points in the triangulation.

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

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

◆ getSurfaceSegmentList()

const SubsimplexesViewType & vulpes::geometry::Triangulation::getSurfaceSegmentList ( ) const
inline

Gets the list of edges of the boundary of the triangulation.

◆ getTriangleList()

const SimplexesViewType & vulpes::geometry::Triangulation::getTriangleList ( ) const
inline

Gets the list of triangles in the triangulation.

The triangles are represented as a 3xM Eigen matrix where each column contains the indices of the three vertices of a triangle.

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

Member Data Documentation

◆ dim

int32_t vulpes::geometry::Triangulation::dim = 2
staticconstexpr

◆ m_cell

const geometry::Cell2D<float_t>& vulpes::geometry::Triangulation::m_cell
protected

The input 2D geometric cell for triangulation.

◆ m_in

struct triangle::triangulateio vulpes::geometry::Triangulation::m_in
protected

Input structure for the Triangle library.

◆ m_out

struct triangle::triangulateio vulpes::geometry::Triangulation::m_out
protected

Output structure for the Triangle library.

◆ m_point_list

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

Unique pointer to an Eigen::Map representing the list of points in the triangulation.

The data is generated by Triangle in m_out

◆ m_segmentlist

std::vector<index_t> vulpes::geometry::Triangulation::m_segmentlist
protected

Dynamic buffer where we store the segment list. It is used only if the static buffer is not large enough.

◆ m_static_segmentlist

index_t vulpes::geometry::Triangulation::m_static_segmentlist[s_buffer_size]
protected
Initial value:
= {
0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15,
15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30,
30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37,
38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45,
45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52,
53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60,
60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67,
68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75,
75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82,
83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90,
90, 91, 91, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 97, 97,
98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 105,
105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112,
113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120,
120, 121, 121, 122, 122, 123, 123, 124, 124, 125, 125, 126, 126, 127, 127,
0}

Static buffer where we store the segment list.

◆ m_surface_segment_list

std::unique_ptr<SubsimplexesViewType> vulpes::geometry::Triangulation::m_surface_segment_list
protected

Unique pointer to an Eigen::Map representing the list of edges in the boundary of the triangulation.

The data is a view to m_in.segmentlist.

◆ m_triangle_list

std::unique_ptr<SimplexesViewType> vulpes::geometry::Triangulation::m_triangle_list
protected

Unique pointer to an Eigen::Map representing the list of triangles in the triangulation.

The data is generated by Triangle in m_out.

◆ s_buffer_size

index_t vulpes::geometry::Triangulation::s_buffer_size = 256
staticconstexpr

Static constant defining the size of the static buffer for avoiding dynamic allocation of segment lists. The enumeration is always the same since the cell already provides the vertices in the correct order.

◆ s_triangle_default_options

const triangle::behavior vulpes::geometry::Triangulation::s_triangle_default_options
static
Initial value:
= []() {
triangle::behavior options{};
options.poly = 1;
options.quality = 1;
options.firstnumber = 0;
options.edgesout = 1;
options.quiet = 1;
return options;
}()

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