5#ifndef DUNE_IDENTITYGRID_INDEXSETS_HH
6#define DUNE_IDENTITYGRID_INDEXSETS_HH
19 template<
class Gr
idImp>
22 IdentityGridLevelIndexSet<GridImp>,
23 typename std::remove_const<GridImp>::type::HostGridType::LevelGridView::IndexSet::IndexType,
24 typename std::remove_const<GridImp>::type::HostGridType::LevelGridView::IndexSet::Types
29 typedef typename std::remove_const<GridImp>::type::HostGridType
HostGrid;
30 typedef typename HostGrid::LevelGridView::IndexSet::Types
Types;
32 constexpr static int dim = GridImp::dimension;
36 int index (
const typename GridImp::Traits::template Codim<codim>::Entity& e)
const
38 return grid_->hostgrid_->levelIndexSet(
level_).template index<codim>(
grid_->template getHostEntity<codim>(e));
44 int subIndex (
const typename GridImp::Traits::template Codim<cc>::Entity& e,
int i,
int codim)
const
46 return grid_->hostgrid_->levelIndexSet(
level_).subIndex(
grid_->template getHostEntity<cc>(e), i, codim);
51 std::size_t
size (
int codim)
const {
52 return grid_->hostgrid_->levelIndexSet(
level_).size(codim);
59 return grid_->hostgrid_->levelIndexSet(
level_).size(type);
64 const std::vector<GeometryType>&
geomTypes (
int codim)
const
66 return grid_->hostgrid_->levelIndexSet(
level_).geomTypes(codim);
72 return grid_->hostgrid_->levelIndexSet(
level_).types(codim);
76 template<
class EntityType>
79 return grid_->hostgrid_->levelIndexSet(
level_).contains(
grid_->template getHostEntity<EntityType::codimension>(e));
83 void update(
const GridImp& grid,
int level)
96 template<
class Gr
idImp>
99 IdentityGridLeafIndexSet<GridImp>,
100 typename std::remove_const<GridImp>::type::HostGridType::LeafGridView::IndexSet::IndexType,
101 typename std::remove_const<GridImp>::type::HostGridType::LeafGridView::IndexSet::Types
104 typedef typename std::remove_const<GridImp>::type::HostGridType HostGrid;
108 typedef typename HostGrid::LevelGridView::IndexSet::Types
Types;
114 constexpr static int dim = std::remove_const<GridImp>::type::dimension;
129 int index (
const typename std::remove_const<GridImp>::type::template Codim<codim>::Entity& e)
const
131 return grid_->hostgrid_->leafIndexSet().template index<codim>(
grid_->template getHostEntity<codim>(e));
141 int subIndex (
const typename std::remove_const<GridImp>::type::Traits::template Codim<cc>::Entity& e,
int i,
int codim)
const
143 return grid_->hostgrid_->leafIndexSet().subIndex(
grid_->template getHostEntity<cc>(e),i, codim);
150 return grid_->hostgrid_->leafIndexSet().size(type);
155 std::size_t
size (
int codim)
const
157 return grid_->hostgrid_->leafIndexSet().size(codim);
162 const std::vector<GeometryType>&
geomTypes (
int codim)
const
164 return grid_->hostgrid_->leafIndexSet().geomTypes(codim);
170 return grid_->hostgrid_->leafIndexSet().types(codim);
174 template<
class EntityType>
177 return grid_->hostgrid_->leafIndexSet().contains(
grid_->template getHostEntity<EntityType::codimension>(e));
195 template <
class Gr
idImp>
197 public IdSet<GridImp,IdentityGridGlobalIdSet<GridImp>,
198 typename std::remove_const<GridImp>::type::HostGridType::Traits::GlobalIdSet::IdType>
201 typedef typename std::remove_const<GridImp>::type::HostGridType HostGrid;
209 typedef typename HostGrid::Traits::GlobalIdSet::IdType
IdType;
218 IdType id (
const typename std::remove_const<GridImp>::type::Traits::template Codim<cd>::Entity& e)
const
221 return grid_->hostgrid_->globalIdSet().id(e.impl().hostEntity_);
230 IdType subId (
const typename std::remove_const<GridImp>::type::Traits::template Codim<0>::Entity& e,
int i,
int codim)
const
233 return grid_->hostgrid_->globalIdSet().subId(e.impl().hostEntity_,i, codim);
247 template<
class Gr
idImp>
249 public IdSet<GridImp,IdentityGridLocalIdSet<GridImp>,
250 typename std::remove_const<GridImp>::type::HostGridType::Traits::LocalIdSet::IdType>
254 typedef typename std::remove_const<GridImp>::type::HostGridType HostGrid;
259 typedef typename HostGrid::Traits::LocalIdSet::IdType
IdType;
272 IdType id (
const typename std::remove_const<GridImp>::type::Traits::template Codim<cd>::Entity& e)
const
275 return grid_->hostgrid_->localIdSet().id(e.impl().hostEntity_);
284 IdType subId (
const typename std::remove_const<GridImp>::type::template Codim<0>::Entity& e,
int i,
int codim)
const
287 return grid_->hostgrid_->localIdSet().subId(e.impl().hostEntity_,i,codim);
Provides base classes for index and id sets.
Include standard header files.
Definition: agrid.hh:60
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Index Set Interface base class.
Definition: indexidset.hh:78
Id Set Interface.
Definition: indexidset.hh:452
Definition: identitygridindexsets.hh:26
bool contains(const EntityType &e) const
Return true if the given entity is contained in the index set.
Definition: identitygridindexsets.hh:77
int index(const typename GridImp::Traits::template Codim< codim >::Entity &e) const
get index of an entity
Definition: identitygridindexsets.hh:36
GridImp * grid_
Definition: identitygridindexsets.hh:90
std::remove_const< GridImp >::type::HostGridType HostGrid
Definition: identitygridindexsets.hh:29
const std::vector< GeometryType > & geomTypes(int codim) const
Deliver all geometry types used in this grid.
Definition: identitygridindexsets.hh:64
Types types(int codim) const
Deliver all geometry types used in this grid.
Definition: identitygridindexsets.hh:70
std::size_t size(GeometryType type) const
get number of entities of given codim, type and on this level
Definition: identitygridindexsets.hh:57
static constexpr int dim
Definition: identitygridindexsets.hh:32
HostGrid::LevelGridView::IndexSet::Types Types
Definition: identitygridindexsets.hh:30
std::size_t size(int codim) const
get number of entities of given codim, type and on this level
Definition: identitygridindexsets.hh:51
int subIndex(const typename GridImp::Traits::template Codim< cc >::Entity &e, int i, int codim) const
get index of subEntity of a codim 0 entity
Definition: identitygridindexsets.hh:44
int level_
Definition: identitygridindexsets.hh:92
void update(const GridImp &grid, int level)
Set up the index set.
Definition: identitygridindexsets.hh:83
Definition: identitygridindexsets.hh:103
IdentityGridLeafIndexSet(const GridImp &grid)
constructor stores reference to a grid and level
Definition: identitygridindexsets.hh:118
static constexpr int dim
Definition: identitygridindexsets.hh:114
std::size_t size(int codim) const
get number of entities of given codim
Definition: identitygridindexsets.hh:155
bool contains(const EntityType &e) const
Return true if the given entity is contained in the index set.
Definition: identitygridindexsets.hh:175
std::size_t size(GeometryType type) const
get number of entities of given type
Definition: identitygridindexsets.hh:148
HostGrid::LevelGridView::IndexSet::Types Types
Definition: identitygridindexsets.hh:108
int index(const typename std::remove_const< GridImp >::type::template Codim< codim >::Entity &e) const
get index of an entity
Definition: identitygridindexsets.hh:129
int subIndex(const typename std::remove_const< GridImp >::type::Traits::template Codim< cc >::Entity &e, int i, int codim) const
get index of subEntity of a codim 0 entity
Definition: identitygridindexsets.hh:141
Types types(int codim) const
Deliver all geometry types used in this grid.
Definition: identitygridindexsets.hh:168
GridImp * grid_
Definition: identitygridindexsets.hh:189
void update(const GridImp &grid)
Definition: identitygridindexsets.hh:183
const std::vector< GeometryType > & geomTypes(int codim) const
Deliver all geometry types used in this grid.
Definition: identitygridindexsets.hh:162
Definition: identitygridindexsets.hh:199
IdentityGridGlobalIdSet(const GridImp &g)
constructor stores reference to a grid
Definition: identitygridindexsets.hh:206
void update()
Definition: identitygridindexsets.hh:238
const GridImp * grid_
Definition: identitygridindexsets.hh:241
HostGrid::Traits::GlobalIdSet::IdType IdType
define the type used for persistent indices
Definition: identitygridindexsets.hh:209
IdType subId(const typename std::remove_const< GridImp >::type::Traits::template Codim< 0 >::Entity &e, int i, int codim) const
get id of subEntity
Definition: identitygridindexsets.hh:230
IdType id(const typename std::remove_const< GridImp >::type::Traits::template Codim< cd >::Entity &e) const
get id of an entity
Definition: identitygridindexsets.hh:218
Definition: identitygridindexsets.hh:251
IdType subId(const typename std::remove_const< GridImp >::type::template Codim< 0 >::Entity &e, int i, int codim) const
get id of subEntity
Definition: identitygridindexsets.hh:284
IdentityGridLocalIdSet(const GridImp &g)
constructor stores reference to a grid
Definition: identitygridindexsets.hh:263
const GridImp * grid_
Definition: identitygridindexsets.hh:295
void update()
Definition: identitygridindexsets.hh:292
IdType id(const typename std::remove_const< GridImp >::type::Traits::template Codim< cd >::Entity &e) const
get id of an entity
Definition: identitygridindexsets.hh:272
HostGrid::Traits::LocalIdSet::IdType IdType
define the type used for persistent local ids
Definition: identitygridindexsets.hh:259