5 #ifndef DUNE_INDEXIDSET_HH
6 #define DUNE_INDEXIDSET_HH
10 #include <dune/common/exceptions.hh>
11 #include <dune/common/forloop.hh>
23 #include <dune/common/bartonnackmanifcheck.hh>
76 template<
class Gr
idImp,
class IndexSetImp,
class IndexTypeImp>
81 typedef typename remove_const< GridImp >::type::Traits Traits;
88 static const int dimension = remove_const< GridImp >::type::dimension;
108 Traits::template Codim<cc>::Entity& e)
const
110 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
111 return asImp().template index<cc>(e);
123 template<
class EntityType>
126 enum { cc = EntityType::codimension };
127 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
128 return asImp().template index<cc>(e);
147 int i,
unsigned int codim )
const
149 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template subIndex< cc >(e,i,codim)));
150 return asImp().template subIndex< cc >(e,i,codim);
171 template<
class Entity >
175 return asImp().template subIndex< cc >( e, i, codim );
193 const std::vector<GeometryType>&
geomTypes (
int codim)
const
195 CHECK_INTERFACE_IMPLEMENTATION((asImp().
geomTypes(codim)));
196 return asImp().geomTypes(codim);
206 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(type)));
207 return asImp().size(type);
218 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(codim)));
219 return asImp().size(codim);
227 template<
class EntityType>
230 CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains(e)));
231 return asImp().contains(e);
244 IndexSetImp& asImp () {
return static_cast<IndexSetImp &
> (*this);}
246 const IndexSetImp& asImp ()
const {
return static_cast<const IndexSetImp &
>(*this);}
249 #undef CHECK_INTERFACE_IMPLEMENTATION
250 #undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
257 template<
class Gr
idImp,
class IndexSetImp>
259 :
public IndexSet< GridImp, IndexSetImp >
262 typedef typename remove_const< GridImp >::type::Traits Traits;
289 IndexType subIndex (
const typename Traits::template Codim< cc >::Entity &e,
int i,
unsigned int codim )
const
294 DUNE_THROW(NotImplemented,
"subIndex for entities is not is not implemented");
315 typedef typename std::vector< GeometryType >::const_iterator Iterator;
316 const Iterator end = geomTs.end();
317 for( Iterator it = geomTs.begin(); it != end; ++it )
401 template<
class Gr
idImp,
class IdSetImp,
class IdTypeImp>
409 template<
class EntityType>
412 enum { cc = EntityType::codimension };
413 return asImp().template id<cc>(e);
422 IdType id (
const typename remove_const<GridImp>::type::
423 Traits::template Codim<cc>::Entity& e)
const
425 return asImp().template id<cc>(e);
431 Traits::template Codim<0>::Entity& e,
int i,
unsigned int codim)
const
433 return asImp().subId(e,i,codim);
446 IdSetImp& asImp () {
return static_cast<IdSetImp &
> (*this);}
448 const IdSetImp& asImp ()
const {
return static_cast<const IdSetImp &
>(*this);}
Know your own codimension.
Definition: common/entity.hh:99
bool contains(const EntityType &e) const
Return true if the given entity is contained in .
Definition: indexidset.hh:228
IndexType index(const EntityType &e) const
Map entity to index. Easier to use than the above because codimension template parameter need not be ...
Definition: indexidset.hh:124
static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:269
IdType id(const typename remove_const< GridImp >::type::Traits::template Codim< cc >::Entity &e) const
Get id of an entity of codim cc. Unhandy because template parameter must be supplied explicitely...
Definition: indexidset.hh:422
IndexType size(int codim) const
Return total number of entities of given codim in the entity set . This is simply a sum over all geom...
Definition: indexidset.hh:216
Base::IndexType IndexType
The type used for the indices.
Definition: indexidset.hh:266
Wrapper class for entities.
Definition: common/entity.hh:56
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Provide default implementation of method if IndexSet.
Definition: indexidset.hh:258
IndexSet()
Definition: indexidset.hh:235
Index Set Interface base class.
Definition: common/grid.hh:359
IdType id(const EntityType &e) const
Get id of an entity. This method is simpler to use than the one below.
Definition: indexidset.hh:410
IndexType size(const int codim) const
Return total number of entities of given codim in the entity set . This is simply a sum over all geom...
Definition: indexidset.hh:311
IdTypeImp IdType
Type used to represent an id.
Definition: indexidset.hh:406
IdType subId(const typename remove_const< GridImp >::type::Traits::template Codim< 0 >::Entity &e, int i, unsigned int codim) const
Get id of subentity i of co-dimension codim of a co-dimension 0 entity.
Definition: indexidset.hh:430
IndexTypeImp IndexType
The type used for the indices.
Definition: indexidset.hh:85
IdSet()
Definition: indexidset.hh:437
IndexType index(const typename remove_const< GridImp >::type::Traits::template Codim< cc >::Entity &e) const
Map entity to index. The result of calling this method with an entity that is not in the index set is...
Definition: indexidset.hh:107
IndexType subIndex(const Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:172
Different resources needed by all grid implementations.
IndexType subIndex(const typename Traits::template Codim< cc >::Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:146
IndexType subIndex(const typename Traits::template Codim< cc >::Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:289
Id Set Interface.
Definition: common/grid.hh:360
static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:88
const std::vector< GeometryType > & geomTypes(int codim) const
Return vector with all geometry types of entities in domain of index map. Return a vector with all ge...
Definition: indexidset.hh:193
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:204