dune-grid
2.2.0
|
Implements a mapper for an arbitrary subset of entities. More...
#include <dune/grid/common/universalmapper.hh>
Public Member Functions | |
UniversalMapper (const G &grid, const IDS &idset) | |
Construct mapper from grid and one of its id sets. | |
template<class EntityType > | |
int | map (const EntityType &e) const |
Map entity to array index. | |
int | map (const typename G::Traits::template Codim< 0 >::Entity &e, int i, int cc) const |
Map subentity of codim 0 entity to array index. | |
int | size () const |
Return total number of entities in the entity set managed by the mapper. | |
template<class EntityType > | |
bool | contains (const EntityType &e, int &result) const |
Returns true if the entity is contained in the index set. | |
bool | contains (const typename G::Traits::template Codim< 0 >::Entity &e, int i, int cc, int &result) const |
Returns true if the entity is contained in the index set. | |
void | update () |
Recalculates map after mesh adaptation. | |
void | clear () |
int | map (const typename G::Traits::template Codim< 0 >::Entity &e, int i, unsigned int codim) const |
Map subentity i of codim cc of a codim 0 entity to array index. |
Implements a mapper for an arbitrary subset of entities.
This implementation uses an ID set and a map, thus it has log complexity for each access. Template parameters are:
Entities need to be registered in order to use them. If an entity is queried with map, the known index is returned or a new index is created. The method contains only return true, if the entites was queried via map already.
Dune::UniversalMapper< G, IDS >::UniversalMapper | ( | const G & | grid, |
const IDS & | idset | ||
) | [inline] |
void Dune::UniversalMapper< G, IDS >::clear | ( | ) | [inline] |
bool Dune::UniversalMapper< G, IDS >::contains | ( | const EntityType & | e, |
int & | result | ||
) | const [inline] |
Returns true if the entity is contained in the index set.
The method contains only return true, if the entites was queried via map already.
e | Reference to entity |
result | integer reference where corresponding index is stored if true |
Reimplemented from Dune::Mapper< G, UniversalMapper< G, IDS > >.
bool Dune::UniversalMapper< G, IDS >::contains | ( | const typename G::Traits::template Codim< 0 >::Entity & | e, |
int | i, | ||
int | cc, | ||
int & | result | ||
) | const [inline] |
Returns true if the entity is contained in the index set.
[in] | e | Reference to codim 0 entity |
[in] | i | subentity number |
[in] | cc | subentity codim |
[out] | result | integer reference where corresponding index is stored if true |
Reimplemented from Dune::Mapper< G, UniversalMapper< G, IDS > >.
int Dune::UniversalMapper< G, IDS >::map | ( | const EntityType & | e | ) | const [inline] |
Map entity to array index.
If an entity is queried with map, the known index is returned or a new index is created. A call to map can never fail.
e | Reference to codim cc entity, where cc is the template parameter of the function. |
Reimplemented from Dune::Mapper< G, UniversalMapper< G, IDS > >.
int Dune::UniversalMapper< G, IDS >::map | ( | const typename G::Traits::template Codim< 0 >::Entity & | e, |
int | i, | ||
int | cc | ||
) | const [inline] |
Map subentity of codim 0 entity to array index.
If an entity is queried with map, the known index is returned or a new index is created. A call to map can never fail.
e | Reference to codim 0 entity. |
i | Number of codim cc subentity of e, where cc is the template parameter of the function. |
cc | codim of the subentity |
int Dune::Mapper< G, UniversalMapper< G, IDS > >::map | ( | const typename G::Traits::template Codim< 0 >::Entity & | e, |
int | i, | ||
unsigned int | codim | ||
) | const [inline, inherited] |
Map subentity i of codim cc of a codim 0 entity to array index.
e | Reference to codim 0 entity. |
i | Number of codim cc subentity of e, where cc is the template parameter of the function. |
codim | codimension of subentity of e |
int Dune::UniversalMapper< G, IDS >::size | ( | ) | const [inline] |
Return total number of entities in the entity set managed by the mapper.
This number can be used to allocate a vector of data elements associated with the entities of the set. In the parallel case this number is per process (i.e. it may be different in different processes).
Reimplemented from Dune::Mapper< G, UniversalMapper< G, IDS > >.
void Dune::UniversalMapper< G, IDS >::update | ( | ) | [inline] |
Recalculates map after mesh adaptation.
Reimplemented from Dune::Mapper< G, UniversalMapper< G, IDS > >.