3 #ifndef DUNE_PDELAB_COMMON_MULTIINDEX_HH
4 #define DUNE_PDELAB_COMMON_MULTIINDEX_HH
6 #include <dune/common/reservedvector.hh>
7 #include <dune/geometry/typeindex.hh>
9 #include <dune/common/hash.hh>
149 template<
typename T, std::
size_t n>
151 :
public ReservedVector<T,n>
154 typedef ReservedVector<T,n> base_type;
177 typedef typename base_type::const_iterator
iterator;
228 assert(s <= _mi.size());
254 for (
typename ReservedVector<T,n>::const_iterator it = mi._mi.begin(); it != mi._mi.begin() + mi.
size(); ++it)
255 s << std::setw(3) << *it;
270 : base_type(static_cast<const base_type&>(view._mi))
272 this->resize(view.size());
275 void set(
typename ReservedVector<T,n>::value_type index)
278 this->push_back(index);
286 for (std::size_t i = mi.size(); i <
max_depth; ++i)
288 for (
typename ReservedVector<T,n>::const_iterator it = mi.begin(); it != mi.end(); ++it)
289 s << std::setw(3) << *it;
296 return View(*
this,this->size());
299 View
view(std::size_t size)
const
301 return View(*
this,size);
311 this->size() == r.size() &&
312 std::equal(this->begin(),this->end(),r.begin());
318 return !(*
this == r);
325 return _c.size() < _r.size();
326 return std::lexicographical_compare(_c.begin(),_c.end(),r._c.begin(),r._c.end());
333 template<
typename T, std::
size_t n>
336 return hash_range(mi.begin(),mi.end());
345 #endif // DUNE_PDELAB_COMMON_MULTIINDEX_HH
void clear()
Definition: multiindex.hh:189
base_type::value_type value_type
Definition: multiindex.hh:171
static const std::size_t max_depth
The maximum possible depth of the MultiIndex.
Definition: multiindex.hh:159
void set(typename ReservedVector< T, n >::value_type index)
Definition: multiindex.hh:275
base_type::const_reference reference
Definition: multiindex.hh:173
reference operator[](size_type i)
Definition: multiindex.hh:214
base_type::pointer pointer
Definition: multiindex.hh:172
base_type::difference_type difference_type
Definition: multiindex.hh:176
base_type::size_type size_type
Definition: multiindex.hh:175
View view(std::size_t size) const
Definition: multiindex.hh:299
static const std::size_t max_depth
The maximum possible depth of the MultiIndex.
Definition: multiindex.hh:169
bool empty() const
Definition: multiindex.hh:243
const_reference back() const
Definition: multiindex.hh:209
base_type::const_reference const_reference
Definition: multiindex.hh:174
size_type size() const
Definition: multiindex.hh:238
const_reference operator[](size_type i) const
Definition: multiindex.hh:220
bool operator!=(const MultiIndex &r) const
Tests whether two MultiIndices are not equal.
Definition: multiindex.hh:316
View back_popped() const
Definition: multiindex.hh:232
std::size_t _size
Definition: datahandleprovider.hh:46
reference back()
Definition: multiindex.hh:204
void resize(size_type s)
Definition: multiindex.hh:226
View view() const
Definition: multiindex.hh:294
reference front()
Definition: multiindex.hh:194
Definition: multiindex.hh:161
A multi-index representing a degree of freedom in a GridFunctionSpace.
Definition: multiindex.hh:150
MultiIndex(const View &view)
Definition: multiindex.hh:269
friend std::ostream & operator<<(std::ostream &s, const View &mi)
Definition: multiindex.hh:248
const_reference front() const
Definition: multiindex.hh:199
bool operator==(const MultiIndex &r) const
Tests whether two MultiIndices are equal.
Definition: multiindex.hh:308
MultiIndex()
Definition: multiindex.hh:266
std::size_t hash_value(const DOFIndex< T, n1, n2 > &di)
Definition: dofindex.hh:196
base_type::const_iterator iterator
Definition: multiindex.hh:177
const std::string s
Definition: function.hh:1103
friend std::ostream & operator<<(std::ostream &s, const MultiIndex &mi)
Writes a pretty representation of the MultiIndex to the given std::ostream.
Definition: multiindex.hh:282
base_type::const_iterator const_iterator
Definition: multiindex.hh:178