1#ifndef DUNE_FEM_GRIDPART_COMMON_INDEXSET_HH
2#define DUNE_FEM_GRIDPART_COMMON_INDEXSET_HH
10#include <dune/fem/io/streams/streams.hh>
20 template<
class Traits >
22 template<
class Traits >
23 class ConsecutiveIndexSet;
24 template<
class Traits >
25 class AdaptiveIndexSet;
28 namespace Capabilities
37 template<
class IndexSet >
40 template<
class Traits >
43 static std::false_type __isDuneFemIndexSet ( ... );
46 static const bool v =
decltype( __isDuneFemIndexSet( std::declval< IndexSet >() ) )::value;
59 template<
class IndexSet >
62 template<
class Traits >
65 static std::false_type __isConsecutive ( ... );
68 static const bool v =
decltype( __isConsecutive( std::declval< IndexSet >() ) )::value;
81 template<
class IndexSet >
84 template<
class Traits >
87 static std::false_type __isAdaptive ( ... );
90 static const bool v =
decltype( __isAdaptive( std::declval< IndexSet >() ) )::value;
97 template<
class IndexSet >
102 template<
class IndexSet >
103 struct isAdaptiveIndexSet< const
IndexSet >
104 :
public isAdaptiveIndexSet< IndexSet >
121 template<
class Traits >
128 template<
int codim >
132 typedef typename Traits::template Codim< codim >::Entity
Entity;
139 typedef typename Traits::Types
Types;
148 return impl().types( codim );
152 template<
class Entity >
155 return impl().contains( entity );
161 return impl().size( type );
167 return impl().size( codim );
171 template<
class Entity >
174 return index< Entity::codimension >( entity );
178 template<
int codim >
181 return impl().template index< codim >( entity );
185 template<
class Entity >
188 return subIndex< Entity::codimension >( entity, i, cd );
192 template<
int codim >
193 IndexType subIndex (
const typename Codim< codim >::Entity &entity,
int i,
unsigned int cd )
const
195 return impl().template subIndex< codim >( entity, i, cd );
204 const typename Traits::IndexSetType &impl ()
const
206 return static_cast< const typename Traits::IndexSetType &
>( *this );
218 template<
class Traits >
225 using BaseType::impl;
241 void insertEntity (
const typename BaseType::template Codim< 0 >::Entity &entity )
243 impl().insertEntity( entity );
247 void removeEntity (
const typename BaseType::template Codim< 0 >::Entity &entity )
249 impl().removeEntity( entity );
253 void backup ()
const { impl().backup(); }
262 impl().write( stream );
269 impl().read( stream );
275 typename Traits::IndexSetType &impl ()
277 const typename Traits::IndexSetType &impl = BaseType::impl();
278 return const_cast< typename Traits::IndexSetType &
>( impl );
292 template<
class Traits >
299 using BaseType::impl;
311 return impl().numberOfHoles( type );
317 return impl().oldIndex( hole, type );
323 return impl().newIndex( hole, type );
Wrapper class for entities.
Definition: entity.hh:66
extended interface for adaptive, consecutive index sets
Definition: indexset.hh:295
int numberOfHoles(GeometryType type) const
return number of holes for given type
Definition: indexset.hh:309
int oldIndex(int hole, GeometryType type) const
return old index for given hole and type
Definition: indexset.hh:315
int newIndex(int hole, GeometryType type) const
return new index for given hole and type
Definition: indexset.hh:321
specialize with true if index set implements the interface for adaptive index sets
Definition: indexset.hh:83
extended interface for consecutive index sets
Definition: indexset.hh:221
void write(OutStreamInterface< T > &stream) const
please doc me
Definition: indexset.hh:260
bool compress()
please doc me
Definition: indexset.hh:238
void backup() const
please doc me
Definition: indexset.hh:253
void resize()
please doc me
Definition: indexset.hh:235
void insertEntity(const typename BaseType::template Codim< 0 >::Entity &entity)
please doc me
Definition: indexset.hh:241
void removeEntity(const typename BaseType::template Codim< 0 >::Entity &entity)
please doc me
Definition: indexset.hh:247
void restore()
please doc me
Definition: indexset.hh:256
void read(InStreamInterface< T > &stream)
please doc me
Definition: indexset.hh:267
abstract interface for an input stream
Definition: streams.hh:190
interface documentation for (grid part) index sets
Definition: indexset.hh:123
IndexType subIndex(const typename Codim< codim >::Entity &entity, int i, unsigned int cd) const
return index for given subentity
Definition: indexset.hh:193
IndexType index(const typename Codim< codim >::Entity &entity) const
return index for given entity
Definition: indexset.hh:179
Traits::Types Types
geometry type range type
Definition: indexset.hh:139
bool contains(const Entity &entity) const
return true if entity has index
Definition: indexset.hh:153
void requestCodimensions(const std::vector< int > &codimensions) const
receive request for codimension support in case index set is adaptive
Definition: indexset.hh:199
IndexType size(GeometryType type) const
return number of entities of given type
Definition: indexset.hh:159
IndexType subIndex(const Entity &entity, int i, unsigned int cd) const
return index for given subentity
Definition: indexset.hh:186
Types types(int codim) const
return range of geometry types
Definition: indexset.hh:146
IndexType size(int codim) const
return number of entities of given codimension
Definition: indexset.hh:165
IndexType index(const Entity &entity) const
return index for given entity
Definition: indexset.hh:172
static const int dimension
grid dimension
Definition: indexset.hh:126
Traits::IndexType IndexType
index type
Definition: indexset.hh:136
abstract interface for an output stream
Definition: streams.hh:48
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
Dune namespace.
Definition: alignedallocator.hh:13
specialize with true if index set implements the interface for consecutive index sets
Definition: indexset.hh:61
specialize with true if index set implements the dune-fem interface for index sets
Definition: indexset.hh:39
A unique label for each type of element that can occur in a grid.