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 );
221 auto size (GeometryType type)
const
223 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(type)));
224 return asImp().size(type);
236 CHECK_INTERFACE_IMPLEMENTATION((asImp().
size(codim)));
237 return asImp().size(codim);
245 template<
class Entity>
248 CHECK_INTERFACE_IMPLEMENTATION((asImp().
contains(e)));
249 return asImp().contains(e);
264 IndexSetImp& asImp () {
return static_cast<IndexSetImp &
> (*this);}
266 const IndexSetImp& asImp ()
const {
return static_cast<const IndexSetImp &
>(*this);}
269#undef CHECK_INTERFACE_IMPLEMENTATION
270#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
277 template<
class Gr
idImp,
class IndexSetImp>
279 :
public IndexSet< GridImp, IndexSetImp >
282 typedef typename std::remove_const< GridImp >::type::Traits Traits;
302 Types types (
int codim )
const {
return asImp().geomTypes( codim ); }
311 auto size (
const int codim )
const
313 using SizeType = std::decay_t<
decltype(
Base::size( Dune::GeometryType() ) )>;
315 const std::vector< GeometryType > &geomTs = asImp().geomTypes( codim );
316 typedef typename std::vector< GeometryType >::const_iterator Iterator;
318 const Iterator end = geomTs.end();
321 for( Iterator it = geomTs.begin() ; it != end; ++it )
329 IndexSetImp &asImp () {
return static_cast< IndexSetImp &
>( *this );}
330 const IndexSetImp &asImp ()
const {
return static_cast< const IndexSetImp &
>( *this ); }
448 template<
class Gr
idImp,
class IdSetImp,
class IdTypeImp>
453 using Traits =
typename std::remove_const< GridImp >::type::Traits;
465 static constexpr auto dimension = std::remove_const< GridImp >::type::dimension;
468 template<
class Entity>
472 return asImp().template id<cc>(e);
483 return asImp().template id<cc>(e);
490 return asImp().subId(e,i,codim);
505 IdSetImp& asImp () {
return static_cast<IdSetImp &
> (*this);}
507 const IdSetImp& asImp ()
const {
return static_cast<const IdSetImp &
>(*this);}
Include standard header files.
Definition: agrid.hh:58
Wrapper class for entities.
Definition: common/entity.hh:64
@ codimension
Know your own codimension.
Definition: common/entity.hh:105
Index Set Interface base class.
Definition: indexidset.hh:76
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:234
auto size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:221
IndexType subIndex(const Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:180
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:151
TypesImp Types
iterator range for geometry types in domain
Definition: indexidset.hh:93
Types types(int codim) const
obtain all geometry types of entities in domain
Definition: indexidset.hh:209
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:111
IndexSet & operator=(const IndexSet &)=delete
Forbid the assignment operator.
IndexTypeImp IndexType
The type used for the indices.
Definition: indexidset.hh:90
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
bool contains(const Entity &e) const
Return true if the given entity is contained in .
Definition: indexidset.hh:246
Id Set Interface.
Definition: indexidset.hh:450
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:488
static constexpr auto dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:465
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:481
IdTypeImp IdType
Type used to represent an id.
Definition: indexidset.hh:456
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:469
Export the type of the entity used as parameter in the index(...) method.
Definition: indexidset.hh:85
Traits::template Codim< cc >::Entity Entity
Definition: indexidset.hh:86
Provide default implementation of method if IndexSet.
Definition: indexidset.hh:280
Base::IndexType IndexType
The type used for the indices.
Definition: indexidset.hh:286
Base::Types Types
Definition: indexidset.hh:288
static const int dimension
dimension of the grid (maximum allowed codimension)
Definition: indexidset.hh:291
Types types(int codim) const
Definition: indexidset.hh:302
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:311
Export the type of the entity used as parameter in the id(...) method.
Definition: indexidset.hh:460
typename Traits::template Codim< cc >::Entity Entity
Definition: indexidset.hh:461
Different resources needed by all grid implementations.