![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Represents a 3D mesh. More...
#include <mesh_3d.hpp>
Public Types | |
| using | SelfPoint = Point<FloatType, 3> |
| Alias for a 3D point with coordinates of type FloatType. | |
| using | BaseType |
| Alias for the base class, MeshBase. | |
| using | CellsFaceVtxsUncompressed = std::vector<std::vector<IndexType>> |
| A vector of vectors, where each inner vector holds the vertex indices for the faces of a cell. | |
| using | CellToVtxMap |
| An uncompressed (temporary) version of the CellToVtxMap. | |
| using | CellToVtxMapUncompressed |
| Map from facets to the cells they separate. | |
| using | CellToEdgeMap |
| Map from edges to adjacent cells. | |
| using | EdgeToCellMap |
| using | EdgeToVtxMap |
| Map from cells to their edges. | |
| using | EdgeVtxs |
| Map from an edge to its two vertices. | |
| using | index_t |
| using | float_t |
| using | DualMap |
| Map from cells to the facets that form their boundary. | |
| using | CellToFacetMap |
| Map from cells to the vertices that define them. | |
| using | FacetToCellMap |
| Map from facets to the vertices that define them. | |
| using | FacetToVtxMap |
| Map from vertices to the cells they belong to. | |
| using | VtxToCellMap |
| Represents an edge as a pair of vertex indices. | |
| enum | Entity |
| Enumerates the different types of mesh entities based on their dimension. More... | |
Public Member Functions | |
| Mesh3D ()=default | |
| Default constructor. Creates an empty 3D mesh. | |
| Mesh3D (const std::vector< SelfPoint > &vertexes, const CellToVtxMapUncompressed &cell_vertices, const CellsFaceVtxsUncompressed &cells_face_vtxs) | |
| Constructor for creating a 3D mesh from a list of vertices, cell-to-vertex connectivity, and cell-face-vertex connectivity. | |
| Mesh3D (const std::vector< SelfPoint > &vertexes, const CellToVtxMapUncompressed &cell_vertices, const CellsFaceVtxsUncompressed &cells_face_vtxs, const MeshTag< 3, IndexType > &mesh_tags) | |
| Constructor for creating a 3D mesh with tags. | |
| template<class Archive> | |
| void | serialize (Archive &ar, const unsigned int) |
| Serializes the mesh data for saving or transferring. | |
| EdgeToVtxMap & | getEdgeToVtxMap () |
| Gets a mutable reference to the edge-to-vertex map. | |
| const EdgeToVtxMap & | getEdgeToVtxMap () const |
| Gets a constant reference to the edge-to-vertex map. | |
| CellToEdgeMap & | getCellToEdgeMap () |
| Gets a mutable reference to the cell-to-edge map. | |
| const CellToEdgeMap & | getCellToEdgeMap () const |
| Gets a constant reference to the cell-to-edge map. | |
| EdgeToCellMap & | getEdgeToCellMap () |
| Gets a mutable reference to the edge-to-cell map. | |
| const EdgeToCellMap & | getEdgeToCellMap () const |
| Gets a constant reference to the edge-to-cell map. | |
| const auto & | getEdgeToVtxGlobalMap () const |
| Gets a constant reference to the global edge-to-vertex map. | |
| const auto & | getCellToEdgeGlobalMap () const |
| Gets a constant reference to the global cell-to-edge map. | |
| const auto & | getEdgeToCellGlobalMap () const |
| Gets a constant reference to the global edge-to-cell map. | |
| constexpr IndexType | nEntity (std::size_t dim) const |
| Returns the number of entities of a specific dimension in the mesh. | |
| template<std::size_t dim> | |
| constexpr auto & | getEntityToCellMap () const |
| Returns the entity-to-cell map for a given dimension. | |
| Mesh3D | agglomerate (const std::vector< IndexType > &old_to_new_cell) const |
| Creates a new mesh by agglomerating (merging) cells of the current mesh. | |
| std::vector< SelfPoint > & | getVertexes () |
| Gets a modifiable reference to the vector of vertices. | |
| const std::vector< SelfPoint > & | getVertexes () const |
| Gets a constant reference to the vector of vertices. | |
| DualMap & | getDualMap () |
| Gets a modifiable reference to the dual graph (cell-to-cell connections). | |
| const DualMap & | getDualMap () const |
| Gets a constant reference to the dual graph (cell-to-cell connections). | |
| CellToFacetMap & | getCellToFacetMap () |
| Gets a modifiable reference to the cell-to-facet map. | |
| const CellToFacetMap & | getCellToFacetMap () const |
| Gets a constant reference to the cell-to-facet map. | |
| CellToVtxMap & | getCellToVtxMap () |
| Gets a modifiable reference to the cell-to-vertex map. | |
| const CellToVtxMap & | getCellToVtxMap () const |
| Gets a constant reference to the cell-to-vertex map. | |
| FacetToCellMap & | getFacetToCellMap () |
| Gets a modifiable reference to the facet-to-cell map. | |
| const FacetToCellMap & | getFacetToCellMap () const |
| Gets a constant reference to the facet-to-cell map. | |
| FacetToVtxMap & | getFacetToVtxMap () |
| Gets a modifiable reference to the facet-to-vertex map. | |
| const FacetToVtxMap & | getFacetToVtxMap () const |
| Gets a constant reference to the facet-to-vertex map. | |
| VtxToCellMap & | getVtxToCellMap () |
| Gets a modifiable reference to the vertex-to-cell map. | |
| const VtxToCellMap & | getVtxToCellMap () const |
| Gets a constant reference to the vertex-to-cell map. | |
| const auto & | getDualGlobalMap () const |
| const auto & | getCellToFacetGlobalMap () const |
| const auto & | getCellToVtxGlobalMap () const |
| const auto & | getFacetToCellGlobalMap () const |
| const auto & | getFacetToVtxGlobalMap () const |
| const auto & | getVtxToCellGlobalMap () const |
| auto & | getMeshTags () |
| Gets a modifiable reference to the mesh tags. | |
| const auto & | getMeshTags () const |
| Gets a constant reference to the mesh tags. | |
| auto & | getMetadata () |
| Gets a modifiable reference to the mesh metadata. | |
| const auto & | getMetadata () const |
| Gets a constant reference to the mesh metadata. | |
| IndexType | numCells () const |
| Returns the total number of cells in the mesh. | |
| void | buildInternalMaps () |
| Builds all the secondary connectivity maps from the primary ones. | |
| constexpr IndexType | nLocEntity (std::size_t dim) const |
| Returns the number of locally owned entities of a given dimension. | |
| constexpr auto & | getEntityToCellGlobalMap () const |
| Gets the global map from a given entity dimension to cells. | |
| constexpr IndexType | nOwnedCells () const |
| Returns the number of locally owned cells. | |
Static Public Member Functions | |
| static Mesh3D | extrude (const Mesh2D< FloatType, IndexType > &mesh_2d, const Eigen::Vector< FloatType, 2 > z_range, IndexType n_elems) |
| Creates a 3D mesh by extruding a 2D mesh. | |
| static constexpr bool | parallel () |
| Indicates if the mesh is configured for parallel computation. | |
Static Public Attributes | |
| static constexpr IndexType | outer_dim |
| The dimension of the embedding space. | |
| static constexpr IndexType | self_dim |
| The dimension of the mesh itself. | |
| static constexpr IndexType | vtx_per_face |
| True if the mesh is a surface in a higher-dimensional space (e.g., a 2D surface in 3D space). | |
| static constexpr bool | is_manifold |
| A special value used to represent an undefined or invalid index. | |
| static constexpr IndexType | UNDEF |
Protected Member Functions | |
| void | buildFacetToCellAndFacetToVertex (const CellsFaceVtxsUncompressed &cells_face_vtxs) |
| Builds the facet-to-cell and facet-to-vertex maps. | |
| void | buildEdgeMaps () |
| Builds the edge-related maps. | |
| const auto & | self () const |
| Helper to get a constant reference to the Derived class instance. | |
| auto & | self () |
| Helper to get a reference to the Derived class instance. | |
| datastructure::CrsMap< index_t, index_t > | invertCellAgglomeration (const std::vector< index_t > &old_to_new_cell) const |
| Creates a map from new (agglomerated) cell IDs to old (fine) cell IDs. | |
| std::vector< index_t > | buildNewToOldFacetAgglomerationAndCellToFacet (const auto &new_to_old_cell, Mesh3D< FloatType, IndexType > &agg_mesh) const |
| Builds the facet mapping and cell-to-facet map for an agglomerated mesh. | |
| auto | buildFacetToCellAndFacetToVtxAgglomeration (const std::vector< index_t > &new_to_old_facet, const std::vector< index_t > &old_to_new_cell, Mesh3D< FloatType, IndexType > &agg_mesh) const |
| Builds the facet-to-cell and facet-to-vertex maps for an agglomerated mesh. | |
| void | buildCellToVtxAgglomeration (const auto &new_to_old_cell, const auto &old_to_new_vtx, Mesh3D< FloatType, IndexType > &agg_mesh) const |
| Builds the cell-to-vertex map for an agglomerated mesh. | |
| Mesh3D< FloatType, IndexType > | agglomerateBase (const std::vector< index_t > &old_to_new_cell, bool check_connected=true) const |
| Creates a new, coarser mesh by grouping cells together. | |
| void | agglomerateCheckConnected (const datastructure::CrsMap< IndexType, IndexType > &new_to_old_cell) const |
| Checks if each new agglomerated cell consists of connected old cells. | |
| void | buildVtxToCell () |
| Builds the vertex-to-cell connectivity map. | |
| void | buildCellToFacet () |
| Builds the cell-to-facet connectivity map. | |
| void | buildDualGraph () |
| Builds the dual graph (cell-to-cell adjacency). | |
Protected Attributes | |
| EdgeToVtxMap | m_edge_to_vtx |
| A map from edges to their constituent vertices. | |
| CellToEdgeMap | m_cell_to_edge |
| A map from cells to their edges. | |
| EdgeToCellMap | m_edge_to_cell |
| A map from edges to the cells that contain them. | |
| std::vector< SelfPoint > | m_vertexes |
| < A list of all vertex coordinates. | |
| DualMap | m_dual_graph |
| Maps each cell to the list of its boundary facets. | |
| CellToFacetMap | m_cell_to_facet |
| Maps each cell to the list of its vertices. | |
| CellToVtxMap | m_cell_to_vtx |
| Maps each facet to its borders. | |
| FacetToCellMap | m_facet_to_cell |
| Maps each facet to its vertices. | |
| FacetToVtxMap | m_facet_to_vtx |
| Maps each vertex to the list of cells it belongs to. | |
| VtxToCellMap | m_vtx_to_cell |
| Stores all tags associated with the mesh. | |
| MeshTag< SelfDim, IndexType > | m_mesh_tags |
| Stores global metadata for the mesh. | |
| Metadata< FloatType, IndexType > | m_metadata |
Friends | |
| bool | operator== (const Mesh3D &lhs, const Mesh3D &rhs) |
| Compares two Mesh3D objects for equality. | |
Represents a 3D mesh.
| FloatType | The floating-point type for vertex coordinates (e.g., float, double). |
| IndexType | The integer type for indexing vertices, cells, etc. (e.g., int, long). |
| using vulpes::geometry::Mesh3D< FloatType, IndexType >::BaseType |
Alias for the base class, MeshBase.
| using vulpes::geometry::Mesh3D< FloatType, IndexType >::CellsFaceVtxsUncompressed = std::vector<std::vector<IndexType>> |
A vector of vectors, where each inner vector holds the vertex indices for the faces of a cell.
The format is similar to VTU files and voro++, where the first element of each inner vector is the number of vertices for the first face, followed by the vertex indices, and so on for all faces of the cell.
| using vulpes::geometry::MeshBase< FloatType, IndexType, OuterDim, SelfDim, Mesh3D< FloatType, IndexType > >::CellToEdgeMap |
Map from edges to adjacent cells.
|
inherited |
Map from cells to the vertices that define them.
| using vulpes::geometry::MeshBase< FloatType, IndexType, OuterDim, SelfDim, Mesh3D< FloatType, IndexType > >::CellToVtxMap |
An uncompressed (temporary) version of the CellToVtxMap.
| using vulpes::geometry::MeshBase< FloatType, IndexType, OuterDim, SelfDim, Mesh3D< FloatType, IndexType > >::CellToVtxMapUncompressed |
Map from facets to the cells they separate.
If this is not a manyfold a facet separates exactly two cells (unless on the boundary of the mesh). If it is a manifold there is no limit (e.g. a graph junction of many edges)
|
inherited |
Map from cells to the facets that form their boundary.
| using vulpes::geometry::MeshBase< FloatType, IndexType, OuterDim, SelfDim, Mesh3D< FloatType, IndexType > >::EdgeToCellMap |
| using vulpes::geometry::MeshBase< FloatType, IndexType, OuterDim, SelfDim, Mesh3D< FloatType, IndexType > >::EdgeToVtxMap |
Map from cells to their edges.
| using vulpes::geometry::MeshBase< FloatType, IndexType, OuterDim, SelfDim, Mesh3D< FloatType, IndexType > >::EdgeVtxs |
Map from an edge to its two vertices.
|
inherited |
Map from facets to the vertices that define them.
|
inherited |
Map from vertices to the cells they belong to.
|
inherited |
|
inherited |
| using vulpes::geometry::Mesh3D< FloatType, IndexType >::SelfPoint = Point<FloatType, 3> |
Alias for a 3D point with coordinates of type FloatType.
|
inherited |
Represents an edge as a pair of vertex indices.
|
inherited |
Enumerates the different types of mesh entities based on their dimension.
|
default |
Default constructor. Creates an empty 3D mesh.
|
inlineexplicit |
Constructor for creating a 3D mesh from a list of vertices, cell-to-vertex connectivity, and cell-face-vertex connectivity.
| vertexes | A vector of 3D points representing the mesh vertices. |
| cell_vertices | An uncompressed map showing which vertices belong to each cell. |
| cells_face_vtxs | An uncompressed map showing the vertices of each face for each cell. |
|
inlineexplicit |
Constructor for creating a 3D mesh with tags.
| vertexes | A vector of 3D points representing the mesh vertices. |
| cell_vertices | An uncompressed map showing which vertices belong to each cell. |
| cells_face_vtxs | An uncompressed map showing the vertices of each face for each cell. |
| mesh_tags | The tags (metadata) to be associated with the mesh entities. |
|
inline |
Creates a new mesh by agglomerating (merging) cells of the current mesh.
| old_to_new_cell | A vector mapping old cell indices to new cell indices. |
|
protectedinherited |
Creates a new, coarser mesh by grouping cells together.
This process, called agglomeration, is used to create a simplified version of the mesh, for example in multigrid solvers.
| old_to_new_cell | A vector mapping each old cell to a new, larger cell ID. |
| check_connected | If true, verifies that each new cell is formed by a connected group of old cells. |
|
protectedinherited |
Checks if each new agglomerated cell consists of connected old cells.
It performs a search (DFS) within each group of old cells to ensure they form a single, contiguous block. It will exit with an error if a disconnected group is found.
| new_to_old_cell | A map from new cell IDs to the old cell IDs they contain. |
|
protectedinherited |
Builds the cell-to-facet connectivity map.
|
protectedinherited |
Builds the cell-to-vertex map for an agglomerated mesh.
| new_to_old_cell | A map from new cell IDs to the old cell IDs they contain. | |
| old_to_new_vtx | A map from old vertex IDs to new vertex IDs. | |
| [in,out] | agg_mesh | The new, agglomerated mesh being built. |
|
protectedinherited |
Builds the dual graph (cell-to-cell adjacency).
Two cells are considered neighbors if they share a common facet.
|
protected |
Builds the edge-related maps.
This method computes and populates the m_edge_to_vtx, m_cell_to_edge, and m_edge_to_cell maps. It does this by iterating through all the faces and their vertices, identifying unique edges, and then determining which cells and vertices are connected to each edge.
|
protected |
Builds the facet-to-cell and facet-to-vertex maps.
This method uses the provided cell-face-vertex connectivity to determine which faces belong to which cells and which vertices belong to each face. It correctly identifies shared faces between cells and builds the m_facet_to_cell and m_facet_to_vtx maps. It relies on the m_cell_to_vtx map being already built.
| cells_face_vtxs | An uncompressed map showing the vertices of each face for each cell. |
|
protectedinherited |
Builds the facet-to-cell and facet-to-vertex maps for an agglomerated mesh.
| new_to_old_facet | A map from new facet IDs to old facet IDs. | |
| old_to_new_cell | A map from old cell IDs to new cell IDs. | |
| [in,out] | agg_mesh | The new, agglomerated mesh being built. |
|
inlineinherited |
Builds all the secondary connectivity maps from the primary ones.
This is a convenience function that calls the individual build methods for creating maps like VtxToCell, CellToFacet, and the DualGraph.
|
protectedinherited |
Builds the facet mapping and cell-to-facet map for an agglomerated mesh.
This function identifies the boundary facets of the new, larger cells.
| new_to_old_cell | A map from new cell IDs to the old cell IDs they contain. | |
| [in,out] | agg_mesh | The new, agglomerated mesh being built. |
|
protectedinherited |
Builds the vertex-to-cell connectivity map.
|
static |
Creates a 3D mesh by extruding a 2D mesh.
| mesh_2d | The 2D mesh to extrude. |
| z_range | The range [z_min, z_max] over which to extrude. |
| n_elems | The number of new cells to create along the extrusion direction (z-axis). |
|
inline |
Gets a constant reference to the global cell-to-edge map.
|
inline |
Gets a mutable reference to the cell-to-edge map.
|
inline |
Gets a constant reference to the cell-to-edge map.
|
inlineinherited |
|
inlineinherited |
Gets a modifiable reference to the cell-to-facet map.
|
inlineinherited |
Gets a constant reference to the cell-to-facet map.
|
inlineinherited |
|
inlineinherited |
Gets a modifiable reference to the cell-to-vertex map.
|
inlineinherited |
Gets a constant reference to the cell-to-vertex map.
|
inlineinherited |
|
inlineinherited |
Gets a modifiable reference to the dual graph (cell-to-cell connections).
|
inlineinherited |
Gets a constant reference to the dual graph (cell-to-cell connections).
|
inline |
Gets a constant reference to the global edge-to-cell map.
|
inline |
Gets a mutable reference to the edge-to-cell map.
|
inline |
Gets a constant reference to the edge-to-cell map.
|
inline |
Gets a constant reference to the global edge-to-vertex map.
|
inline |
Gets a mutable reference to the edge-to-vertex map.
|
inline |
Gets a constant reference to the edge-to-vertex map.
|
inlineconstexprinherited |
Gets the global map from a given entity dimension to cells.
Similar to getEntityToCellMap, but for the entire (global) mesh. This call is forwarded to the Derived class.
| dim | The dimension of the entity. |
|
inlineconstexpr |
Returns the entity-to-cell map for a given dimension.
| dim | The dimension of the entity (0 for vertices, 1 for edges, 2 for faces). |
|
inlineinherited |
|
inlineinherited |
Gets a modifiable reference to the facet-to-cell map.
|
inlineinherited |
Gets a constant reference to the facet-to-cell map.
|
inlineinherited |
|
inlineinherited |
Gets a modifiable reference to the facet-to-vertex map.
|
inlineinherited |
Gets a constant reference to the facet-to-vertex map.
|
inlineinherited |
Gets a modifiable reference to the mesh tags.
|
inlineinherited |
Gets a constant reference to the mesh tags.
|
inlineinherited |
Gets a modifiable reference to the mesh metadata.
|
inlineinherited |
Gets a constant reference to the mesh metadata.
|
inlineinherited |
Gets a modifiable reference to the vector of vertices.
|
inlineinherited |
Gets a constant reference to the vector of vertices.
|
inlineinherited |
|
inlineinherited |
Gets a modifiable reference to the vertex-to-cell map.
|
inlineinherited |
Gets a constant reference to the vertex-to-cell map.
|
protectedinherited |
Creates a map from new (agglomerated) cell IDs to old (fine) cell IDs.
| old_to_new_cell | A vector where the index is the old cell ID and the value is the new cell ID. |
|
inlineconstexpr |
Returns the number of entities of a specific dimension in the mesh.
| dim | The dimension of the entity (0 for vertices, 1 for edges, 2 for faces, 3 for cells). |
|
inlineconstexprinherited |
Returns the number of locally owned entities of a given dimension.
This is mainly for parallel computing. This call is forwarded to the Derived class.
| dim | The dimension of the entity. |
|
inlineconstexprinherited |
Returns the number of locally owned cells.
|
inlineinherited |
Returns the total number of cells in the mesh.
It also includes assertions to ensure the mesh data is consistent.
|
inlinestaticconstexprinherited |
Indicates if the mesh is configured for parallel computation.
|
inlineprotectedinherited |
Helper to get a reference to the Derived class instance.
|
inlineprotectedinherited |
Helper to get a constant reference to the Derived class instance.
|
inline |
Serializes the mesh data for saving or transferring.
| Archive | The archive type (e.g., from Boost.Serialization). |
| ar | The archive to serialize to or from. |
|
friend |
Compares two Mesh3D objects for equality.
| lhs | The left-hand side mesh. |
| rhs | The right-hand side mesh. |
|
staticconstexprinherited |
A special value used to represent an undefined or invalid index.
|
protected |
A map from cells to their edges.
This is a crucial map, especially for things like finite element method degrees of freedom.
|
protectedinherited |
Maps each cell to the list of its vertices.
|
protectedinherited |
Maps each facet to its borders.
If this is not a manifold the cells are always two if the facet is internal and one if on the boundary, in this case one of the two entries is UNDEF. The cell in the first position in the one where the vertices of the facet in m_facet_to_vtx follow the "correct" orientation (CCW in 2D/outer pointing following the right-hand rule in 3D), the second one instead must be the contrary.
|
protectedinherited |
Maps each cell to the list of its boundary facets.
|
protected |
A map from edges to the cells that contain them.
|
protected |
A map from edges to their constituent vertices.
This is a handy internal map used during the building of other maps.
|
protectedinherited |
Maps each facet to its vertices.
In 1D, facets are the same as vertices.
|
protectedinherited |
Maps each vertex to the list of cells it belongs to.
|
protectedinherited |
Stores global metadata for the mesh.
|
protectedinherited |
|
protectedinherited |
< A list of all vertex coordinates.
The dual graph, storing neighbors for each cell. Two cells are neighbors if they share a facet.
|
protectedinherited |
Stores all tags associated with the mesh.
|
staticconstexprinherited |
The dimension of the embedding space.
|
staticconstexprinherited |
The dimension of the mesh itself.
The number of vertices per face. Set to -1 for 3D meshes where faces can have variable vertices.
|
inlinestaticconstexprinherited |
|
staticconstexprinherited |
True if the mesh is a surface in a higher-dimensional space (e.g., a 2D surface in 3D space).