coeffIterator.hh

Go to the documentation of this file.
1 
6 #ifndef coeffIterator_hh
7 #define coeffIterator_hh
8 
9 #include "basics/typedefs.hh"
10 #include "basics/exceptions.hh"
12 #include "basics/debug.hh"
13 
14 // debugging
15 #define CoeffItIncrOp_D 0
16 
17 namespace concepts {
18 
19  // ********************************************************* CoeffIterator **
20 
37  template<typename F, typename Coeff>
39 
45  template<typename F>
46  class CoeffIterator<F, F> {
47  public:
48  CoeffIterator(const F* data) : data_(data) {}
49  const F* operator++() { return ++data_; }
50  inline const F* operator++(int) { return data_++; }
51  private:
52  const F* data_;
53  };
54 
60  template<typename F, uint dim>
61  class CoeffIterator<F, Point<F,dim> >
62  {
63  public:
65  CoeffIterator(const Point<F,dim>* data, int i = 0) : data_(data), i_(i) {}
67  inline const F* operator++();
69  inline const F* operator++(int);
71  inline const F* data();
72  private:
76  const int i_;
77  };
78 
79  template<typename F, uint dim>
80  const F* CoeffIterator<F, Point<F,dim> >::operator++()
81  {
82  ++data_;
83  DEBUGL(CoeffItIncrOp_D, '(' << i_ << ") is "
84  << *this->data() << " at " << this->data());
85  return this->data();
86  }
87 
88  template<typename F, uint dim>
89  const F* CoeffIterator<F, Point<F,dim> >::operator++(int)
90  {
91  const F* tmp = this->data();
92  ++data_;
93  return tmp;
94  }
95 
96  template<typename F, uint dim>
97  const F* CoeffIterator<F, Point<F,dim> >::data()
98  {
99  return &(data_->operator[](i_));
100  }
101 
107  template<typename F, uint dim>
108  class CoeffIterator<F, Mapping<F,dim> >
109  {
110  public:
112  CoeffIterator(const Mapping<F,dim>* data, uint i = 0, uint j = 0) :
113  data_(data), i_(i), j_(j) {}
115  inline const F* operator++();
117  inline const F* operator++(int);
119  inline const F* data();
120  private:
123  const uint i_;
124  const uint j_;
125  };
126 
127  template<typename F, uint dim>
128  const F* CoeffIterator<F, Mapping<F,dim> >::operator++()
129  {
130  ++data_;
131  DEBUGL(CoeffItIncrOp_D, '(' << i_ << ", " << j_ << ") is "
132  << *this->data() << " at " << this->data());
133  return this->data();
134  }
135 
136  template<typename F, uint dim>
137  const F* CoeffIterator<F, Mapping<F,dim> >::operator++(int)
138  {
139  const F* tmp = this->data();
140  ++data_;
141  return tmp;
142  }
143 
144  template<typename F, uint dim>
146  {
147  return &(data_->operator()(i_, j_));
148  }
149 
150 } // namespace
151 
152 #endif // coeffIterator_hh
Basic class for a 2D or 3D map.
Basic class for a Point or a vector.
CoeffIterator(const Mapping< F, dim > *data, uint i=0, uint j=0)
Constructor.
Iterator for an array of coefficients.
#define DEBUGL(doit, msg)
CoeffIterator(const Point< F, dim > *data, int i=0)
Constructor.
#define CoeffItIncrOp_D
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich