Chombo + EB + MF  3.2
FourthOrderMappedFineInterp.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 _FOURTHORDERMAPPEDFINEINTERP_H_
12 #define _FOURTHORDERMAPPEDFINEINTERP_H_
13 
14 
15 /******************************************************************************/
16 /**
17  * \file
18  *
19  * \brief Class to interpolate from coarse to valid fine cells on mapped grids
20  *
21  *//*+*************************************************************************/
22 
23 #include <map>
24 
25 #include "IntVectSet.H"
26 #include "FArrayBox.H"
27 #include "CHArray.H"
28 #include "LevelData.H"
29 #include "Copier.H"
31 
32 #include "NamespaceHeader.H"
33 
34 //--Forward declarations
35 
36 class RealVect;
37 class ProblemDomain;
38 class BoxIterator;
39 class IVSIterator;
40 class CoordTransform;
41 class LevelGridMetrics;
42 
43 
44 /*******************************************************************************
45  */
46 /// Interpolate from coarse cells to valid fine cells on mapped grids.
47 /**
48  * This class is used to interpolate the solution from coarse cells to valid
49  * fine cells on mapped grids using a constrained least-squares procedure.
50  * We solve a least-squares system for the coefficients of a polynomial
51  * interpolant
52  * \f[
53  * \sum \limits_{\mathbf{p}} a_{\mathbf{p}} \langle \mathbf{\xi}^\mathbf{p}
54  * \rangle_{\mathbf{j}^l} = \langle U \rangle_{\mathbf{j}^l} \hbox{ , }
55  * \mathbf{j}^l \in \mathcal{I}(\mathbf{i}^l)
56  * \f]
57  * subject to the constraint
58  * \f[
59  * \sum \limits_{\mathbf{i}^{l+1} \in \mathcal{C}^{-1} {\mathbf{i}^l }}
60  * \sum \limits_{\mathbf{p}} a_\mathbf{p} \langle J \mathbf{\xi}^\mathbf{p}
61  * \rangle_{\mathbf{i}^{l+1}} = \langle J U \rangle_{\mathbf{i}^l}.
62  * \f]
63  * Given this interpolant, we can construct \f$\langle JU \rangle\f$ on the
64  * control volumes at level \f$l+1\f$.
65  * \f[
66  * \langle JU \rangle_{\mathbf{i}^{l+1}} = \sum \limits_\mathbf{p}
67  * a_\mathbf{p} \langle J\mathbf{\xi}^\mathbf{p} \rangle_{\mathbf{i}^{l+1}}
68  * \hbox{ , } \mathbf{i}^{l+1} \in \mathcal{C}^{-1}(\mathbf{i}^{l})
69  * \f]
70  * The details of the method are described in the Chombo document titled
71  * "Fourth-order conservation law example"
72  *
73  * <B> Implementation </B><BR>
74  * To compute the coefficients, we solve the system
75  * \f[
76  * \min_{{B \mathbf{x}} = \mathbf{d}} \| A \mathbf{x} - \mathbf{b} \|_2
77  * \f]
78  * where \f$A\f$ is the lenM x lenN coefficient matrix of
79  * \f$\langle \mathbf{\xi}^\mathbf{p} \rangle_{\mathbf{j}^l}\f$. lenM is
80  * the number of equations (number of cells in the stencil, the maximum value
81  * is for the interior stencil where \f$\mbox{lenM} =
82  * 3^{\mbox{SpaceDim}} + 2\mbox{SpaceDim}\f$ and lenN is the
83  * number of powers of a displacement given by 0 = binomial(degree +
84  * SpaceDim, SpaceDim) where degree is the order of interpolation (i.e., 3
85  * for a cubic polynomial and fourth-order interpolation). We solve for
86  * coeffients \f$\mathbf{x} = a_\mathbf{p}\f$ where \f$B \mathbf{x} =
87  * \mathbf{d}\f$ is the constraint equation shown above. You will see this
88  * notation in the code, e.g, A, LSx, LSBu, LSbl, etc. Implementation is
89  * broken down into two parts. During construction, data is initialized that
90  * is valid for any boxes with the same mesh spacing and refinement ratios.
91  * Specifically, this is A and the displacements in the fine cells. Then,
92  * the member function, 'interpolate', will then interpolate everywhere on a
93  * coarse box.
94  *
95  * The solution can be achieved using the LAPACK [S|D]GGLSE routine or an
96  * internal method which solves the linear system using a Cholesky factoriza-
97  * tion. Define statements in the Fortran routine 'maplsinterp' are used to
98  * select the method. The internal method is faster by a factor of about 4
99  * for 2 components in the solution and should be even faster for more
100  * components. If both are used, the results are compared to some tolerance.
101  *
102  * <B> Stencil </B><BR>
103  * The standard interior stencil has an inner box with size 3 and outer
104  * cells added in each dimension. See the Chombo doc mentioned above for
105  * more details and boundary stencils. The maximum stencil extent is shown
106  * below when cell 'i' is adjacent to the boundary. The encroachment of the
107  * wall in this example is by two cells relative to cell 'i' in the interior
108  * stencil. We label this as a "stencil offset from interior" of 2 in this
109  * direction, (2, 0). In this fashion, we can mark all the possible stencils.
110  * \verbatim
111  * +---+ +---+\\
112  * | | | |\\
113  * +===========+ +===========+\\
114  * H | | H H | | H\\
115  * +---H---+---+---H---+ +---H---+---+---H\\
116  * | H | i | H | | H | | i H\\
117  * +---H---+---+---H---+ +---H---+---+---H\\
118  * H | | H H | | H\\
119  * +===========+ +===========+\\
120  * | | | |\\
121  * +---+ +---+\\
122  * <---2--> stencil extent <-----3----> max stencil extent
123  * \endverbatim
124  * The stencils along with the coefficient matrices are stored during
125  * construction. To minimize the required memory, symmetric stencils are only
126  * stored once and coordinate transformations are used during actual
127  * interpolation. In the above example, a wall on the left would produce an
128  * identical but reflected stencil. If dx = dy, then walls on the top and
129  * bottom would also form the same stencil with some rotational similarity.
130  * Without any symmetry, the number of required stencils is given by
131  * \f$5^{\mbox{SpaceDim}}\f$. By exploiting symmetry in a given direction
132  * (quadrant), the number of stencils is \f$3^{\mbox{SpaceDim}}\f$. By
133  * exploiting symmetry between directions with the same mesh spacing, the
134  * number of stencils is binomial(SpaceDim + 2, 2). This has a dramatic effect
135  * at higher dimensions. At 6 dimensions, the memory required for 64 bit
136  * storage of matrix A are 7.246 GiB, 346 MiB, and 13 MiB, respectively. For
137  * 3 dimensions, this is 644 KiB, 139 KiB, and 52 KiB, respectively. All
138  * possible symmetries are exploited herein, both within a direction and
139  * between directions with the same mesh spacing.
140  *
141  * \note
142  * <ul>
143  * <li> Most of the hard-core work is written in Fortran in file
144  * FourthOrderMappedFineInerpF.ChF.
145  * <li> loadAvgXipA is written in both C++ and Fortran exploring ways of
146  * using the SpaceDim macros. Both seem to have similar performance.
147  * <li> The min box size in any given direction is 4. 11/24/10 I don't
148  * think this is true -- proper nesting is all that is required.
149  * </ul>
150  *
151  ******************************************************************************/
152 
154 {
155 protected:
156 
157  /// Status of internal coarsened-fine data
159  {
163  };
164 
165 public:
166 
167 
168 /*==============================================================================
169  * Constructors and destructors
170  *============================================================================*/
171 
172  /// Non-defining construction
173  FourthOrderMappedFineInterp(const int a_degree,
174  const int a_nComp);
175 
176  /// Constructor that initializes the stencils
177  FourthOrderMappedFineInterp(const int a_degree,
178  const int a_nComp,
179  const IntVect& a_refRatio,
180  const RealVect& a_h);
181 
182  /// Destructor
184 
185 private:
186 
187  // Copy and assignment not allowed
190 
191 
192 /*==============================================================================
193  * Member functions
194  *============================================================================*/
195 
196 public:
197 
198  /// Define that initializes the stencils
199  virtual void defineStencils(const IntVect& a_refRatio,
200  const RealVect& a_h);
201 
202  /// Define that allocates data for coarse representations of the fine grid
203  virtual void defineGrids(
204  const DisjointBoxLayout& a_FnGrid,
205  const DisjointBoxLayout& a_CrGrid,
206  const ProblemDomain& a_CrProblemDomain,
207  const IntVect& a_FnInterpRadVec = IntVect::Zero,
208  const bool a_willFillGhostsWithCrFnJU = true,
209  const MultiBlockLevelGeom *const a_mbgeoPtr = 0);
210 
211  /// Define that saves the coarse <J> on the coarsened-fine layout
212  virtual void defineCrFnJ(const LevelData<FArrayBox>& a_CrJ);
213 
214  /// Define that initializes the coarse-fine interface for filling ghosts
215  virtual void defineCFInterface(LevelGridMetrics *const a_CrMetricsPtr);
216 
217 //--For interpolating to an entire fine patch during regrid
218 
219  /// Interpolate from a coarse to fine level on a mapped grid
220  virtual void interpToFine(LevelData<FArrayBox>& a_FnLevJU,
221  const LevelData<FArrayBox>& a_FnLevJ,
222  const LevelData<FArrayBox>& a_CrLevU,
223  const LevelData<FArrayBox>& a_CrLevJU,
224  LevelGridMetrics *const a_CrMetricsPtr,
225  const Interval& a_vectorIntv);
226 
227 //--For filling ghost cells at the coarse-fine interface
228 
229  /// Fill the invalid ghost cells on a mapped grid
230  void fillGhosts(LevelData<FArrayBox>& a_FnLevU,
231  LevelData<FArrayBox>& a_FnLevJU,
232  const LevelData<FArrayBox>& a_FnLevJ,
233  const LevelData<FArrayBox>& a_CrLevData,
234  const char* const a_CrDataType,
235  const ProblemDomain& a_CrProblemDomain);
236 
237  /// Fill invalid ghost cells from preset coarsened-fine data on a mapped grid
238  virtual void fillGhosts(LevelData<FArrayBox>& a_FnLevU,
239  LevelData<FArrayBox>& a_FnLevJU,
240  const LevelData<FArrayBox>& a_FnLevJ,
241  LevelGridMetrics *const a_CrMetricsPtr);
242 
243 //--Support for both types of operations
244 
245  /// Interpolate from a coarsened-fine to fine level on a mapped grid
246  virtual void interpCrFnToFine(LevelData<FArrayBox>& a_FnLevJU,
247  const LevelData<FArrayBox>& a_FnLevJ,
248  const DisjointBoxLayout& a_CrFnGrid,
249  const LevelData<FArrayBox>& a_CrFnLevU,
250  const LevelData<FArrayBox>& a_CrFnLevJU,
251  LevelGridMetrics *const a_CrMetricsPtr) const;
252 
253  /// Interpolate from a coarse to fine box on a mapped grid
254  int interpToFine(FArrayBox& a_FnFabJU,
255  const FArrayBox& a_FnFabJ,
256  const Box& a_CrBox,
257  const FArrayBox& a_CrFabU,
258  const FArrayBox& a_CrFabJU,
259  const ProblemDomain& a_CrProblemDomain) const;
260 
261  /// Fill any ghost cells on a finer mesh
262  void fillGhosts(FArrayBox& a_FnFabU,
263  FArrayBox& a_FnFabJU,
264  const FArrayBox& a_FnFabJ,
265  const IntVectSet& a_CrCells,
266  const BaseFab<int>& a_CrCellsArIdx,
267  const FArrayBox& a_CrFabU,
268  const ProblemDomain& a_CrProblemDomain) const;
269 
270  /// True if stencil defined
271  bool isStencilDefined() const;
272 
273  /// True if coarsend-fine grid data defined
274  bool isGridDefined() const;
275 
276  /// True if coarse-fine interface defined
277  bool isCFInterfaceDefined() const;
278 
279  /// True if coarse-fine <J> defined
280  bool isCrFnJDefined() const;
281 
282  /// Check for proper nesting of the fine level in the coarse level
283  bool properNesting(const DisjointBoxLayout& a_CrBoxes,
284  const DisjointBoxLayout& a_CrFnBoxes,
285  LevelGridMetrics *const a_CrMetricsPtr) const;
286 
287 //--Access
288 
289  /// Preset the coarsened-fine <U> externally
291 
292  /// Preset the coarsened-fine <JU> externally
294 
295  /// Preset the coarsened-fine <U> from coarse level data
296  virtual void presetCrFnLevU(const LevelData<FArrayBox>& a_CrLevU,
297  const Interval& a_vectorIntv);
298 
299 // Should not be used
300  // /// Preset the coarsened-fine <JU> from coarse level data
301  // void presetCrFnLevJU(const LevelData<FArrayBox>& a_CrLevJU);
302 
303 // Obsolete
304  // /// Access coarsened-fine <U> to fill externally
305  // const LevelData<FArrayBox>& getCrFnLevU() const;
306 
307  // /// Access coarsened-fine <JU> to fill externally
308  // const LevelData<FArrayBox>& getCrFnLevJU() const;
309 
310  /// Invalidate the CrFn data, both <U> and <JU>
311  virtual void invalidateCrFnLevData();
312 
313  /// Get the number of ghosts used to build the coarsened-fine data
314  const IntVect& CrFnNumGhost() const;
315 
316  /// Return the number of components
317  int nComp() const;
318 
319 private:
320 
321  void selectStencil(const IntVect a_center,
322  const ProblemDomain& a_CrProblemDomain,
323  int& a_iStencil,
324  CoordTransform& a_ctStoP,
325  CoordTransform& a_ctPtoS,
326  IntVect& a_offset,
327  IntVect& a_fineSmlEnd) const;
328 
329  /// Sort sets of dimensions with the same mesh spacing
330  void sortEachSetDx(int *const a_a, int *const a_b) const;
331 
332  /// Get the stencil key from a list of offsets
333  int offset2Key(const int *const a_offsets) const;
334 
335  /// Load \f$\langle \Delta\xi \rangle^p\f$ for all p
336  void loadAvgXipA(Real *a_A, const RealVect& a_dxi, const RealVect a_h) const;
337 
338  /// Load \f$\langle \Delta\xi \rangle^p\f$ for all p, evaluated with K
339  void loadAvgXiKpA(Real *a_A, const RealVect& a_dxi, const RealVect a_h) const;
340 
341  /// Load gradients of \f$\langle \Delta\xi \rangle^p\f$ for all p
342  // Applies to both of the above methods for finding AvgXip
343  void loadAvgGradXip(Real* a_gradXip,
344  const RealVect& a_dxi,
345  const RealVect a_h) const;
346 
347 protected:
348 
349  /// Is this a multiblock grid
350  bool isMultiblock() const;
351 
352 
353 /*==============================================================================
354  * Data members
355  *============================================================================*/
356 
357 public:
358 
359  const int m_degree; ///< Degree of interpolating polynomial
360  const int m_stencilExtent; ///< Maximum extent of interior stencil.
361  ///< Hard coded as 2.
362  const int m_nComp; ///< Number of components for <U> and
363  ///< <JU>
364  IntVect m_refRatio; ///< Refinement ratios between the levels
365  int m_numStencil; ///< Number of possible stencils
366  int m_numUniqueDx; ///< Number of different mesh spacing over
367  ///< all dimensions
368  int m_uniqueDx[SpaceDim]; ///< Marks sets of dimensions with the
369  ///< same mesh spacing
370  bool m_defined[4]; ///< 0 - stencil, 1 - grids,
371  ///< 2 - CF interface,
372  ///< 3 - coarsened-fine<J>
373  bool m_willFillGhostsWithCrFnJU; ///< T - expecting to fill ghosts from
374  ///< from a coarsened-fine <JU> as
375  ///< specified in defineGrids().
376  std::map<int, int> m_mapStencilIndex;
377  ///< Maps a key based on the stencil
378  ///< offset to a sequential index for a
379  ///< stencil
380 
381  // Note: All CHArrays have column storage to avoid confusion with Fortran
383  ///< Masks for the various stencils.
385  ///< The transpose of matrix A for solving
386  ///< \f$A\mathbf{x} = \mathbf{b}\f$.
387  ///< I.e., the powers of the displacements
388  ///< \f$\delta\xi\f$ to the neighbour
389  ///< cells. The 'm_At' for all stencils
390  ///< are stored in a continguous chunk of
391  ///< memory by the ArrayOfMatrixAlloc
392  ///< allocator
394  ///< Fine displacements already
395  ///< multiplied by the solution to the
396  ///< constrained least-squares problem
397  ///< (LSx). Multiply by LSbl to get <U>
398  ///< in a fine cell.
400  ///< Gradients of fine displacements
401  ///< already multiplied by the solution to
402  ///< the constrained least-squares problem
403  ///< (LSx). Multiply by LSbl to get the
404  ///< gradient of <U> in a fine cell.
406  ///< Powers of displacements for fine
407  ///< cells
409  ///< Powers of displacements for fine
410  ///< cells with constant added to impose
411  ///< constraint when filling ghosts
413  ///< Gradients of 'm_avgXipFine'. This is
414  ///< stored linearly in each cell as
415  ///< (SpaceDim, p) with 'p' contiguous
416  ///< since fortran only supports rank
417  ///< 7 arrays (at least until F2008
418  ///< becomes commonplace).
419 
420  // Same as FineInterp -- used once during a regrid but also when filling
421  // ghost cells
422  DisjointBoxLayout m_CrFnGrid; ///< The coarsened-fine boxes
423  LevelData<FArrayBox> m_CrFnLevU; ///< <U> on a coarse representation of
424  ///< the fine mesh
425  LevelData<FArrayBox> m_CrFnLevJU; ///< <JU> on a coarse representation of
426  ///< the fine mesh
427  LevelData<FArrayBox> m_CrFnLevJ; ///< <J> on a coarse representation of
428  ///< the fine mesh
429  Copier m_copier; ///< Friendly neighbourhood copier for
430  ///< copying from Cr to CrFn
432  ///< To copy information between
433  ///< diffferent layout across multiblock
434  ///< boundaries
435 
436  // Data for filling interface ghost cells
437  IntVect m_FnInterpRadVec; ///< Number of fine ghost cells that must
438  ///< be filled in each direction.
439  IntVect m_CrInterpRadVec; ///< Number of coarse cells that underlie
440  ///< fine ghost cells in each direction
441  IntVect m_CrFnNumGhost; ///< Number of layers of ghost cells
442  ///< required on the coarsened-fine mesh
444  ///< Coarse cells in which to interpolate
445  ///< to fill fine ghost cells
447  ///< Index into all the CHArray for an
448  ///< IntVect
450  ///< Box describing the fine cells that
451  ///< need to be filled in a coarse cell.
452  ///< Max size is n_{ref}^{l}
453  int m_numCrFnFillGhost; ///< Total number of coarse cells used to
454  ///< fill fine ghost cells on this
455  ///< processor (this is actually a count
456  ///< of total cells, not layers like
457  ///< numGhost usually is)
458  int m_CrFnStatus; ///< Status of coarsened-fine data. We
459  ///< may know JU, U, or nothing. This is
460  ///< kept consistent with what
461  ///< MappedLevelData knows about the
462  ///< coarser data
463  bool m_isMultiblock; ///< T - A multiblock coordinates system
464 };
465 
466 
467 /*******************************************************************************
468  *
469  * Class FourthOrderMappedFineInterp: inline member definitions
470  *
471  ******************************************************************************/
472 
473 /*--------------------------------------------------------------------*/
474 // True if stencil defined
475 /** \return T - stencil has been defined
476  *//*-----------------------------------------------------------------*/
477 
478 inline bool
480 {
481  return m_defined[0];
482 }
483 
484 /*--------------------------------------------------------------------*/
485 // True if coarsend-fine grid data defined
486 /** \return T - coarsend-fine grid data has been defined
487  *//*-----------------------------------------------------------------*/
488 
489 inline bool
491 {
492  return m_defined[1];
493 }
494 
495 /*--------------------------------------------------------------------*/
496 // True if coarse-fine interface defined
497 /** \return T - coarse-fine interface has been defined
498  *//*-----------------------------------------------------------------*/
499 
500 inline bool
502 {
503  return m_defined[2];
504 }
505 
506 /*--------------------------------------------------------------------*/
507 // True if coarse-fine <J> defined
508 /** Must be defined to fill ghosts using 'fillGhostsFromCrJU'
509  * \return T - m_CrFnLevJ has been defined
510  *//*-----------------------------------------------------------------*/
511 
512 inline bool
514 {
515  return m_defined[3];
516 }
517 
518 /*--------------------------------------------------------------------*/
519 // Preset the coarsened-fine <U> externally
520 /** This returns the coarsened-fine representation and you have to do
521  * the copyTo externally
522  *//*-----------------------------------------------------------------*/
523 
524 inline LevelData<FArrayBox>&
526 {
529  return m_CrFnLevU;
530 }
531 
532 /*--------------------------------------------------------------------*/
533 // Preset the coarsened-fine <JU> externally
534 /** This returns the coarsened-fine representation and you have to do
535  * the copyTo externally
536  *//*-----------------------------------------------------------------*/
537 
538 inline LevelData<FArrayBox>&
540 {
543  return m_CrFnLevJU;
544 }
545 
546 // Obsolete
547 // /*--------------------------------------------------------------------*/
548 // // Access coarsened-fine <U>
549 // /*--------------------------------------------------------------------*/
550 
551 // inline const LevelData<FArrayBox>&
552 // FourthOrderMappedFineInterp::getCrFnLevU() const
553 // {
554 // CH_assert(isGridDefined());
555 // return m_CrFnLevU;
556 // }
557 
558 // /*--------------------------------------------------------------------*/
559 // // Access coarsened-fine <JU>
560 // /*--------------------------------------------------------------------*/
561 
562 // inline const LevelData<FArrayBox>&
563 // FourthOrderMappedFineInterp::getCrFnLevJU() const
564 // {
565 // CH_assert(isGridDefined());
566 // return m_CrFnLevJU;
567 // }
568 
569 /*--------------------------------------------------------------------*/
570 // Invalidate the CrFn data, both <U> and <JU>
571 /*--------------------------------------------------------------------*/
572 
573 inline void
575 {
577 }
578 
579 /*--------------------------------------------------------------------*/
580 // Get the number of ghosts used to build the coarsened-fine data
581 /*--------------------------------------------------------------------*/
582 
583 inline const IntVect&
585 {
587  return m_CrFnNumGhost;
588 }
589 
590 /*--------------------------------------------------------------------*/
591 // Return the number of components
592 /*--------------------------------------------------------------------*/
593 
594 inline int
596 {
597  return m_nComp;
598 }
599 
600 /*--------------------------------------------------------------------*/
601 // Is this a multiblock grid?
602 /** \return T - Yes
603  *//*-----------------------------------------------------------------*/
604 
605 inline bool
607 {
608  return m_isMultiblock;
609 }
610 
611 #include "NamespaceFooter.H"
612 #endif
The class MultiBlockLevelGeom stores topological and geometric information.
Definition: MultiBlockLevelGeom.H:29
DisjointBoxLayout m_CrFnGrid
The coarsened-fine boxes.
Definition: FourthOrderMappedFineInterp.H:422
Definition: FourthOrderMappedFineInterp.H:162
bool isGridDefined() const
True if coarsend-fine grid data defined.
Definition: FourthOrderMappedFineInterp.H:490
bool properNesting(const DisjointBoxLayout &a_CrBoxes, const DisjointBoxLayout &a_CrFnBoxes, LevelGridMetrics *const a_CrMetricsPtr) const
Check for proper nesting of the fine level in the coarse level.
int m_numCrFnFillGhost
Definition: FourthOrderMappedFineInterp.H:453
The class MultiBlockLevelCopierAverage stores topological and geometric information.
Definition: MultiBlockLevelCopierAverage.H:25
CHArray< IntVectSet, 1 > m_ivsStencilMask
Masks for the various stencils.
Definition: FourthOrderMappedFineInterp.H:382
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
CHArray< Box, 1, ArZeroCol > m_FnBoxFillInterp
Definition: FourthOrderMappedFineInterp.H:449
FourthOrderMappedFineInterp(const int a_degree, const int a_nComp)
Non-defining construction.
void loadAvgGradXip(Real *a_gradXip, const RealVect &a_dxi, const RealVect a_h) const
Load gradients of for all p.
bool m_isMultiblock
T - A multiblock coordinates system.
Definition: FourthOrderMappedFineInterp.H:463
FourthOrderMappedFineInterp & operator=(const FourthOrderMappedFineInterp &)
Definition: FourthOrderMappedFineInterp.H:160
bool m_willFillGhostsWithCrFnJU
Definition: FourthOrderMappedFineInterp.H:373
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:152
void loadAvgXipA(Real *a_A, const RealVect &a_dxi, const RealVect a_h) const
Load for all p.
CHArray< Real, SpaceDim+1, ArRangeCol > m_avgXipFine
Definition: FourthOrderMappedFineInterp.H:405
virtual void interpToFine(LevelData< FArrayBox > &a_FnLevJU, const LevelData< FArrayBox > &a_FnLevJ, const LevelData< FArrayBox > &a_CrLevU, const LevelData< FArrayBox > &a_CrLevJU, LevelGridMetrics *const a_CrMetricsPtr, const Interval &a_vectorIntv)
Interpolate from a coarse to fine level on a mapped grid.
Coordinate transformations.
Definition: FourthOrderMappedFineInterpSup.H:141
bool isCrFnJDefined() const
True if coarse-fine <J> defined.
Definition: FourthOrderMappedFineInterp.H:513
int nComp() const
Return the number of components.
Definition: FourthOrderMappedFineInterp.H:595
IntVect m_CrInterpRadVec
Definition: FourthOrderMappedFineInterp.H:439
iterates through the IntVects of a Box
Definition: BoxIterator.H:37
CHArray< Real, SpaceDim+1, ArRangeCol > m_avgGradXipFine
Definition: FourthOrderMappedFineInterp.H:412
virtual LevelData< FArrayBox > & presetCrFnLevU()
Preset the coarsened-fine <U> externally.
Definition: FourthOrderMappedFineInterp.H:525
const int SpaceDim
Definition: SPACE.H:38
virtual LevelData< FArrayBox > & presetCrFnLevJU()
Preset the coarsened-fine <JU> externally.
Definition: FourthOrderMappedFineInterp.H:539
virtual void defineGrids(const DisjointBoxLayout &a_FnGrid, const DisjointBoxLayout &a_CrGrid, const ProblemDomain &a_CrProblemDomain, const IntVect &a_FnInterpRadVec=IntVect::Zero, const bool a_willFillGhostsWithCrFnJU=true, const MultiBlockLevelGeom *const a_mbgeoPtr=0)
Define that allocates data for coarse representations of the fine grid.
const int m_degree
Degree of interpolating polynomial.
Definition: FourthOrderMappedFineInterp.H:359
CrFnStatus
Status of internal coarsened-fine data.
Definition: FourthOrderMappedFineInterp.H:158
IntVect m_refRatio
Refinement ratios between the levels.
Definition: FourthOrderMappedFineInterp.H:364
std::map< int, int > m_mapStencilIndex
Definition: FourthOrderMappedFineInterp.H:376
int m_numUniqueDx
Definition: FourthOrderMappedFineInterp.H:366
Structure for passing component ranges in code.
Definition: Interval.H:23
Copier m_copier
Definition: FourthOrderMappedFineInterp.H:429
virtual void defineStencils(const IntVect &a_refRatio, const RealVect &a_h)
Define that initializes the stencils.
virtual void invalidateCrFnLevData()
Invalidate the CrFn data, both <U> and <JU>
Definition: FourthOrderMappedFineInterp.H:574
virtual void interpCrFnToFine(LevelData< FArrayBox > &a_FnLevJU, const LevelData< FArrayBox > &a_FnLevJ, const DisjointBoxLayout &a_CrFnGrid, const LevelData< FArrayBox > &a_CrFnLevU, const LevelData< FArrayBox > &a_CrFnLevJU, LevelGridMetrics *const a_CrMetricsPtr) const
Interpolate from a coarsened-fine to fine level on a mapped grid.
A multi-dimensional array class for Chombo.
double Real
Definition: REAL.H:33
Grid metrics for a level.
Definition: LevelGridMetrics.H:223
void sortEachSetDx(int *const a_a, int *const a_b) const
Sort sets of dimensions with the same mesh spacing.
void selectStencil(const IntVect a_center, const ProblemDomain &a_CrProblemDomain, int &a_iStencil, CoordTransform &a_ctStoP, CoordTransform &a_ctPtoS, IntVect &a_offset, IntVect &a_fineSmlEnd) const
LevelData< FArrayBox > m_CrFnLevJU
Definition: FourthOrderMappedFineInterp.H:425
const int m_nComp
Definition: FourthOrderMappedFineInterp.H:362
IntVect m_FnInterpRadVec
Definition: FourthOrderMappedFineInterp.H:437
const IntVect & CrFnNumGhost() const
Get the number of ghosts used to build the coarsened-fine data.
Definition: FourthOrderMappedFineInterp.H:584
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void fillGhosts(LevelData< FArrayBox > &a_FnLevU, LevelData< FArrayBox > &a_FnLevJU, const LevelData< FArrayBox > &a_FnLevJ, const LevelData< FArrayBox > &a_CrLevData, const char *const a_CrDataType, const ProblemDomain &a_CrProblemDomain)
Fill the invalid ghost cells on a mapped grid.
virtual void defineCFInterface(LevelGridMetrics *const a_CrMetricsPtr)
Define that initializes the coarse-fine interface for filling ghosts.
int m_numStencil
Number of possible stencils.
Definition: FourthOrderMappedFineInterp.H:365
IntVect m_CrFnNumGhost
Definition: FourthOrderMappedFineInterp.H:441
bool isMultiblock() const
Is this a multiblock grid.
Definition: FourthOrderMappedFineInterp.H:606
int m_uniqueDx[SpaceDim]
Definition: FourthOrderMappedFineInterp.H:368
static const IntVect Zero
Definition: IntVect.H:658
LayoutData< IntVectSet > m_CrFnFillInterp
Definition: FourthOrderMappedFineInterp.H:443
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
bool isCFInterfaceDefined() const
True if coarse-fine interface defined.
Definition: FourthOrderMappedFineInterp.H:501
Definition: FourthOrderMappedFineInterp.H:161
MultiBlockLevelCopierAverage m_mbcp
Definition: FourthOrderMappedFineInterp.H:431
int m_CrFnStatus
Definition: FourthOrderMappedFineInterp.H:458
int offset2Key(const int *const a_offsets) const
Get the stencil key from a list of offsets.
virtual void defineCrFnJ(const LevelData< FArrayBox > &a_CrJ)
Define that saves the coarse <J> on the coarsened-fine layout.
CHArray< CHMatrix, 1, ArZeroCol, ArSp::ArrayOfMatrixAlloc > m_At
Definition: FourthOrderMappedFineInterp.H:384
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
CHArray< Real, SpaceDim+1, ArRangeCol > * m_fnGradXiLSx
Definition: FourthOrderMappedFineInterp.H:399
Definition: FArrayBox.H:45
bool m_defined[4]
Definition: FourthOrderMappedFineInterp.H:370
LevelData< FArrayBox > m_CrFnLevU
Definition: FourthOrderMappedFineInterp.H:423
Interpolate from coarse cells to valid fine cells on mapped grids.
Definition: FourthOrderMappedFineInterp.H:153
LayoutData< BaseFab< int > > m_ArIdxFillInterp
Definition: FourthOrderMappedFineInterp.H:446
CHArray< Real, SpaceDim+1, ArRangeCol > m_avgXiKpFine
Definition: FourthOrderMappedFineInterp.H:408
LevelData< FArrayBox > m_CrFnLevJ
Definition: FourthOrderMappedFineInterp.H:427
Iterator for an IntVectSet.
Definition: IntVectSet.H:640
void loadAvgXiKpA(Real *a_A, const RealVect &a_dxi, const RealVect a_h) const
Load for all p, evaluated with K.
bool isStencilDefined() const
True if stencil defined.
Definition: FourthOrderMappedFineInterp.H:479
CHArray< Real, SpaceDim+1, ArRangeCol > * m_fnXiLSx
Definition: FourthOrderMappedFineInterp.H:393
~FourthOrderMappedFineInterp()
Destructor.
const int m_stencilExtent
Definition: FourthOrderMappedFineInterp.H:360