Chombo + EB  3.0
EBMGAverage.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 // major revision dtg dec 2009
13 #ifndef _EBMGAVERAGE_H_
14 #define _EBMGAVERAGE_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 "EBStencil.H"
24 #include "NamespaceHeader.H"
25 class EBIndexSpace;
26 
27 /// Piecewise constant interpolation.
28 /**
29  Finedata += coarse data.
30  */
32 {
33 public:
34  ///
35  /**
36  Default constructor. User must subsequently call define().
37  */
38  EBMGAverage();
39 
40  ///
41  ~EBMGAverage();
42 
43  EBMGAverage(const DisjointBoxLayout& a_dblFine,
44  const DisjointBoxLayout& a_dblCoar,
45  const EBISLayout& a_ebislFine,
46  const EBISLayout& a_ebislCoar,
47  const ProblemDomain& a_domainCoar,
48  const int& a_nref,
49  const int& a_nvar,
50  const EBIndexSpace* ebisPtr,
51  const IntVect& a_ghostCellsRHS,
52  const bool& a_layoutChanged = true);
53 
54  ///
55  /**
56  Defines this object. Existing information is overriden.
57 
58  {\bf Arguments:}\\
59  dblFine, dblCoar: The fine and coarse layouts
60  of the data.\\
61  ebislFine, ebislCoar: The fine and coarse layouts
62  of the geometric description.\\
63  nref: The refinement ratio between the two levels. \\
64  nvar: The number of variables contained in the data
65  at each VoF.
66  */
67  void define(const DisjointBoxLayout& dblFine,
68  const DisjointBoxLayout& dblCoar,
69  const EBISLayout& ebislFine,
70  const EBISLayout& ebislCoar,
71  const ProblemDomain& domainCoar,
72  const int& nref,
73  const int& nvar,
74  const EBIndexSpace* ebisPtr,
75  const IntVect& ghostCellsRHS,
76  const bool& a_layoutChanged = true);
77 
78  ///
79  /**
80  Returns true if this object was created with the defining
81  constructor or if define() has been called.
82  */
83  bool isDefined() const;
84 
85  ///
86  /**
87  Piecewise constant interpolation function
88  FineData += coarseData
89  */
90  void
91  average(LevelData<EBCellFAB>& a_coarData,
92  const LevelData<EBCellFAB>& a_fineData,
93  const Interval& a_variables);
94 
95  ///
96  /**
97  Piecewise constant interpolation function for unchanged layouts (no agglomeration)
98  there are no copies here
99  FineData += coarseData
100  */
101  void
102  averageMG(LevelData<EBCellFAB>& a_coarData,
103  const LevelData<EBCellFAB>& a_fineData,
104  const Interval& a_variables);
105 
106 protected:
107  void
108  averageFAB(EBCellFAB& a_coar,
109  const Box& a_box,
110  const EBCellFAB& a_refCoar,
111  const DataIndex& a_datInd,
112  const Interval& a_variables) const;
113 
114  void setDefaultValues();
115  void defineStencils();
116 
122  Copier m_copier;//this goes from m_refinedCoarseGrids to m_fineGrids
125 
128 
129  int m_refRat;
130  int m_nComp;
131 
134 
135  //LevelData<EBCellFAB> m_refinedCoarseData;
136  //if coarsenable, these are the coarsened fine
137  // otherwise, refined coarse.
138  //actual buffer is no longer member data
139  //not defined if !m_layoutChanged
142 
144 
145 private:
146  //disallowed for all the usual reasons
147  EBMGAverage(const EBMGAverage& ebcin)
148  {
149  MayDay::Error("ebmgi 2 invalid operator");
150  }
151  void operator=(const EBMGAverage& fabin)
152  {
153  MayDay::Error("ebmgi 3 invalid operator");
154  }
155 
156 };
157 
158 #include "NamespaceFooter.H"
159 #endif
bool m_isDefined
Definition: EBMGAverage.H:117
bool m_coarsenable
Definition: EBMGAverage.H:133
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Definition: EBIndexSpace.H:260
int m_refRat
Definition: EBMGAverage.H:129
void operator=(const EBMGAverage &fabin)
Definition: EBMGAverage.H:151
void defineStencils()
void averageMG(LevelData< EBCellFAB > &a_coarData, const LevelData< EBCellFAB > &a_fineData, const Interval &a_variables)
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: LayoutData.H:46
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:137
bool m_layoutChanged
Definition: EBMGAverage.H:132
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 &ghostCellsRHS, const bool &a_layoutChanged=true)
DisjointBoxLayout m_fineGrids
Definition: EBMGAverage.H:120
EBISLayout m_coarEBISL
Definition: EBMGAverage.H:126
int m_nComp
Definition: EBMGAverage.H:130
Structure for passing component ranges in code.
Definition: Interval.H:23
Definition: EBCellFAB.H:29
EBISLayout m_buffEBISL
Definition: EBMGAverage.H:141
Copier m_copier
Definition: EBMGAverage.H:122
DisjointBoxLayout m_refinedCoarseGrids
Definition: EBMGAverage.H:121
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.
void averageFAB(EBCellFAB &a_coar, const Box &a_box, const EBCellFAB &a_refCoar, const DataIndex &a_datInd, const Interval &a_variables) const
DisjointBoxLayout m_buffGrids
Definition: EBMGAverage.H:140
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
Definition: DataIndex.H:112
ProblemDomain m_coarDomain
Definition: EBMGAverage.H:123
Piecewise constant interpolation.
Definition: EBMGAverage.H:31
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
ProblemDomain m_fineDomain
Definition: EBMGAverage.H:124
bool isDefined() const
Definition: EBISLayout.H:39
IntVect m_ghost
Definition: EBMGAverage.H:118
void setDefaultValues()
DisjointBoxLayout m_coarGrids
Definition: EBMGAverage.H:119
EBISLayout m_fineEBISL
Definition: EBMGAverage.H:127
LayoutData< RefCountedPtr< EBStencil > > m_averageEBStencil
Definition: EBMGAverage.H:143
EBMGAverage(const EBMGAverage &ebcin)
Definition: EBMGAverage.H:147
void average(LevelData< EBCellFAB > &a_coarData, const LevelData< EBCellFAB > &a_fineData, const Interval &a_variables)