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 DUNE_DEPRECATED_MSG(
"Will be removed after dune-grid-2.4. Use method 'index' instead!")
map (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;
81 template<
class EntityType>
84 IdType
id = ids.id(e);
85 typename std::map<IdType,Index>::iterator it = index_.find(
id);
86 if (it!=index_.end())
return it->second;
101 Index DUNE_DEPRECATED_MSG(
"Will be removed after dune-grid-2.4. Use method 'subIndex' instead!")
map (const typename G::Traits::template Codim<0>::
Entity& e,
int i,
int cc)
const
103 IdType
id = ids.subId(e,i,cc);
104 typename std::map<IdType,Index>::iterator it = index_.find(
id);
105 if (it!=index_.end())
return it->second;
119 Index subIndex (
const typename G::Traits::template Codim<0>::Entity& e,
int i,
int cc)
const
121 IdType
id = ids.subId(e,i,cc);
122 typename std::map<IdType,Index>::iterator it = index_.find(
id);
123 if (it!=index_.end())
return it->second;
149 template<
class EntityType>
152 IdType
id = ids.id(e);
153 typename std::map<IdType,Index>::iterator it = index_.find(
id);
154 if (it!=index_.end())
171 bool contains (
const typename G::Traits::template Codim<0>::Entity& e,
int i,
int cc,
Index& result)
const
173 IdType
id = ids.subId(e,i,cc);
174 typename std::map<IdType,Index>::iterator it = index_.find(
id);
175 if (it!=index_.end())
201 mutable std::map<IdType,Index> index_;
213 template <
typename G>
221 :
UniversalMapper<G,typename G::Traits::GlobalIdSet>(grid,grid.globalIdSet())
231 template <
typename G>
240 :
UniversalMapper<G,typename G::Traits::LocalIdSet>(grid,grid.localIdSet())
int Index
Number type used for indices.
Definition: mapper.hh:112
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:119
Mapper interface.
Definition: mapper.hh:108
GlobalUniversalMapper(const G &grid)
Definition: universalmapper.hh:220
Universal mapper based on global ids.
Definition: universalmapper.hh:214
Implements a mapper for an arbitrary subset of entities.
Definition: universalmapper.hh:36
Wrapper class for entities.
Definition: common/entity.hh:61
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:171
bool contains(const EntityType &e, Index &result) const
Returns true if the entity is contained in the index set.
Definition: universalmapper.hh:150
IndexType Index
Number type used for indices.
Definition: universalmapper.hh:43
UniversalMapper(const G &grid, const IDS &idset)
Construct mapper from grid and one of its id sets.
Definition: universalmapper.hh:51
LocalUniversalMapper(const G &grid)
The constructor.
Definition: universalmapper.hh:239
void update()
Recalculates map after mesh adaptation.
Definition: universalmapper.hh:186
Index map(const EntityType &e) const
Map entity to array index.
Definition: universalmapper.hh:65
Index index(const EntityType &e) const
Map entity to array index.
Definition: universalmapper.hh:82
Universal mapper based on local ids.
Definition: universalmapper.hh:232
Provides classes with basic mappers which are used to attach data to a grid.
void clear()
Definition: universalmapper.hh:191
int size() const
Return total number of entities in the entity set managed by the mapper.
Definition: universalmapper.hh:136