Chombo + EB + MF  3.2
EBCFCopy.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 _EBCFCOPY_H_
12 #define _EBCFCOPY_H_
13 
14 #include "REAL.H"
15 #include "FArrayBox.H"
16 #include "LevelData.H"
17 #include "DisjointBoxLayout.H"
18 #include "Interval.H"
19 
20 #include "EBISLayout.H"
21 #include "EBCellFAB.H"
22 #include "EBIndexSpace.H"
23 #include "EBStencil.H"
24 #include "EBLevelGrid.H"
25 
26 #include "NamespaceHeader.H"
27 
28 /// Copy coarse values from coarse cells to the fine cells covering them.
29 /**
30  Copy coarse values from coarse cells to the fine cells covering them.
31  This was adapted from EBMGInterp to live in EBTools instead of EBAMRTools
32  because it's used by EBIndexSpace.
33 */
34 class EBCFCopy
35 {
36 public:
37  ///
38  /**
39  Default constructor. User must subsequently call define().
40  */
41  EBCFCopy();
42 
43  ///
44  ~EBCFCopy();
45 
46  ///
47  /**
48  Defining constructor. Constructs a valid object.
49  Equivalent to default construction followed by define().
50 
51  {\bf Arguments:}\\
52  dblFine, dblCoar: The fine and coarse layouts
53  of the data.\\
54  ebislFine, ebislCoar: The fine and coarse layouts
55  of the geometric description.\\
56  nref: The refinement ratio between the two levels. \\
57  nvar: The number of variables contained in the data
58  at each VoF.
59  */
60  EBCFCopy(const DisjointBoxLayout & a_dblFine,
61  const DisjointBoxLayout & a_dblCoar,
62  const EBISLayout & a_ebislFine,
63  const EBISLayout & a_ebislCoar,
64  const ProblemDomain & a_domainCoar,
65  const int & a_nref,
66  const int & a_nvar,
67  const EBIndexSpace * a_ebisPtr,
68  const IntVect & a_ghostCellsPhi,
69  const bool & a_layoutChanged = true);
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 & a_dblFine,
86  const DisjointBoxLayout & a_dblCoar,
87  const EBISLayout & a_ebislFine,
88  const EBISLayout & a_ebislCoar,
89  const ProblemDomain & a_domainCoar,
90  const int & a_nref,
91  const int & a_nvar,
92  const EBIndexSpace * a_ebisPtr,
93  const IntVect & a_ghostCellsPhi,
94  const bool & a_layoutChanged = true);
95 
96  ///
97  /**
98  Returns true if this object was created with the defining
99  constructor or if define() has been called.
100  */
101  bool isDefined() const;
102 
103  ///
104  /**
105  Copy coarse data to the fine data covering them (agglomeration allowed).
106  fine data = coarse data
107  */
108  void copy(LevelData<EBCellFAB> & a_fineData,
109  const LevelData<EBCellFAB> & a_coarseData,
110  const Interval & a_variables);
111 
112  ///
113  /**
114  Copy coarse data to the fine data covering them (no agglomeration allowed).
115  There are no copyTo's here.
116  fine data = coarse data
117  */
118  void copySameLayout(LevelData<EBCellFAB> & a_fineData,
119  const LevelData<EBCellFAB> & a_coarseData,
120  const Interval & a_variables);
121 
122 protected:
123  void copyFAB(EBCellFAB & a_refCoar,
124  const Box & a_coarBox,
125  const EBCellFAB & a_fine,
126  const DataIndex & a_datInd,
127  const Interval & a_variables) const;
128 
129  void setDefaultValues();
130 
131  void defineStencils();
132 
134 
136 
139 
142 
145 
146  int m_refRat;
147  int m_nComp;
148 
151 
152  // LevelData<EBCellFAB> m_refinedCoarseData;
153  // if coarsenable, these are the coarsened fine
154  // otherwise, refined coarse.
155  // actual buffer is no longer member data
156  // not defined if !m_layoutChanged
159 
160  // the following copiers only get defined where needed.
161  Copier m_copierFtoRC; // this goes from m_fineGrids to m_refinedCoarseGrids
162  Copier m_copierRCtoF; // this goes from m_refinedCoarseGrids to m_fineGrids
163 
164  // stencils for prolongation
166 
167 private:
168  // disallowed for all the usual reasons
169  EBCFCopy(const EBCFCopy& ebcin)
170  {
171  MayDay::Error("EBCFCopy 2 invalid operator");
172  }
173  void operator=(const EBCFCopy& fabin)
174  {
175  MayDay::Error("EBCFCopy 3 invalid operator");
176  }
177 
178 };
179 
180 #include "NamespaceFooter.H"
181 
182 #endif
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
void operator=(const EBCFCopy &fabin)
Definition: EBCFCopy.H:173
Definition: EBIndexSpace.H:50
int m_refRat
Definition: EBCFCopy.H:146
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:152
EBISLayout m_coarEBISL
Definition: EBCFCopy.H:143
EBISLayout m_fineEBISL
Definition: EBCFCopy.H:144
EBISLayout m_buffEBISL
Definition: EBCFCopy.H:158
int m_nComp
Definition: EBCFCopy.H:147
Copy coarse values from coarse cells to the fine cells covering them.
Definition: EBCFCopy.H:34
bool isDefined() const
DisjointBoxLayout m_buffGrids
Definition: EBCFCopy.H:157
Structure for passing component ranges in code.
Definition: Interval.H:23
Definition: EBCellFAB.H:29
void defineStencils()
void copy(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarseData, const Interval &a_variables)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void copyFAB(EBCellFAB &a_refCoar, const Box &a_coarBox, const EBCellFAB &a_fine, const DataIndex &a_datInd, const Interval &a_variables) const
void setDefaultValues()
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.
ProblemDomain m_coarDomain
Definition: EBCFCopy.H:140
IntVect m_ghost
Definition: EBCFCopy.H:135
DisjointBoxLayout m_fineGrids
Definition: EBCFCopy.H:138
DisjointBoxLayout m_coarGrids
Definition: EBCFCopy.H:137
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
Copier m_copierFtoRC
Definition: EBCFCopy.H:161
Definition: DataIndex.H:114
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
bool m_isDefined
Definition: EBCFCopy.H:133
LayoutData< RefCountedPtr< EBStencil > > m_copyEBStencil
Definition: EBCFCopy.H:165
bool m_coarsenable
Definition: EBCFCopy.H:150
ProblemDomain m_fineDomain
Definition: EBCFCopy.H:141
Definition: EBISLayout.H:39
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 *a_ebisPtr, const IntVect &a_ghostCellsPhi, const bool &a_layoutChanged=true)
Copier m_copierRCtoF
Definition: EBCFCopy.H:162
void copySameLayout(LevelData< EBCellFAB > &a_fineData, const LevelData< EBCellFAB > &a_coarseData, const Interval &a_variables)
EBCFCopy(const EBCFCopy &ebcin)
Definition: EBCFCopy.H:169
bool m_layoutChanged
Definition: EBCFCopy.H:149