Chombo + EB + MF  3.2
EBCellFAB.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 // ANAG, LBNL
12 
13 #ifndef _EBCELLFAB_H_
14 #define _EBCELLFAB_H_
15 
16 #include <cmath>
17 #include <cstdlib>
18 #include "SPACE.H"
19 #include "BaseEBCellFAB.H"
20 #include "FArrayBox.H"
21 #include "EBISBox.H"
22 #include "Box.H"
23 #include "NamespaceHeader.H"
24 ///
25 /**
26  EBCellFAB is a BaseEBCellFAB<Real>
27  which includes arithmetic functions.
28  */
29 class EBCellFAB: public BaseEBCellFAB<Real>
30 {
31 public:
32  static bool s_verbose;
33  ///
34  EBCellFAB();
35 
36  ///
37  /**
38  Box going into this needs to be cell-centered.
39  Data will exist over the surrounding nodes of the box.
40  */
41  EBCellFAB(const EBISBox& a_ebisBox,
42  const Box& a_region, int a_nVar);
43 
44  ///aliasing constructor
45  EBCellFAB(const Interval& a_comps,
46  EBCellFAB& a_original):BaseEBCellFAB<Real>(a_comps, a_original){ ;}
47 
48 
49  ///
50  void define(const EBISBox& a_ebisBox,
51  const Box& a_region, int a_nVar);
52 
53 
54  ///
55  virtual ~EBCellFAB();
56 
57  ///
58  const FArrayBox& getFArrayBox() const;
59 
60 
61  ///
62  /**
63  Does a dynamic cast of the BaseFab<Real>
64  to a FArrayBox for arithmetic purposes.
65  */
67 
68  ///
70  {
71  return m_irrFAB;
72  }
73 
74  ///
76  {
77  return m_irrFAB;
78  }
79  ///
80  /**
81  Negate the values in all locations
82  */
83  EBCellFAB& negate(void);
84 
85  ///
86  /**
87  done over intersection of src, dst
88  Both fabs need the same ncomp
89  */
90  EBCellFAB& operator+=(const EBCellFAB& a_ebfab);
91 
92 
93  ///
94  /**
95  done over intersection of src, dst
96  */
97  EBCellFAB& plus(const EBCellFAB& a_ebfab,
98  int a_srccomp,
99  int a_destcomp,
100  int a_numcomp);
101  ///
102  /**
103  done over a_region
104  */
105  EBCellFAB& plus(const EBCellFAB& a_ebfab,
106  const Box& a_region,
107  int a_srccomp,
108  int a_destcomp,
109  int a_numcomp);
110 
111 
112  ///
113  /**
114  done over intersection of src, dst
115  Both fabs need the same ncomp
116  */
117  EBCellFAB& operator-=(const EBCellFAB& a_ebfab);
118 
119  ///
120  /**
121  done over intersection of src, dst
122  */
123  EBCellFAB& minus(const EBCellFAB& a_ebfab,
124  int a_srccomp,
125  int a_destcomp,
126  int a_numcomp);
127 
128  ///
129  /**
130  done over intersection of src, dst
131  Both fabs need the same ncomp
132  */
133  EBCellFAB& operator*=(const EBCellFAB& a_ebfab);
134 
135  ///
136  /**
137  done over intersection of src, dst
138  */
139  EBCellFAB& mult(Real a_value,
140  int a_srccomp,
141  int a_numcomp);
142 
143 
144 
145  EBCellFAB& mult(const EBCellFAB& a_src,
146  int a_srccomp,
147  int a_destcomp,
148  int a_numcomp);
149  ///
150  /**
151  done over intersection of src, dst
152  Both fabs need the same ncomp
153  */
154  EBCellFAB& operator/=(const EBCellFAB& a_ebfab);
155 
156 
157  ///
158  /**
159  done over intersection of src, dst
160  */
161  EBCellFAB& divide(const EBCellFAB& a_ebfab,
162  int a_srccomp,
163  int a_destcomp,
164  int a_numcomp);
165 
166  ///
167  /**
168  */
169  EBCellFAB& operator+=(const Real& a_scalar);
170 
171  ///
172  /**
173  */
174  EBCellFAB& operator-=(const Real& a_scalar);
175 
176  ///
177  /**
178  */
179  EBCellFAB& operator*=(const Real& a_scalar);
180 
181  ///
182  /**
183  */
184  EBCellFAB& mult(Real a_scalar);
185 
186  ///
187  /**
188  */
189  EBCellFAB& operator/=(const Real& a_scalar);
190 
191  ///
192  /**
193  Current FAB += a_src FAB * a_scalar. Both fabs need the same ebisBox
194  and region.
195  */
196  EBCellFAB& plus(const EBCellFAB& a_src,
197  Real a_scalar);
198 
199  ///
200  /**
201  Current FAB = a_X FAB * a_A + a_Y FAB * a_B.
202  */
203  EBCellFAB& axby(const EBCellFAB& a_X, const EBCellFAB& a_Y,
204  const Real& a_A, const Real& a_B);
205 
206  ///
207  /**
208  Current FAB = a_X FAB * a_A + a_Y FAB * a_B.
209  */
210  // EBCellFAB& axby(const EBCellFAB& a_X, const EBCellFAB& a_Y,
211  // const Real& a_A, const Real& a_B,
212  // const int& a_destComp,const int& a_xComp,const int& a_yComp);
213 
214  //! Returns the maximum value in the FAB for the given component.
215  Real max(int a_comp = 0) const;
216 
217  //! Returns the minimum value in the FAB for the given component.
218  Real min(int a_comp = 0) const;
219 
220  /// (Not implemented) Returns the Lp-norm of this EBCellFAB
221  /**
222  (Not implemented) Returns the Lp-norm of this EBCellFAB using components
223  (a_comp : a_comp + a_numcomp - 1). a_power < 0 -> ERROR.
224  a_power = 0 -> infinity norm (max norm).
225  a_power = 1 -> L1-norm
226  a_power > 1 -> Lp-norm
227  */
228  virtual Real norm(int a_power,
229  int a_comp,
230  int a_numComp) const;
231 
232  /// (Not implemented) Returns the Lp-norm of this EBCellFAB within a region
233  /**
234  (Not implemented) Returns the Lp-norm of this EBCellFAB using components
235  (a_comp : a_comp + a_numcomp - 1) and within the a_subbox. a_power < 0
236  -> ERROR.
237  a_power = 0 -> infinity norm (max norm).
238  a_power = 1 -> L1-norm
239  a_power > 1 -> Lp-norm
240  */
241  virtual Real norm(const Box& a_subbox,
242  int a_power,
243  int a_comp,
244  int a_numComp) const;
245 
246  /// (Not implemented) Returns a sum of powers of a subset of this EBCellFAB
247  /**
248  (Not implemented) Returns a sum of powers of a subset of this EBCellFAB,
249  specifically components a_comp to a_comp+a_numcomp-1 within a_subbox.
250  a_power >= 2 only.
251 
252  */
253  virtual Real sumPow(const Box& a_subbox,
254  int a_power,
255  int a_comp,
256  int a_numComp) const;
257 
258  /// (Not implemented) Return the dot product of this EBCellFAB with another
259  /**
260  (Not implemented) Return the dot product of this EBCellFAB and "ebfab2"
261  over their overlap region and all components.
262  */
263  Real dotProduct(const EBCellFAB& ebfab2) const;
264 
265  //needed for leveldata to compile
266  //but very invalid
267  EBCellFAB(const Box& a_region, int a_nComp)
268  {
269  MayDay::Error("ebcelfab 1 invalid operator");
270  }
271 
272  /// good for making temps.
273  void clone(const EBCellFAB& a_arg);
274 
275  virtual void setCoveredCellVal(const Real& a_val,
276  const int& a_comp,
277  const bool& a_doMulti=true);
278 private:
279  //disallowed for all the usual reasons
280  EBCellFAB(const EBCellFAB& ebcin)
281  {
282  MayDay::Error("ebcellfab 2 invalid operator");
283  }
284  void operator=(const EBCellFAB& fabin)
285  {
286  MayDay::Error("ebcellfab 3 invalid operator");
287  }
288 
289 };
290 
291 void writeVectorLevelName(const Vector<LevelData<EBCellFAB>*>*, Vector<int>* ref, const char*);
292 
293 #include "NamespaceFooter.H"
294 #endif
void clone(const EBCellFAB &a_arg)
good for making temps.
Real max(int a_comp=0) const
Returns the maximum value in the FAB for the given component.
one dimensional dynamic array
Definition: Vector.H:53
EBCellFAB & operator/=(const EBCellFAB &a_ebfab)
EBCellFAB & operator-=(const EBCellFAB &a_ebfab)
EBCellFAB(const Interval &a_comps, EBCellFAB &a_original)
aliasing constructor
Definition: EBCellFAB.H:45
Definition: EBISBox.H:46
EBCellFAB & divide(const EBCellFAB &a_ebfab, int a_srccomp, int a_destcomp, int a_numcomp)
void define(const EBISBox &a_ebisBox, const Box &a_region, int a_nVar)
EBCellFAB & negate(void)
static bool s_verbose
Definition: EBCellFAB.H:32
EBCellFAB & axby(const EBCellFAB &a_X, const EBCellFAB &a_Y, const Real &a_A, const Real &a_B)
EBCellFAB & operator+=(const EBCellFAB &a_ebfab)
Structure for passing component ranges in code.
Definition: Interval.H:23
void operator=(const EBCellFAB &fabin)
Definition: EBCellFAB.H:284
Definition: EBCellFAB.H:29
double Real
Definition: REAL.H:33
Real dotProduct(const EBCellFAB &ebfab2) const
(Not implemented) Return the dot product of this EBCellFAB with another
Array defined at the VolIndexs of an Box in an EBIS.
Definition: BaseEBCellFAB.H:40
MiniIVFAB< Real > m_irrFAB
data at multi-valued cells
Definition: BaseEBCellFAB.H:259
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
void writeVectorLevelName(const Vector< LevelData< EBCellFAB > * > *, Vector< int > *ref, const char *)
virtual void setCoveredCellVal(const Real &a_val, const int &a_comp, const bool &a_doMulti=true)
virtual Real sumPow(const Box &a_subbox, int a_power, int a_comp, int a_numComp) const
(Not implemented) Returns a sum of powers of a subset of this EBCellFAB
virtual Real norm(int a_power, int a_comp, int a_numComp) const
(Not implemented) Returns the Lp-norm of this EBCellFAB
EBCellFAB & minus(const EBCellFAB &a_ebfab, int a_srccomp, int a_destcomp, int a_numcomp)
Definition: FArrayBox.H:45
MiniIVFAB< Real > & getMultiValuedFAB()
Definition: EBCellFAB.H:69
EBCellFAB(const Box &a_region, int a_nComp)
Definition: EBCellFAB.H:267
EBCellFAB & plus(const EBCellFAB &a_ebfab, int a_srccomp, int a_destcomp, int a_numcomp)
EBCellFAB & mult(Real a_value, int a_srccomp, int a_numcomp)
EBCellFAB & operator*=(const EBCellFAB &a_ebfab)
Real min(int a_comp=0) const
Returns the minimum value in the FAB for the given component.
const FArrayBox & getFArrayBox() const
virtual ~EBCellFAB()
EBCellFAB(const EBCellFAB &ebcin)
Definition: EBCellFAB.H:280
const MiniIVFAB< Real > & getMultiValuedFAB() const
Definition: EBCellFAB.H:75