Chombo + EB  3.0
EBCoarseAverage.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 _EBCOARSEAVERAGE_H_
14 #define _EBCOARSEAVERAGE_H_
15 
16 #include "REAL.H"
17 #include "FArrayBox.H"
18 #include "LevelData.H"
19 #include "DisjointBoxLayout.H"
20 #include "EBISLayout.H"
21 #include "EBLevelGrid.H"
22 #include "EBCellFAB.H"
23 #include "EBFluxFAB.H"
24 #include "BaseIVFAB.H"
25 #include "BaseIVFactory.H"
26 #include "EBFaceFAB.H"
27 #include "Interval.H"
28 #include "NamespaceHeader.H"
29 class EBIndexSpace;
30 
31 /// replaces coarse level data with an average of fine level data.
32 /**
33  This class replaces data at a coarse level of refinement with an
34  average of data at a finer level of refinement, in areas where fine
35  data is present. Coarse level data is not modified where fine
36  level data is not present.
37  */
39 {
40 public:
41  ///
42  /**
43  Default constructor. User must subsequently call define().
44  */
46 
47  ///
49 
50  ///
51  /**
52  Defining constructor. Constructs a valid object.
53  Equivalent to default construction followed by define().
54 
55  {\bf Arguments:}\\
56  dblFine, dblCoar: The fine and coarse layouts
57  of the data.\\
58  ebislFine, ebislCoar: The fine and coarse layouts
59  of the geometric description.\\
60  nref: The refinement ratio between the two levels. \\
61  nvar: The number of variables contained in the data
62  at each VoF.
63  */
64  EBCoarseAverage(const DisjointBoxLayout& dblFine,
65  const DisjointBoxLayout& dblCoar,
66  const EBISLayout& ebislFine,
67  const EBISLayout& ebislCoar,
68  const ProblemDomain& domainCoar,
69  const int& nref,
70  const int& nvar,
71  const EBIndexSpace* ebisPtr);
72 
73  ///
74  /**
75  Defining constructor. Constructs a valid object.
76  Equivalent to default construction followed by define().
77 
78  {\bf Arguments:}\\
79  eblgFine, eblgCoar: The fine and coarse EBLevelGrids \\
80  nref: The refinement ratio between the two levels. \\
81  nvar: The number of variables contained in the data
82  at each VoF.
83  */
84  EBCoarseAverage(const EBLevelGrid& a_eblgFine,
85  const EBLevelGrid& a_eblgCoar,
86  const EBLevelGrid& a_eblgCoFi,
87  const int& nref,
88  const int& nvar);
89  ///
90  /**
91  Defines this object. Existing information is overriden.
92 
93  {\bf Arguments:}\\
94  dblFine, dblCoar: The fine and coarse layouts
95  of the data.\\
96  ebislFine, ebislCoar: The fine and coarse layouts
97  of the geometric description.\\
98  nref: The refinement ratio between the two levels. \\
99  nvar: The number of variables contained in the data
100  at each VoF.
101  */
102  void define(const DisjointBoxLayout& dblFine,
103  const DisjointBoxLayout& dblCoar,
104  const EBISLayout& ebislFine,
105  const EBISLayout& ebislCoar,
106  const ProblemDomain& domainCoar,
107  const int& nref,
108  const int& nvar,
109  const EBIndexSpace* ebisPtr);
110 
111  ///
112  /**
113  Defines this object. Existing information is overriden.
114 
115  {\bf Arguments:}\\
116  eblgFine, eblgCoar: The fine and coarse EBLevelGrids \\
117  nref: The refinement ratio between the two levels. \\
118  nvar: The number of variables contained in the data
119  at each VoF.
120  */
121  void define(const EBLevelGrid& a_eblgFine,
122  const EBLevelGrid& a_eblgCoar,
123  const EBLevelGrid& a_eblgCoFi,
124  const int& nref,
125  const int& nvar);
126  ///
127  /**
128  Returns true if this object was created with the defining
129  constructor or if define() has been called.
130  */
131  bool isDefined() const;
132 
133  ///
134  /**
135  Replaces a_coarse_data with the average of a_fine_data within the
136  coarsening of the domain of the fine level. Elsewhere, the
137  coarse data is unchanged. It is an error to call if not
138  this->isDefined(). The domain of a_fine_data should be
139  the same as the fine domain specified in the most recent call to
140  define(). It is expected that the coarse and fine level's
141  domains are properly nested. Both a_coarse_data and a_fine_data
142  should have the same number of components specified in the most
143  recent call to define().
144 
145  {\bf Arguments:}\\
146  coarData: The data over the coarse layout.\\
147  fineData: The data over the fine layout. \\
148  Fine and coarse data must
149  have the same number of variables.\\
150  variables: The variables to average. Those not
151  in this range will be left alone. This range of variables
152  must be in both the coarse and fine data.
153  */
154  void
155  average(LevelData<EBCellFAB>& a_coarData,
156  const LevelData<EBCellFAB>& a_fineData,
157  const Interval& a_variables);
158 
159  void
160  average(LevelData<EBFluxFAB>& a_coarData,
161  const LevelData<EBFluxFAB>& a_fineData,
162  const Interval& a_variables);
163 
164 
165  void
166  average(LevelData<BaseIVFAB<Real> >& a_coarData,
167  const LevelData<BaseIVFAB<Real> >& a_fineData,
168  const Interval& a_variables);
169 
170 protected:
171  void
172  averageFAB(EBCellFAB& a_coar,
173  const EBCellFAB& a_fine,
174  const DataIndex& a_datInd,
175  const Interval& a_variables) const;
176 
177  void
178  averageFAB(EBFaceFAB& a_coar,
179  const EBFaceFAB& a_fine,
180  const DataIndex& a_datInd,
181  const Interval& a_variables,
182  const int& a_dir) const;
183 
184  void
185  averageFAB(BaseIVFAB<Real>& a_coar,
186  const BaseIVFAB<Real>& a_fine,
187  const DataIndex& a_datInd,
188  const Interval& a_variables) const;
189 
190 
191  void
193 
195  //true only if the layout is not coarsenable
196  //and the grid covers the domain. This
197  //happens in multigrid sometimes
203 
204  //only defined if using fine buffer
206 
207  int m_refRat;
208  int m_nComp;
209 
210 private:
211  //disallowed for all the usual reasons
213  {
214  MayDay::Error("ebca 2 invalid operator");
215  }
216  void operator=(const EBCoarseAverage& fabin)
217  {
218  MayDay::Error("ebca 3 invalid operator");
219  }
220 
221 };
222 
223 #include "NamespaceFooter.H"
224 #endif
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)
replaces coarse level data with an average of fine level data.
Definition: EBCoarseAverage.H:38
int m_nComp
Definition: EBCoarseAverage.H:208
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: EBIndexSpace.H:260
bool m_isDefined
Definition: EBCoarseAverage.H:194
EBLevelGrid m_eblgCoFi
Definition: EBCoarseAverage.H:201
Definition: EBLevelGrid.H:30
Definition: EBFaceFAB.H:28
void operator=(const EBCoarseAverage &fabin)
Definition: EBCoarseAverage.H:216
EBCoarseAverage(const EBCoarseAverage &ebcin)
Definition: EBCoarseAverage.H:212
void setDefaultValues()
LayoutData< IntVectSet > m_irregSetsFine
Definition: EBCoarseAverage.H:205
LayoutData< IntVectSet > m_irregSetsCoFi
Definition: EBCoarseAverage.H:202
Structure for passing component ranges in code.
Definition: Interval.H:23
Definition: EBCellFAB.H:29
int m_refRat
Definition: EBCoarseAverage.H:207
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
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.
EBLevelGrid m_eblgCoar
Definition: EBCoarseAverage.H:199
void averageFAB(EBCellFAB &a_coar, const EBCellFAB &a_fine, const DataIndex &a_datInd, const Interval &a_variables) const
Definition: DataIndex.H:112
EBLevelGrid m_eblgFine
Definition: EBCoarseAverage.H:200
bool m_useFineBuffer
Definition: EBCoarseAverage.H:198
Definition: EBISLayout.H:39
void average(LevelData< EBCellFAB > &a_coarData, const LevelData< EBCellFAB > &a_fineData, const Interval &a_variables)
bool isDefined() const