4 #ifndef DUNE_GRID_COMMON_MCMGMAPPER_HH
5 #define DUNE_GRID_COMMON_MCMGMAPPER_HH
10 #include <dune/geometry/referenceelements.hh>
11 #include <dune/geometry/type.hh>
12 #include <dune/geometry/typeindex.hh>
101 template <
typename GV,
template<
int>
class Layout>
103 public Mapper<typename GV::Grid,MultipleCodimMultipleGeomTypeMapper<GV,Layout>, typename GV::IndexSet::IndexType >
108 typedef typename GV::IndexSet::IndexType
Index;
119 : gridView(gridView_),
120 is(gridView.indexSet()),
121 offset(GlobalGeometryTypeIndex::
size(GV::dimension)),
132 : gridView(gridView_),
133 is(gridView.indexSet()),
134 offset(GlobalGeometryTypeIndex::
size(GV::dimension))
146 template<
class EntityType>
147 Index DUNE_DEPRECATED_MSG(
"Will be removed after dune-grid-2.4. Use method 'index' instead!")
map (const EntityType& e)
const
150 assert(layout.contains(gt));
151 return is.index(e) + offset[GlobalGeometryTypeIndex::index(gt)];
161 template<
class EntityType>
165 assert(layout.contains(gt));
166 return is.index(e) + offset[GlobalGeometryTypeIndex::index(gt)];
176 Index DUNE_DEPRECATED_MSG(
"Will be removed after dune-grid-2.4. Use method 'subIndex' instead!")
map (const typename GV::template Codim<0>::
Entity& e,
int i,
unsigned int codim)
const
178 GeometryType gt=ReferenceElements<double,GV::dimension>::general(e.type()).type(i,codim);
179 assert(layout.contains(gt));
180 return is.subIndex(e, i, codim) + offset[GlobalGeometryTypeIndex::index(gt)];
190 Index subIndex (
const typename GV::template Codim<0>::Entity& e,
int i,
unsigned int codim)
const
192 GeometryType gt=ReferenceElements<double,GV::dimension>::general(e.type()).type(i,codim);
193 assert(layout.contains(gt));
194 return is.subIndex(e, i, codim) + offset[GlobalGeometryTypeIndex::index(gt)];
216 template<
class EntityType>
219 if(!is.contains(e) || !layout.contains(e.type()))
236 bool contains (
const typename GV::template Codim<0>::Entity& e,
int i,
int cc,
Index& result)
const
238 GeometryType gt=ReferenceElements<double,GV::dimension>::general(e.type()).type(i,cc);
239 if (not layout.contains(gt))
241 result = is.subIndex(e, i, cc) + offset[GlobalGeometryTypeIndex::index(gt)];
251 for (
unsigned int codim = 0; codim <= GV::dimension; ++codim)
254 typedef typename GV::IndexSet::Types GTV;
255 GTV gtv = is.types(codim);
256 for (
typename GTV::const_iterator it = gtv.begin(); it != gtv.end(); ++it)
259 if (layout.contains(*it))
261 offset[GlobalGeometryTypeIndex::index(*it)] = n;
273 const typename GV::IndexSet& is;
275 std::vector<int> offset;
276 mutable Layout<GV::dimension> layout;
294 template <
typename G,
template<
int>
class Layout>
305 :
Base(grid.leafGridView())
317 :
Base(grid.leafGridView(),layout)
333 template <
typename G,
template<
int>
class Layout>
344 :
Base(grid.levelGridView(level))
357 :
Base(grid.levelGridView(level),layout)
G::LevelGridView::IndexSet::IndexType Index
Number type used for indices.
Definition: mapper.hh:112
Mapper interface.
Definition: mapper.hh:108
LevelMultipleCodimMultipleGeomTypeMapper(const G &grid, int level, const Layout< G::dimension > layout)
The constructor.
Definition: mcmgmapper.hh:356
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:102
Multiple codim and multiple geometry type mapper for leaf entities.
Definition: mcmgmapper.hh:295
Index map(const EntityType &e) const
Map entity to array index.
Definition: mcmgmapper.hh:147
Wrapper class for entities.
Definition: common/entity.hh:61
LeafMultipleCodimMultipleGeomTypeMapper(const G &grid, const Layout< G::dimension > layout)
The constructor.
Definition: mcmgmapper.hh:316
bool contains(const typename GV::template Codim< 0 >::Entity &e, int i, int cc, Index &result) const
Returns true if the entity is contained in the index set.
Definition: mcmgmapper.hh:236
Index subIndex(const typename GV::template Codim< 0 >::Entity &e, int i, unsigned int codim) const
Map subentity of codim 0 entity to array index.
Definition: mcmgmapper.hh:190
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
MultipleCodimMultipleGeomTypeMapper(const GV &gridView_)
Construct mapper from grid and one of its index sets.
Definition: mcmgmapper.hh:131
LeafMultipleCodimMultipleGeomTypeMapper(const G &grid)
The constructor.
Definition: mcmgmapper.hh:304
int size() const
Return total number of entities in the entity set managed by the mapper.
Definition: mcmgmapper.hh:205
Layout template for vertices.
Definition: mcmgmapper.hh:57
MultipleCodimMultipleGeomTypeMapper(const GV &gridView_, const Layout< GV::dimension > layout)
Construct mapper from grid and one of its index sets.
Definition: mcmgmapper.hh:118
bool contains(const EntityType &e, Index &result) const
Returns true if the entity is contained in the index set.
Definition: mcmgmapper.hh:217
void update()
Recalculates map after mesh adaptation.
Definition: mcmgmapper.hh:247
GV::IndexSet::IndexType Index
Number type used for indices.
Definition: mcmgmapper.hh:108
Layout template for elements.
Definition: mcmgmapper.hh:43
Multiple codim and multiple geometry type mapper for entities of one level.
Definition: mcmgmapper.hh:334
LevelMultipleCodimMultipleGeomTypeMapper(const G &grid, int level)
The constructor.
Definition: mcmgmapper.hh:343
bool contains(Dune::GeometryType gt)
Definition: mcmgmapper.hh:60
Provides classes with basic mappers which are used to attach data to a grid.
bool contains(Dune::GeometryType gt)
Definition: mcmgmapper.hh:46
Index index(const EntityType &e) const
Map entity to array index.
Definition: mcmgmapper.hh:162