Chombo + EB + MF  3.2
NodeQCFI.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 // NodeQCFI.H
12 // petermc, Mon, Apr 23, 2001
13 // petermc, 1 Nov 2001, redid this so that it uses NodeQCFI2
14 #ifndef _NODEQCFI_H_
15 #define _NODEQCFI_H_
16 
17 #include <cmath>
18 #include <cstdlib>
19 #include "BaseFab.H"
20 #include "NodeFArrayBox.H"
21 #include "NodeCFIVS.H"
22 #include "LevelData.H"
23 #include "NodeQuadCFInterp2.H"
24 #include "NodeBCFunc.H"
25 #include "NamespaceHeader.H"
26 
27 /// Class to interpolate quadratically at coarse/fine interface.
28 class NodeQCFI
29 /**
30 
31 */
32 {
33 public:
34 
35  /**
36  \name Constructors, destructor and defines
37  */
38  /*@{*/
39 
40  ///
41  /** Default constructor. User must subsequently call define().
42  */
43  NodeQCFI();
44 
45  ///
46  /** Constructor calls setDefaultValues() and then
47  calls define() with the same arguments.
48  */
49  NodeQCFI(const DisjointBoxLayout& a_grids,
50  Real a_dx,
51  const ProblemDomain& a_domain,
52  const LayoutData<NodeCFIVS>* const a_loCFIVS,
53  const LayoutData<NodeCFIVS>* const a_hiCFIVS,
54  int a_refToCoarse,
55  NodeBCFunc a_bc,
56  int a_interpolationDegree = 2,
57  int a_ncomp = 1,
58  bool a_verbose = false);
59 
60  ///
61  /** Constructor calls setDefaultValues() and then
62  calls define() with the same arguments.
63  */
64  NodeQCFI(const DisjointBoxLayout& a_grids,
65  Real a_dx,
66  const Box& a_domain,
67  const LayoutData<NodeCFIVS>* const a_loCFIVS,
68  const LayoutData<NodeCFIVS>* const a_hiCFIVS,
69  int a_refToCoarse,
70  NodeBCFunc a_bc,
71  int a_interpolationDegree = 2,
72  int a_ncomp = 1,
73  bool a_verbose = false);
74 
75  ///
76  /** Destructor.
77  */
78  ~NodeQCFI();
79 
80  ///
81  /** Full define function. Makes all coarse-fine
82  information and sets internal variables. The current level
83  is taken to be the fine level.
84  */
85  void define(/// CELL-centered grids at this level
86  const DisjointBoxLayout& a_grids,
87  /// mesh spacing at this level
88  Real a_dx,
89  /// CELL-centered physical domain at this level
90  const ProblemDomain& a_domain,
91  /// pointer to object storing coarse/fine interface nodes
92  const LayoutData<NodeCFIVS>* const a_loCFIVS,
93  /// pointer to object storing coarse/fine interface nodes
94  const LayoutData<NodeCFIVS>* const a_hiCFIVS,
95  /// refinement ratio between this and next coarser level
96  int a_refToCoarse,
97  NodeBCFunc a_bc,
98  /// degree of interpolation; 1 for (bi)linear, 2 for (bi)quadratic
99  int a_interpolationDegree = 2,
100  /// number of components of data
101  int a_ncomp = 1,
102  /// verbose output flag
103  bool a_verbose = false);
104 
105  ///
106  /** Full define function. Makes all coarse-fine
107  information and sets internal variables. The current level
108  is taken to be the fine level.
109  */
110  void define(/// CELL-centered grids at this level
111  const DisjointBoxLayout& a_grids,
112  /// mesh spacing at this level
113  Real a_dx,
114  /// CELL-centered physical domain at this level
115  const Box& a_domain,
116  /// pointer to object storing coarse/fine interface nodes
117  const LayoutData<NodeCFIVS>* const a_loCFIVS,
118  /// pointer to object storing coarse/fine interface nodes
119  const LayoutData<NodeCFIVS>* const a_hiCFIVS,
120  /// refinement ratio between this and next coarser level
121  int a_refToCoarse,
122  NodeBCFunc a_bc,
123  /// degree of interpolation, 1 for (bi)linear, 2 for (bi)quadratic
124  int a_interpolationDegree = 2,
125  /// number of components of data
126  int a_ncomp = 1,
127  /// verbose output flag
128  bool a_verbose = false);
129 
130  /*@}*/
131 
132  /**
133  \name Access functions
134  */
135  /*@{*/
136 
137  ///
138  /** Returns <tt>true</tt> if this object was created with the defining
139  constructor or if define() has been called.
140  */
141  bool isDefined() const;
142 
143  /*@}*/
144 
145  /**
146  \name Parameter-setting functions
147  */
148  /*@{*/
149 
150  ///
151  /** Set whether to give output. Default is <tt>false</tt>.
152  */
153  void setVerbose( bool a_verbose );
154 
155  /*@}*/
156 
157  /**
158  \name Data modification functions
159  */
160  /*@{*/
161 
162  ///
163  /** Coarse / Fine (inhomogeneous) interpolation operator.
164  Fill the nodes of <i>a_phi</i> on the coarse/fine interface with
165  interpolated data from <i>a_phiCoarse</i>.
166  */
167  void coarseFineInterp(/// data at this level
168  LevelData<NodeFArrayBox>& a_phiFine,
169  /// data at the next coarser level
170  const LevelData<NodeFArrayBox>& a_phiCoarse,
171  /// whether to apply inhomogeneous physical boundary conditions?
172  bool a_inhomogeneous);
173 
174  /*@}*/
175 
176 protected:
177 
179  /** CELL-centered grids at the current level (the finer level)
180  */
182 
183  /** number of components of data, needed for setting size of work array
184  */
185  int m_ncomp;
186 
187  /** refinement ratio between this and the next coarser level
188  */
190 
191  /** the number of coarsenings to be done:
192  this is log2(<i>m_refToCoarse</i>)
193  */
195 
196  /** has full define function been called?
197  */
199 
200  /** mesh spacing at this (fine) level
201  */
203 
204  /** mesh spacing at coarsest level refined by 2
205  */
207 
208  /** CELL-centered physical domain of coarsest level refined by 2
209  */
211 
212  /** data at intermediate coarsening levels;
213  Vector length <i>m_coarsenings</i>-1.
214  */
216 
217  /** Vector of interpolating objects, of length <i>m_coarsenings</i>.
218  <i>m_qcfi2</i>[i] averages refined versions of the SAME grids if i > 1,
219  and in general DIFFERENT grids if i == 0.
220  */
222 
223  /** pointers to objects storing coarse/fine interface nodes
224  between levels of refinement, including intermediate ones
225  */
227 
228  /** pointers to objects storing coarse/fine interface nodes
229  between levels of refinement, including intermediate ones
230  */
232 
233  /** if <tt>true</tt>, print out extra information
234  */
235  bool m_verbose ;
236 
237 private:
238  //internally useful functions
239 
240  void clearMemory();
241 
242  void setDefaultValues();
243 };
244 
245 #include "NamespaceFooter.H"
246 #endif
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Vector< NodeQuadCFInterp2 *> m_qcfi2
Definition: NodeQCFI.H:221
Class to interpolate quadratically at coarse/fine interface.
Definition: NodeQCFI.H:28
bool m_verbose
Definition: NodeQCFI.H:235
one dimensional dynamic array
Definition: Vector.H:53
NodeBCFunc m_bc
Definition: NodeQCFI.H:178
void define(const DisjointBoxLayout &a_grids, Real a_dx, const ProblemDomain &a_domain, const LayoutData< NodeCFIVS > *const a_loCFIVS, const LayoutData< NodeCFIVS > *const a_hiCFIVS, int a_refToCoarse, NodeBCFunc a_bc, int a_interpolationDegree=2, int a_ncomp=1, bool a_verbose=false)
Real m_dx
Definition: NodeQCFI.H:202
void coarseFineInterp(LevelData< NodeFArrayBox > &a_phiFine, const LevelData< NodeFArrayBox > &a_phiCoarse, bool a_inhomogeneous)
Vector< LevelData< NodeFArrayBox > *> m_inter
Definition: NodeQCFI.H:215
Real m_dxPenultimate
Definition: NodeQCFI.H:206
DisjointBoxLayout m_grids
Definition: NodeQCFI.H:181
Vector< LayoutData< NodeCFIVS > *> m_loCFIVScoarser
Definition: NodeQCFI.H:226
void(* NodeBCFunc)(NodeFArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: NodeBCFunc.H:22
void setVerbose(bool a_verbose)
double Real
Definition: REAL.H:33
int m_ncomp
Definition: NodeQCFI.H:185
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
bool m_isDefined
Definition: NodeQCFI.H:198
int m_coarsenings
Definition: NodeQCFI.H:194
ProblemDomain m_domainPenultimate
Definition: NodeQCFI.H:210
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
int m_refToCoarse
Definition: NodeQCFI.H:189
void setDefaultValues()
void clearMemory()
bool isDefined() const
Vector< LayoutData< NodeCFIVS > *> m_hiCFIVScoarser
Definition: NodeQCFI.H:231