Proto
Proto_LevelIterators.H
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 #ifndef Proto_LEVELITERATORS_H_
11 #define Proto_LEVELITERATORS_H_
12 #include <vector>
13 #include "Proto.H"
14 #include "Proto_DataIndex.H"
15 #include "Proto_DisjointBoxLayout.H"
16 
17 namespace Proto
18 {
20  {
21  protected:
22 
23  DisjointBoxLayout m_dbl;
24  DataIndex m_current;
25  DataIndex m_end;
26 
27  public:
28 
29  inline DataIterator(const DisjointBoxLayout& a_dbl);
30  inline DataIterator& begin();
31  inline DataIndex& end(){return m_end;};
32  inline bool ok();
33  inline DataIterator& operator++();
35  inline const DataIndex& operator*() const;
37  inline Point point() const;
39  inline Box box() const;
40  };
42  {
43  protected:
44 
45  DisjointBoxLayout m_dbl;
46  Box m_bx;
47  BoxIterator m_bxit;
48  Point m_shift;
49  DataIndex m_current;
50  DataIndex m_end;
51  ProblemDomain m_dProbC;
52 
53  public:
54 
56  //NeighborIterator();
57  inline NeighborIterator(const DisjointBoxLayout& a_dbl, const Box& a_bx);
58  //~NeighborIterator();
59 
61  inline NeighborIterator& begin();
62  inline const DataIndex& end() const{return m_end;};
63  inline bool ok() const {return (m_current != m_end);}
64  inline NeighborIterator& operator++();
65 
67  inline const DataIndex& operator*() const{return m_current;};
69  inline Point point() const;
71  inline Box srcBox() const;
73  inline Box destBox() const;
75  inline Point shift();
76  // Processor ID for current iterate.
77  inline int procID(){return m_dbl.procID(m_current);};
78  };
79 #if 0
80 
87  class FineFRIterator
88  {
89  public:
91  FineFRIterator(const DataIndex& a_fineIndex,
92  const Point& a_refRatio);
93  ~FineFRIterator();
94 
96  inline void begin();
97  inline DataIndex end();
98  inline void operator++();
100  inline DataIndex operator*{return m_fineIndex;};
101 
103  inline Point operator();
104 
106  inline Box box();
107 
109  inline Point srcShift();
110  protected:
111  DataIndex m_fineIndex;
112  pair<int,int> m_currentRegister;
113  //first element is 0 or 1 (LoHiSide), second element is dir.
114  };
116  class CoarseFRIterator
117  {
118  public:
120  CoarseFRIterator(const& a_DisjointBoxLayout m_fineDBL,
121  const DataIndex& a_coarseDit,
122  const Point& a_refRatio);
123  ~CoarseFRIterator();
124  void begin();
125  bool end();
126  void operator++();
127  DataIndex operator();
128  Box box();
129  Point srcShift();
130  DataIndex fromIndex();
131  protected:
132  DataIndex m_coarseDit;
133  DisjointBoxlayout m_fine;
134  pair<LoHiSide,int> m_currentRegisterSet;
135  BoxIterator m_bxit;
136  // For each LoHiSide, direction, we iterate over a box corresponding to the
137  // fine boxes coarsened to single Points inside the coarse box.
138  }
139 #endif
140 #include "implem/Proto_LevelIteratorsImplem.H"
141 } // end Proto namespace.
142 #endif
143 
Definition: Proto_LevelIterators.H:41
const DataIndex & operator*() const
Dereference operator returns the DataIndex corresponding to the current iterate.
Definition: Proto_LevelIterators.H:67
Iterator for Boxes.
Definition: Proto_Box.H:863
Definition: Proto_LevelIterators.H:19
Disjoint Box Layout.
Definition: Proto_DisjointBoxLayout.H:37
An interval in DIM dimensional space.
Definition: Proto_Box.H:26
int procID()
local process ID
Definition: Proto_SPMD.H:52
Point point() const
Returns the Point corresponding to the Box for that index. Undefined if invalid.
Definition: Proto_LevelIterators.H:149
const DataIndex & operator*() const
Dereference returns a DataIndex.
Definition: Proto_LevelIterators.H:131
Definition: Proto_Box.H:11
Integer Valued Vector.
Definition: Proto_Point.H:21
Definition: Proto_DataIndex.H:17
Box box() const
Returns the Box corresponding to that index. Undefined if invalid.
Definition: Proto_LevelIterators.H:138
int procID(const DataIndex &a_index) const
Get Process ID.
Definition: Proto_DisjointBoxLayout.H:121
Represents a rectangular domain over which a problem can be defined, including periodic images...
Definition: Proto_ProblemDomain.H:22