Go to the documentation of this file.
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;
49 typedef typename base_type::pointer
pointer;
50 typedef typename base_type::const_reference
reference;
54 typedef typename base_type::const_iterator
iterator;
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))
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());
176 View
view(std::size_t size)
const
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
MultiIndex()
Definition: multiindex.hh:143
base_type::const_reference reference
Definition: multiindex.hh:50
base_type::const_iterator const_iterator
Definition: multiindex.hh:55
Definition: multiindex.hh:38
friend std::ostream & operator<<(std::ostream &s, const View &mi)
Definition: multiindex.hh:125
std::size_t index
Definition: interpolate.hh:118
reference back()
Definition: multiindex.hh:81
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
base_type::const_reference const_reference
Definition: multiindex.hh:51
static const std::size_t max_depth
The maximum possible depth of the MultiIndex.
Definition: multiindex.hh:36
static const std::size_t max_depth
The maximum possible depth of the MultiIndex.
Definition: multiindex.hh:46
A class for representing multi-indices.
Definition: multiindex.hh:27
View view(std::size_t size) const
Definition: multiindex.hh:176
size_type size() const
Definition: multiindex.hh:115
base_type::difference_type difference_type
Definition: multiindex.hh:53
const_reference operator[](size_type i) const
Definition: multiindex.hh:97
base_type::size_type size_type
Definition: multiindex.hh:52
void resize(size_type s)
Definition: multiindex.hh:103
const_reference front() const
Definition: multiindex.hh:76
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:159
bool empty() const
Definition: multiindex.hh:120
reference front()
Definition: multiindex.hh:71
void set(typename ReservedVector< T, n >::value_type index)
Definition: multiindex.hh:152
bool operator!=(const MultiIndex &r) const
Tests whether two MultiIndices are not equal.
Definition: multiindex.hh:193
View back_popped() const
Definition: multiindex.hh:109
base_type::pointer pointer
Definition: multiindex.hh:49
View view() const
Definition: multiindex.hh:171
MultiIndex(const View &view)
Definition: multiindex.hh:146
reference operator[](size_type i)
Definition: multiindex.hh:91
const_reference back() const
Definition: multiindex.hh:86
base_type::const_iterator iterator
Definition: multiindex.hh:54
const std::string s
Definition: function.hh:830
bool operator==(const MultiIndex &r) const
Tests whether two MultiIndices are equal.
Definition: multiindex.hh:185
void clear()
Definition: multiindex.hh:66
std::size_t hash_value(const DOFIndex< T, n1, n2 > &di)
Definition: dofindex.hh:334
base_type::value_type value_type
Definition: multiindex.hh:48