Basis 2D mesh type compliant with abstract mesh interface.
Definition at line 35 of file mesh.h.
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 177 of file mesh.cc.
nonstd::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
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;
}
Abstract interface for objects representing a single mesh.
virtual nonstd::span< const Entity *const > Entities(unsigned codim) const =0
All entities of a given codimension.
virtual size_type Index(const Entity &e) const =0
Acess to the index of a mesh entity of any co-dimension.
unsigned int dim_t
type for dimensions and co-dimensions and numbers derived from them
unsigned int size_type
general type for variables related to size of arrays
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.
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.
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.