Chombo + EB  3.0
FineInterp.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 _FINEINTERP_H_
12 #define _FINEINTERP_H_
13 
14 #include "REAL.H"
15 #include "LevelData.H"
16 #include "BaseFab.H"
17 #include "FArrayBox.H"
18 #include "ProblemDomain.H"
19 #include "NamespaceHeader.H"
20 
21 class DisjointBoxLayout;
22 
23 /// replaces fine level data with interpolation of coarse level data.
24 /**
25  This class replaces data at a fine level of refinement with data
26  interpolated from a coarser level of refinement. Interpolation is
27  piecewise bi(tri)linear, with van Leer slopes if there is room for
28  the stencil, with lower-order slopes if there isn't. See the
29  design document.
30 
31  */
33 {
34 public:
35  ///
36  /**
37  Default constructor. User must subsequently call define().
38  */
39  FineInterp();
40 
41  ///
42  /**
43  Destructor.
44  */
45  ~FineInterp();
46 
47  ///
48  /**
49  Defining constructor. Constructs a valid object.
50  Equivalent to default construction followed by define().
51 
52  {\bf Arguments:}\\
53  a_fine_domain (not modified): the fine level domain.\\
54  a_numcomps (not modified): the number of components.\\
55  a_ref_ratio (not modified): the refinement ratio.\\
56  a_fine_problem_domain (not modified): problem domain at the fine level.\\
57 
58  */
59  FineInterp(const DisjointBoxLayout& a_fine_domain,
60  const int& a_numcomps,
61  const int& a_ref_ratio,
62  const Box& a_fine_problem_domain);
63 
64  ///
65  /**
66  Defining constructor. Constructs a valid object.
67  Equivalent to default construction followed by define().
68 
69  {\bf Arguments:}\\
70  a_fine_domain (not modified): the fine level domain.\\
71  a_numcomps (not modified): the number of components.\\
72  a_ref_ratio (not modified): the refinement ratio.\\
73  a_fine_problem_domain (not modified): problem domain at the fine level.\\
74  */
75  FineInterp(const DisjointBoxLayout& a_fine_domain,
76  const int& a_numcomps,
77  const int& a_ref_ratio,
78  const ProblemDomain& a_fine_problem_domain);
79 
80  ///
81  /**
82  Defines this object. Existing information is overriden.
83 
84  {\bf Arguments:}\\
85  a_fine_domain (not modified): the fine level domain.\\
86  a_numcomps (not modified): the number of components.\\
87  a_ref_ratio (not modified): the refinement ratio.\\
88  a_fine_problem_domain (not modified): problem domain at the fine level.\\
89 
90  {\bf This:}\\
91  ---This object is modified.---
92 
93  */
94  void
95  define(const DisjointBoxLayout& a_fine_domain, // the fine level domain
96  const int& a_numcomps, // the number of components
97  const int& a_ref_ratio, // the refinement ratio
98  const Box& a_fine_problem_domain); // problem domain
99 
100  ///
101  /**
102  Defines this object. Existing information is overriden.
103 
104  {\bf Arguments:}\\
105  a_fine_domain (not modified): the fine level domain.\\
106  a_numcomps (not modified): the number of components.\\
107  a_ref_ratio (not modified): the refinement ratio.\\
108  a_fine_problem_domain (not modified): problem domain at the fine level.\\
109 
110  {\bf This:}\\
111  ---This object is modified.---
112 
113  */
114  void
115  define(const DisjointBoxLayout& a_fine_domain, // the fine level domain
116  const int& a_numcomps, // the number of components
117  const int& a_ref_ratio, // the refinement ratio
118  const ProblemDomain& a_fine_problem_domain);
119 
120  ///
121  /**
122  Returns true if this object was created with the defining
123  constructor or if define() has been called.
124 
125  {\bf This:}\\
126  This object is not modified.
127  */
128  bool
129  isDefined() const;
130 
131  ///
132  /**
133  Replaces a_fine_data with data interpolated from a_coarse_data. It
134  is an error to call if not this->isDefined(). The domain of
135  a_fine_data should be the same as the fine domain specified in the
136  most recent call to define(). It is expected that the coarse and
137  fine level's domains are properly nested. Both a_coarse_data and
138  a_fine_data should have the same number of components specified in
139  the most recent call to define().
140 
141  {\bf Arguments:}\\
142  a_fine_data (modified): fine data. \\
143  a_coarse_data (not modified): coarse data. \\
144  a_averageFromDest: if true, first average data from a_fine_data down
145  to the resolution of a_coarse_data, then interp
146  everything back up -- necessary when the coarse
147  grids don't cover the fine grid (i.e when flattening
148  an AMR hierarchy to a single resolution). Default is
149  false.
150 
151 
152  {\bf This:}\\
153  Well, it's complicated. As far as the user is concerned, this object
154  is not modified. See the design document if you care for details.
155 
156  */
157  void
158  interpToFine(LevelData<FArrayBox>& a_fine_data,
159  const LevelData<FArrayBox>& a_coarse_data,
160  bool a_averageFromDest=false);
161 
162  /// Just do piecewise-constant interpolation.
163  void
165  const LevelData<FArrayBox>& a_coarse_data,
166  bool a_averageFromDest = false);
167 
168 protected:
169  void
171  const BaseFab<Real>& a_coarse,
172  const Box& a_coarsened_fine_box,
173  int a_ref_ratio)
174  const;
175  void
177  const BaseFab<Real>& a_coarse,
178  const Box& a_coarsened_fine_box,
179  int a_ref_ratio) const;
180 
181 protected:
183  // the refinement ratio
185  // work array for the coarse level data in a domain that is the
186  // outline of the fine level domain on the coarse level
188  // coarse level problem domain
190 };
191 
192 #include "NamespaceFooter.H"
193 #endif
ProblemDomain m_coarse_problem_domain
Definition: FineInterp.H:189
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
bool is_defined
Definition: FineInterp.H:182
void interpGridData(BaseFab< Real > &a_fine, const BaseFab< Real > &a_coarse, const Box &a_coarsened_fine_box, int a_ref_ratio) const
replaces fine level data with interpolation of coarse level data.
Definition: FineInterp.H:32
void define(const DisjointBoxLayout &a_fine_domain, const int &a_numcomps, const int &a_ref_ratio, const Box &a_fine_problem_domain)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
LevelData< FArrayBox > m_coarsened_fine_data
Definition: FineInterp.H:187
bool isDefined() const
int m_ref_ratio
Definition: FineInterp.H:184
void pwcinterpGridData(BaseFab< Real > &a_fine, const BaseFab< Real > &a_coarse, const Box &a_coarsened_fine_box, int a_ref_ratio) const
void interpToFine(LevelData< FArrayBox > &a_fine_data, const LevelData< FArrayBox > &a_coarse_data, bool a_averageFromDest=false)
void pwcinterpToFine(LevelData< FArrayBox > &a_fine_data, const LevelData< FArrayBox > &a_coarse_data, bool a_averageFromDest=false)
Just do piecewise-constant interpolation.