1 #ifndef DUNE_FEM_SUBARRAY_HH 2 #define DUNE_FEM_SUBARRAY_HH 4 #include <dune/common/typetraits.hh> 33 return asImp().operator[]( index );
39 return asImp().range();
45 return asImp().size();
62 : size_( size ), offset_( offset )
67 ThisType& operator=(
const ThisType& ) =
default;
68 ThisType& operator=( ThisType&& ) =
default;
86 const unsigned int size_;
87 const unsigned int offset_;
91 template<
unsigned int dim>
105 ThisType& operator=(
const ThisType& ) =
default;
106 ThisType& operator=( ThisType&& ) =
default;
108 static constexpr
unsigned int size()
113 static constexpr
unsigned int range()
124 const unsigned int offset_;
129 template<
class IndexMapper >
133 static const bool v = Conversion< IndexMapper, IndexMapperInterfaceType >::exists;
138 template<
class BaseArrayImp,
class IndexMapperImp >
140 :
public ArrayDefault< typename BaseArrayImp :: ElementType,
141 SubArray< BaseArrayImp, IndexMapperImp > >
158 BaseArrayType &baseArray_;
159 const IndexMapperType &indexMapper_;
162 SubArray( BaseArrayType &baseArray,
const IndexMapperType &indexMapper )
163 : baseArray_( baseArray ),
164 indexMapper_( indexMapper )
168 assert( baseArray_.size() == indexMapper_.range() );
172 : baseArray_( other.baseArray_ ),
173 indexMapper_( other.indexMapper_ )
177 ThisType &operator= (
const ThisType &other );
182 return baseArray_[ indexMapper_[ index ] ];
187 return baseArray_[ indexMapper_[ index ] ];
192 return indexMapper_.size();
198 template<
class BaseVectorImp,
class IndexMapperImp >
201 SubVector< BaseVectorImp, IndexMapperImp > >
218 BaseVectorType &baseVector_;
219 const IndexMapperType &indexMapper_;
222 SubVector( BaseVectorType &baseVector,
const IndexMapperType &indexMapper )
223 : baseVector_( baseVector ),
224 indexMapper_( indexMapper )
231 assert( (
unsigned int)baseVector_.size() == indexMapper_.range() );
237 ThisType &operator= (
const ThisType & );
242 return baseVector_[ indexMapper_[ index ] ];
247 return baseVector_[ indexMapper_[ index ] ];
252 return indexMapper_.size();
260 #endif // #ifndef DUNE_FEM_SUBARRAY_HH unsigned int range() const
Definition: subarray.hh:75
unsigned int operator[](unsigned int index) const
Maps an index onto another one.
Definition: subarray.hh:31
BaseVectorType::FieldType FieldType
type of array elements
Definition: subarray.hh:211
unsigned int size() const
Definition: subarray.hh:70
Definition: subarray.hh:139
IM IndexMapperType
type of the implementation (Barton-Nackman)
Definition: subarray.hh:24
unsigned int size() const
Definition: subarray.hh:190
unsigned int size() const
Definition: subarray.hh:250
unsigned int size() const
Returns the map's size.
Definition: subarray.hh:43
Definition: subarray.hh:130
default implementation of VectorInterface
Definition: vector.hh:173
Index mapper with static size which simply adds an offset to the index.
Definition: subarray.hh:92
default implementation of the ArrayInterface
Definition: array.hh:248
static constexpr unsigned int range()
Definition: subarray.hh:113
const IM & asImp() const
Definition: bartonnackmaninterface.hh:37
static constexpr unsigned int size()
Definition: subarray.hh:108
SubArray(const ThisType &other)
Definition: subarray.hh:171
IndexMapperInterface< IndexMapper > IndexMapperInterfaceType
Definition: subarray.hh:132
ThisType IndexMapperInterfaceType
type of the interface
Definition: subarray.hh:27
unsigned int operator[](unsigned int i) const
Definition: subarray.hh:80
BaseArrayImp BaseArrayType
type of the base array
Definition: subarray.hh:145
BaseVectorImp BaseVectorType
type of the base array
Definition: subarray.hh:205
Definition: coordinate.hh:4
BaseArrayType::ElementType ElementType
type of array elements
Definition: subarray.hh:151
unsigned int range() const
Returns the map's range.
Definition: subarray.hh:37
Index mapper which simply adds an offset to the index.
Definition: subarray.hh:54
Definition: subarray.hh:199
IndexMapperImp IndexMapperType
type of the index mapper
Definition: subarray.hh:208
SubVector(BaseVectorType &baseVector, const IndexMapperType &indexMapper)
Definition: subarray.hh:222
OffsetSubMapper(unsigned int size, unsigned int offset)
Definition: subarray.hh:61
StaticOffsetSubMapper(unsigned int offset)
Definition: subarray.hh:99
Abstract index mapper interface.
Definition: subarray.hh:16
SubArray(BaseArrayType &baseArray, const IndexMapperType &indexMapper)
Definition: subarray.hh:162
unsigned int operator[](unsigned int i) const
Definition: subarray.hh:118
IndexMapperImp IndexMapperType
type of the index mapper
Definition: subarray.hh:148
Definition: bartonnackmaninterface.hh:15