1#ifndef DUNE_SPGRID_HINDEXSET_HH
2#define DUNE_SPGRID_HINDEXSET_HH
16 template<
class Gr
id >
18 :
public IndexSet< Grid, SPHierarchyIndexSet< Grid >, unsigned int, std::array< GeometryType, 1 > >
21 typedef IndexSet< Grid, This, unsigned int, std::array< GeometryType, 1 > > Base;
23 typedef typename std::remove_const< Grid >::type::Traits Traits;
27 typedef typename Base::Types
Types;
29 static const int dimension = Traits::ReferenceCube::dimension;
43 typedef std::array< IndexType, dimension+1 > CodimIndexArray;
49 for(
int codim = 0; codim <=
dimension; ++codim )
55 for(
int codim = 0; codim <=
dimension; ++codim )
58 const int maxLevel =
grid().maxLevel();
59 levelIndexSets_.resize( maxLevel+1 );
60 offsets_.resize( maxLevel+1 );
61 for(
int level = 0; level <= maxLevel; ++level )
65 for(
int codim = 0; codim <=
dimension; ++codim )
67 offsets_[ level ][ codim ] = size_[ codim ];
73 template<
class Entity >
76 return index< Entity::codimension >( entity );
82 const int level = entity.level();
83 const IndexType offset = offsets_[ level ][ codim ];
91 DUNE_THROW( NotImplemented,
"SPHierarchyIndexSet does not implement the old subIndex method." );
94 template<
class Entity >
96 const int i,
const unsigned int codim )
const
98 return subIndex< Entity::codimension >( entity, i, codim );
103 const int i,
const unsigned int codim )
const
105 const int level = entity.level();
106 const IndexType offset = offsets_[ level ][ codim ];
107 return offset +
levelIndexSet( level ).subIndex( entity, i, codim );
112 const std::vector< GeometryType > &
geomTypes (
const int codim )
const
124 assert( (codim >= 0) && (codim <=
dimension) );
125 return size_[ codim ];
128 template<
class Entity >
131 return contains< Entity::codimension >( entity );
134 template<
int codim >
147 assert( (level >= 0) && (level <= (
int)levelIndexSets_.size()) );
148 assert( (
int)levelIndexSets_.size() ==
grid().maxLevel()+1 );
149 return *levelIndexSets_[ level ];
154 std::vector< const LevelIndexSet * > levelIndexSets_;
155 std::vector< CodimIndexArray > offsets_;
156 CodimIndexArray size_;
Definition: iostream.hh:7
Definition: entityinfo.hh:24
Definition: gridlevel.hh:35
Definition: indexset.hh:19
IndexType size(const GeometryType &type) const
Definition: indexset.hh:239
Definition: hindexset.hh:19
IndexType size(const GeometryType &type) const
Definition: hindexset.hh:117
IndexType subIndex(const typename Codim< cd >::Entity &entity, const int i, const unsigned int codim) const
Definition: hindexset.hh:102
bool contains(const typename Codim< codim >::Entity &entity) const
Definition: hindexset.hh:135
SPHierarchyIndexSet(const Grid &grid)
Definition: hindexset.hh:46
Base::IndexType IndexType
Definition: hindexset.hh:26
IndexType index(const typename Codim< codim >::Entity &entity) const
Definition: hindexset.hh:80
IndexType index(const Entity &entity) const
Definition: hindexset.hh:74
IndexType subIndex(const typename Codim< 0 >::Entity &entity, const int i) const
Definition: hindexset.hh:89
void update()
Definition: hindexset.hh:53
SPGridLevel< typename std::remove_const< Grid >::type > GridLevel
Definition: hindexset.hh:38
const Grid & grid() const
Definition: hindexset.hh:140
IndexType subIndex(const Entity &entity, const int i, const unsigned int codim) const
Definition: hindexset.hh:95
IndexType size(const int codim) const
Definition: hindexset.hh:122
const LevelIndexSet & levelIndexSet(const int level) const
Definition: hindexset.hh:145
static const int dimension
Definition: hindexset.hh:29
Types types(int codim) const
Definition: hindexset.hh:110
bool contains(const Entity &entity) const
Definition: hindexset.hh:129
const std::vector< GeometryType > & geomTypes(const int codim) const
Definition: hindexset.hh:112
Base::Types Types
Definition: hindexset.hh:27
Definition: hindexset.hh:33
Traits::template Codim< codim >::Entity Entity
Definition: hindexset.hh:35
__SPGrid::EntityInfo< Grid, codim > EntityInfo
Definition: hindexset.hh:34