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 std::remove_const< GridImp >::type::Traits Traits;
96 static const int dimension = std::remove_const< GridImp >::type::dimension;
113 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
114 return asImp().template index<cc>(e);
126 template<
class Entity>
130 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
131 return asImp().template index<cc>(e);
152 int i,
unsigned int codim )
const 154 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template subIndex< cc >(e,i,codim)));
155 return asImp().template subIndex< cc >(e,i,codim);
179 template<
class Entity >
183 return asImp().template subIndex< cc >( e, i, codim );
211 CHECK_INTERFACE_IMPLEMENTATION( (asImp().
types( codim )) );
212 return asImp().types( codim );
222 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(type)));
223 return asImp().size(type);
232 IndexType
size (
int codim)
const 234 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(codim)));
235 return asImp().size(codim);
243 template<
class Entity>
246 CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains(e)));
247 return asImp().contains(e);
260 IndexSetImp& asImp () {
return static_cast<IndexSetImp &
> (*this);}
262 const IndexSetImp& asImp ()
const {
return static_cast<const IndexSetImp &
>(*this);}
265 #undef CHECK_INTERFACE_IMPLEMENTATION 266 #undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION 273 template<
class Gr
idImp,
class IndexSetImp>
275 :
public IndexSet< GridImp, IndexSetImp >
278 typedef typename std::remove_const< GridImp >::type::Traits Traits;
290 using Base::subIndex;
298 Types
types (
int codim )
const {
return asImp().geomTypes( codim ); }
306 IndexType
size (
const int codim )
const 309 const std::vector< GeometryType > &geomTs = asImp().geomTypes( codim );
310 typedef typename std::vector< GeometryType >::const_iterator Iterator;
311 const Iterator end = geomTs.end();
312 for( Iterator it = geomTs.begin(); it != end; ++it )
313 s += Base::size( *it );
319 IndexSetImp &asImp () {
return static_cast< IndexSetImp &
>( *this );}
320 const IndexSetImp &asImp ()
const {
return static_cast< const IndexSetImp &
>( *this ); }
400 template<
class Gr
idImp,
class IdSetImp,
class IdTypeImp>
408 template<
class Entity>
412 return asImp().template id<cc>(e);
421 IdType
id (
const typename std::remove_const<GridImp>::type::
424 return asImp().template id<cc>(e);
429 IdType
subId (
const typename std::remove_const<GridImp>::type::
432 return asImp().subId(e,i,codim);
445 IdSetImp& asImp () {
return static_cast<IdSetImp &
> (*this);}
447 const IdSetImp& asImp ()
const {
return static_cast<const IdSetImp &
>(*this);}
452 #endif // DUNE_GRID_COMMON_INDEXIDSET_HH static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:96
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
IndexTypeImp IndexType
The type used for the indices.
Definition: indexidset.hh:90
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:220
Export the type of the entity used as parameter in the index(...) method.
Definition: indexidset.hh:84
Types types(int codim) const
obtain all geometry types of entities in domain
Definition: indexidset.hh:209
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:306
IndexSet()
Definition: indexidset.hh:251
IdType id(const Entity &e) const
Get id of an entity. This method is simpler to use than the one below.
Definition: indexidset.hh:409
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:127
Base::Types Types
Definition: indexidset.hh:284
bool contains(const Entity &e) const
Return true if the given entity is contained in .
Definition: indexidset.hh:244
Traits ::template Codim< cc >::Entity Entity
Definition: indexidset.hh:86
Types types(int codim) const
Definition: indexidset.hh:298
Know your own codimension.
Definition: common/entity.hh:107
IdType id(const typename std::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:421
IndexType subIndex(const Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:180
Include standard header files.
Definition: agrid.hh:59
Id Set Interface.
Definition: common/grid.hh:347
IdType subId(const typename std::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:429
Provide default implementation of method if IndexSet.
Definition: indexidset.hh:274
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:232
IdSet()
Definition: indexidset.hh:436
Wrapper class for entities.
Definition: common/entity.hh:64
Index Set Interface base class.
Definition: common/grid.hh:346
IdTypeImp IdType
Type used to represent an id.
Definition: indexidset.hh:405
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:111
TypesImp Types
iterator range for geometry types in domain
Definition: indexidset.hh:93
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:151
Different resources needed by all grid implementations.
Base::IndexType IndexType
The type used for the indices.
Definition: indexidset.hh:282