Chombo + EB  3.0
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 
134  /**
135  \name Access functions
136  */
137  /*@{*/
138 
139  ///
140  /** Returns <tt>true</tt> if this object was created with the defining
141  constructor or if define() has been called.
142  */
143  bool isDefined() const;
144 
145  /*@}*/
146 
147  /**
148  \name Parameter-setting functions
149  */
150  /*@{*/
151 
152  ///
153  /** Set whether to give output. Default is <tt>false</tt>.
154  */
155  void setVerbose( bool a_verbose );
156 
157  /*@}*/
158 
159  /**
160  \name Data modification functions
161  */
162  /*@{*/
163 
164  ///
165  /** Coarse / Fine (inhomogeneous) interpolation operator.
166  Fill the nodes of <i>a_phi</i> on the coarse/fine interface with
167  interpolated data from <i>a_phiCoarse</i>.
168  */
169  void coarseFineInterp(/// data at this level
170  LevelData<NodeFArrayBox>& a_phiFine,
171  /// data at the next coarser level
172  const LevelData<NodeFArrayBox>& a_phiCoarse,
173  /// whether to apply inhomogeneous physical boundary conditions?
174  bool a_inhomogeneous);
175 
176  /*@}*/
177 
178 protected:
179 
181  /** CELL-centered grids at the current level (the finer level)
182  */
184 
185  /** number of components of data, needed for setting size of work array
186  */
187  int m_ncomp;
188 
189  /** refinement ratio between this and the next coarser level
190  */
192 
193  /** the number of coarsenings to be done:
194  this is log2(<i>m_refToCoarse</i>)
195  */
197 
198  /** has full define function been called?
199  */
201 
202  /** mesh spacing at this (fine) level
203  */
205 
206  /** mesh spacing at coarsest level refined by 2
207  */
209 
210  /** CELL-centered physical domain of coarsest level refined by 2
211  */
213 
214  /** data at intermediate coarsening levels;
215  Vector length <i>m_coarsenings</i>-1.
216  */
218 
219  /** Vector of interpolating objects, of length <i>m_coarsenings</i>.
220  <i>m_qcfi2</i>[i] averages refined versions of the SAME grids if i > 1,
221  and in general DIFFERENT grids if i == 0.
222  */
224 
225  /** pointers to objects storing coarse/fine interface nodes
226  between levels of refinement, including intermediate ones
227  */
229 
230  /** pointers to objects storing coarse/fine interface nodes
231  between levels of refinement, including intermediate ones
232  */
234 
235  /** if <tt>true</tt>, print out extra information
236  */
237  bool m_verbose ;
238 
239 private:
240  //internally useful functions
241 
242  void clearMemory();
243 
244  void setDefaultValues();
245 };
246 
247 #include "NamespaceFooter.H"
248 #endif
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
Vector< NodeQuadCFInterp2 *> m_qcfi2
Definition: NodeQCFI.H:223
Class to interpolate quadratically at coarse/fine interface.
Definition: NodeQCFI.H:28
bool m_verbose
Definition: NodeQCFI.H:237
one dimensional dynamic array
Definition: Vector.H:52
NodeBCFunc m_bc
Definition: NodeQCFI.H:180
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:204
void coarseFineInterp(LevelData< NodeFArrayBox > &a_phiFine, const LevelData< NodeFArrayBox > &a_phiCoarse, bool a_inhomogeneous)
Vector< LevelData< NodeFArrayBox > *> m_inter
Definition: NodeQCFI.H:217
Real m_dxPenultimate
Definition: NodeQCFI.H:208
DisjointBoxLayout m_grids
Definition: NodeQCFI.H:183
Vector< LayoutData< NodeCFIVS > *> m_loCFIVScoarser
Definition: NodeQCFI.H:228
void(* NodeBCFunc)(NodeFArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: NodeBCFunc.H:23
void setVerbose(bool a_verbose)
double Real
Definition: REAL.H:33
int m_ncomp
Definition: NodeQCFI.H:187
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
bool m_isDefined
Definition: NodeQCFI.H:200
int m_coarsenings
Definition: NodeQCFI.H:196
ProblemDomain m_domainPenultimate
Definition: NodeQCFI.H:212
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
int m_refToCoarse
Definition: NodeQCFI.H:191
void setDefaultValues()
void clearMemory()
bool isDefined() const
Vector< LayoutData< NodeCFIVS > *> m_hiCFIVScoarser
Definition: NodeQCFI.H:233