Chombo + EB + MF  3.2
EBMGInterp.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 // dtgraves fri aug 17, 2001
12 
13 #ifndef _EBMGINTERP_H_
14 #define _EBMGINTERP_H_
15 
16 #include "REAL.H"
17 #include "FArrayBox.H"
18 #include "LevelData.H"
19 #include "DisjointBoxLayout.H"
20 #include "EBISLayout.H"
21 #include "EBCellFAB.H"
22 #include "Interval.H"
23 #include "EBIndexSpace.H"
24 #include "EBStencil.H"
25 #include "EBLevelGrid.H"
26 #include "EBConstantCFInterp.H"
27 #include "NamespaceHeader.H"
28 
29 /// Piecewise constant interpolation.
30 /**
31  Finedata += coarse data.
32  */
34 {
35 public:
36  ///
37  /**
38  Default constructor. User must subsequently call define().
39  */
40  EBMGInterp();
41 
42  ///
43  ~EBMGInterp();
44 
45  ///
46  /**
47  Defining constructor. Constructs a valid object.
48  Equivalent to default construction followed by define().
49 
50  {\bf Arguments:}\\
51  dblFine, dblCoar: The fine and coarse layouts
52  of the data.\\
53  ebislFine, ebislCoar: The fine and coarse layouts
54  of the geometric description.\\
55  nref: The refinement ratio between the two levels. \\
56  nvar: The number of variables contained in the data
57  at each VoF.
58  */
59  EBMGInterp(const DisjointBoxLayout& dblFine,
60  const DisjointBoxLayout& dblCoar,
61  const EBISLayout& ebislFine,
62  const EBISLayout& ebislCoar,
63  const ProblemDomain& domainCoar,
64  const int& nref,
65  const int& nvar,
66  const EBIndexSpace* ebisPtr,
67  const IntVect& ghostCellsPhi,
68  const bool& layoutChanged = true,
69  const bool& doLinear = false);
70 
71 
72  ///
73  /**
74  Defines this object. Existing information is overriden.
75 
76  {\bf Arguments:}\\
77  dblFine, dblCoar: The fine and coarse layouts
78  of the data.\\
79  ebislFine, ebislCoar: The fine and coarse layouts
80  of the geometric description.\\
81  nref: The refinement ratio between the two levels. \\
82  nvar: The number of variables contained in the data
83  at each VoF.
84  */
85  void define(const DisjointBoxLayout& dblFine,
86  const DisjointBoxLayout& dblCoar,
87  const EBISLayout& ebislFine,
88  const EBISLayout& ebislCoar,
89  const ProblemDomain& domainCoar,
90  const int& nref,
91  const int& nvar,
92  const EBIndexSpace* ebisPtr,
93  const IntVect& ghostCellsPhi,
94  const bool& layoutChanged = true,
95  const bool& doLinear = false);
96 
97  ///
98  /**
99  Returns true if this object was created with the defining
100  constructor or if define() has been called.
101  */
102  bool isDefined() const;
103 
104  ///
105  /**
106  Piecewise constant interpolation function
107  FineData += coarseData
108  */
109  void
110  pwcInterp(LevelData<EBCellFAB>& a_fineData,
111  const LevelData<EBCellFAB>& a_coarseData,
112  const Interval& a_variables);
113 
114 
115  ///
116  /**
117  Piecewise linear interpolation function
118  FineData += coarseData + slope*dist
119  only works if you turned on useLinear in define function.
120  Ghost cells for the coarse data must be filled coming into the function.
121  */
122  void
123  pwlInterp(LevelData<EBCellFAB>& a_fineData,
124  const LevelData<EBCellFAB>& a_coarseData,
125  const Interval& a_variables);
126 
127  ///
128  /**
129  Piecewise linear interpolation function
130  FineData += coarseData + slope*dist
131  only works if you turned on useLinear in define function.
132  no copies here
133  Ghost cells for the coarse data must be filled coming into the function.
134  */
135  void
136  pwlInterpMG(LevelData<EBCellFAB>& a_fineData,
137  const LevelData<EBCellFAB>& a_coarseData,
138  const Interval& a_variables);
139 
140  ///
141  /**
142  Piecewise constant interpolation function for unchanged layouts (no agglomeration)
143  there are no copies here
144  FineData += coarseData
145  */
146  void
147  pwcInterpMG(LevelData<EBCellFAB>& a_fineData,
148  const LevelData<EBCellFAB>& a_coarseData,
149  const Interval& a_variables);
150 
151 
152 protected:
153  void
154  defineLinearStencil(const DataIndex & a_dit,
155  const Vector<VolIndex>& a_allFineVoFs,
156  const EBISLayout & a_ebislStenFine,
157  const EBISLayout & a_ebislStenCoar,
158  const Box & a_boxFine,
159  const Box & a_boxCoar);
160 
161  void
162  defineConstantStencil(const DataIndex & a_dit,
163  const Vector<VolIndex>& a_allFineVoFs,
164  const EBISLayout & a_ebislStenFine,
165  const EBISLayout & a_ebislStenCoar,
166  const Box & a_boxFine,
167  const Box & a_boxCoar);
168 
170  const EBISLayout& a_ebisl,
171  const ProblemDomain& a_dom);
172  void
173  pwcInterpFAB(EBCellFAB& a_refCoar,
174  const Box& a_coarBox,
175  const EBCellFAB& a_fine,
176  const DataIndex& a_datInd,
177  const Interval& a_variables) const;
178 
179 
180  void
181  pwlInterpFAB(EBCellFAB& a_refCoar,
182  const Box& a_coarBox,
183  const EBCellFAB& a_fine,
184  const DataIndex& a_datInd,
185  const Interval& a_variables) const;
186 
187  void setDefaultValues();
188 
189  void defineStencils();
190 
200  int m_refRat;
201  int m_nComp;
202 
206 
207  //LevelData<EBCellFAB> m_refinedCoarseData;
208  //if coarsenable, these are the coarsened fine
209  // otherwise, refined coarse.
210  //actual buffer is no longer member data
211  //not defined if !m_layoutChanged
214 
215  //the following copiers only get defined where needed.
216  Copier m_copierFtoRC;//this goes from m_fineGrids to m_refinedCoarseGrids
217  Copier m_copierRCtoF;//this goes from m_refinedCoarseGrids to m_fineGrids
218 
219 
220  //stencils for prolongation
222 
223  //stencils for prolongation
225 
226 private:
227  //disallowed for all the usual reasons
228  EBMGInterp(const EBMGInterp& ebcin)
229  {
230  MayDay::Error("ebmgi 2 invalid operator");
231  }
232  void operator=(const EBMGInterp& fabin)
233  {
234  MayDay::Error("ebmgi 3 invalid operator");
235  }
236 
237 };
238 
239 #include "NamespaceFooter.H"
240 #endif
EBMGInterp(const EBMGInterp &ebcin)
Definition: EBMGInterp.H:228
LevelData< EBCellFAB > m_buffer
Definition: EBMGInterp.H:199
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: EBIndexSpace.H:50
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
bool m_isDefined
Definition: EBMGInterp.H:191
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:152
void defineStencils()
void pwcInterpMG(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarseData, const Interval &a_variables)
Piecewise constant interpolation.
Definition: EBMGInterp.H:33
void pwlInterpFAB(EBCellFAB &a_refCoar, const Box &a_coarBox, const EBCellFAB &a_fine, const DataIndex &a_datInd, const Interval &a_variables) const
DisjointBoxLayout m_fineGrids
Definition: EBMGInterp.H:194
void pwlInterpMG(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarseData, const Interval &a_variables)
void setDefaultValues()
int m_refRat
Definition: EBMGInterp.H:200
void pwcInterp(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarseData, const Interval &a_variables)
void pwcInterpFAB(EBCellFAB &a_refCoar, const Box &a_coarBox, const EBCellFAB &a_fine, const DataIndex &a_datInd, const Interval &a_variables) const
LayoutData< RefCountedPtr< EBStencil > > m_linearEBStencil
Definition: EBMGInterp.H:224
void pwlInterp(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarseData, const Interval &a_variables)
Structure for passing component ranges in code.
Definition: Interval.H:23
ProblemDomain m_fineDomain
Definition: EBMGInterp.H:196
void fillGhostCellsPWC(LevelData< EBCellFAB > &a_data, const EBISLayout &a_ebisl, const ProblemDomain &a_dom)
bool m_layoutChanged
Definition: EBMGInterp.H:204
Definition: EBCellFAB.H:29
EBISLayout m_coarEBISL
Definition: EBMGInterp.H:197
EBISLayout m_fineEBISL
Definition: EBMGInterp.H:198
DisjointBoxLayout m_buffGrids
Definition: EBMGInterp.H:212
void define(const DisjointBoxLayout &dblFine, const DisjointBoxLayout &dblCoar, const EBISLayout &ebislFine, const EBISLayout &ebislCoar, const ProblemDomain &domainCoar, const int &nref, const int &nvar, const EBIndexSpace *ebisPtr, const IntVect &ghostCellsPhi, const bool &layoutChanged=true, const bool &doLinear=false)
void defineConstantStencil(const DataIndex &a_dit, const Vector< VolIndex > &a_allFineVoFs, const EBISLayout &a_ebislStenFine, const EBISLayout &a_ebislStenCoar, const Box &a_boxFine, const Box &a_boxCoar)
bool isDefined() const
LayoutData< RefCountedPtr< EBStencil > > m_interpEBStencil
Definition: EBMGInterp.H:221
EBISLayout m_buffEBISL
Definition: EBMGInterp.H:213
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
Copier m_copierRCtoF
Definition: EBMGInterp.H:217
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.
void defineLinearStencil(const DataIndex &a_dit, const Vector< VolIndex > &a_allFineVoFs, const EBISLayout &a_ebislStenFine, const EBISLayout &a_ebislStenCoar, const Box &a_boxFine, const Box &a_boxCoar)
Copier m_copierFtoRC
Definition: EBMGInterp.H:216
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
ProblemDomain m_coarDomain
Definition: EBMGInterp.H:195
Definition: DataIndex.H:114
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
bool m_doLinear
Definition: EBMGInterp.H:203
Definition: EBISLayout.H:39
IntVect m_ghost
Definition: EBMGInterp.H:192
int m_nComp
Definition: EBMGInterp.H:201
DisjointBoxLayout m_coarGrids
Definition: EBMGInterp.H:193
void operator=(const EBMGInterp &fabin)
Definition: EBMGInterp.H:232
bool m_coarsenable
Definition: EBMGInterp.H:205