Chombo + EB  3.2
EBFluxRegister.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 _EBFLUXREGISTER_H_
12 #define _EBFLUXREGISTER_H_
13 
14 #include "REAL.H"
15 #include "Vector.H"
16 #include "EBCellFAB.H"
17 #include "EBFaceFAB.H"
18 #include "EBISLayout.H"
19 #include "EBISBox.H"
20 #include "IntVectSet.H"
21 #include "CFStencil.H"
22 #include "LoHiSide.H"
23 #include "LevelData.H"
24 #include "LayoutData.H"
25 #include "EBFastFR.H"
26 #include "NamespaceHeader.H"
27 class EBIndexSpace;
28 
29 class EBCoarToFineRedist;
30 class EBCoarToCoarRedist;
31 
32 ///EBFluxRegister-A class to encapsulate a levels worth of flux registers.
33 /**
34  A EBFluxRegister handles all the data choreography
35  necessary to create a levels worth of flux registers.
36  */
37 class EBFluxRegister: public EBFastFR
38 {
39 public:
40 
41  ///
42  /**
43  Default constructor. Leaves object undefined.
44  */
46  {;}
47 
48  ///
49  /**
50  Full constructor. Calls the define function which creates
51  a levels worth of flux registers.
52  */
53  EBFluxRegister(const DisjointBoxLayout& a_dblFine,
54  const DisjointBoxLayout& a_dblCoar,
55  const EBISLayout& a_ebislFine,
56  const EBISLayout& a_ebislCoar,
57  const Box& a_domainCoar,
58  const int& a_nref,
59  const int& a_nvar,
60  const EBIndexSpace* ebisPtr,
61  bool a_forceNoEBCF = false);
62 
63  ///
64  virtual ~EBFluxRegister();
65 
66  ///
67  /**
68  Full define function. Creates a levels worth of flux registers.
69  */
70  void
71  define(const DisjointBoxLayout& a_dblFine,
72  const DisjointBoxLayout& a_dblCoar,
73  const EBISLayout& a_ebislFine,
74  const EBISLayout& a_ebislCoar,
75  const ProblemDomain& a_domainCoar,
76  const int& a_nref,
77  const int& a_nvar,
78  const EBIndexSpace* ebisPtr,
79  bool a_forceNoEBCF = false);
80 
81 
82 
83  ///
84  /**
85  increments the register with data from coarseFlux, multiplied by scale.
86  Increment coarse buffer with the area-weighted sum
87  of the fluxes on the faces.
88  buf += -scale*sum(areaFrac*flux)
89  CoarseFlux must contain the coarse fluxes in the dir direction
90  for the grid m_coarseLayout[coarseDataIndex].
91  */
92  void
93  incrementCoarseRegular(const EBFaceFAB& a_coarseFlux,
94  const Real& a_scale,
95  const DataIndex& a_coarseDataIndex,
96  const Interval& a_variables,
97  const int& a_dir)
98  {
99  for (SideIterator sit; sit.ok(); ++sit)
100  {
101  incrementCoarRegul(a_coarseFlux,
102  a_scale,
103  a_coarseDataIndex,
104  a_variables,
105  a_dir, sit());
106  }
107  }
108 
109 
110  void incrementCoarse(const EBFaceFAB& a_coarseFlux,
111  const Real& a_scale,
112  const DataIndex& a_coarseDataIndex,
113  const Interval& a_varSrc,
114  const Interval& a_varDst,
115  const int& a_dir)
116  {
117  CH_assert(a_varSrc==a_varDst);
118  for (SideIterator sit; sit.ok(); ++sit)
119  {
120  incrementCoarseBoth(a_coarseFlux, a_scale, a_coarseDataIndex, a_varSrc, a_dir, sit());
121  }
122  }
123 
124 
125  ///
126  /**
127  increments the register with data from coarseFlux, multiplied by scale.
128  Increment coarse buffer with the area-weighted sum
129  of the fluxes on the faces.
130  buf += -scale*sum(areaFrac*flux)
131  CoarseFlux must contain the coarse fluxes in the dir direction
132  for the grid m_coarseLayout[coarseDataIndex].
133  */
134  void
135  incrementCoarseIrregular(const BaseIFFAB<Real>& a_coarseFlux,
136  const Real& a_scale,
137  const DataIndex& a_coarseDataIndex,
138  const Interval& a_variables,
139  const int& a_dir);
140 
141  ///
142  /**
143  For when you have an EBFaceFAB lying around instead of a BaseIFFAB
144  */
145  void incrementCoarseIrregular(const EBFaceFAB& a_coarFlux,
146  const Real& a_scale,
147  const DataIndex& a_coarDatInd,
148  const Interval& a_variables,
149  const int& a_dir)
150  {
151  for (SideIterator sit; sit.ok(); ++sit)
152  {
153  incrementCoarIrreg(a_coarFlux,
154  a_scale,
155  a_coarDatInd,
156  a_variables,
157  a_dir,
158  sit());
159  }
160 
161  }
162 
163  ///
164  /**
165  increments the register with data from fineFlux, multiplied by scale.
166  fineFlux must contain the coarse fluxes in the dir direction
167  for the grid m_fineLayout[fineDataIndex].
168  This operation is local.
169  */
170  void
171  incrementFineRegular(const EBFaceFAB& a_fineFlux,
172  const Real& a_scale,
173  const DataIndex& a_fineDataIndex,
174  const Interval& a_variables,
175  const int& a_dir,
176  const Side::LoHiSide& a_sd)
177  {
178  incrementFineRegul(a_fineFlux,
179  a_scale,
180  a_fineDataIndex,
181  a_variables,
182  a_dir,
183  a_sd);
184  }
185 
186 
187  void
188  incrementFine(const EBFaceFAB& a_fineFlux,
189  const Real& a_scale,
190  const DataIndex& a_fineDataIndex,
191  const Interval& a_varSrc,
192  const Interval& a_varDst,
193  const int& a_dir)
194  {
195  CH_assert(a_varSrc == a_varDst);
196  for (SideIterator sit; sit.ok(); ++sit)
197  {
198  incrementFineBoth(a_fineFlux, a_scale, a_fineDataIndex, a_varSrc, a_dir, sit());
199  }
200  }
201 
202 
203 
204 
205 
206  ///
207  /**
208  increments the register with data from fineFlux, multiplied by scale.
209  fineFlux must contain the coarse fluxes in the dir direction
210  for the grid m_fineLayout[fineDataIndex].
211  This operation is local.
212  */
213  void
214  incrementFineIrregular(const BaseIFFAB<Real>& a_fineFlux,
215  const Real& a_scale,
216  const DataIndex& a_fineDataIndex,
217  const Interval& a_variables,
218  const int& a_dir,
219  const Side::LoHiSide& a_sd);
220 
221  ///
222  /**
223  For when you have a EBFaceFAB lying around instead of a BaseIFFAB
224  */
225  void
227  const Real& a_scale,
228  const DataIndex& a_fineDataIndex,
229  const Interval& a_variables,
230  const int& a_dir,
231  const Side::LoHiSide& a_sd)
232  {
233  incrementFineIrreg(a_fineFlux,
234  a_scale,
235  a_fineDataIndex,
236  a_variables,
237  a_dir,
238  a_sd);
239  }
240 
241 
242 
243  ///
244  /**
245  Increments redistribution register with left-over mass
246  from reflux divergence.
247  */
249  const Interval& a_variables,
250  const Real& a_scale);
251 
252  ///
253  /**
254  Increments redistribution register with left-over mass
255  from reflux divergence.
256  */
258  const Interval& a_variables,
259  const Real& a_scale);
260 
261 
262  ///
263  bool isDefined() const;
264 
265 protected:
266 
267 
268 private:
269  //returns true if a_src contains any cells
270  bool
271  copyBIFFToEBFF(EBFaceFAB& a_dst,
272  const BaseIFFAB<Real>& a_src,
273  const Box & a_box,
274  const EBISBox& a_ebisBox);
275 
276  //for all the usual reasons,
277  //there is no copy constructor for this class
278  //and there is no operator= for this class
279  //(there is no rule six).
281  {
282  MayDay::Error("invalid operator");
283  }
285  {
286  MayDay::Error("invalid operator");
287  }
288 };
289 #include "NamespaceFooter.H"
290 #endif
EBFastFR-A class to encapsulate a levels worth of flux registers.
Definition: EBFastFR.H:39
void incrementFineRegular(const EBFaceFAB &a_fineFlux, const Real &a_scale, const DataIndex &a_fineDataIndex, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
Definition: EBFluxRegister.H:171
bool ok() const
#define CH_assert(cond)
Definition: CHArray.H:37
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: EBIndexSpace.H:50
void incrementFineIrregular(const BaseIFFAB< Real > &a_fineFlux, const Real &a_scale, const DataIndex &a_fineDataIndex, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
Definition: EBISBox.H:46
void incrementRedistRegister(EBCoarToFineRedist &a_register, const Interval &a_variables, const Real &a_scale)
EBFluxRegister()
Definition: EBFluxRegister.H:45
Coarse to fine redistribution class.
Definition: EBCoarToFineRedist.H:35
Definition: EBFaceFAB.H:28
Structure for passing component ranges in code.
Definition: Interval.H:23
virtual void incrementCoarseBoth(const EBFaceFAB &a_coarseFlux, const Real &a_scale, const DataIndex &a_coarseDataIndex, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
virtual void incrementFineBoth(const EBFaceFAB &a_fineFlux, const Real &a_scale, const DataIndex &a_fineDataIndex, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
double Real
Definition: REAL.H:33
Definition: EBCoarToCoarRedist.H:36
void incrementFineRegul(const EBFaceFAB &a_fineFlux, const Real &a_newScale, const DataIndex &a_fineDatInd, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
bool isDefined() const
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void incrementCoarRegul(const EBFaceFAB &a_coarFlux, const Real &a_scale, const DataIndex &a_coarDatInd, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
LoHiSide
Definition: LoHiSide.H:27
EBFluxRegister(const EBFluxRegister &)
Definition: EBFluxRegister.H:284
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.
virtual ~EBFluxRegister()
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
Iterator for low and high side.
Definition: LoHiSide.H:74
void incrementCoarseRegular(const EBFaceFAB &a_coarseFlux, const Real &a_scale, const DataIndex &a_coarseDataIndex, const Interval &a_variables, const int &a_dir)
Definition: EBFluxRegister.H:93
void incrementCoarseIrregular(const BaseIFFAB< Real > &a_coarseFlux, const Real &a_scale, const DataIndex &a_coarseDataIndex, const Interval &a_variables, const int &a_dir)
Definition: DataIndex.H:112
Definition: BaseIFFAB.H:34
void define(const DisjointBoxLayout &a_dblFine, const DisjointBoxLayout &a_dblCoar, const EBISLayout &a_ebislFine, const EBISLayout &a_ebislCoar, const ProblemDomain &a_domainCoar, const int &a_nref, const int &a_nvar, const EBIndexSpace *ebisPtr, bool a_forceNoEBCF=false)
void operator=(const EBFluxRegister &)
Definition: EBFluxRegister.H:280
void incrementCoarse(const EBFaceFAB &a_coarseFlux, const Real &a_scale, const DataIndex &a_coarseDataIndex, const Interval &a_varSrc, const Interval &a_varDst, const int &a_dir)
Definition: EBFluxRegister.H:110
void incrementCoarseIrregular(const EBFaceFAB &a_coarFlux, const Real &a_scale, const DataIndex &a_coarDatInd, const Interval &a_variables, const int &a_dir)
Definition: EBFluxRegister.H:145
bool copyBIFFToEBFF(EBFaceFAB &a_dst, const BaseIFFAB< Real > &a_src, const Box &a_box, const EBISBox &a_ebisBox)
Definition: EBISLayout.H:39
void incrementFineIrreg(const EBFaceFAB &a_fineFlux, const Real &a_newScale, const DataIndex &a_fineDatInd, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
void incrementFineIrregular(const EBFaceFAB &a_fineFlux, const Real &a_scale, const DataIndex &a_fineDataIndex, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)
Definition: EBFluxRegister.H:226
void incrementFine(const EBFaceFAB &a_fineFlux, const Real &a_scale, const DataIndex &a_fineDataIndex, const Interval &a_varSrc, const Interval &a_varDst, const int &a_dir)
Definition: EBFluxRegister.H:188
EBFluxRegister-A class to encapsulate a levels worth of flux registers.
Definition: EBFluxRegister.H:37
void incrementCoarIrreg(const EBFaceFAB &a_coarFlux, const Real &a_scale, const DataIndex &a_coarDatInd, const Interval &a_variables, const int &a_dir, const Side::LoHiSide &a_sd)