5 #ifndef DUNE_UNIVERSALMAPPER_HH
6 #define DUNE_UNIVERSALMAPPER_HH
38 template <
typename G,
typename IDS>
40 public Mapper<G,UniversalMapper<G,IDS> >
42 typedef typename IDS::IdType IdType;
57 : g(grid), ids(idset), index()
69 template<
class EntityType>
70 int map (
const EntityType& e)
const
72 IdType
id = ids.id(e);
73 typename std::map<IdType,int>::iterator it = index.find(
id);
74 if (it!=index.end())
return it->second;
89 int map (
const typename G::Traits::template Codim<0>::Entity& e,
int i,
int cc)
const
91 IdType
id = ids.subId(e,i,cc);
92 typename std::map<IdType,int>::iterator it = index.find(
id);
93 if (it!=index.end())
return it->second;
119 template<
class EntityType>
120 bool contains (
const EntityType& e,
int& result)
const
122 IdType
id = ids.id(e);
123 typename std::map<IdType,int>::iterator it = index.find(
id);
141 bool contains (
const typename G::Traits::template Codim<0>::Entity& e,
int i,
int cc,
int& result)
const
143 IdType
id = ids.subId(e,i,cc);
144 typename std::map<IdType,int>::iterator it = index.find(
id);
171 mutable std::map<IdType,int> index;
184 template <
typename G>
192 :
UniversalMapper<G,typename G::Traits::GlobalIdSet>(grid,grid.globalIdSet())
203 template <
typename G>
211 :
UniversalMapper<G,typename G::Traits::LocalIdSet>(grid,grid.localIdSet())
Universal mapper based on global ids.
Definition: universalmapper.hh:185
void clear()
Definition: universalmapper.hh:161
void update()
Recalculates map after mesh adaptation.
Definition: universalmapper.hh:156
GlobalUniversalMapper(const G &grid)
Definition: universalmapper.hh:191
UniversalMapper(const G &grid, const IDS &idset)
Construct mapper from grid and one of its id sets.
Definition: universalmapper.hh:56
int map(const EntityType &e) const
Map entity to array index.
Definition: universalmapper.hh:70
int size() const
Return total number of entities in the entity set managed by the mapper.
Definition: universalmapper.hh:106
Provides classes with basic mappers which are used to attach data to a grid.
Mapper interface.
Definition: mapper.hh:110
LocalUniversalMapper(const G &grid)
Definition: universalmapper.hh:210
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.
Definition: universalmapper.hh:141
Implements a mapper for an arbitrary subset of entities.
Definition: universalmapper.hh:39
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.
Definition: universalmapper.hh:89
Universal mapper based on local ids.
Definition: universalmapper.hh:204
bool contains(const EntityType &e, int &result) const
Returns true if the entity is contained in the index set.
Definition: universalmapper.hh:120