6#ifndef DUNE_GRID_COMMON_INDEXIDSET_HH
7#define DUNE_GRID_COMMON_INDEXIDSET_HH
10#include <dune/common/exceptions.hh>
22#include <dune/common/bartonnackmanifcheck.hh>
76 template<
class Gr
idImp,
class IndexSetImp,
class IndexTypeImp,
class TypesImp >
81 typedef typename std::remove_const< GridImp >::type::Traits Traits;
98 static const int dimension = std::remove_const< GridImp >::type::dimension;
115 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
116 return asImp().template index<cc>(e);
128 template<
class Entity>
132 CHECK_INTERFACE_IMPLEMENTATION((asImp().
template index<cc>(e)));
133 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);
181 template<
class Entity >
185 return asImp().template subIndex< cc >( e, i, codim );
213 CHECK_INTERFACE_IMPLEMENTATION( (asImp().
types( codim )) );
214 return asImp().types( codim );
225 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(type)));
226 return asImp().size(type);
238 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(codim)));
239 return asImp().size(codim);
247 template<
class Entity>
250 CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains(e)));
251 return asImp().contains(e);
266 IndexSetImp& asImp () {
return static_cast<IndexSetImp &
> (*this);}
268 const IndexSetImp& asImp ()
const {
return static_cast<const IndexSetImp &
>(*this);}
271#undef CHECK_INTERFACE_IMPLEMENTATION
272#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
279 template<
class Gr
idImp,
class IndexSetImp>
281 :
public IndexSet< GridImp, IndexSetImp >
284 typedef typename std::remove_const< GridImp >::type::Traits Traits;
304 Types types (
int codim )
const {
return asImp().geomTypes( codim ); }
313 auto size (
const int codim )
const
317 const std::vector< GeometryType > &geomTs = asImp().geomTypes( codim );
318 typedef typename std::vector< GeometryType >::const_iterator Iterator;
320 const Iterator end = geomTs.end();
323 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 ); }
450 template<
class Gr
idImp,
class IdSetImp,
class IdTypeImp>
455 using Traits =
typename std::remove_const< GridImp >::type::Traits;
467 static constexpr auto dimension = std::remove_const< GridImp >::type::dimension;
470 template<
class Entity>
474 return asImp().template id<cc>(e);
481 return asImp().template id<cc>(e);
488 return asImp().subId(e,i,codim);
503 IdSetImp& asImp () {
return static_cast<IdSetImp &
> (*this);}
505 const IdSetImp& asImp ()
const {
return static_cast<const IdSetImp &
>(*this);}
Include standard header files.
Definition: agrid.hh:60
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Wrapper class for entities.
Definition: common/entity.hh:66
static constexpr int codimension
Know your own codimension.
Definition: common/entity.hh:106
Index Set Interface base class.
Definition: indexidset.hh:78
auto 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:236
auto size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:223
IndexType subIndex(const Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:182
static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:98
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
TypesImp Types
iterator range for geometry types in domain
Definition: indexidset.hh:95
Types types(int codim) const
obtain all geometry types of entities in domain
Definition: indexidset.hh:211
IndexSet(const IndexSet &)=delete
Forbid the copy constructor.
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:113
IndexSet & operator=(const IndexSet &)=delete
Forbid the assignment operator.
IndexTypeImp IndexType
The type used for the indices.
Definition: indexidset.hh:92
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:129
bool contains(const Entity &e) const
Return true if the given entity is contained in .
Definition: indexidset.hh:248
Id Set Interface.
Definition: indexidset.hh:452
IdType subId(const typename 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:486
static constexpr auto dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:467
IdSet(const IdSet &)=delete
Forbid the copy constructor.
IdType id(const typename Codim< cc >::Entity &e) const
Get id of an entity of codim cc. Unhandy because template parameter must be supplied explicitly.
Definition: indexidset.hh:479
IdTypeImp IdType
Type used to represent an id.
Definition: indexidset.hh:458
IdSet & operator=(const IdSet &)=delete
Forbid the assignment operator.
IdType id(const Entity &e) const
Get id of an entity. This method is simpler to use than the one below.
Definition: indexidset.hh:471
Export the type of the entity used as parameter in the index(...) method.
Definition: indexidset.hh:87
Traits::template Codim< cc >::Entity Entity
Definition: indexidset.hh:88
Provide default implementation of method if IndexSet.
Definition: indexidset.hh:282
Base::IndexType IndexType
The type used for the indices.
Definition: indexidset.hh:288
Base::Types Types
Definition: indexidset.hh:290
static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:293
Types types(int codim) const
Definition: indexidset.hh:304
auto 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:313
Export the type of the entity used as parameter in the id(...) method.
Definition: indexidset.hh:462
typename Traits::template Codim< cc >::Entity Entity
Definition: indexidset.hh:463
Different resources needed by all grid implementations.