Chombo + EB  3.0
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 
45  ///
46  void define(const EBISBox& a_ebisBox,
47  const Box& a_region, int a_nVar);
48 
49  ///
50  void setInvalidData(const Real& a_val,
51  const int& a_comp);
52 
53  ///
54  virtual ~EBCellFAB();
55 
56  ///
57  const FArrayBox& getFArrayBox() const;
58 
59  ///
60  /**
61  Does a dynamic cast of the BaseFab<Real>
62  to a FArrayBox for arithmetic purposes.
63  */
65 
66  ///
67  /**
68  Negate the values in all locations
69  */
70  EBCellFAB& negate(void);
71 
72  ///
73  /**
74  done over intersection of src, dst
75  Both fabs need the same ncomp
76  */
77  EBCellFAB& operator+=(const EBCellFAB& a_ebfab);
78 
79 
80  ///
81  /**
82  done over intersection of src, dst
83  */
84  EBCellFAB& plus(const EBCellFAB& a_ebfab,
85  int a_srccomp,
86  int a_destcomp,
87  int a_numcomp);
88  ///
89  /**
90  done over a_region
91  */
92  EBCellFAB& plus(const EBCellFAB& a_ebfab,
93  const Box& a_region,
94  int a_srccomp,
95  int a_destcomp,
96  int a_numcomp);
97 
98 
99  ///
100  /**
101  done over intersection of src, dst
102  Both fabs need the same ncomp
103  */
104  EBCellFAB& operator-=(const EBCellFAB& a_ebfab);
105 
106  ///
107  /**
108  done over intersection of src, dst
109  */
110  EBCellFAB& minus(const EBCellFAB& a_ebfab,
111  int a_srccomp,
112  int a_destcomp,
113  int a_numcomp);
114 
115  ///
116  /**
117  done over intersection of src, dst
118  Both fabs need the same ncomp
119  */
120  EBCellFAB& operator*=(const EBCellFAB& a_ebfab);
121 
122  ///
123  /**
124  done over intersection of src, dst
125  */
126  EBCellFAB& mult(const EBCellFAB& a_ebfab,
127  int a_srccomp,
128  int a_destcomp,
129  int a_numcomp);
130 
131 
132 
133  ///
134  /**
135  done over intersection of src, dst
136  Both fabs need the same ncomp
137  */
138  EBCellFAB& operator/=(const EBCellFAB& a_ebfab);
139 
140 
141  ///
142  /**
143  done over intersection of src, dst
144  */
145  EBCellFAB& divide(const EBCellFAB& a_ebfab,
146  int a_srccomp,
147  int a_destcomp,
148  int a_numcomp);
149 
150  ///
151  /**
152  */
153  EBCellFAB& operator+=(const Real& a_scalar);
154 
155  ///
156  /**
157  */
158  EBCellFAB& operator-=(const Real& a_scalar);
159 
160  ///
161  /**
162  */
163  EBCellFAB& operator*=(const Real& a_scalar);
164 
165  ///
166  /**
167  */
168  EBCellFAB& mult(Real a_scalar);
169 
170  ///
171  /**
172  */
173  EBCellFAB& operator/=(const Real& a_scalar);
174 
175  ///
176  /**
177  Current FAB += a_src FAB * a_scalar. Both fabs need the same ebisBox
178  and region.
179  */
180  EBCellFAB& plus(const EBCellFAB& a_src,
181  Real a_scalar);
182 
183  ///
184  /**
185  Current FAB = a_X FAB * a_A + a_Y FAB * a_B.
186  */
187  EBCellFAB& axby(const EBCellFAB& a_X, const EBCellFAB& a_Y,
188  const Real& a_A, const Real& a_B);
189 
190  ///
191  /**
192  Current FAB = a_X FAB * a_A + a_Y FAB * a_B.
193  */
194  EBCellFAB& axby(const EBCellFAB& a_X, const EBCellFAB& a_Y,
195  const Real& a_A, const Real& a_B,
196  const int& a_destComp,const int& a_xComp,const int& a_yComp);
197 
198  //! Returns the maximum value in the FAB for the given component.
199  Real max(int a_comp = 0) const;
200 
201  //! Returns the minimum value in the FAB for the given component.
202  Real min(int a_comp = 0) const;
203 
204  /// (Not implemented) Returns the Lp-norm of this EBCellFAB
205  /**
206  (Not implemented) Returns the Lp-norm of this EBCellFAB using components
207  (a_comp : a_comp + a_numcomp - 1). a_power < 0 -> ERROR.
208  a_power = 0 -> infinity norm (max norm).
209  a_power = 1 -> L1-norm
210  a_power > 1 -> Lp-norm
211  */
212  virtual Real norm(int a_power,
213  int a_comp,
214  int a_numComp) const;
215 
216  /// (Not implemented) Returns the Lp-norm of this EBCellFAB within a region
217  /**
218  (Not implemented) Returns the Lp-norm of this EBCellFAB using components
219  (a_comp : a_comp + a_numcomp - 1) and within the a_subbox. a_power < 0
220  -> ERROR.
221  a_power = 0 -> infinity norm (max norm).
222  a_power = 1 -> L1-norm
223  a_power > 1 -> Lp-norm
224  */
225  virtual Real norm(const Box& a_subbox,
226  int a_power,
227  int a_comp,
228  int a_numComp) const;
229 
230  /// (Not implemented) Returns a sum of powers of a subset of this EBCellFAB
231  /**
232  (Not implemented) Returns a sum of powers of a subset of this EBCellFAB,
233  specifically components a_comp to a_comp+a_numcomp-1 within a_subbox.
234  a_power >= 2 only.
235 
236  */
237  virtual Real sumPow(const Box& a_subbox,
238  int a_power,
239  int a_comp,
240  int a_numComp) const;
241 
242  /// (Not implemented) Return the dot product of this EBCellFAB with another
243  /**
244  (Not implemented) Return the dot product of this EBCellFAB and "ebfab2"
245  over their overlap region and all components.
246  */
247  Real dotProduct(const EBCellFAB& ebfab2) const;
248 
249  //needed for leveldata to compile
250  //but very invalid
251  EBCellFAB(const Box& a_region, int a_nComp)
252  {
253  MayDay::Error("ebcelfab 1 invalid operator");
254  }
255 
256  /// good for making temps.
257  void clone(const EBCellFAB& a_arg);
258 
259 private:
260  //disallowed for all the usual reasons
261  EBCellFAB(const EBCellFAB& ebcin)
262  {
263  MayDay::Error("ebcellfab 2 invalid operator");
264  }
265  void operator=(const EBCellFAB& fabin)
266  {
267  MayDay::Error("ebcellfab 3 invalid operator");
268  }
269 
270 };
271 
272 void writeVectorLevelName(const Vector<LevelData<EBCellFAB>*>*, Vector<int>* ref, const char*);
273 
274 #include "NamespaceFooter.H"
275 #endif
Real max(int a_comp=0) const
Returns the maximum value in the FAB for the given component.
void writeVectorLevelName(const Vector< LevelData< EBCellFAB > *> *, Vector< int > *ref, const char *)
void clone(const EBCellFAB &a_arg)
good for making temps.
one dimensional dynamic array
Definition: Vector.H:52
const FArrayBox & getFArrayBox() const
EBCellFAB & operator/=(const EBCellFAB &a_ebfab)
EBCellFAB & operator-=(const EBCellFAB &a_ebfab)
Definition: EBISBox.H:46
Real min(int a_comp=0) const
Returns the minimum value in the FAB for the given component.
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)
void operator=(const EBCellFAB &fabin)
Definition: EBCellFAB.H:265
Definition: EBCellFAB.H:29
void setInvalidData(const Real &a_val, const int &a_comp)
double Real
Definition: REAL.H:33
Array defined at the VolIndexs of an Box in an EBIS.
Definition: BaseEBCellFAB.H:40
Real dotProduct(const EBCellFAB &ebfab2) const
(Not implemented) Return the dot product of this EBCellFAB with another
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:465
EBCellFAB & minus(const EBCellFAB &a_ebfab, int a_srccomp, int a_destcomp, int a_numcomp)
Definition: FArrayBox.H:44
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
EBCellFAB & mult(const EBCellFAB &a_ebfab, int a_srccomp, int a_destcomp, int a_numcomp)
EBCellFAB(const Box &a_region, int a_nComp)
Definition: EBCellFAB.H:251
virtual Real norm(int a_power, int a_comp, int a_numComp) const
(Not implemented) Returns the Lp-norm of this EBCellFAB
EBCellFAB & plus(const EBCellFAB &a_ebfab, int a_srccomp, int a_destcomp, int a_numcomp)
EBCellFAB & operator*=(const EBCellFAB &a_ebfab)
virtual ~EBCellFAB()
EBCellFAB(const EBCellFAB &ebcin)
Definition: EBCellFAB.H:261