Chombo + EB  3.2
FourthOrderInterpStencil.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 _FOURTHORDERINTERPSTENCIL_H_
12 #define _FOURTHORDERINTERPSTENCIL_H_
13 
14 #include "FArrayBox.H"
15 #include "IntVect.H"
16 #include "Vector.H"
17 #include "NamespaceHeader.H"
18 
19 /// Class to manage coarse-to-fine spatial interpolation to all fine cells within a single particular coarse cell
20 
21 /**
22  */
24 {
25 public:
26  /// Default constructor
27  /**
28  Object requires define() to be called before all other functions.
29  */
31 
32  /// Full constructor
33  FourthOrderInterpStencil(/// in range -(a_degree-1):(a_degree-1), specifies displacement to boundary in each dimension
34  const IntVect& a_bdryOffset,
35  /// refinement ratio
36  const int& a_refineCoarse,
37  /// max degree of polynomials
38  const int& a_degree = 3,
39  /// dimensions that are fixed, not interpolated
40  Interval a_fixedDims = Interval() )
41  {
42  define(a_bdryOffset, a_refineCoarse, a_degree, a_fixedDims);
43  }
44 
45  /// Destructor
46  /**
47  Destroys all objects created by define(). Passed in data references
48  of define() are left alone.
49  */
51 
52  /// Actual constructor.
53  /**
54  Set up object.
55  */
56  void define(/// in range -(a_degree-1):(a_degree-1), specifies displacement to boundary in each dimension
57  const IntVect& a_bdryOffset,
58  /// refinement ratio
59  const int& a_refineCoarse,
60  /// max degree of polynomials
61  const int& a_degree = 3,
62  /// dimensions that are fixed, not interpolated
63  Interval a_fixedDims = Interval() );
64 
65  /// Interpolate to all the fine cells within one coarse cell.
66  /**
67  Fill the fine cells inside a_coarseDataCell with interpolated data
68  from a_coarseFab.
69 
70  The fine cells to be filled in are at
71  m_baseFineBox + m_refineVect * a_coarseDataCell + a_coarseToFineOffset.
72  The coarse cells from which we draw data are
73  (a_coarseDataCell + m_coarseBaseIndices[i*D+[0:D-1]]: 0 <= i < m_stencilSize).
74  */
75  void fillFine(/// to fill at m_baseFineBox + m_refineVect*a_coarseDataCell + a_coarseToFineOffset
76  FArrayBox& a_fineFab,
77  /// coarse data
78  const FArrayBox& a_coarseFab,
79  /// coarse cell with fine subcells to fill in
80  const IntVect& a_coarseDataCell,
81  /// offset from base coarse cell to coarsened fine cells
82  const IntVect& a_coarseToFineOffset = IntVect::Zero) const;
83 
84 protected:
85 
86  /// refinement ratio
88 
89  /// max degree of polynomials
90  int m_degree;
91 
92  /// dimensions that are fixed, not interpolated
94 
95  /// 1 in m_fixedDims, m_refineCoarse in other dimensions
97 
98  /// displacement from domain boundary in each dimension, in range -(a_degree-1):(a_degree-1)
100 
101  /// 0:(m_refineCoarse-1) in every dimension
103 
104 public:
105  /// number of coarse cells in the stencil
107 
108  /// length m_stencilSize, lists indices of coarse cell corresponding to each component of m_coarseToFineFab
110 
111  /// m_stencilSize coefficients of coarse cells for each cell in m_baseFineBox
113 
114 protected:
115 
116  /// whether define() has been called
117  bool m_defined;
118 
119  Real power1d0avg(Real a_lower,
120  Real a_upper,
121  int a_ipwr) const;
122 
123  Real power1dcoarseind0avg(int a_offset,
124  int a_ipwr) const;
125 
126  Real power1dfineind0avg(int a_offset,
127  int a_ipwr) const;
128 
129 private:
130 
131  // Disallowed for all the usual reasons
132  void operator=(const FourthOrderInterpStencil& a_input)
133  {
134  MayDay::Error("invalid operator");
135  }
136 
137  // Disallowed for all the usual reasons
139  {
140  MayDay::Error("invalid operator");
141  }
142 };
143 
144 #include "NamespaceFooter.H"
145 #endif
~FourthOrderInterpStencil()
Destructor.
FourthOrderInterpStencil(const IntVect &a_bdryOffset, const int &a_refineCoarse, const int &a_degree=3, Interval a_fixedDims=Interval())
Full constructor.
Definition: FourthOrderInterpStencil.H:33
IntVect m_refineVect
1 in m_fixedDims, m_refineCoarse in other dimensions
Definition: FourthOrderInterpStencil.H:96
void define(const IntVect &a_bdryOffset, const int &a_refineCoarse, const int &a_degree=3, Interval a_fixedDims=Interval())
Actual constructor.
Box m_baseFineBox
0:(m_refineCoarse-1) in every dimension
Definition: FourthOrderInterpStencil.H:102
int m_degree
max degree of polynomials
Definition: FourthOrderInterpStencil.H:90
void operator=(const FourthOrderInterpStencil &a_input)
Definition: FourthOrderInterpStencil.H:132
FourthOrderInterpStencil(const FourthOrderInterpStencil &a_input)
Definition: FourthOrderInterpStencil.H:138
Class to manage coarse-to-fine spatial interpolation to all fine cells within a single particular coa...
Definition: FourthOrderInterpStencil.H:23
Interval m_fixedDims
dimensions that are fixed, not interpolated
Definition: FourthOrderInterpStencil.H:93
int m_refineCoarse
refinement ratio
Definition: FourthOrderInterpStencil.H:87
void fillFine(FArrayBox &a_fineFab, const FArrayBox &a_coarseFab, const IntVect &a_coarseDataCell, const IntVect &a_coarseToFineOffset=IntVect::Zero) const
Interpolate to all the fine cells within one coarse cell.
Structure for passing component ranges in code.
Definition: Interval.H:23
Vector< IntVect > m_coarseBaseIndices
length m_stencilSize, lists indices of coarse cell corresponding to each component of m_coarseToFineF...
Definition: FourthOrderInterpStencil.H:109
double Real
Definition: REAL.H:33
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.
static const IntVect Zero
Definition: IntVect.H:654
IntVect m_bdryOffset
displacement from domain boundary in each dimension, in range -(a_degree-1):(a_degree-1) ...
Definition: FourthOrderInterpStencil.H:99
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
Real power1dcoarseind0avg(int a_offset, int a_ipwr) const
FArrayBox m_coarseToFineFab
m_stencilSize coefficients of coarse cells for each cell in m_baseFineBox
Definition: FourthOrderInterpStencil.H:112
Real power1dfineind0avg(int a_offset, int a_ipwr) const
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:45
int m_stencilSize
number of coarse cells in the stencil
Definition: FourthOrderInterpStencil.H:106
FourthOrderInterpStencil()
Default constructor.
bool m_defined
whether define() has been called
Definition: FourthOrderInterpStencil.H:117
Real power1d0avg(Real a_lower, Real a_upper, int a_ipwr) const