Basis 2D mesh type compliant with abstract mesh interface.
More...
#include <lf/mesh/hybrid2d/mesh.h>
|
unsigned | DimMesh () const override |
| The dimension of the manifold described by the mesh, or equivalently the maximum dimension of the reference elements present in the mesh.
|
|
unsigned | DimWorld () const override |
| The dimension of the Euclidean space in which the mesh is embedded.
|
|
std::span< const Entity *const > | Entities (unsigned codim) const override |
| All entities of a given codimension.
|
|
size_type | NumEntities (unsigned codim) const override |
| The number of Entities that have the given codimension.
|
|
size_type | NumEntities (lf::base::RefEl ref_el_type) const override |
| Tells number of entities of a particular topological/geometric type.
|
|
size_type | Index (const Entity &e) const override |
| Acess to the index of a mesh entity of any co-dimension.
|
|
const mesh::Entity * | EntityByIndex (dim_t codim, glb_idx_t index) const override |
| Method for accessing an entity through its index.
|
|
bool | Contains (const mesh::Entity &e) const override |
| Check if the given entity is a part of this mesh.
|
|
virtual | ~Mesh ()=default |
| virtual destructor
|
|
|
static std::shared_ptr< spdlog::logger > & | Logger () |
| logger, used by methods of Mesh to log additional information.
|
|
Basis 2D mesh type compliant with abstract mesh interface.
Definition at line 35 of file mesh.h.
◆ CellList
Initial value:
std::vector<std::pair<std::array<size_type, 4>,
GeometryPtr>>
std::unique_ptr< geometry::Geometry > GeometryPtr
Data types for passing information about mesh intities.
Definition at line 74 of file mesh.h.
◆ EdgeList
Initial value:
std::vector<std::pair<std::array<size_type, 2>,
GeometryPtr>>
Definition at line 72 of file mesh.h.
◆ GeometryPtr
Data types for passing information about mesh intities.
Definition at line 70 of file mesh.h.
◆ NodeCoordList
◆ Mesh()
Construction of mesh from information gathered in a MeshFactory.
- Parameters
-
dim_world | Dimension of the ambient space. |
nodes | sequential container of node coordinates |
edges | sequential container of pairs of (i) vectors of indices of the nodes of an edge (ii) pointers to the geometry object describing an edge |
cells | sequential container of pairs of (i) vectors of indices of the nodes of a cell (ii) pointers to the geometry object for the cell |
check_completeness | If set to true, the constructor will check that the mesh is topologically complete. That means that every entity with codimension codim>0 is a subentity of at least one entity with codimension codim-1 . If check_completeness = true and the mesh is not complete, an assert will fail. |
Shape guessing
Shape information usually supplied by a unique pointer to a lf::geometry::Geometry object attached to an entity may be missing for some of the entities. In this case the constructor tries to reconstruct the shape from that of other entities.
The main example is missing geometry information for nodes or edges. In this case a call to the lf::geometry::SubGeometry() method of cell entities is used to generate shape information for its lower-dimensional sub-entities. Note that any adjacent cell can be used and no selection rule is given.
Even cells without shape information may be passed. In this case the current implementation builds a cell with straight edges of type lf::geometry::TriaO1 (in the case of a topological triangle) or lf::geometry::QuadO1 (in the case of a quadrilateral) from the node positions. The shape of edges is not taken into account.
An extreme situation is marked by passing node positions as the only geometric information together with topological node-cell incidence relationships. In this case the constructor will build a mesh with straight edges throughout, type lf::geometry::SegmentO1.
Missing entities
- Note
- not all edges of the mesh have to be passed in the
edges
argument; missing edges are inserted based on the information about the cells.
-
the position of node information the
nodes
array and of cell information in the cells
array, respectively, determines the interpretation of the index numbers, that is the n-th node in the container has index n-1.
is stored in the 'edge_global_index' field of the EdgeData structure.
Definition at line 178 of file mesh.cc.
◆ Contains()
bool lf::mesh::hybrid2d::Mesh::Contains |
( |
const mesh::Entity & | e | ) |
const |
|
overridevirtual |
Check if the given entity is a part of this mesh.
- Parameters
-
e | The entity that should be checked. |
- Returns
- true if the entity belongs to the mesh.
Implements lf::mesh::Mesh.
Definition at line 113 of file mesh.cc.
◆ DimMesh()
unsigned lf::mesh::hybrid2d::Mesh::DimMesh |
( |
| ) |
const |
|
inlineoverridevirtual |
The dimension of the manifold described by the mesh, or equivalently the maximum dimension of the reference elements present in the mesh.
See the code snippet showing the use of lf::mesh::Mesh
Implements lf::mesh::Mesh.
Definition at line 37 of file mesh.h.
◆ DimWorld()
unsigned lf::mesh::hybrid2d::Mesh::DimWorld |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ Entities()
std::span< const Entity *const > lf::mesh::hybrid2d::Mesh::Entities |
( |
unsigned | codim | ) |
const |
|
overridevirtual |
All entities of a given codimension.
- Parameters
-
codim | The codimension of the entities that should be returned. |
- Returns
- A span of pointers to entities that enumerate all entities of the given codimension.
- See also
- Entity
Principal access method for entities distinguished only by their co-dimension. Hence, all cells of a mesh are covered by the range returned when giving co-dimension 0, regardless of their concrete shape.
The typical loop for entity traversal looks like this, where mesh
is a variable containing a reference to a Mesh object.
....
}
Interface class representing a topological entity in a cellular complex
std::span< const Entity *const > Entities(unsigned codim) const override
All entities of a given codimension.
Inside the loop body the variable entity
contains a pointer to an immutable object of type Entity whose co-dimension is codim
.
- Note
- The pointer remains valid for as long as the mesh data structure remains valid.
Demonstration code
std::cout << cnt <<
": Entity #" << mesh.
Index(*entity) <<
": " << *entity
<< std::endl;
cnt++;
}
return cnt;
}
Also see Lecture Document Example 2.7.2.6 or the code snippet showing the use of lf::mesh::Mesh
Implements lf::mesh::Mesh.
Definition at line 20 of file mesh.cc.
◆ EntityByIndex()
Method for accessing an entity through its index.
- Parameters
-
codim | codimension of the entity. Remember that indices are supposed to be unique and contiguous for a given co-dimension |
index | an integer between 0 and number of entities of the given co-dimension -1. It passes the index. |
- Returns
- pointer to the entity object with the given index.
Based on the bijectition between entities of a given co-dimension and an integer range. The following expression should evaluate to true
, if mesh
is a reference to a Mesh object, and idx
a valid index
((idx < mesh.NumEntities(codim)) &&
mesh.Index(*mesh.EntityByIndex(codim,idx)) == idx)
- Note
- O(1) access complexity due to table lookup.
Also see the code snippet showing the use of lf::mesh::Mesh
Implements lf::mesh::Mesh.
Definition at line 106 of file mesh.cc.
◆ Index()
Acess to the index of a mesh entity of any co-dimension.
- Parameters
-
e | Entity whose index is requested |
- Returns
- index ranging from 0 to no. of entities of the same co-dimension-1
It is a strict convention in LehrFEM++ that all entities of the same co-dimension belonging to a mesh are endowed with an integer index. These indices are guaranteed to be contiguous and to range from 0 to Size(codim)-1
, cf. Lecture Document Equation 2.7.2.5.
- Note
- The index of a mesh entity is NOT related to its position in the range returned by the Entities() method.
Also see the code snippet showing the use of lf::mesh::Mesh
The indexing of mesh entities is explained in Lecture Document Subsection 2.7.2.1
Implements lf::mesh::Mesh.
Definition at line 84 of file mesh.cc.
◆ Logger()
static std::shared_ptr< spdlog::logger > & lf::mesh::hybrid2d::Mesh::Logger |
( |
| ) |
|
|
inlinestatic |
◆ NumEntities() [1/2]
Tells number of entities of a particular topological/geometric type.
- Parameters
-
ref_el_type | topological/geometric type |
- Returns
- number of entities of that type
Implements lf::mesh::Mesh.
Definition at line 62 of file mesh.cc.
◆ NumEntities() [2/2]
Mesh::size_type lf::mesh::hybrid2d::Mesh::NumEntities |
( |
unsigned | codim | ) |
const |
|
overridevirtual |
The number of Entities that have the given codimension.
- Parameters
-
codim | The codimension of the entities that should be counted. |
- Returns
- That number of entities that have the given codimension.
See the code snippet showing the use of lf::mesh::Mesh
Implements lf::mesh::Mesh.
Definition at line 49 of file mesh.cc.
◆ MeshFactory
◆ dim_world_
dim_t lf::mesh::hybrid2d::Mesh::dim_world_ {} |
|
private |
◆ entity_pointers_
std::array<std::vector<const mesh::Entity*>, 3> lf::mesh::hybrid2d::Mesh::entity_pointers_ |
|
private |
Auxliary array of cell (co-dim ==0 entities) pointers.
This array serves two purposes. It facilitates the construction of a range covering all the cells. It is also required to retrieving the entity of a specific codimension belonging to an index.
Definition at line 67 of file mesh.h.
◆ points_
array of 0-dimensional entity object of co-dimension 2
Definition at line 53 of file mesh.h.
◆ quads_
array of quadrilateral cell objects, oo-dimension 0
Definition at line 59 of file mesh.h.
◆ segments_
array of 1-dimensional entity object of co-dimension 1
Definition at line 55 of file mesh.h.
◆ trias_
array of triangular cell objects, oo-dimension 0
Definition at line 57 of file mesh.h.
The documentation for this class was generated from the following files:
- /__w/lehrfempp/lehrfempp/lib/lf/mesh/hybrid2d/mesh.h
- /__w/lehrfempp/lehrfempp/lib/lf/mesh/hybrid2d/mesh.cc