Chombo + EB  3.2
LoHiSide.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 _LOHISIDE_H_
12 #define _LOHISIDE_H_
13 #include "BaseNamespaceHeader.H"
14 
15 /// Encapsulation of high or low side.
16 /**
17  Encapsulation of high or low side.
18 */
19 class Side
20 {
21 public:
22  ///
23  /**
24  Lo is the low side.<br>
25  Hi is the high side.
26  */
27  enum LoHiSide
28  {
29  Invalid=-1,
30  Lo=0,
31  Hi,
33  };
34 
35  /**
36  Constructor.
37  */
38  Side()
39  {
40  }
41 
42  /**
43  Destructor.
44  */
46  {
47  }
48 
49  ///
50  /**
51  Returns the other side. That is, swap Hi for Lo and vice versa.
52  */
53  friend Side::LoHiSide flip(const Side::LoHiSide& a_side);
54 
55  ///
56  static Side::LoHiSide flip(const Side::LoHiSide& a_side);
57 
58  ///
59  /**
60  Returns -1 for Lo Side, +1 for Hi Side.
61  */
62  friend
63  int sign(const CH_XD::Side::LoHiSide& a_side);
64 };
65 
66 // needs a declaration outside the class (Stroustrup 11.5.1)
67 int sign(const CH_XD::Side::LoHiSide& a_side);
68 
69 /// Iterator for low and high side.
70 /**
71  SideIterator iterates over the values Side::Lo and Side::Hi.
72  There are no adjustable parameters whatsoever.
73 */
75 {
76 public:
77  ///
78  /**
79  Default, and only, constructor.
80  */
81  SideIterator();
82 
83  ///
84  /**
85  Default destructor.
86  */
88  {}
89 
90  /**
91  \name Modification functions
92  */
93  /*@{*/
94 
95  ///
96  /**
97  Set the iterator to the first side.
98  */
99  void begin();
100 
101  ///
102  /**
103  Set the iterator to the first side.
104  */
105  void reset()
106  {
107  begin();
108  }
109 
110  ///
111  /**
112  Advance the iterator to the next face.
113  */
114  void next();
115 
116  ///
117  /**
118  Advance the iterator to the next face.
119  */
120  void operator ++ ();
121 
122  /*@}*/
123 
124  /**
125  \name Access functions
126  */
127  /*@{*/
128 
129  ///
130  /**
131  Returns the value of the side for the current iteration.
132  */
133  CH_XD::Side::LoHiSide operator () () const;
134 
135  ///
136  /**
137  Returns <tt>true</tt> if there is a next side, <tt>false</tt> if not.
138  */
139  bool ok() const;
140 
141 
142 private:
144 };
145 
146 #include "BaseNamespaceFooter.H"
147 #endif
Encapsulation of high or low side.
Definition: LoHiSide.H:19
int m_current
Definition: LoHiSide.H:143
~SideIterator()
Definition: LoHiSide.H:87
Definition: LoHiSide.H:32
Definition: LoHiSide.H:29
Definition: LoHiSide.H:31
~Side()
Definition: LoHiSide.H:45
friend Side::LoHiSide flip(const Side::LoHiSide &a_side)
LoHiSide
Definition: LoHiSide.H:27
Side()
Definition: LoHiSide.H:38
friend int sign(const CH_XD::Side::LoHiSide &a_side)
Iterator for low and high side.
Definition: LoHiSide.H:74
void reset()
Definition: LoHiSide.H:105
Definition: LoHiSide.H:30