Chombo + EB + MF  3.2
MultiBlockLevelCopier.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 _MULTIBLOCKLEVELCOPIER_H_
12 #define _MULTIBLOCKLEVELCOPIER_H_
13 
14 #include "MultiBlockLevelGeom.H"
15 #include "IVSFAB.H"
16 #include "MultiBlockUtil.H"
17 #include "MBStencil.H"
18 
19 #include "NamespaceHeader.H"
20 
21 /// The class MultiBlockLevelCopier stores topological and geometric information
22 /**
23  MultiBlockLevelCopier stores topological and geometric information
24  about a particular layout with a particular MultiBlockCoordSys,
25  for copying to another layout.
26 
27  Implementations of specific multiblock coordinate systems will be
28  provided by derived classes.
29 */
31 {
32 
33 public:
34 
35  /// default constructor
37  { m_isDefined = false;
38  m_isVectorDefined = false; }
39 
40  /// destructor
41  virtual ~MultiBlockLevelCopier();
42 
43  /// full constructor
45  const BoxLayout& a_dstLayout,
46  int a_order);
47 
49  const DisjointBoxLayout& a_dstDisjointLayout,
50  const IntVect& a_ghostVect,
51  int a_order);
52 
53  virtual void undefine();
54 
55  virtual void define(const MultiBlockLevelGeom* a_geomPtr,
56  const BoxLayout& a_dstLayout,
57  int a_order);
58 
59  virtual void define(const MultiBlockLevelGeom* a_geomPtr,
60  const DisjointBoxLayout& a_dstDisjointLayout,
61  const IntVect& a_ghostVect,
62  int a_order);
63 
64  /// must be in the derived class, else error when calling.
65  virtual void defineVector();
66 
67  /// copy from a_src to extra-block cells of a_dst at components in a_intvl
68  virtual void copyTo(const LevelData<FArrayBox>& a_src,
70  const Interval& a_intvl) const;
71 
72  /// copy from a_src to extra-block cells of a_dst at all components
73  virtual void copyTo(const LevelData<FArrayBox>& a_src,
74  BoxLayoutData<FArrayBox>& a_dst) const;
75 
76  /// copy from a_src to extra-block cells of vector a_dst at all components
77  virtual void copyToVector(const LevelData<FArrayBox>& a_src,
78  BoxLayoutData<FArrayBox>& a_dst) const;
79 
80  /// copy from a_src to extra-block cells of vector a_dst at components in a_intvl, of length SpaceDim. Must be in the derived class, else error when calling.
81  virtual void copyToVector(const LevelData<FArrayBox>& a_src,
83  const Interval& a_intvl) const;
84 
85  /// copy from a_src to extra-block cells of a_dst at all components where a_vecIntvl is interval of components of a vector, and the other components are scalars
86  virtual void copyToAllWithVector(const LevelData<FArrayBox>& a_src,
88  const Interval& a_vecIntvl) const;
89 
90 
91  /// accessor
93  { CH_assert(isDefined());
94  return m_extraCellsIVS; }
95 
96  /// accessor
97  /**
98  IVSFAB<MBStencil> *m_stencils[dit] lives on m_ghostCells[dit]
99  and has 1 component.
100  For each IntVect thisGhostCell in IntVectSet m_ghostCells[dit]
101  (i.e., thisGhostCell an extra-block ghost cell of m_grids[dit]),
102  MBStencil *m_stencils[dit](thisGhostCell, 0) contains the
103  interpolation stencil for thisGhostCell.
104  */
106  { CH_assert(isDefined());
107  return m_stencils; }
108 
109  bool isDefined() const
110  {
111  return m_isDefined;
112  }
113 
114 protected:
115 
116  /// is defined?
118 
119  /// is defined for vector transformations?
121 
122  /// either IndexType::TheCellType() for averaged, or IndexType::TheNodeType() for centered
124 
125  /// underlying source grids
127 
129 
130  /// underlying destination grids
132 
133  /// displacement of original destination layout from m_dstLayout: 0 in m_interpDimsVect but varying in m_fixedDimsVect
135 
136  /// whether all original underlying grids contain m_fixedPt in m_fixedDimsVect
138 
139  /// block number of base box of each box in m_dstLayout
141 
142  /// order of approximation wanted
143  int m_order;
144 
145  /// radius of neighborhood of data used for interpolation to extra-block cell
146  int m_radius;
147 
148  /// degree of Taylor polynomials
149  int m_degree;
150 
151  /// [0:m_degree]^D
153 
154  /// powers in Taylor polynomial
156 
157  /// number of coefficients in Taylor polynomial
159 
160  /// contains topological and geometric information
162 
163  /// contains coordinate systems; from m_geomPtr
165 
166  /// Number of mapping blocks
168 
169  /// extra-block cells of m_dstLayout that need to be filled in, in the form of IntVectSets
170  /**
171  For each dit, IntVectSet m_extraCellsIVS[dit]
172  contains the cells of m_grids[dit] that\
173  are not in block m_blockNumbersDst[dit].
174  */
176 
177  /// index of the valid block in which the center of each extra-block ghost cell falls. Lives on m_extraCellsIVS, has 1 component.
179 
180  /// index of the valid cell in which each extra-block ghost cell falls. Lives on m_extraCellsIVS, has 1 component.
182 
183  /// mapped coordinates, in valid block's index space, of center of each extra-block ghost cell. Lives on m_extraCellsIVS, has 1 component.
185 
186  /// interval of dimensions that are fixed. Default empty.
188 
189  /// dimensions that are fixed. Default empty.
191 
192  /// dimensions that are not fixed. Default 0:SpaceDim-1.
194 
195  /// fixed values of dimensions that are fixed. Default empty.
197 
198  /// displacement from m_fixedPt of original underlying grids, 0 in m_interpDimsVect but varying in m_fixedDimsVect
200 
201  /// interpolation stencils
202  /**
203  For each dit, IVSFAB<MBStencil> *m_stencils[dit]
204  lives on IntVectSet m_extraCellsIVS[dit] and has 1 component,
205  containing the stencil for each extra-block ghost cell of m_grids[dit].
206  */
208 
209  /// vector interpolation stencils
210  /**
211  For each dit, IVSFAB<MBVectorStencil> *m_vectorstencils[dit]
212  lives on IntVectSet m_extraCellsIVS[dit] and has 1 component,
213  containing the vector stencil for each extra-block ghost cell of m_grids[dit].
214  */
216 
217  /// for each source block, min Box containing valid cells
218  /**
219  For each srcBlock and dit,
220  Box (*(m_validLayout[srcBlock]))[dit]
221  is the minimum Box containing all valid cells that are needed
222  to fill in the ghost cells of m_ghostCells[dit].
223  */
225 
227 
229 
231 
232  /// Copier *m_copiers[srcBlock] for copying from m_grids to BoxLayout *m_validLayout[srcBlock]
234 
236 
238 };
239 
240 #include "NamespaceFooter.H"
241 #endif
virtual void copyToVector(const LevelData< FArrayBox > &a_src, BoxLayoutData< FArrayBox > &a_dst) const
copy from a_src to extra-block cells of vector a_dst at all components
LayoutData< RefCountedPtr< IVSFAB< MBStencil > > > m_stencils
interpolation stencils
Definition: MultiBlockLevelCopier.H:207
The class MultiBlockLevelGeom stores topological and geometric information.
Definition: MultiBlockLevelGeom.H:29
MultiBlockLevelCopier()
default constructor
Definition: MultiBlockLevelCopier.H:36
Vector< RefCountedPtr< LayoutData< Box > > > m_stencilCellsMinBox
Definition: MultiBlockLevelCopier.H:228
#define CH_assert(cond)
Definition: CHArray.H:37
Vector< BoxLayout * > m_validFullLayout
Definition: MultiBlockLevelCopier.H:226
const LayoutData< IntVectSet > & extraCells() const
accessor
Definition: MultiBlockLevelCopier.H:92
MultiBlockLevelGeom * m_geomPtr
contains topological and geometric information
Definition: MultiBlockLevelCopier.H:161
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
Interval m_fixedDims
interval of dimensions that are fixed. Default empty.
Definition: MultiBlockLevelCopier.H:187
The class MultiBlockLevelCopier stores topological and geometric information.
Definition: MultiBlockLevelCopier.H:30
virtual void copyToAllWithVector(const LevelData< FArrayBox > &a_src, BoxLayoutData< FArrayBox > &a_dst, const Interval &a_vecIntvl) const
copy from a_src to extra-block cells of a_dst at all components where a_vecIntvl is interval of compo...
Vector< RefCountedPtr< LayoutData< Box > > > m_stencilCellsFullMinBox
Definition: MultiBlockLevelCopier.H:230
LayoutData< RefCountedPtr< IVSFAB< MBVectorStencil > > > m_vectorstencils
vector interpolation stencils
Definition: MultiBlockLevelCopier.H:215
LayoutData< IVSFAB< RealVect > *> m_validMappedCenter
mapped coordinates, in valid block&#39;s index space, of center of each extra-block ghost cell...
Definition: MultiBlockLevelCopier.H:184
virtual void defineVector()
must be in the derived class, else error when calling.
virtual ~MultiBlockLevelCopier()
destructor
Vector< IntVect > m_powers
powers in Taylor polynomial
Definition: MultiBlockLevelCopier.H:155
LayoutData< int > m_blockNumbersDst
block number of base box of each box in m_dstLayout
Definition: MultiBlockLevelCopier.H:140
BoxLayout m_dstLayout
underlying destination grids
Definition: MultiBlockLevelCopier.H:131
int m_nblocks
Number of mapping blocks.
Definition: MultiBlockLevelCopier.H:167
DisjointBoxLayout m_srcLayout
underlying source grids
Definition: MultiBlockLevelCopier.H:126
BoxLayout m_gridsFixedOff
displacement from m_fixedPt of original underlying grids, 0 in m_interpDimsVect but varying in m_fixe...
Definition: MultiBlockLevelCopier.H:199
bool m_allGridsHaveFixedPt
whether all original underlying grids contain m_fixedPt in m_fixedDimsVect
Definition: MultiBlockLevelCopier.H:137
int m_numTaylorCoeffs
number of coefficients in Taylor polynomial
Definition: MultiBlockLevelCopier.H:158
LayoutData< IVSFAB< int > *> m_validBlock
index of the valid block in which the center of each extra-block ghost cell falls. Lives on m_extraCellsIVS, has 1 component.
Definition: MultiBlockLevelCopier.H:178
Structure for passing component ranges in code.
Definition: Interval.H:23
virtual void undefine()
Box m_degreeBox
[0:m_degree]^D
Definition: MultiBlockLevelCopier.H:152
BoxLayout m_dstFixedOff
displacement of original destination layout from m_dstLayout: 0 in m_interpDimsVect but varying in m_...
Definition: MultiBlockLevelCopier.H:134
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
DisjointBoxLayout m_srcFullLayout
Definition: MultiBlockLevelCopier.H:128
Vector< Copier * > m_copiers
Copier *m_copiers[srcBlock] for copying from m_grids to BoxLayout *m_validLayout[srcBlock].
Definition: MultiBlockLevelCopier.H:233
bool isDefined() const
Definition: MultiBlockLevelCopier.H:109
LayoutData< IntVectSet > m_extraCellsIVS
extra-block cells of m_dstLayout that need to be filled in, in the form of IntVectSets ...
Definition: MultiBlockLevelCopier.H:175
virtual interface class encapsulating multi-block mapping API
Definition: MultiBlockCoordSys.H:34
int m_degree
degree of Taylor polynomials
Definition: MultiBlockLevelCopier.H:149
Vector< int > m_fixedDimsVect
dimensions that are fixed. Default empty.
Definition: MultiBlockLevelCopier.H:190
bool m_isDefined
is defined?
Definition: MultiBlockLevelCopier.H:117
The class MultiBlockUtil contains some functions used by MultiBlockLevelGeom, MultiBlockLevelExchange...
Definition: MultiBlockUtil.H:23
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
MultiBlockUtil * m_mbUtil
Definition: MultiBlockLevelCopier.H:237
bool m_isVectorDefined
is defined for vector transformations?
Definition: MultiBlockLevelCopier.H:120
LayoutData< IVSFAB< IntVect > *> m_validIndices
index of the valid cell in which each extra-block ghost cell falls. Lives on m_extraCellsIVS, has 1 component.
Definition: MultiBlockLevelCopier.H:181
Vector< int > m_interpDimsVect
dimensions that are not fixed. Default 0:SpaceDim-1.
Definition: MultiBlockLevelCopier.H:193
Vector< int > m_fixedPt
fixed values of dimensions that are fixed. Default empty.
Definition: MultiBlockLevelCopier.H:196
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Cell-Based or Node-Based Indices.
Definition: Box.H:45
Vector< BoxLayout * > m_validLayout
for each source block, min Box containing valid cells
Definition: MultiBlockLevelCopier.H:224
int m_order
order of approximation wanted
Definition: MultiBlockLevelCopier.H:143
const LayoutData< RefCountedPtr< IVSFAB< MBStencil > > > & stencils() const
accessor
Definition: MultiBlockLevelCopier.H:105
Vector< Copier * > m_copiersFull
Definition: MultiBlockLevelCopier.H:235
MultiBlockCoordSys * m_coordSysPtr
contains coordinate systems; from m_geomPtr
Definition: MultiBlockLevelCopier.H:164
IndexType m_type
either IndexType::TheCellType() for averaged, or IndexType::TheNodeType() for centered ...
Definition: MultiBlockLevelCopier.H:123
int m_radius
radius of neighborhood of data used for interpolation to extra-block cell
Definition: MultiBlockLevelCopier.H:146
virtual void copyTo(const LevelData< FArrayBox > &a_src, BoxLayoutData< FArrayBox > &a_dst, const Interval &a_intvl) const
copy from a_src to extra-block cells of a_dst at components in a_intvl
virtual void define(const MultiBlockLevelGeom *a_geomPtr, const BoxLayout &a_dstLayout, int a_order)