4 #ifndef DUNE_GRID_COMMON_INDEXIDSET_HH
5 #define DUNE_GRID_COMMON_INDEXIDSET_HH
8 #include <dune/common/exceptions.hh>
20 #include <dune/common/bartonnackmanifcheck.hh>
74 template<
class Gr
idImp,
class IndexSetImp,
class IndexTypeImp,
class TypesImp >
79 typedef typename remove_const< GridImp >::type::Traits Traits;
96 static const int dimension = remove_const< GridImp >::type::dimension;
117 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
118 return asImp().template index<cc>(e);
130 template<
class Entity>
134 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
135 return asImp().template index<cc>(e);
154 int i,
unsigned int codim )
const
156 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template subIndex< cc >(e,i,codim)));
157 return asImp().template subIndex< cc >(e,i,codim);
178 template<
class Entity >
182 return asImp().template subIndex< cc >( e, i, codim );
210 CHECK_INTERFACE_IMPLEMENTATION( (asImp().
types( codim )) );
211 return asImp().types( codim );
221 const std::vector<GeometryType>&
geomTypes (
int codim)
const DUNE_DEPRECATED_MSG(
"Use IndexSet::types instead." )
223 CHECK_INTERFACE_IMPLEMENTATION((asImp().
geomTypes(codim)));
224 return asImp().geomTypes(codim);
234 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(type)));
235 return asImp().size(type);
246 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(codim)));
247 return asImp().size(codim);
255 template<
class Entity>
258 CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains(e)));
259 return asImp().contains(e);
272 IndexSetImp& asImp () {
return static_cast<IndexSetImp &
> (*this);}
274 const IndexSetImp& asImp ()
const {
return static_cast<const IndexSetImp &
>(*this);}
277 #undef CHECK_INTERFACE_IMPLEMENTATION
278 #undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
285 template<
class Gr
idImp,
class IndexSetImp>
287 :
public IndexSet< GridImp, IndexSetImp >
290 typedef typename remove_const< GridImp >::type::Traits Traits;
310 Types types (
int codim )
const {
return asImp().geomTypes( codim ); }
321 const std::vector< GeometryType > &geomTs = asImp().geomTypes( codim );
322 typedef typename std::vector< GeometryType >::const_iterator Iterator;
323 const Iterator end = geomTs.end();
324 for( Iterator it = geomTs.begin(); it != end; ++it )
331 IndexSetImp &asImp () {
return static_cast< IndexSetImp &
>( *this );}
332 const IndexSetImp &asImp ()
const {
return static_cast< const IndexSetImp &
>( *this ); }
412 template<
class Gr
idImp,
class IdSetImp,
class IdTypeImp>
420 template<
class Entity>
424 return asImp().template id<cc>(e);
433 IdType id (
const typename remove_const<GridImp>::type::
434 Traits::template Codim<cc>::Entity& e)
const
436 return asImp().template id<cc>(e);
442 Traits::template Codim<0>::Entity& e,
int i,
unsigned int codim)
const
444 return asImp().subId(e,i,codim);
457 IdSetImp& asImp () {
return static_cast<IdSetImp &
> (*this);}
459 const IdSetImp& asImp ()
const {
return static_cast<const IdSetImp &
>(*this);}
464 #endif // DUNE_GRID_COMMON_INDEXIDSET_HH
Index Set Interface base class.
Definition: common/grid.hh:361
IdType id(const Entity &e) const
Get id of an entity. This method is simpler to use than the one below.
Definition: indexidset.hh:421
Base::Types Types
Definition: indexidset.hh:296
IndexType index(const typename 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:115
Different resources needed by all grid implementations.
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:441
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:318
static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:299
Wrapper class for entities.
Definition: common/entity.hh:61
bool contains(const Entity &e) const
Return true if the given entity is contained in .
Definition: indexidset.hh:256
IndexSet()
Definition: indexidset.hh:263
TypesImp Types
iterator range for geometry types in domain
Definition: indexidset.hh:93
IndexTypeImp IndexType
The type used for the indices.
Definition: indexidset.hh:90
IdSet()
Definition: indexidset.hh:448
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:232
IdTypeImp IdType
Type used to represent an id.
Definition: indexidset.hh:417
Traits::template Codim< cc >::Entity Entity
Definition: indexidset.hh:86
IndexType index(const Entity &e) const
Map entity to index. Easier to use than the above because codimension template parameter need not be ...
Definition: indexidset.hh:131
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:433
Export the type of the entity used as parameter in the index(...) method.
Definition: indexidset.hh:84
Provide default implementation of method if IndexSet.
Definition: indexidset.hh:286
Types types(int codim) const
Definition: indexidset.hh:310
static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:96
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:153
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:244
Types types(int codim) const
obtain all geometry types of entities in domain
Definition: indexidset.hh:208
IndexType subIndex(const Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:179
Know your own codimension.
Definition: common/entity.hh:104
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:221
Id Set Interface.
Definition: common/grid.hh:362
Base::IndexType IndexType
The type used for the indices.
Definition: indexidset.hh:294