4 #ifndef DUNE_MCMGMAPPER_HH
5 #define DUNE_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> >
109 #ifndef __INTEL_COMPILER
125 : gridView(gridView_),
126 is(gridView.indexSet()),
127 offset(GlobalGeometryTypeIndex::
size(GV::dimension)),
138 : gridView(gridView_),
139 is(gridView.indexSet()),
140 offset(GlobalGeometryTypeIndex::
size(GV::dimension))
152 template<
class EntityType>
153 int map (
const EntityType& e)
const
156 return is.index(e) + offset[GlobalGeometryTypeIndex::index(gt)];
166 int map (
const typename GV::template Codim<0>::Entity& e,
int i,
unsigned int codim)
const
168 GeometryType gt=ReferenceElements<double,GV::dimension>::general(e.type()).type(i,codim);
169 assert(GlobalGeometryTypeIndex::index(gt) < n);
170 return is.subIndex(e, i, codim) + offset[GlobalGeometryTypeIndex::index(gt)];
192 template<
class EntityType>
193 bool contains (
const EntityType& e,
int& result)
const
195 if(!is.contains(e) || !layout.contains(e.type()))
212 bool contains (
const typename GV::template Codim<0>::Entity& e,
int i,
int cc,
int& result)
const
214 result = this->
map(e,i,cc);
224 for (
unsigned int codim = 0; codim <= GV::dimension; ++codim)
227 typedef std::vector<GeometryType> GTV;
228 const GTV >v = is.geomTypes(codim);
229 for (
typename GTV::const_iterator it = gtv.begin(); it != gtv.end(); ++it)
232 if (layout.contains(*it))
234 offset[GlobalGeometryTypeIndex::index(*it)] = n;
246 const typename GV::IndexSet& is;
248 std::vector<int> offset;
249 mutable Layout<GV::dimension> layout;
267 template <
typename G,
template<
int>
class Layout>
278 :
Base(grid.leafView())
290 :
Base(grid.leafView(),layout)
306 template <
typename G,
template<
int>
class Layout>
317 :
Base(grid.levelGridView(level))
330 :
Base(grid.levelGridView(level),layout)
LeafMultipleCodimMultipleGeomTypeMapper(const G &grid)
The constructor.
Definition: mcmgmapper.hh:277
Layout template for vertices.
Definition: mcmgmapper.hh:57
LeafMultipleCodimMultipleGeomTypeMapper(const G &grid, const Layout< G::dimension > layout)
The constructor.
Definition: mcmgmapper.hh:289
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:102
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
LevelMultipleCodimMultipleGeomTypeMapper(const G &grid, int level, const Layout< G::dimension > layout)
The constructor.
Definition: mcmgmapper.hh:329
int size() const
Return total number of entities in the entity set managed by the mapper.
Definition: mcmgmapper.hh:181
MultipleCodimMultipleGeomTypeMapper(const GV &gridView_, const Layout< GV::dimension > layout)
Construct mapper from grid and one of its index sets.
Definition: mcmgmapper.hh:124
Layout template for elements.
Definition: mcmgmapper.hh:43
Provides classes with basic mappers which are used to attach data to a grid.
Mapper interface.
Definition: mapper.hh:110
MultipleCodimMultipleGeomTypeMapper(const GV &gridView_)
Construct mapper from grid and one of its index sets.
Definition: mcmgmapper.hh:137
Multiple codim and multiple geometry type mapper for leaf entities.
Definition: mcmgmapper.hh:268
bool contains(const EntityType &e, int &result) const
Returns true if the entity is contained in the index set.
Definition: mcmgmapper.hh:193
bool contains(Dune::GeometryType gt)
Definition: mcmgmapper.hh:60
LevelMultipleCodimMultipleGeomTypeMapper(const G &grid, int level)
The constructor.
Definition: mcmgmapper.hh:316
int map(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:166
Multiple codim and multiple geometry type mapper for entities of one level.
Definition: mcmgmapper.hh:307
int map(const EntityType &e) const
Map entity to array index.
Definition: mcmgmapper.hh:153
bool contains(const typename GV::template Codim< 0 >::Entity &e, int i, int cc, int &result) const
Returns true if the entity is contained in the index set.
Definition: mcmgmapper.hh:212
void update()
Recalculates map after mesh adaptation.
Definition: mcmgmapper.hh:220
bool contains(Dune::GeometryType gt)
Definition: mcmgmapper.hh:46