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> 26 template<
typename T, std::
size_t n>
28 :
public ReservedVector<T,n>
31 typedef ReservedVector<T,n> base_type;
46 static const std::size_t max_depth = n;
49 typedef typename base_type::pointer
pointer;
50 typedef typename base_type::const_reference
reference;
54 typedef typename base_type::const_iterator
iterator;
86 const_reference
back()
const 105 assert(s <= _mi.size());
112 return View(_mi,_size-1);
131 for (
typename ReservedVector<T,n>::const_iterator it = mi._mi.begin(); it != mi._mi.begin() + mi.
size(); ++it)
132 s << std::setw(3) << *it;
147 : base_type(static_cast<const base_type&>(view._mi))
149 this->
resize(view.size());
152 void set(
typename ReservedVector<T,n>::value_type index)
155 this->push_back(index);
163 for (std::size_t i = mi.size(); i <
max_depth; ++i)
165 for (
typename ReservedVector<T,n>::const_iterator it = mi.begin(); it != mi.end(); ++it)
166 s << std::setw(3) << *it;
173 return View(*
this,this->
size());
178 return View(*
this,size);
188 this->
size() == r.size() &&
189 std::equal(this->begin(),this->end(),r.begin());
195 return !(*
this == r);
202 return _c.size() < _r.size();
203 return std::lexicographical_compare(_c.begin(),_c.end(),r._c.begin(),r._c.end());
210 template<
typename T, std::
size_t n>
213 return hash_range(mi.begin(),mi.end());
222 #endif // DUNE_PDELAB_COMMON_MULTIINDEX_HH A class for representing multi-indices.
Definition: multiindex.hh:27
base_type::difference_type difference_type
Definition: multiindex.hh:53
bool empty() const
Definition: multiindex.hh:120
base_type::size_type size_type
Definition: multiindex.hh:52
bool operator==(const MultiIndex &r) const
Tests whether two MultiIndices are equal.
Definition: multiindex.hh:185
static const std::size_t max_depth
The maximum possible depth of the MultiIndex.
Definition: multiindex.hh:36
const std::string s
Definition: function.hh:1101
base_type::const_reference reference
Definition: multiindex.hh:50
const_reference operator[](size_type i) const
Definition: multiindex.hh:97
base_type::pointer pointer
Definition: multiindex.hh:49
const_reference front() const
Definition: multiindex.hh:76
base_type::const_iterator iterator
Definition: multiindex.hh:54
static const std::size_t max_depth
The maximum possible depth of the MultiIndex.
Definition: multiindex.hh:46
friend std::ostream & operator<<(std::ostream &s, const View &mi)
Definition: multiindex.hh:125
base_type::value_type value_type
Definition: multiindex.hh:48
View view(std::size_t size) const
Definition: multiindex.hh:176
void resize(size_type s)
Definition: multiindex.hh:103
MultiIndex(const View &view)
Definition: multiindex.hh:146
void clear()
Definition: multiindex.hh:66
View view() const
Definition: multiindex.hh:171
std::size_t hash_value(const DOFIndex< T, n1, n2 > &di)
Definition: dofindex.hh:333
const_reference back() const
Definition: multiindex.hh:86
MultiIndex()
Definition: multiindex.hh:143
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
View back_popped() const
Definition: multiindex.hh:109
Definition: multiindex.hh:38
size_type size() const
Definition: multiindex.hh:115
bool operator!=(const MultiIndex &r) const
Tests whether two MultiIndices are not equal.
Definition: multiindex.hh:193
reference back()
Definition: multiindex.hh:81
base_type::const_reference const_reference
Definition: multiindex.hh:51
reference operator[](size_type i)
Definition: multiindex.hh:91
reference front()
Definition: multiindex.hh:71
base_type::const_iterator const_iterator
Definition: multiindex.hh:55