Chombo + EB  3.0
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 
62  ///
63  virtual ~EBFluxRegister();
64 
65  ///
66  /**
67  Full define function. Creates a levels worth of flux registers.
68  */
69  void
70  define(const DisjointBoxLayout& a_dblFine,
71  const DisjointBoxLayout& a_dblCoar,
72  const EBISLayout& a_ebislFine,
73  const EBISLayout& a_ebislCoar,
74  const ProblemDomain& a_domainCoar,
75  const int& a_nref,
76  const int& a_nvar,
77  const EBIndexSpace* ebisPtr);
78 
79 
80  ///
81  /**
82  increments the register with data from coarseFlux, multiplied by scale.
83  Increment coarse buffer with the area-weighted sum
84  of the fluxes on the faces.
85  buf += -scale*sum(areaFrac*flux)
86  CoarseFlux must contain the coarse fluxes in the dir direction
87  for the grid m_coarseLayout[coarseDataIndex].
88  */
89  void
90  incrementCoarseRegular(const EBFaceFAB& a_coarseFlux,
91  const Real& a_scale,
92  const DataIndex& a_coarseDataIndex,
93  const Interval& a_variables,
94  const int& a_dir)
95  {
96  for (SideIterator sit; sit.ok(); ++sit)
97  {
98  incrementCoarRegul(a_coarseFlux,
99  a_scale,
100  a_coarseDataIndex,
101  a_variables,
102  a_dir, sit());
103  }
104  }
105 
106 
107  void incrementCoarse(const EBFaceFAB& a_coarseFlux,
108  const Real& a_scale,
109  const DataIndex& a_coarseDataIndex,
110  const Interval& a_varSrc,
111  const Interval& a_varDst,
112  const int& a_dir)
113  {
114  CH_assert(a_varSrc==a_varDst);
115  for (SideIterator sit; sit.ok(); ++sit)
116  {
117  incrementCoarseBoth(a_coarseFlux, a_scale, a_coarseDataIndex, a_varSrc, a_dir, sit());
118  }
119  }
120 
121 
122  ///
123  /**
124  increments the register with data from coarseFlux, multiplied by scale.
125  Increment coarse buffer with the area-weighted sum
126  of the fluxes on the faces.
127  buf += -scale*sum(areaFrac*flux)
128  CoarseFlux must contain the coarse fluxes in the dir direction
129  for the grid m_coarseLayout[coarseDataIndex].
130  */
131  void
132  incrementCoarseIrregular(const BaseIFFAB<Real>& a_coarseFlux,
133  const Real& a_scale,
134  const DataIndex& a_coarseDataIndex,
135  const Interval& a_variables,
136  const int& a_dir);
137 
138  ///
139  /**
140  For when you have an EBFaceFAB lying around instead of a BaseIFFAB
141  */
142  void incrementCoarseIrregular(const EBFaceFAB& a_coarFlux,
143  const Real& a_scale,
144  const DataIndex& a_coarDatInd,
145  const Interval& a_variables,
146  const int& a_dir)
147  {
148  for (SideIterator sit; sit.ok(); ++sit)
149  {
150  incrementCoarIrreg(a_coarFlux,
151  a_scale,
152  a_coarDatInd,
153  a_variables,
154  a_dir,
155  sit());
156  }
157 
158  }
159 
160  ///
161  /**
162  increments the register with data from fineFlux, multiplied by scale.
163  fineFlux must contain the coarse fluxes in the dir direction
164  for the grid m_fineLayout[fineDataIndex].
165  This operation is local.
166  */
167  void
168  incrementFineRegular(const EBFaceFAB& a_fineFlux,
169  const Real& a_scale,
170  const DataIndex& a_fineDataIndex,
171  const Interval& a_variables,
172  const int& a_dir,
173  const Side::LoHiSide& a_sd)
174  {
175  incrementFineRegul(a_fineFlux,
176  a_scale,
177  a_fineDataIndex,
178  a_variables,
179  a_dir,
180  a_sd);
181  }
182 
183 
184  void
185  incrementFine(const EBFaceFAB& a_fineFlux,
186  const Real& a_scale,
187  const DataIndex& a_fineDataIndex,
188  const Interval& a_varSrc,
189  const Interval& a_varDst,
190  const int& a_dir)
191  {
192  CH_assert(a_varSrc == a_varDst);
193  for (SideIterator sit; sit.ok(); ++sit)
194  {
195  incrementFineBoth(a_fineFlux, a_scale, a_fineDataIndex, a_varSrc, a_dir, sit());
196  }
197  }
198 
199 
200 
201 
202 
203  ///
204  /**
205  increments the register with data from fineFlux, multiplied by scale.
206  fineFlux must contain the coarse fluxes in the dir direction
207  for the grid m_fineLayout[fineDataIndex].
208  This operation is local.
209  */
210  void
211  incrementFineIrregular(const BaseIFFAB<Real>& a_fineFlux,
212  const Real& a_scale,
213  const DataIndex& a_fineDataIndex,
214  const Interval& a_variables,
215  const int& a_dir,
216  const Side::LoHiSide& a_sd);
217 
218  ///
219  /**
220  For when you have a EBFaceFAB lying around instead of a BaseIFFAB
221  */
222  void
224  const Real& a_scale,
225  const DataIndex& a_fineDataIndex,
226  const Interval& a_variables,
227  const int& a_dir,
228  const Side::LoHiSide& a_sd)
229  {
230  incrementFineIrreg(a_fineFlux,
231  a_scale,
232  a_fineDataIndex,
233  a_variables,
234  a_dir,
235  a_sd);
236  }
237 
238 
239 
240  ///
241  /**
242  Increments redistribution register with left-over mass
243  from reflux divergence.
244  */
246  const Interval& a_variables,
247  const Real& a_scale);
248 
249  ///
250  /**
251  Increments redistribution register with left-over mass
252  from reflux divergence.
253  */
255  const Interval& a_variables,
256  const Real& a_scale);
257 
258 
259  ///
260  bool isDefined() const;
261 
262 protected:
263 
264 
265 private:
266  //returns true if a_src contains any cells
267  bool
268  copyBIFFToEBFF(EBFaceFAB& a_dst,
269  const BaseIFFAB<Real>& a_src,
270  const Box & a_box,
271  const EBISBox& a_ebisBox);
272 
273  //for all the usual reasons,
274  //there is no copy constructor for this class
275  //and there is no operator= for this class
276  //(there is no rule six).
278  {
279  MayDay::Error("invalid operator");
280  }
282  {
283  MayDay::Error("invalid operator");
284  }
285 };
286 #include "NamespaceFooter.H"
287 #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:168
bool ok() const
#define CH_assert(cond)
Definition: CHArray.H:37
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: EBIndexSpace.H:260
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:31
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
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)
EBFluxRegister(const EBFluxRegister &)
Definition: EBFluxRegister.H:281
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:90
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 operator=(const EBFluxRegister &)
Definition: EBFluxRegister.H:277
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:107
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:142
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:223
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:185
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)