dune-fem  2.4.1-rc
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 >
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  const std::vector< GeometryType > &geomTypes ( int codim ) const
74  {
75  return indexSet().geomTypes( codim );
76  }
77 
79  template< class Entity >
80  bool contains ( const Entity &entity ) const
81  {
82  return indexSet().contains( entity );
83  }
84 
86  IndexType size ( GeometryType type ) const
87  {
88  return indexSet().size( type );
89  }
90 
92  IndexType size ( int codim ) const
93  {
94  return indexSet().size( codim );
95  }
96 
98  template< class Entity >
99  IndexType index ( const Entity &entity ) const
100  {
101  return index< Entity::codimension >( entity );
102  }
103 
105  template< int codim >
106  IndexType index ( const typename BaseType::template Codim< codim >::Entity &entity ) const
107  {
108  return indexSet().template index< codim >( entity );
109  }
110 
112  template< class Entity >
113  IndexType subIndex ( const Entity &entity, int i, unsigned int cd ) const
114  {
115  return subIndex< Entity::codimension >( entity, i, cd );
116  }
117 
119  template< int codim >
120  IndexType subIndex ( const typename BaseType::template Codim< codim >::Entity &entity, int i, unsigned int cd ) const
121  {
122  return indexSet().template subIndex< codim >( entity, i, cd );
123  }
124 
126  static constexpr bool consecutive () noexcept
127  // DUNE_DEPRECATED_MSG("IndexSet::consecutive() is deprecated, use Capabilities::isConsecutiveIndexSet<IndexSet>::v instead")
128  {
129  return false;
130  }
131 
133  static void resize () {}
134 
136  static constexpr bool compress () noexcept { return false; }
137 
139  static void insertEntity ( const typename BaseType::template Codim< 0 >::Entity & )
140  {}
141 
143  static void removeEntity ( const typename BaseType::template Codim< 0 >::Entity & )
144  {}
145 
147  void backup () const {}
148 
150  void restore () {}
151 
153  template< class T >
154  void write ( OutStreamInterface< T > &stream ) const
155  {}
156 
158  template< class T >
159  void read ( InStreamInterface< T > &stream )
160  {}
161 
163  static constexpr int numberOfHoles ( ... ) noexcept
164  {
165  return 0;
166  }
167 
169  static constexpr int oldIndex ( ... ) noexcept
170  {
171  return 0;
172  }
173 
175  static constexpr int newIndex ( ... ) noexcept
176  {
177  return 0;
178  }
179 
180  private:
181  const IndexSet &indexSet () const { return indexSet_; }
182 
183  const IndexSet &indexSet_;
184  };
185 
186 
187 
188  namespace Capabilities
189  {
190 
191  template< class IndexSet >
193  {
194  static const bool v = false;
195  };
196 
197  template< class IndexSet >
199  {
200  static const bool v = false;
201  };
202 
203  } // namespace Capabilities
204 
205  } // namespace Fem
206 
207 } // namespace Dune
208 
209 #endif // #ifndef DUNE_FEM_GRIDPART_COMMON_INDEXSETWRAPPER_HH
BaseType::IndexType IndexType
index type
Definition: nonadaptiveindexset.hh:60
IndexType size(int codim) const
Definition: nonadaptiveindexset.hh:92
NonAdaptiveIndexSet< IndexSet > IndexSetType
Definition: nonadaptiveindexset.hh:30
interface documentation for (grid part) index sets
Definition: common/indexset.hh:25
bool contains(const Entity &entity) const
return true if entity has index
Definition: nonadaptiveindexset.hh:80
IndexSet::IndexType IndexType
Definition: nonadaptiveindexset.hh:39
const std::vector< GeometryType > & geomTypes(int codim) const
return vector of geometry types used of given codimension
Definition: nonadaptiveindexset.hh:73
static constexpr bool consecutive() noexcept
please doc me
Definition: nonadaptiveindexset.hh:126
IndexSet::Types Types
Definition: nonadaptiveindexset.hh:41
void backup() const
please doc me
Definition: nonadaptiveindexset.hh:147
void write(OutStreamInterface< T > &stream) const
please doc me
Definition: nonadaptiveindexset.hh:154
specialize with true if index set implements the interface for consecutive index sets ...
Definition: common/indexset.hh:46
void read(InStreamInterface< T > &stream)
please doc me
Definition: nonadaptiveindexset.hh:159
static constexpr int newIndex(...) noexcept
return new index for given hole and type
Definition: nonadaptiveindexset.hh:175
extended interface for adaptive, consecutive index sets
Definition: common/indexset.hh:29
static void insertEntity(const typename BaseType::template Codim< 0 >::Entity &)
please doc me
Definition: nonadaptiveindexset.hh:139
Definition: coordinate.hh:4
specialize with true if index set implements the interface for adaptive index sets ...
Definition: common/indexset.hh:69
abstract interface for an input stream
Definition: streams.hh:177
IndexType index(const typename BaseType::template Codim< codim >::Entity &entity) const
return index for given entity
Definition: nonadaptiveindexset.hh:106
static const int dimension
Definition: nonadaptiveindexset.hh:32
void restore()
please doc me
Definition: nonadaptiveindexset.hh:150
BaseType::Types types(int codim) const
return range of geometry types
Definition: nonadaptiveindexset.hh:67
IndexType index(const Entity &entity) const
return index for given entity
Definition: nonadaptiveindexset.hh:99
Definition: nonadaptiveindexset.hh:35
NonAdaptiveIndexSet(const IndexSet &indexSet)
Definition: nonadaptiveindexset.hh:62
static constexpr int oldIndex(...) noexcept
return old index for given hole and type
Definition: nonadaptiveindexset.hh:169
IndexType subIndex(const Entity &entity, int i, unsigned int cd) const
return index for given subentity
Definition: nonadaptiveindexset.hh:113
wrapper for (adaptive) index sets that disables all support for adaptivity
Definition: nonadaptiveindexset.hh:20
Traits::IndexType IndexType
index type
Definition: common/indexset.hh:123
static void removeEntity(const typename BaseType::template Codim< 0 >::Entity &)
please doc me
Definition: nonadaptiveindexset.hh:143
IndexType size(GeometryType type) const
return number of entities of given type
Definition: nonadaptiveindexset.hh:86
Traits::Types Types
geometry type range type
Definition: common/indexset.hh:126
IndexType subIndex(const typename BaseType::template Codim< codim >::Entity &entity, int i, unsigned int cd) const
return index for given subentity
Definition: nonadaptiveindexset.hh:120
static constexpr bool compress() noexcept
please doc me
Definition: nonadaptiveindexset.hh:136
static constexpr int numberOfHoles(...) noexcept
return number of holes for given type
Definition: nonadaptiveindexset.hh:163
abstract interface for an output stream
Definition: streams.hh:44
static const int dimension
grid dimension
Definition: common/indexset.hh:113
static void resize()
please doc me
Definition: nonadaptiveindexset.hh:133
Definition: nonadaptiveindexset.hh:28