5#ifndef DUNE_MULTIINDEX_HH
6#define DUNE_MULTIINDEX_HH
25 template<
int dim,
class Field >
28 template<
int dim,
class Field >
36 template<
int dim,
class Field >
61 : vecZ_( other.vecOMZ_ ),
62 vecOMZ_( other.vecZ_ ),
63 factor_( other.factor_ )
68 next_ =
new This( *(other.next_) );
75 : vecZ_( other.vecZ_ ),
76 vecOMZ_( other.vecOMZ_ ),
77 factor_( other.factor_ )
81 next_ =
new This( *(other.next_) );
109 vecOMZ_ = other.vecOMZ_;
110 factor_ = other.factor_;
112 next_ =
new This(*(other.next_));
137 factor_ = field_cast<Field>(f);
143 assert(!next_ && !other.next_);
144 return (vecZ_==other.vecZ_ && vecOMZ_==other.vecOMZ_ && factor_==other.factor_);
150 factor_ *= field_cast<Field>(f);
158 factor_ /= field_cast<Field>(f);
166 assert(!other.next_);
167 vecZ_ += other.vecZ_;
168 vecOMZ_ += other.vecOMZ_;
169 factor_ *= other.factor_;
176 assert(!other.next_);
177 vecZ_ -= other.vecZ_;
178 vecOMZ_ -= other.vecOMZ_;
179 factor_ /= other.factor_;
187 assert(!other.next_);
201 next_ =
new This(other);
205 factor_ += other.factor_;
210 assert(!other.next_);
217 next_ =
new This(other);
221 factor_ -= other.factor_;
285 if ( vecZ_[i] != ind.vecZ_[i] ||
286 vecOMZ_[i] != vecOMZ_[i] )
313 template<
int dim,
class Field >
320 template <
int dim,
class Field,
class F>
327 template <
int dim,
class Field,
class F>
335 template <
int d,
class F>
337 for (
unsigned int r=0; r<y.size(); ++r) {
338 out <<
"f_{" << r <<
"}(" << char(
'a');
339 for (
int i=1; i<d; ++i)
340 out <<
"," <<
char(
'a'+i);
346 template <
int d,
class F,
int dimR>
349 out <<
"\\begin{eqnarray*}" <<
std::endl;
350 for (
unsigned int k=0; k<y.size(); ++k) {
351 out <<
"f_{" << k <<
"}(" << char(
'a');
352 for (
int i=1; i<d; ++i)
353 out <<
"," <<
char(
'a'+i);
356 for (
unsigned int r=1; r<dimR; ++r) {
357 out <<
" , " << y[k][r] ;
364 template <
int d,
class F,
int dimR1,
int dimR2>
367 out <<
"\\begin{eqnarray*}" <<
std::endl;
368 for (
unsigned int k=0; k<y.size(); ++k) {
369 for (
int q=0; q<dimR2; q++) {
370 out <<
"d_{" << char(
'a'+q) <<
"}f_{" << k <<
"}(" << char(
'a');
371 for (
int i=1; i<d; ++i)
372 out <<
"," <<
char(
'a'+i);
375 for (
unsigned int r=1; r<dimR1; ++r) {
376 out <<
" , " << y[k][r][q] ;
384 template <
int d,
class F>
392 if (!m->next_ || !first)
402 if (m->
factor()>0 && !first)
425 for (
int i=0; i<d; ++i) {
428 else if (m->vecZ_[i]==1)
430 else if (m->vecZ_[i]>0)
431 out << char(
'a'+i) <<
"^" << m->vecZ_[i] <<
"";
432 else if (m->vecZ_[i]<0)
433 out << char(
'a'+i) <<
"^" << m->vecZ_[i] <<
"";
434 absVal += m->vecZ_[i];
435 if (absVal<m->absZ()) out <<
"";
459 template<
int dim,
class F>
471 return Field( 1, other );
476 return Field() / other;
482 template<
int dim,
class F >
494 template<
int dim,
class Field >
500 template<
int dim,
class Field >
bigunsignedint< k > operator*(const bigunsignedint< k > &x, std::uintmax_t y)
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
bigunsignedint< k > operator/(const bigunsignedint< k > &x, std::uintmax_t y)
bigunsignedint< k > operator-(const bigunsignedint< k > &x, std::uintmax_t y)
EnableIfInterOperable< T1, T2, bool >::type operator<(const RandomAccessIteratorFacade< T1, V1, R1, D > &lhs, const RandomAccessIteratorFacade< T2, V2, R2, D > &rhs)
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition field.hh:159
constexpr Base power(Base m, Exponent p)
A class representing the unit of a given Field.
Definition field.hh:30
A class representing the zero of a given Field.
Definition field.hh:79
Definition multiindex.hh:38
This operator+(const This &other) const
Definition multiindex.hh:249
int absOMZ() const
Definition multiindex.hh:273
~MultiIndex()
Definition multiindex.hh:87
This & operator-=(const This &other)
Definition multiindex.hh:208
MultiIndex(int, const This &other)
Definition multiindex.hh:60
static const int dimension
Definition multiindex.hh:44
int absZ() const
Definition multiindex.hh:265
int omz(int i) const
Definition multiindex.hh:96
This & operator+=(const This &other)
Definition multiindex.hh:185
bool operator==(const This &other) const
Definition multiindex.hh:141
bool sameMultiIndex(const This &ind)
Definition multiindex.hh:281
This & operator=(const This &other)
Definition multiindex.hh:105
MultiIndex(const This &other)
Definition multiindex.hh:74
This & operator*=(const F &f)
Definition multiindex.hh:148
const Field & factor() const
Definition multiindex.hh:100
This operator/(const F &f) const
Definition multiindex.hh:232
MultiIndex(const F &f)
Definition multiindex.hh:53
This & operator/=(const F &f)
Definition multiindex.hh:156
This operator*(const F &f) const
Definition multiindex.hh:226
void set(int d, int power=1)
Definition multiindex.hh:260
This operator-(const This &other) const
Definition multiindex.hh:254
int z(int i) const
Definition multiindex.hh:92
MultiIndex()
Definition multiindex.hh:46
Field field_type
Definition multiindex.hh:316
typename FieldTraits< field_type >::real_type real_type
Definition multiindex.hh:317
MultiIndex< dim, F > Field
Definition multiindex.hh:462
MultiIndex< dim, F > Field
Definition multiindex.hh:485