Chombo + EB  3.2
QuadCFStencil.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 _QUADCFSTENCIL_H_
12 #define _QUADCFSTENCIL_H_
13 
14 #include <iostream>
15 #include <math.h>
16 #include "SPACE.H"
17 #include <stdlib.h>
18 #include "REAL.H"
19 #include "IntVect.H"
20 #include "Box.H"
21 #include "DisjointBoxLayout.H"
22 #include "FArrayBox.H"
23 #include "IntVectSet.H"
24 #include "CFStencil.H"
25 #include "DerivStencil.H"
26 #include "NamespaceHeader.H"
27 
28 /// class to encapsulate CF info for quadratic interpolation
29 /**
30  QuadCFStencil is a wrapper around a bunch of things
31  that allow LevelOp to do coarse-fine interpolation
32  on a particular face of a grid.
33  */
35 {
36 
37 public:
38  /// {\bf Derivative functions}
39 
40  ///
41  /**
42  compute second derivative in devdir_a direction
43  at coarse point a_ivin
44  Uses centered finite diff approximation if
45  ivs_standard_m.contains(a_ivin ).
46  Otherwise, it uses the stencil from second_m
47  Asserts that a_derivdir != direction of face
48  */
50  const BaseFab<Real> & a_phic,
51  int a_derivdir,
52  int a_ivar,
53  const IntVect& a_ivin,
54  Real a_dx) const;
55 
56  ///
57  /**
58  compute first derivative in devdir_a direction
59  at coarse point a_ivin
60  Uses centered finite diff approximation if
61  ivs_standard_m.contains(a_ivin ).
62  Otherwise, it uses the stencil from firstd_m
63  Asserts that a_derivdir != direction of face
64  */
66  const BaseFab<Real> & a_phic,
67  int a_derivdir,
68  int a_ivar,
69  const IntVect& a_ivin,
70  Real a_dx) const;
71 
72  ///
73  /**
74  compute mixed derivative (direction is unambiguous.
75  x and y are the two directions tangential to face)
76  at coarse point a_ivin. \\
77  In two dimensions, always returns 0. \\
78  Uses centered finite diff approximation if
79  ivs_standard_m.contains(a_ivin ).
80  It uses the stencil from mixed_sten_m.\\
81  Returns 0 if SpaceDim != 3
82  */
84  const BaseFab<Real> & a_phic,
85  int a_ivar,
86  const IntVect& a_ivin,
87  Real a_dx) const;
88 
89  ///
90  QuadCFStencil();
91 
92  ///
94 
95  ///
97  const Box& a_fine_domain,
98  const Box& a_grid,
99  const DisjointBoxLayout& a_fineBoxes,
100  const DisjointBoxLayout& a_coarBoxes,
101  int a_refRatio,
102  int a_direction,
103  Side::LoHiSide a_hiorlo);
104 
105  ///
107  const ProblemDomain& a_fine_domain,
108  const Box& a_grid,
109  const DisjointBoxLayout& a_fineBoxes,
110  const DisjointBoxLayout& a_coarBoxes,
111  int a_refRatio,
112  int a_direction,
113  Side::LoHiSide a_hiorlo);
114 
115  ///
116  void define(
117  const Box& a_fine_domain,
118  const Box& a_grid,
119  const DisjointBoxLayout& a_fineBoxes,
120  const DisjointBoxLayout& a_coarBoxes,
121  int a_refRatio,
122  int a_direction,
123  Side::LoHiSide a_hiorlo);
124 
125  ///
126  void define(
127  const ProblemDomain& a_fine_domain,
128  const Box& a_grid,
129  const DisjointBoxLayout& a_fineBoxes,
130  const DisjointBoxLayout& a_coarBoxes,
131  int a_refRatio,
132  int a_direction,
133  Side::LoHiSide a_hiorlo);
134 
135 
136  /// faster constructor that requires the use of CFStencil::buildPeriodicVector
137  void define(
138  const ProblemDomain& a_fine_domain,
139  const Box& a_grid,
140  const Vector<Box>& a_periodicBoxes,
141  const Vector<Box>& a_coarsenedPeriodicBoxes,
142  const DisjointBoxLayout& a_coarBoxes,
143  int a_refRatio,
144  int a_direction,
145  Side::LoHiSide a_hiorlo);
146 
147  /// {\bf Access functions}
148 
149  ///
150  /**
151  has full define function been called? return true if so
152  */
153  bool isDefined() const;
154 
155  ///
156  /**
157  are there any interpolation points? \\
158  returns false if so.*/
159  bool isEmpty() const
160  {
162  return m_baseCFS.isEmpty();
163  }
164 
165  ///
166  /** get fine intvects which need to be interpolated \\
167  This will be empty if isEmpty() returns true*/
168  const IntVectSet& getFineIVS() const
169  {
171  return m_baseCFS.getFineIVS();
172  }
173 
174  ///
175  /** get coarse intvects that underly fiinterpivs.
176  This will be empty if isEmpty() returns true*/
177  const IntVectSet& getCoarIVS() const
178  {
180  return m_baseCFS.getCoarIVS();
181  }
182 
183  bool finePacked() const
184  {
185  return m_baseCFS.isPacked();
186  }
187 
188  const Box& packedBox() const
189  {
190  return m_baseCFS.packedBox();
191  }
192 
193 
194 protected:
195 
196  //has define fcn been called?
198 
199  //direction of face
201 
202  ///
203  /**
204  set of all points which have ALL their
205  derivatives taken normally. This means
206  that no stencil either leaves the domain or
207  intersects the next finer level.
208  */
210 
211  ///
212  /**
213  set of all points which have at least
214  one derivative shifted
215  */
217 
218  /**
219  Derivative stencils. Only defined at intvects where there
220  is at least one non-standard derivative to take
221  (ie. at all points of ivs_Quadd)
222  */
223 
224  ///
225  /**
226  stencil information for mixed derivatives
227  undefined if SpaceDim != 3
228  */
230 
231  ///
232  /**
233  stencil information for unmixed derivatives
234  (second derivatives)
235  */
237 
238  ///
239  /**
240  stencil information for unmixed derivatives
241  (first derivatives)
242  */
244 
245  ///
246  /**
247  whether to drop order at any
248  one-sided point
249  */
251 
252  ///
254 
255 
256 private:
257  // internally useful but not for public consumption
258 
259  //
260  void setDefaultValues();
261 
262  /*
263  add fab to the stencil. For internal use only.
264  */
265  void addFabToSten(const BaseFab<Real> & fabin_a,
266  DerivStencil& sten_a);
267 
268  // there is no assignment operator for this class
269  void operator= (const QuadCFStencil& cfs_in)
270  {
271  }
272 
273  // there is no copy constructor for this class
275  {
276  }
277 
278  void buildStencils(const IntVectSet& ivsAllGood);
279 
280 };
281 
282 #include "NamespaceFooter.H"
283 #endif
void operator=(const QuadCFStencil &cfs_in)
Definition: QuadCFStencil.H:269
void buildStencils(const IntVectSet &ivsAllGood)
Real computeMixedDerivative(const BaseFab< Real > &a_phic, int a_ivar, const IntVect &a_ivin, Real a_dx) const
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
#define CH_assert(cond)
Definition: CHArray.H:37
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
bool isDefined() const
{ Access functions}
const Box & packedBox() const
Definition: QuadCFStencil.H:188
BaseFab< DerivStencil > m_second[SpaceDim]
Definition: QuadCFStencil.H:236
Real computeSecondDerivative(const BaseFab< Real > &a_phic, int a_derivdir, int a_ivar, const IntVect &a_ivin, Real a_dx) const
{ Derivative functions}
QuadCFStencil(const QuadCFStencil &cfs_in)
Definition: QuadCFStencil.H:274
bool finePacked() const
Definition: QuadCFStencil.H:183
int m_direction
Definition: QuadCFStencil.H:200
BaseFab< bool > m_dropOrd
Definition: QuadCFStencil.H:250
bool isEmpty() const
const int SpaceDim
Definition: SPACE.H:38
Real computeFirstDerivative(const BaseFab< Real > &a_phic, int a_derivdir, int a_ivar, const IntVect &a_ivin, Real a_dx) const
const IntVectSet & getCoarIVS() const
Definition: QuadCFStencil.H:177
BaseFab< DerivStencil > m_mixedSten
Definition: QuadCFStencil.H:229
Class to encapsulate coarse-fine information for AMR operations.
Definition: CFStencil.H:31
double Real
Definition: REAL.H:33
const IntVectSet & getFineIVS() const
void define(const Box &a_fine_domain, const Box &a_grid, const DisjointBoxLayout &a_fineBoxes, const DisjointBoxLayout &a_coarBoxes, int a_refRatio, int a_direction, Side::LoHiSide a_hiorlo)
BaseFab< DerivStencil > m_firstD[SpaceDim]
Definition: QuadCFStencil.H:243
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
LoHiSide
Definition: LoHiSide.H:27
const IntVectSet & getFineIVS() const
Definition: QuadCFStencil.H:168
class to encapsulate the operations to create derivs on irreg stencils
Definition: DerivStencil.H:35
IntVectSet m_ivsQuadd
Definition: QuadCFStencil.H:216
bool isDefined() const
{ Access functions}
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
const Box & packedBox() const
Definition: CFStencil.H:85
IntVectSet m_ivsStandard
Definition: QuadCFStencil.H:209
void setDefaultValues()
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
bool isPacked() const
Definition: CFStencil.H:80
CFStencil m_baseCFS
Definition: QuadCFStencil.H:253
bool m_isDefined
Definition: QuadCFStencil.H:197
void addFabToSten(const BaseFab< Real > &fabin_a, DerivStencil &sten_a)
bool isEmpty() const
Definition: QuadCFStencil.H:159
class to encapsulate CF info for quadratic interpolation
Definition: QuadCFStencil.H:34
const IntVectSet & getCoarIVS() const