3 #ifndef DUNE_GRID_COMMON_UNIVERSALMAPPER_HH 4 #define DUNE_GRID_COMMON_UNIVERSALMAPPER_HH 35 template <
typename G,
typename IDS,
typename IndexType=
int>
37 public Mapper<G,UniversalMapper<G,IDS> >
39 typedef typename IDS::IdType IdType;
52 : g(grid), ids(idset), index_()
64 template<
class EntityType>
65 Index
index (
const EntityType& e)
const 67 IdType
id = ids.id(e);
68 typename std::map<IdType,Index>::iterator it = index_.find(
id);
69 if (it!=index_.end())
return it->second;
83 Index
subIndex (
const typename G::Traits::template Codim<0>::Entity& e,
int i,
int cc)
const 85 IdType
id = ids.subId(e,i,cc);
86 typename std::map<IdType,Index>::iterator it = index_.find(
id);
87 if (it!=index_.end())
return it->second;
113 template<
class EntityType>
114 bool contains (
const EntityType& e, Index& result)
const 116 IdType
id = ids.id(e);
117 typename std::map<IdType,Index>::iterator it = index_.find(
id);
118 if (it!=index_.end())
135 bool contains (
const typename G::Traits::template Codim<0>::Entity& e,
int i,
int cc, Index& result)
const 137 IdType
id = ids.subId(e,i,cc);
138 typename std::map<IdType,Index>::iterator it = index_.find(
id);
139 if (it!=index_.end())
165 mutable std::map<IdType,Index> index_;
177 template <
typename G>
185 :
UniversalMapper<G,typename G::Traits::GlobalIdSet>(grid,grid.globalIdSet())
195 template <
typename G>
204 :
UniversalMapper<G,typename G::Traits::LocalIdSet>(grid,grid.localIdSet())
void update()
Recalculates map after mesh adaptation.
Definition: universalmapper.hh:150
IndexType Index
Number type used for indices.
Definition: universalmapper.hh:43
LocalUniversalMapper(const G &grid)
The constructor.
Definition: universalmapper.hh:203
UniversalMapper(const G &grid, const IDS &idset)
Construct mapper from grid and one of its id sets.
Definition: universalmapper.hh:51
Universal mapper based on local ids.
Definition: universalmapper.hh:196
int size() const
Return total number of entities in the entity set managed by the mapper.
Definition: universalmapper.hh:100
GlobalUniversalMapper(const G &grid)
Definition: universalmapper.hh:184
bool contains(const typename G::Traits::template Codim< 0 >::Entity &e, int i, int cc, Index &result) const
Returns true if the entity is contained in the index set.
Definition: universalmapper.hh:135
Include standard header files.
Definition: agrid.hh:59
Universal mapper based on global ids.
Definition: universalmapper.hh:178
Mapper interface.
Definition: mapper.hh:107
Index index(const EntityType &e) const
Map entity to array index.
Definition: universalmapper.hh:65
Provides classes with basic mappers which are used to attach data to a grid.
bool contains(const EntityType &e, Index &result) const
Returns true if the entity is contained in the index set.
Definition: universalmapper.hh:114
Implements a mapper for an arbitrary subset of entities.
Definition: universalmapper.hh:36
void clear()
Definition: universalmapper.hh:155
Index subIndex(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:83