Chombo + EB  3.2
MomentIterator.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _MOMENTITERATOR_H_
12 #define _MOMENTITERATOR_H_
13 
14 #include "IndexedMoments.H"
15 
16 #include "NamespaceHeader.H"
17 
18 ///class to enable template containment
19 template <int D>
21 {
22 public:
23  ///
24  /**
25  */
27  {
28  }
29 
30  ///
32  {
33  }
34 
35  ///
36  virtual void reset() = 0;
37 
38  ///
39  virtual void operator++()= 0;
40 
41  ///
42  virtual const IndexTM<int, D>& operator () () const = 0;
43 
44  ///
45  virtual bool ok() = 0;
46 
47  virtual int size() const = 0;
48 
49 };
50 
51 ///iterates through the indices of a IndexedMoment
52 /**
53  MomentIterator iterates through the multi-indices of a IndexedMoments.
54 */
55 template <int D, int P>
57 {
58 public:
59  ///
60  /**
61  */
63  {
65  m_current = 0;
66  }
67 
68  ///
69  virtual ~MomentIterator()
70  {
71  }
72 
73  ///
74  virtual void reset()
75  {
76  m_current = 0;
77  }
78 
79  ///
80  virtual void operator ++ ()
81  {
82  m_current++;
83  }
84 
85  ///
86  /**
87  Returns the moment of the current multi-index of this MomentIterator.
88  */
89  virtual const IndexTM<int, D>& operator () () const
90  {
91  return (*m_indicies)[m_current];
92  }
93 
94  ///
95  /**
96  Returns true if this MomentIterator's location is within its IndexedMoment.
97  */
98  virtual bool ok()
99  {
100  bool retval = m_current < m_indicies->size();
101  return retval;
102  }
103 
104  virtual int size() const
105  {
106  return m_indicies->size();
107  }
108 protected:
109 
110 
111  /// points to the (static) powers that live in IndexedMoments
113 
114  ///
116 
117 
118 };
119 
120 #include "NamespaceFooter.H"
121 #endif
virtual bool ok()=0
virtual const IndexTM< int, D > & operator()() const =0
one dimensional dynamic array
Definition: Vector.H:53
class to enable template containment
Definition: MomentIterator.H:20
static const Vector< IndexTM< int, Dim > > & getMonomialPowers()
monomial powers
Definition: IndexedMoments.H:134
virtual void reset()
Definition: MomentIterator.H:74
virtual int size() const
Definition: MomentIterator.H:104
virtual const IndexTM< int, D > & operator()() const
Definition: MomentIterator.H:89
virtual int size() const =0
Definition: IndexTM.H:36
virtual void operator++()=0
const Vector< IndexTM< int, D > > * m_indicies
points to the (static) powers that live in IndexedMoments
Definition: MomentIterator.H:112
virtual void reset()=0
virtual ~MomentIterator()
Definition: MomentIterator.H:69
virtual ~BaseMomentIterator()
Definition: MomentIterator.H:31
iterates through the indices of a IndexedMoment
Definition: MomentIterator.H:56
int m_current
Definition: MomentIterator.H:115
BaseMomentIterator()
Definition: MomentIterator.H:26
virtual bool ok()
Definition: MomentIterator.H:98
size_t size() const
Definition: Vector.H:192
MomentIterator()
Definition: MomentIterator.H:62
virtual void operator++()
Definition: MomentIterator.H:80