![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
A class for a 2D mesh, inheriting from MeshBase. More...
#include <mesh_2d.hpp>
Public Types | |
| using | SelfPoint = Point<FloatType, 2> |
| Alias for a 2D point. | |
| using | BaseType |
| Alias for the map from cells to vertices. | |
| using | CellToVtxMap = datastructure::CrsMap<IndexType, IndexType> |
| Alias for the uncompressed version of the cell-to-vertex map. | |
| using | CellToVtxMapUncompressed = datastructure::CrsMapUncompressed<IndexType> |
| A special value used to represent an undefined or invalid index. | |
| 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. | |
| using | EdgeVtxs |
| Map from an edge to its two vertices. | |
| using | EdgeToVtxMap |
| Map from cells to their edges. | |
| using | CellToEdgeMap |
| Map from edges to adjacent cells. | |
| using | EdgeToCellMap |
| enum | Entity |
| Enumerates the different types of mesh entities based on their dimension. More... | |
Public Member Functions | |
| Mesh2D ()=default | |
| Default constructor. Creates an empty mesh. | |
| Mesh2D (const std::vector< SelfPoint > &vertexes, const CellToVtxMapUncompressed &cell_vertices) | |
| Constructs a mesh from vertices and an uncompressed cell-to-vertex map. | |
| Mesh2D (const std::vector< SelfPoint > &vertexes, const CellToVtxMap &cell_vertices) | |
| Constructs a mesh from vertices and a compressed cell-to-vertex map. | |
| Mesh2D (const std::vector< SelfPoint > &vertexes, const CellToVtxMap &cell_vertices, const MeshTag< 2, IndexType > &tags) | |
| Constructs a mesh from vertices, a cell-to-vertex map, and tags. | |
| Mesh2D (const std::vector< SelfPoint > &vertexes, const CellToVtxMapUncompressed &cell_vertices, const MeshTag< 2, IndexType > &tags) | |
| Constructs a mesh from vertices, an uncompressed cell-to-vertex map, and tags. | |
| template<class Archive> | |
| void | serialize (Archive &ar, const unsigned int) |
| Serializes the mesh data by calling the base class's serialization. | |
| constexpr IndexType | nEntity (std::size_t dim) const |
| Returns the total number of entities of a given dimension. | |
| template<std::size_t dim> | |
| constexpr auto & | getEntityToCellMap () const |
| Gets the connectivity map from a given entity dimension to cells. | |
| Mesh2D | agglomerate (const std::vector< IndexType > &old_to_new_cell) const |
| Creates a new, coarser mesh by grouping cells together. | |
| Mesh2D | subMesh (const std::vector< IndexType > &cell_ids) const |
| Creates a new mesh from a subset of 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 constexpr bool | parallel () |
| Indicates if the mesh is configured for parallel computation. | |
Static Public Attributes | |
| static constexpr IndexType | UNDEF = static_cast<IndexType>(-1) |
| 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. | |
Protected Member Functions | |
| void | buildMesh () |
| Builds all the necessary connectivity maps for the mesh. | |
| void | buildFacetToCellAndCellToFacetAndFacetToVertex () |
| Builds the core connectivity maps relating facets (edges) to cells and vertices. | |
| void | fixVertexAndFacetsOrders () |
| Enforces the CCW ordering conventions for the mesh. | |
| 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, Mesh2D< 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, Mesh2D< 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, Mesh2D< FloatType, IndexType > &agg_mesh) const |
| Builds the cell-to-vertex map for an agglomerated mesh. | |
| Mesh2D< 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 | |
| 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 Mesh2D &lhs, const Mesh2D &rhs) |
| Checks if two 2D meshes are identical by comparing their base class data. | |
A class for a 2D mesh, inheriting from MeshBase.
This class provides a specific implementation for a two-dimensional mesh composed of polygonal cells. It defines strict ordering rules to ensure consistency, which is important for many numerical algorithms.
| FloatType | The data type for floating-point numbers (e.g., float or double). |
| IndexType | The data type for indices (e.g., int or std::size_t). |
| using vulpes::geometry::Mesh2D< FloatType, IndexType >::BaseType |
Alias for the map from cells to vertices.
|
inherited |
Map from edges to adjacent cells.
|
inherited |
Map from cells to the vertices that define them.
| using vulpes::geometry::Mesh2D< FloatType, IndexType >::CellToVtxMap = datastructure::CrsMap<IndexType, IndexType> |
Alias for the uncompressed version of the cell-to-vertex map.
| using vulpes::geometry::Mesh2D< FloatType, IndexType >::CellToVtxMapUncompressed = datastructure::CrsMapUncompressed<IndexType> |
A special value used to represent an undefined or invalid index.
|
inherited |
Map from cells to the facets that form their boundary.
|
inherited |
|
inherited |
Map from cells to their edges.
|
inherited |
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::Mesh2D< FloatType, IndexType >::SelfPoint = Point<FloatType, 2> |
Alias for a 2D point.
Alias for the base class type.
|
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 mesh.
|
inlineexplicit |
Constructs a mesh from vertices and an uncompressed cell-to-vertex map.
| vertexes | A vector of 2D points representing the mesh vertices. |
| cell_vertices | An uncompressed map where each row contains the vertex indices for a cell. |
|
inlineexplicit |
Constructs a mesh from vertices and a compressed cell-to-vertex map.
| vertexes | A vector of 2D points representing the mesh vertices. |
| cell_vertices | A compressed map where each row contains the vertex indices for a cell. |
|
inlineexplicit |
Constructs a mesh from vertices, a cell-to-vertex map, and tags.
| vertexes | A vector of 2D points representing the mesh vertices. |
| cell_vertices | A compressed map of cell vertices. |
| tags | A MeshTag object containing labels for mesh entities. |
|
inlineexplicit |
Constructs a mesh from vertices, an uncompressed cell-to-vertex map, and tags.
| vertexes | A vector of 2D points representing the mesh vertices. |
| cell_vertices | An uncompressed map of cell vertices. |
| tags | A MeshTag object containing labels for mesh entities. |
|
inline |
Creates a new, coarser mesh by grouping cells together.
This method extends the base agglomeration by performing an extra step to fix the ordering of vertices and facets to ensure the new mesh follows the required CCW ordering conventions.
| old_to_new_cell | A vector mapping each old cell to a new, larger cell ID. |
|
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 core connectivity maps relating facets (edges) to cells and vertices.
This setup function constructs the mesh's topology from the list of vertices that form each cell (m_cell_to_vtx). It simultaneously populates three data structures: m_facet_to_cell, m_cell_to_facet, and m_facet_to_vtx.
|
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.
|
inlineprotected |
Builds all the necessary connectivity maps for the mesh.
This is a helper function called by the constructors to build the full mesh structure from the initial vertex and cell-to-vertex data.
|
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.
|
protected |
Enforces the CCW ordering conventions for the mesh.
After operations like agglomeration, the ordering of vertices within cells and facets might be incorrect. This function iterates through the mesh and reorders them to match the class's specified properties.
|
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).
|
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 |
Gets the connectivity map from a given entity dimension to cells.
| dim | The dimension of the entity (0 for vertices, 1 for facets). |
|
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 total number of entities of a given dimension.
| dim | The dimension of the entity: 0 for vertices, 1 for facets (edges), 2 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 by calling the base class's serialization.
| ar | The archive object to write to or read from. |
| Mesh2D< FloatType, IndexType > vulpes::geometry::Mesh2D< FloatType, IndexType >::subMesh | ( | const std::vector< IndexType > & | cell_ids | ) | const |
Creates a new mesh from a subset of cells of the current mesh.
| cell_ids | A vector of cell indices to include in the new mesh. |
|
friend |
Checks if two 2D meshes are identical by comparing their base class data.
| lhs | The left-hand side mesh. |
| rhs | The right-hand side mesh. |
|
staticconstexprinherited |
A special value used to represent an undefined or invalid index.
|
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.
|
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.
|
inlinestaticconstexpr |
|
staticconstexprinherited |
True if the mesh is a surface in a higher-dimensional space (e.g., a 2D surface in 3D space).