LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
|
Abstract interface for objects representing a single mesh. More...
#include <lf/mesh/mesh_interface.h>
Public Types | |
using | size_type = lf::base::size_type |
using | dim_t = lf::base::dim_t |
Public Member Functions | |
virtual unsigned | DimMesh () const =0 |
The dimension of the manifold described by the mesh, or equivalently the maximum dimension of the reference elements present in the mesh. | |
virtual unsigned | DimWorld () const =0 |
The dimension of the Euclidean space in which the mesh is embedded. | |
virtual std::span< const Entity *const > | Entities (unsigned codim) const =0 |
All entities of a given codimension. | |
virtual size_type | NumEntities (unsigned codim) const =0 |
The number of Entities that have the given codimension. | |
virtual size_type | NumEntities (lf::base::RefEl ref_el_type) const =0 |
Tells number of entities of a particular topological/geometric type. | |
virtual size_type | Index (const Entity &e) const =0 |
Acess to the index of a mesh entity of any co-dimension. | |
virtual const mesh::Entity * | EntityByIndex (dim_t codim, base::glb_idx_t index) const =0 |
Method for accessing an entity through its index. | |
virtual bool | Contains (const Entity &e) const =0 |
Check if the given entity is a part of this mesh. | |
virtual | ~Mesh ()=default |
virtual destructor | |
Protected Member Functions | |
Mesh ()=default | |
Mesh (const Mesh &)=default | |
Mesh (Mesh &&)=default | |
Mesh & | operator= (const Mesh &)=default |
Mesh & | operator= (Mesh &&)=default |
Related Symbols | |
(Note that these are not member symbols.) | |
void | PrintInfo (std::ostream &o, const lf::mesh::Mesh &mesh, int ctrl=11) |
Diagnostic output operator. Prints info about a mesh. | |
Abstract interface for objects representing a single mesh.
This abstract base class describes the basic functionality of objects that manage single-level conforming finite element meshes. These objects essentially boil down to containers for mesh entities of different co-dimensions. Thus they allow sequential traversal of these entities.
Another important functionality concerns the management of entity indices, which have to provide a consecutive numbering of entities of a specific co-dimension starting from zero.
Mesh objects are usually accessed through C++ shared pointers; declare and initialize variable for a mesh as follows (second line optional)
In most contexts mesh objects will be 'read-only' (immutable). Then the declaration should look like
Why do we use shared pointers? Usually in a finite element code a mesh object is allocated dynamically in the beginning and disposed only before the code terminates. Many other objects rely on information about the mesh. If the mesh was destroyed before all the objects depending on it, those would be plunged into an undefined state. Shared pointers ensure that a mesh object is destroyed only after every object holding a pointer to it has been destroyed.
The standard ways to create a Mesh object are:
The following function demonstrates the use of all pertinent methods of the class Entity. In particular is shows how to loop over all entities of a mesh.
Design and use of lf::mesh::Mesh functionality is also presented in Lecture Document Subsection 2.7.2.1
Definition at line 73 of file mesh_interface.h.
using lf::mesh::Mesh::dim_t = lf::base::dim_t |
Definition at line 84 of file mesh_interface.h.
Auxiliary types
Definition at line 83 of file mesh_interface.h.
|
protecteddefault |
|
protecteddefault |
|
protecteddefault |
|
virtualdefault |
virtual destructor
|
pure virtual |
Check if the given entity is a part of this mesh.
e | The entity that should be checked. |
Implemented in lf::mesh::hybrid2d::Mesh.
|
pure virtual |
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
Implemented in lf::mesh::hybrid2d::Mesh.
Referenced by lf::mesh::test_utils::checkEntityIndexing(), lf::mesh::test_utils::checkMeshCompleteness(), lf::mesh::test_utils::isWatertightMesh(), PrintInfo(), lf::io::writeMatlab(), lf::io::writeMatplotlib(), and lf::io::writeTikZ().
|
pure virtual |
The dimension of the Euclidean space in which the mesh is embedded.
Implemented in lf::mesh::hybrid2d::Mesh.
Referenced by PrintInfo().
|
pure virtual |
All entities of a given codimension.
codim | The codimension of the entities that should be returned. |
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.
Inside the loop body the variable entity
contains a pointer to an immutable object of type Entity whose co-dimension is codim
.
Also see Lecture Document Example 2.7.2.6 or the code snippet showing the use of lf::mesh::Mesh
Implemented in lf::mesh::hybrid2d::Mesh.
Referenced by lf::mesh::test_utils::checkEntityIndexing(), lf::mesh::test_utils::checkMeshCompleteness(), lf::fe::InitEssentialConditionFromFunction(), lf::mesh::test_utils::isWatertightMesh(), lf::refinement::MeshHierarchy::MarkEdges(), lf::refinement::MeshHierarchy::PerformRefinement(), PrintInfo(), lf::refinement::MeshHierarchy::RefineMarked(), lf::refinement::MeshHierarchy::RefineRegular(), lf::io::writeMatlab(), lf::io::writeMatplotlib(), and lf::io::writeTikZ().
|
pure virtual |
Method for accessing an entity through its index.
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. |
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
Also see the code snippet showing the use of lf::mesh::Mesh
Implemented in lf::mesh::hybrid2d::Mesh.
Referenced by lf::mesh::test_utils::checkEntityIndexing().
Acess to the index of a mesh entity of any co-dimension.
e | Entity whose index is requested |
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.
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
Implemented in lf::mesh::hybrid2d::Mesh.
Referenced by lf::mesh::test_utils::checkEntityIndexing(), lf::mesh::test_utils::checkMeshCompleteness(), lf::mesh::test_utils::isWatertightMesh(), lf::refinement::MeshHierarchy::MarkEdges(), lf::refinement::MeshHierarchy::PerformRefinement(), PrintInfo(), lf::refinement::MeshHierarchy::RefineMarked(), lf::refinement::MeshHierarchy::RefineRegular(), lf::io::writeMatlab(), lf::io::writeMatplotlib(), and lf::io::writeTikZ().
|
pure virtual |
Tells number of entities of a particular topological/geometric type.
ref_el_type | topological/geometric type |
Implemented in lf::mesh::hybrid2d::Mesh.
|
pure virtual |
The number of Entities that have the given codimension.
codim | The codimension of the entities that should be counted. |
See the code snippet showing the use of lf::mesh::Mesh
Implemented in lf::mesh::hybrid2d::Mesh.
Referenced by lf::mesh::test_utils::checkEntityIndexing(), lf::mesh::test_utils::checkMeshCompleteness(), lf::refinement::MeshHierarchy::MarkEdges(), PrintInfo(), lf::refinement::MeshHierarchy::RefineMarked(), lf::refinement::MeshHierarchy::RefineRegular(), lf::io::writeMatlab(), and lf::io::writeTikZ().
|
related |
Diagnostic output operator. Prints info about a mesh.
mesh | The mesh to print info about |
ctrl | controls the level of detail of the printed output (see below) |
o | The stream to which this function should output |
Definition at line 18 of file print_info.cc.
References lf::geometry::Geometry::DimLocal(), DimMesh(), DimWorld(), Entities(), lf::geometry::Geometry::Geometry(), lf::geometry::Geometry::Global(), Index(), lf::base::RefEl::NodeCoords(), NumEntities(), lf::geometry::Geometry::RefEl(), and lf::base::RefEl::RefEl().