Dune Core Modules (2.5.2)
Id Set Interface. More...
#include <dune/grid/common/indexidset.hh>
Public Types | |
typedef IdTypeImp | IdType |
Type used to represent an id. | |
Public Member Functions | |
template<class Entity > | |
IdType | id (const Entity &e) const |
Get id of an entity. This method is simpler to use than the one below. | |
template<int cc> | |
IdType | id (const typename std::remove_const< GridImp >::type::Traits::template Codim< cc >::Entity &e) const |
Get id of an entity of codim cc. Unhandy because template parameter must be supplied explicitely. | |
IdType | subId (const typename std::remove_const< GridImp >::type::Traits::template Codim< 0 >::Entity &e, int i, unsigned int codim) const |
Get id of subentity i of co-dimension codim of a co-dimension 0 entity. | |
Detailed Description
class Dune::IdSet< GridImp, IdSetImp, IdTypeImp >
Id Set Interface.
This class template is used as a base class for all id set implementations. It uses the Barton-Nackman trick to ensure conformity to the interface.
- Template Parameters
-
GridImp Type that is a model of Dune::Grid. IdSetImp Type that is a model of Dune::IdSet. IdTypeImp Type used for ids
Overview
An id set provides a map
\[ m : E \to \mathbf{I}\]
where \(E\) is a subset of the entities of a grid and \(\mathbf{I}\) is a discrete set of ids. These ids need not be consecutive nor positive. However, the ids must be usable as keys for STL associative containers (e.g., std::map
). For debugging purposes, it must also be possible to write them into standard C++ streams. More precisely, for such a type Id
, at least the following operators have to be provided:
The index map \(m\) has the following properties:
- It is injective, i.e. for any \(e,e^\prime\in E\) we have \(e\neq e^\prime \Rightarrow m(e)\neq m(e^\prime)\).
- It is persistent with respect to grid modification, i.e. if there exists an entity \(e\) with id \(i\) before grid modification and an entity \(e^\prime\) with id \(i\) after mesh modification it is guaranteed that \(e=e^\prime\).
The set of ids \( \mathbf{I} = \{i\ |\ \exists e\in E : m(e)=i\}\) used by the id set is not necessarily consecutive. In practice the numbers can be quite large, especially in a parallel implementation. Therefore the type used to represent the id can be chosen by the application.
Ids and leaf entities
An element is a copy of its father element if it is the only son. This concept can be transferred to all higher codimensions because in a nested grid structure the entities of any codimension form a set of trees. However, the roots of these trees are not necessarily on level 0. Thus, we define that an entity is a copy of another entity if it is the only descendant of this entity in the refinement tree. This is illustrated in the following figure where, for example, vertex w is a copy of vertex v.
The copy relation can be trivially extended to be an equivalence relation. With respect to ids we define that all copies of an entity share the same id. In the example of the figure the vertices v and w would have the same id.
This definition is useful to transfer data related to the leaf grid during grid modification.
Global id set
A global id set provides ids that are unique over all processes over which the grid is distributed. All grid implementations provide a global id set.
Local id set
A local id set provides ids that are unique within one process but two entities in different processes may have the same id. Obviously, a global id set is also a local id set. A grid implementation may provide an extra local id set for efficiency reasons. In sequential grids local and global id set are identical. All grid implementations provide a local id set.
The documentation for this class was generated from the following files:
- dune/grid/common/grid.hh
- dune/grid/common/indexidset.hh