3#ifndef DUNE_GRID_COMMON_SCSGMAPPER_HH
4#define DUNE_GRID_COMMON_SCSGMAPPER_HH
35 template <
typename GV,
int c>
37 public Mapper<typename GV::Grid,SingleCodimSingleGeomTypeMapper<GV,c>, typename GV::IndexSet::IndexType >
42 typedef typename GV::IndexSet::IndexType
Index;
48 using size_type =
decltype(std::declval<typename GV::IndexSet>().size(0));
56 , indexSet_(&gridView_.indexSet())
59 if (indexSet_->types(c).size() != 1)
60 DUNE_THROW(
GridError,
"mapper treats only a single codim and a single geometry type");
68 template<
class EntityType>
71 static_assert(EntityType::codimension == c,
"Entity of wrong codim passed to SingleCodimSingleGeomTypeMapper");
72 return indexSet_->index(e);
83 int i,
unsigned int codim)
const
86 DUNE_THROW(
GridError,
"Id of wrong codim requested from SingleCodimSingleGeomTypeMapper");
87 return indexSet_->subIndex(e,i,codim);
100 return indexSet_->size(c);
109 template<
class EntityType>
124 bool contains (
const typename GV::template Codim<0>::Entity& e,
int i,
int cc,
Index& result)
const
137 gridView_ = gridView;
138 indexSet_ = &gridView_.indexSet();
148 gridView_ = std::move(gridView);
149 indexSet_ = &gridView_.indexSet();
154 [[deprecated(
"Use update(gridView) instead! Will be removed after release 2.8.")]]
161 const typename GV::IndexSet* indexSet_;
182 template <
typename G,
int c>
183 class [[deprecated(
"Use SingleCodimSingleGeomTypeMapper instead! Will be removed after release 2.8.")]]
202 Base::update(gridPtr_->leafGridView());
220 template <
typename G,
int c>
221 class [[deprecated(
"Use SingleCodimSingleGeomTypeMapper instead! Will be removed after release 2.8.")]]
242 Base::update(gridPtr_->levelGridView(level_));
Provides classes with basic mappers which are used to attach data to a grid.
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:808
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:791
Include standard header files.
Definition: agrid.hh:58
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:18
Mapper interface.
Definition: mapper.hh:108
Implementation class for a single codim and single geometry type mapper.
Definition: scsgmapper.hh:38
bool contains(const EntityType &e, Index &result) const
Returns true if the entity is contained in the index set.
Definition: scsgmapper.hh:110
GV::IndexSet::IndexType Index
Number type used for indices.
Definition: scsgmapper.hh:42
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: scsgmapper.hh:124
decltype(std::declval< typename GV::IndexSet >().size(0)) size_type
Number type used for the overall size (the return value of the 'size' method)
Definition: scsgmapper.hh:48
Index index(const EntityType &e) const
Map entity to array index.
Definition: scsgmapper.hh:69
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: scsgmapper.hh:82
SingleCodimSingleGeomTypeMapper(const GV &gridView)
Construct mapper from grid and one of its index sets.
Definition: scsgmapper.hh:54
void update(GV &&gridView)
Recalculates indices after grid adaptation.
Definition: scsgmapper.hh:146
size_type size() const
Return total number of entities in the entity set managed by the mapper.
Definition: scsgmapper.hh:98
void update()
Recalculates indices after grid adaptation.
Definition: scsgmapper.hh:155
void update(const GV &gridView)
Recalculates indices after grid adaptation.
Definition: scsgmapper.hh:135
Single codim and single geometry type mapper for leaf entities.
Definition: scsgmapper.hh:184
LeafSingleCodimSingleGeomTypeMapper(const G &grid)
The constructor.
Definition: scsgmapper.hh:190
void update()
Recalculates indices after grid adaptation.
Definition: scsgmapper.hh:200
Single codim and single geometry type mapper for entities of one level.
Definition: scsgmapper.hh:222
LevelSingleCodimSingleGeomTypeMapper(const G &grid, int level)
Definition: scsgmapper.hh:229
void update()
Recalculates indices after grid adaptation.
Definition: scsgmapper.hh:240
Different resources needed by all grid implementations.