Chombo + EB  3.2
ExtrapFillPatch.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 _EXTRAPFILLPATCH_H_
12 #define _EXTRAPFILLPATCH_H_
13 
14 #include "Interval.H"
15 #include "SPACE.H"
16 #include "FArrayBox.H"
17 #include "LayoutData.H"
18 #include "LevelData.H"
19 #include "ProblemDomain.H"
20 #include "IntVectSet.H"
21 #include "NamespaceHeader.H"
22 class Box;
23 
24 //
25 /// fills outer ghost cells by copying from inner ghost cells.
26 /**
27  The picture below shows existing ghost cell data in a border around
28  the valid region (including corners). These values are
29  extrapolated to the ghost cells in the outer "flaps." The
30  coordinate direction of extrapolation is a parameter (in this
31  example, it is 0).
32 
33 <PRE>
34  +-----+---------------------------------+-----+
35  | | +-----------------------------+ | |
36  | | | | | |
37  | | | | | |
38  | | | | | |
39  | | | InteriorBox | | |
40  | | | |%| x |
41  | | | | |/ |
42  | x |%| | / |
43  | / | | |/| |
44  |/ | | / | |
45  / | | -----------/| | |
46  /| | | / | | |
47  / | | | / | | |
48  / | | | / | | |
49  / | | +-------------/---------------+x| |
50  / +-----+--------------/----------------/-+-----+
51  / / /
52  / / /
53  / / /
54  / / /
55  ------/------------------------ / /
56  | Ghost cells in outer flaps |/ /
57  | (locations x) are filled by | /
58  | extrapolating from existing | ------------/------------------------
59  | ghost cells (location %). | | Border of exisiting ghost cells. |
60  |-----------------------------| | Assumed to be filled correctly |
61  | on input. |
62  |-----------------------------------|
63 </PRE>
64 
65 Limitation on grid configuration
66 
67 The picture below shows the ghost cells of grid 1 for extrapolation in
68 direction 0. The cells marked X were filled before extrapolation.
69 The cells marked > are extrapolated to from the first X to their
70 right. The cells marked ? want to be filled from an X to the right,
71 but there isn't any. This algorithm is not defined for such a grid
72 configuration, in which the outline of the level has a "step" of width
73 (in this case 2) less than the extrapolation radius (in this case 4).
74 Using this algorithm with grids that violate this condition may result
75 in undefined behavior.
76 
77 <PRE>
78  + - - - - - - - - - - - +
79  > > > X X X X X X < < <
80  | +-------+ |
81  > > > X| |X < < <
82  | | | |
83  > > > X| |X < < <
84  | | grid 1| |
85  > > > X| |X < < <
86  | | | |
87  > > > X| |X < < <
88  | +---+-------+ |
89  ? ?|^ ^ ^ ^ ^ ^|X < < <
90  + - - - - - - - - - - - +
91  | |
92  | |
93  | grid 0 |
94  | |
95  | |
96  +-----------+
97 </PRE>
98 */
100 {
101 public:
102 
103 ///
104 /**
105  Default constructor. User must subsequently call define().
106 */
107  ExtrapFillPatch();
108 
109 ///
110 /**
111  Destructor.
112 */
114 
115 ///
116 /**
117  Defining constructor. Constructs a valid ExtrapFillPatch object.
118  Equivalent to default construction followed by define(). It is a
119  fatal error if any grid in a_level_domain has any dimension less
120  than a_extrap_interval.end().
121 
122  There is also a restriction on grids with "jagged steps" which is
123  described in "Limitation on grid configuration" in the class
124  documentation above (with the ASCII art). It is not checked
125  whether the input domain complies with this restriction. Using
126  this algorithm with grids that violate this condition may result in
127  undefined behavior.
128 
129  {\bf Arguments:}\\
130  a_level_domain (not modified): domain of the level. \\
131  a_problem_domain (not modified): problem domain at this level. \\
132  a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\
133 
134 */
136  const DisjointBoxLayout& a_level_domain,
137  const Box& a_problem_domain,
138  const Interval& a_extrap_interval
139  );
140 
141 ///
142 /**
143  Defining constructor. Constructs a valid ExtrapFillPatch object.
144  Equivalent to default construction followed by define(). It is a
145  fatal error if any grid in a_level_domain has any dimension less
146  than a_extrap_interval.end().
147 
148  There is also a restriction on grids with "jagged steps" which is
149  described in "Limitation on grid configuration" in the class
150  documentation above (with the ASCII art). It is not checked
151  whether the input domain complies with this restriction. Using
152  this algorithm with grids that violate this condition may result in
153  undefined behavior.
154 
155  {\bf Arguments:}\\
156  a_level_domain (not modified): domain of the level. \\
157  a_problem_domain (not modified): problem domain at this level. \\
158  a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\
159 
160 */
162  const DisjointBoxLayout& a_level_domain,
163  const ProblemDomain& a_problem_domain,
164  const Interval& a_extrap_interval
165  );
166 
167 ///
168 /**
169  Defines this ExtrapFillPatch. Existing definition is overridden.
170  The user may call define() once and call fillInterp() multiple
171  times with different valid data sets.
172 
173  It is a fatal error if any grid in a_level_domain has any dimension
174  less than a_extrap_interval.end().
175 
176  There is also a restriction on grids with "jagged steps" which is
177  described in "Limitation on grid configuration" in the class
178  documentation above (with the ASCII art). It is not checked
179  whether the input domain complies with this restriction. Using
180  this algorithm with grids that violate this condition may result in
181  undefined behavior.
182 
183  {\bf Arguments:}\\
184  a_level_domain (not modified): domain of the level. \\
185  a_problem_domain (not modified): problem domain at this level. \\
186  a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\
187 
188  {\bf This:}\\
189  ---This object is modified.---
190 */
191  void
192  define(
193  const DisjointBoxLayout& a_level_domain,
194  const Box& a_problem_domain,
195  const Interval& a_extrap_interval
196  );
197 
198 ///
199 /**
200  Defines this ExtrapFillPatch. Existing definition is overridden.
201  The user may call define() once and call fillInterp() multiple
202  times with different valid data sets.
203 
204  It is a fatal error if any grid in a_level_domain has any dimension
205  less than a_extrap_interval.end().
206 
207  There is also a restriction on grids with "jagged steps" which is
208  described in "Limitation on grid configuration" in the class
209  documentation above (with the ASCII art). It is not checked
210  whether the input domain complies with this restriction. Using
211  this algorithm with grids that violate this condition may result in
212  undefined behavior.
213 
214  {\bf Arguments:}\\
215  a_level_domain (not modified): domain of the level. \\
216  a_problem_domain (not modified): problem domain at this level. \\
217  a_extrap_interval (not modified): the interval of ghost cells to fill by extrapolation. \\
218 
219  {\bf This:}\\
220  ---This object is modified.---
221 */
222  void
223  define(
224  const DisjointBoxLayout& a_level_domain,
225  const ProblemDomain& a_problem_domain,
226  const Interval& a_extrap_interval
227  );
228 
229 ///
230 /**
231  Returns true if this object was created with the defining
232  constructor or if define() has called.
233 
234  {\bf This:}\\
235  This object is not modified.
236 */
237  bool
238  isDefined() const;
239 
240 ///
241 /**
242  Fills ghost cells in the outer flaps, by interpolation from data in
243  the inner ghost cells. It is an error to call if not this->isDefined().\\
244 
245  {\bf Arguments:}\\
246  a_data (modified): data at this level, both the source and destination for extrapolation. \\
247  a_dir (not modified): zero-based coordinate direction of extrapolation. \\
248  a_dest_comp (not modified): the first component for extrapolation. \\
249  a_num_comp (not modified): the number of components to
250  extrapolate. \\
251 
252  {\bf This:}\\
253  This object is not modified.
254 
255 */
256  void
257  fillExtrap(
258  LevelData<FArrayBox>& a_data,
259  int a_dir,
260  int a_dest_comp,
261  int a_num_comp
262  );
263 
264  // void
265  // printIntVectSets() const;
266 
267 protected:
269 // locations of ghost cells on the low side of the grid to extrapolate to.
271 // locations of ghost cells on the high side of the grid to extrapolate to.
273 // interval of ghost cells to extrapolate, where 0 are the ghost cells
274 // directly adjacent to the valid domain, and increasing outwards.
276 };
277 
278 #include "NamespaceFooter.H"
279 #endif
void fillExtrap(LevelData< FArrayBox > &a_data, int a_dir, int a_dest_comp, int a_num_comp)
LayoutData< IntVectSet > m_hi_extrap[SpaceDim]
Definition: ExtrapFillPatch.H:272
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Interval m_extrap_interval
Definition: ExtrapFillPatch.H:275
const int SpaceDim
Definition: SPACE.H:38
bool isDefined() const
fills outer ghost cells by copying from inner ghost cells.
Definition: ExtrapFillPatch.H:99
Structure for passing component ranges in code.
Definition: Interval.H:23
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
bool m_is_defined
Definition: ExtrapFillPatch.H:268
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
void define(const DisjointBoxLayout &a_level_domain, const Box &a_problem_domain, const Interval &a_extrap_interval)
LayoutData< IntVectSet > m_lo_extrap[SpaceDim]
Definition: ExtrapFillPatch.H:270