Chombo + EB  3.2
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  ///this does area weighted face averaging
160  void
161  average(LevelData<EBFluxFAB>& a_coarData,
162  const LevelData<EBFluxFAB>& a_fineData,
163  const Interval& a_variables);
164 
165  ///this does area-weighted averaging for the irregular area (for data on the EB)
166  void
167  average(LevelData<BaseIVFAB<Real> >& a_coarData,
168  const LevelData<BaseIVFAB<Real> >& a_fineData,
169  const Interval& a_variables);
170 
171 protected:
172  void
173  averageFAB(EBCellFAB& a_coar,
174  const EBCellFAB& a_fine,
175  const DataIndex& a_datInd,
176  const Interval& a_fineInterv,
177  const Interval& a_coarInterv) const;
178 
179  void
180  averageFAB(EBFaceFAB& a_coar,
181  const EBFaceFAB& a_fine,
182  const DataIndex& a_datInd,
183  const Interval& a_fineInterv,
184  const Interval& a_coarInterv,
185  const int& a_dir) const;
186 
187  void
188  averageFAB(BaseIVFAB<Real>& a_coar,
189  const BaseIVFAB<Real>& a_fine,
190  const DataIndex& a_datInd,
191  const Interval& a_variables) const;
192 
193 
194  void
196 
198  //true only if the layout is not coarsenable
199  //and the grid covers the domain. This
200  //happens in multigrid sometimes
206 
207  //only defined if using fine buffer
209 
210  int m_refRat;
211  int m_nComp;
212 
213 private:
214  //disallowed for all the usual reasons
216  {
217  MayDay::Error("ebca 2 invalid operator");
218  }
219  void operator=(const EBCoarseAverage& fabin)
220  {
221  MayDay::Error("ebca 3 invalid operator");
222  }
223 
224 };
225 
226 #include "NamespaceFooter.H"
227 #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:211
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: EBIndexSpace.H:50
bool m_isDefined
Definition: EBCoarseAverage.H:197
EBLevelGrid m_eblgCoFi
Definition: EBCoarseAverage.H:204
Definition: EBLevelGrid.H:30
Definition: EBFaceFAB.H:28
void operator=(const EBCoarseAverage &fabin)
Definition: EBCoarseAverage.H:219
void averageFAB(EBCellFAB &a_coar, const EBCellFAB &a_fine, const DataIndex &a_datInd, const Interval &a_fineInterv, const Interval &a_coarInterv) const
EBCoarseAverage(const EBCoarseAverage &ebcin)
Definition: EBCoarseAverage.H:215
void setDefaultValues()
LayoutData< IntVectSet > m_irregSetsFine
Definition: EBCoarseAverage.H:208
LayoutData< IntVectSet > m_irregSetsCoFi
Definition: EBCoarseAverage.H:205
Structure for passing component ranges in code.
Definition: Interval.H:23
Definition: EBCellFAB.H:29
int m_refRat
Definition: EBCoarseAverage.H:210
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
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:202
Definition: DataIndex.H:112
EBLevelGrid m_eblgFine
Definition: EBCoarseAverage.H:203
bool m_useFineBuffer
Definition: EBCoarseAverage.H:201
Definition: EBISLayout.H:39
void average(LevelData< EBCellFAB > &a_coarData, const LevelData< EBCellFAB > &a_fineData, const Interval &a_variables)
bool isDefined() const