4 #ifndef DUNE_GRID_COMMON_MCMGMAPPER_HH 5 #define DUNE_GRID_COMMON_MCMGMAPPER_HH 9 #include <dune/geometry/referenceelements.hh> 10 #include <dune/geometry/type.hh> 11 #include <dune/geometry/typeindex.hh> 100 template <
typename GV,
template<
int>
class Layout>
102 public Mapper<typename GV::Grid,MultipleCodimMultipleGeomTypeMapper<GV,Layout>, typename GV::IndexSet::IndexType >
107 typedef typename GV::IndexSet::IndexType
Index;
118 : gridView(gridView_),
119 is(gridView.indexSet()),
120 offset(GlobalGeometryTypeIndex::size(GV::dimension)),
131 : gridView(gridView_),
132 is(gridView.indexSet()),
133 offset(GlobalGeometryTypeIndex::size(GV::dimension))
145 template<
class EntityType>
146 Index
index (
const EntityType& e)
const 149 assert(layout.contains(gt));
150 return is.index(e) + offset[GlobalGeometryTypeIndex::index(gt)];
160 Index
subIndex (
const typename GV::template Codim<0>::Entity& e,
int i,
unsigned int codim)
const 164 GeometryType( GeometryType::none, GV::dimension - codim ) :
165 ReferenceElements<double,GV::dimension>::general(eType).type(i,codim) ;
167 assert(layout.contains(gt));
168 return is.subIndex(e, i, codim) + offset[GlobalGeometryTypeIndex::index(gt)];
190 template<
class EntityType>
191 bool contains (
const EntityType& e, Index& result)
const 193 if(!is.contains(e) || !layout.contains(e.type()))
210 bool contains (
const typename GV::template Codim<0>::Entity& e,
int i,
int cc, Index& result)
const 214 GeometryType( GeometryType::none, GV::dimension - cc ) :
215 ReferenceElements<double,GV::dimension>::general(eType).type(i,cc) ;
217 if (not layout.contains(gt))
219 result = is.subIndex(e, i, cc) + offset[GlobalGeometryTypeIndex::index(gt)];
229 for (
unsigned int codim = 0; codim <= GV::dimension; ++codim)
232 typedef typename GV::IndexSet::Types GTV;
233 GTV gtv = is.types(codim);
234 for (
typename GTV::const_iterator it = gtv.begin(); it != gtv.end(); ++it)
237 if (layout.contains(*it))
239 offset[GlobalGeometryTypeIndex::index(*it)] = n;
251 const typename GV::IndexSet& is;
253 std::vector<int> offset;
254 mutable Layout<GV::dimension> layout;
272 template <
typename G,
template<
int>
class Layout>
311 template <
typename G,
template<
int>
class Layout>
LeafMultipleCodimMultipleGeomTypeMapper(const G &grid, const Layout< G::dimension > layout)
The constructor.
Definition: mcmgmapper.hh:294
int size() const
Return total number of entities in the entity set managed by the mapper.
Definition: mcmgmapper.hh:179
Grid< dim, dimworld, ct, GridFamily >::LevelGridView levelGridView(const Grid< dim, dimworld, ct, GridFamily > &grid, int level)
level grid view for the given grid and level.
Definition: common/grid.hh:857
LevelMultipleCodimMultipleGeomTypeMapper(const G &grid, int level)
The constructor.
Definition: mcmgmapper.hh:321
GV::IndexSet::IndexType Index
Number type used for indices.
Definition: mcmgmapper.hh:107
bool contains(const EntityType &e, Index &result) const
Returns true if the entity is contained in the index set.
Definition: mcmgmapper.hh:191
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:334
Index index(const EntityType &e) const
Map entity to array index.
Definition: mcmgmapper.hh:146
Layout template for elements.
Definition: mcmgmapper.hh:42
MultipleCodimMultipleGeomTypeMapper(const GV &gridView_)
Construct mapper from grid and one of its index sets.
Definition: mcmgmapper.hh:130
Include standard header files.
Definition: agrid.hh:59
Grid< dim, dimworld, ct, GridFamily >::LeafGridView leafGridView(const Grid< dim, dimworld, ct, GridFamily > &grid)
leaf grid view for the given grid
Definition: common/grid.hh:874
Implementation class for a multiple codim and multiple geometry type mapper.
Definition: mcmgmapper.hh:101
Mapper interface.
Definition: mapper.hh:107
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:210
bool contains(Dune::GeometryType gt)
Definition: mcmgmapper.hh:45
Provides classes with basic mappers which are used to attach data to a grid.
Multiple codim and multiple geometry type mapper for entities of one level.
Definition: mcmgmapper.hh:312
bool contains(Dune::GeometryType gt)
Definition: mcmgmapper.hh:59
Layout template for vertices.
Definition: mcmgmapper.hh:56
void update()
Recalculates map after mesh adaptation.
Definition: mcmgmapper.hh:225
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:160
LeafMultipleCodimMultipleGeomTypeMapper(const G &grid)
The constructor.
Definition: mcmgmapper.hh:282
MultipleCodimMultipleGeomTypeMapper(const GV &gridView_, const Layout< GV::dimension > layout)
Construct mapper from grid and one of its index sets.
Definition: mcmgmapper.hh:117
Multiple codim and multiple geometry type mapper for leaf entities.
Definition: mcmgmapper.hh:273