dune-fem  2.8-git
nonadaptiveindexset.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GRIDPART_COMMON_INDEXSETWRAPPER_HH
2 #define DUNE_FEM_GRIDPART_COMMON_INDEXSETWRAPPER_HH
3 
4 // #warning "Using Dune::Fem::NonAdaptiveIndexSet wrapper around grid part index sets"
5 
6 #include <vector>
7 
9 
10 namespace Dune
11 {
12 
13  namespace Fem
14  {
15 
16  // NonAdaptiveIndexSet
17  // -------------------
18 
19  template< class IndexSet >
20  class NonAdaptiveIndexSet;
21 
22 
23 
24  // NonAdaptiveIndexSetTraits
25  // -------------------------
26 
27  template< class IndexSet >
29  {
31 
32  static const int dimension = IndexSet::dimension;
33 
34  template< int codim >
35  struct Codim
36  : public IndexSet::template Codim< codim >
37  {};
38 
39  typedef typename IndexSet::IndexType IndexType;
40 
41  typedef typename IndexSet::Types Types;
42  };
43 
44 
45 
46  // NonAdaptiveIndexSet
47  // -------------------
48 
52  template< class IndexSet >
54  : public AdaptiveIndexSet< NonAdaptiveIndexSetTraits< IndexSet > >
55  {
57 
58  public:
60  typedef typename BaseType::IndexType IndexType;
61 
62  explicit NonAdaptiveIndexSet ( const IndexSet &indexSet )
63  : indexSet_( indexSet )
64  {}
65 
67  typename BaseType::Types types ( int codim ) const
68  {
69  return indexSet().types( codim );
70  }
71 
73  template< class Entity >
74  bool contains ( const Entity &entity ) const
75  {
76  return indexSet().contains( entity );
77  }
78 
80  IndexType size ( GeometryType type ) const
81  {
82  return indexSet().size( type );
83  }
84 
86  IndexType size ( int codim ) const
87  {
88  return indexSet().size( codim );
89  }
90 
92  template< class Entity >
93  IndexType index ( const Entity &entity ) const
94  {
95  return index< Entity::codimension >( entity );
96  }
97 
99  template< int codim >
100  IndexType index ( const typename BaseType::template Codim< codim >::Entity &entity ) const
101  {
102  return indexSet().template index< codim >( entity );
103  }
104 
106  template< class Entity >
107  IndexType subIndex ( const Entity &entity, int i, unsigned int cd ) const
108  {
109  return subIndex< Entity::codimension >( entity, i, cd );
110  }
111 
113  template< int codim >
114  IndexType subIndex ( const typename BaseType::template Codim< codim >::Entity &entity, int i, unsigned int cd ) const
115  {
116  return indexSet().template subIndex< codim >( entity, i, cd );
117  }
118 
120  static void resize () {}
121 
123  static constexpr bool compress () noexcept { return false; }
124 
126  static void insertEntity ( const typename BaseType::template Codim< 0 >::Entity & )
127  {}
128 
130  static void removeEntity ( const typename BaseType::template Codim< 0 >::Entity & )
131  {}
132 
134  void backup () const {}
135 
137  void restore () {}
138 
140  template< class T >
141  void write ( OutStreamInterface< T > &stream ) const
142  {}
143 
145  template< class T >
146  void read ( InStreamInterface< T > &stream )
147  {}
148 
150  static constexpr int numberOfHoles ( ... ) noexcept
151  {
152  return 0;
153  }
154 
156  static constexpr int oldIndex ( ... ) noexcept
157  {
158  return 0;
159  }
160 
162  static constexpr int newIndex ( ... ) noexcept
163  {
164  return 0;
165  }
166 
167  private:
168  const IndexSet &indexSet () const { return indexSet_; }
169 
170  const IndexSet &indexSet_;
171  };
172 
173 
174 
175  namespace Capabilities
176  {
177 
178  template< class IndexSet >
180  {
181  static const bool v = false;
182  };
183 
184  template< class IndexSet >
186  {
187  static const bool v = false;
188  };
189 
190  } // namespace Capabilities
191 
192  } // namespace Fem
193 
194 } // namespace Dune
195 
196 #endif // #ifndef DUNE_FEM_GRIDPART_COMMON_INDEXSETWRAPPER_HH
Definition: bindguard.hh:11
interface documentation for (grid part) index sets
Definition: common/indexset.hh:104
Traits::Types Types
geometry type range type
Definition: common/indexset.hh:120
bool contains(const Entity &entity) const
return true if entity has index
Definition: common/indexset.hh:134
IndexType size(GeometryType type) const
return number of entities of given type
Definition: common/indexset.hh:140
Types types(int codim) const
return range of geometry types
Definition: common/indexset.hh:127
static const int dimension
grid dimension
Definition: common/indexset.hh:107
Traits::IndexType IndexType
index type
Definition: common/indexset.hh:117
extended interface for adaptive, consecutive index sets
Definition: common/indexset.hh:278
specialize with true if index set implements the interface for consecutive index sets
Definition: common/indexset.hh:42
static const bool v
Definition: common/indexset.hh:49
specialize with true if index set implements the interface for adaptive index sets
Definition: common/indexset.hh:64
static const bool v
Definition: common/indexset.hh:71
Definition: common/indexset.hh:111
wrapper for (adaptive) index sets that disables all support for adaptivity
Definition: nonadaptiveindexset.hh:55
IndexType subIndex(const typename BaseType::template Codim< codim >::Entity &entity, int i, unsigned int cd) const
return index for given subentity
Definition: nonadaptiveindexset.hh:114
static void resize()
please doc me
Definition: nonadaptiveindexset.hh:120
static constexpr int oldIndex(...) noexcept
return old index for given hole and type
Definition: nonadaptiveindexset.hh:156
void restore()
please doc me
Definition: nonadaptiveindexset.hh:137
BaseType::IndexType IndexType
index type
Definition: nonadaptiveindexset.hh:60
IndexType size(int codim) const
Definition: nonadaptiveindexset.hh:86
IndexType size(GeometryType type) const
return number of entities of given type
Definition: nonadaptiveindexset.hh:80
static constexpr int newIndex(...) noexcept
return new index for given hole and type
Definition: nonadaptiveindexset.hh:162
IndexType subIndex(const Entity &entity, int i, unsigned int cd) const
return index for given subentity
Definition: nonadaptiveindexset.hh:107
void write(OutStreamInterface< T > &stream) const
please doc me
Definition: nonadaptiveindexset.hh:141
IndexType index(const Entity &entity) const
return index for given entity
Definition: nonadaptiveindexset.hh:93
static void insertEntity(const typename BaseType::template Codim< 0 >::Entity &)
please doc me
Definition: nonadaptiveindexset.hh:126
static void removeEntity(const typename BaseType::template Codim< 0 >::Entity &)
please doc me
Definition: nonadaptiveindexset.hh:130
void backup() const
please doc me
Definition: nonadaptiveindexset.hh:134
NonAdaptiveIndexSet(const IndexSet &indexSet)
Definition: nonadaptiveindexset.hh:62
static constexpr bool compress() noexcept
please doc me
Definition: nonadaptiveindexset.hh:123
BaseType::Types types(int codim) const
return range of geometry types
Definition: nonadaptiveindexset.hh:67
void read(InStreamInterface< T > &stream)
please doc me
Definition: nonadaptiveindexset.hh:146
bool contains(const Entity &entity) const
return true if entity has index
Definition: nonadaptiveindexset.hh:74
IndexType index(const typename BaseType::template Codim< codim >::Entity &entity) const
return index for given entity
Definition: nonadaptiveindexset.hh:100
static constexpr int numberOfHoles(...) noexcept
return number of holes for given type
Definition: nonadaptiveindexset.hh:150
Definition: nonadaptiveindexset.hh:29
static const int dimension
Definition: nonadaptiveindexset.hh:32
NonAdaptiveIndexSet< IndexSet > IndexSetType
Definition: nonadaptiveindexset.hh:30
IndexSet::IndexType IndexType
Definition: nonadaptiveindexset.hh:39
IndexSet::Types Types
Definition: nonadaptiveindexset.hh:41
Definition: nonadaptiveindexset.hh:37
abstract interface for an output stream
Definition: streams.hh:46
abstract interface for an input stream
Definition: streams.hh:179