Chombo + EB  3.0
NodeIntegrals.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 // NodeIntegrals.H
12 // petermc, 17 Oct 2005
13 // used to be in Norms.H
14 
15 #ifndef _NODEINTEGRALS_H_
16 #define _NODEINTEGRALS_H_
17 
18 #include "LevelData.H"
19 #include "NodeFArrayBox.H"
20 #include "Vector.H"
21 #include "IntVectSet.H"
22 #include "NamespaceHeader.H"
23 
24 /// Computes integral of a subbox of a NodeFArrayBox.
25 /** Computes integral of the data in a subbox of <i>a_nfab</i>.
26  */
27 Real integral(/// the data on which to take the integral
28  const NodeFArrayBox& a_nfab,
29  /// mesh spacing at this level
30  const Real a_dx,
31  /// CELL-centered subbox over which to take integral
32  const Box& a_subbox,
33  /// starting component
34  const int a_startComp = 0,
35  /// number of components
36  const int a_numComp = 1);
37 
38 /// Computes integral of a NodeFArrayBox.
39 /** Computes integral of the data in <i>a_nfab</i>.
40  */
41 Real integral(/// the data on which to take the integral
42  const NodeFArrayBox& a_nfab,
43  /// mesh spacing at this level
44  const Real a_dx,
45  /// starting component
46  const int a_startComp = 0,
47  /// number of components
48  const int a_numComp = 1);
49 
50 /// Computes integral of a BoxLayoutData<NodeFArrayBox>.
51 /** Computes integral of <i>a_layout</i>. Ignores ghost cells for LevelData.
52 
53  This is an internal function that should NOT normally
54  be called by the user.
55  */
56 Real integral(/// the data on which to take the norm
57  const BoxLayoutData<NodeFArrayBox>& a_layout,
58  /// mesh spacing at this level
59  const Real a_dx,
60  /// interval of components to use
61  const Interval& a_interval,
62  /// verbosity, whether to print norms of each box
63  bool a_verbose = true);
64 
65 /// Computes integral of multilevel array, counting only valid nodes at each level.
66 /**
67  Computes integral of multilevel array <i>a_phi</i>.
68  Only the valid nodes at each level are counted.
69  The valid nodes at a level are those that are not covered
70  by the interior of any finer level.
71  */
72 Real integral(/// multilevel data on which to take the norm
73  const Vector<LevelData<NodeFArrayBox>* >& a_phi,
74  /// CELL-centered physical domain on each level
75  const Vector<ProblemDomain>& a_domain,
76  /// refinement ratios between successive levels
77  const Vector<int>& a_nRefFine,
78  /// mesh spacing at base level <i>a_lBase</i>
79  const Real a_dxCrse,
80  /// components to use in computing norm
81  const Interval a_comps,
82  /// index of base level to use in Vectors
83  const int a_lBase,
84  /// verbosity, whether to print norms of each box
85  bool a_verbose = true);
86 
87 /// Computes integral of multilevel array, counting only valid nodes at each level.
88 /**
89  Computes integral of multilevel array <i>a_phi</i>.
90  Only the valid nodes at each level are counted.
91  The valid nodes at a level are those that are not covered
92  by the interior of any finer level.
93  */
94 Real integral(/// multilevel data on which to take the norm
95  const Vector<LevelData<NodeFArrayBox>* >& a_phi,
96  /// CELL-centered physical domain on each level
97  const Vector<Box>& a_domain,
98  /// refinement ratios between successive levels
99  const Vector<int>& a_nRefFine,
100  /// mesh spacing at base level <i>a_lBase</i>
101  const Real a_dxCrse,
102  /// components to use in computing norm
103  const Interval a_comps,
104  /// index of base level to use in Vectors
105  const int a_lBase,
106  /// verbosity, whether to print norms of each box
107  bool a_verbose = true);
108 
109 
110 /// Computes integral of single-level array, counting only valid nodes.
111 /**
112  Computes integral of single-level array <i>a_phi</i>.
113  Only the valid nodes at this level are counted.
114  The valid nodes are the interior nodes of this level that are not
115  projections of interior nodes of the finer level, if any.
116 
117  This function computes exterior boundary nodes, and interior boundary
118  nodes of the coarsened finer level, if any. It is more efficient
119  to precompute these boundary-node objects and call one of the other
120  integral functions below.
121 */
122 Real integral(/// the data on which to take the norm
123  const LevelData<NodeFArrayBox>& a_phi,
124  /// CELL-centered physical domain on each level
125  const ProblemDomain& a_domain,
126  /// pointer to CELL-centered grids on the next finer level, or NULL if there is none.
127  const DisjointBoxLayout* a_finerGridsPtr,
128  /// refinement ratio to next finer level
129  const int a_nRefFine,
130  /// mesh spacing at this level
131  const Real a_dx,
132  /// interval of components to use
133  const Interval a_comps,
134  /// verbosity, whether to print norms of each box
135  bool a_verbose = true);
136 
137 /// Computes integral of single-level array, counting only valid nodes.
138 /**
139  Computes integral of single-level array <i>a_phi</i>.
140  Only the valid nodes at this level are counted.
141  The valid nodes are the interior nodes of this level that are not
142  projections of interior nodes of the finer level, if any.
143 
144  This function computes exterior boundary nodes, and interior boundary
145  nodes of the coarsened finer level, if any. It is more efficient
146  to precompute these boundary-node objects and call one of the other
147  integral functions below.
148 */
149 Real integral(/// the data on which to take the norm
150  const LevelData<NodeFArrayBox>& a_phi,
151  /// CELL-centered physical domain on each level
152  const Box& a_domain,
153  /// pointer to CELL-centered grids on the next finer level, or NULL if there is none.
154  const DisjointBoxLayout* a_finerGridsPtr,
155  /// refinement ratio to next finer level
156  const int a_nRefFine,
157  /// mesh spacing at this level
158  const Real a_dx,
159  /// interval of components to use
160  const Interval a_comps,
161  /// verbosity, whether to print norms of each box
162  bool a_verbose = true);
163 
164 /// Computes integral of single-level array, counting only valid nodes.
165 /**
166  Computes integral of single-level array <i>a_phi</i>.
167  Only the valid nodes at this level are counted.
168  The valid nodes are the interior nodes of this level that are not
169  projections of interior nodes of the finer level, if any.
170 
171  The <i>a_IVSVext</i> argument is obtained from the calls:<br>
172  <tt>
173  interiorBoundaryNodes(IVSVint, a_phi.getBoxes(), a_domain);<br>
174  exteriorBoundaryNodes(a_IVSVext, IVSVint, a_phi.getBoxes();
175  </tt>
176 
177  The <i>a_IVSVintFinerCoarsened</i> argument is obtained from the call:<br>
178  <tt>
179  interiorBoundaryNodes(a_IVSVintFinerCoarsened,
180  a_phi.getBoxes(), a_finerGridsCoarsened, a_domain);
181  </tt>
182 */
183 Real integral(/// the data on which to take the norm
184  const LevelData<NodeFArrayBox>& a_phi,
185  /// CELL-centered physical domain on each level
186  const ProblemDomain& a_domain,
187  /// CELL-centered grids on the next finer level
188  const DisjointBoxLayout& a_finerGridsCoarsened,
189  /// exterior boundary nodes of this level
190  const LayoutData< Vector<IntVectSet> >& a_IVSVext,
191  /// interior boundary nodes of coarsened finer-level grids
192  const LayoutData< Vector<IntVectSet> >& a_IVSVintFinerCoarsened,
193  /// refinement ratio to next finer level
194  const int a_nRefFine,
195  /// mesh spacing at this level
196  const Real a_dx,
197  /// interval of components to use
198  const Interval a_comps,
199  /// verbosity, whether to print norms of each box
200  bool a_verbose = true);
201 
202 /// Computes integral of single-level array, counting only valid nodes.
203 /**
204  Computes integral of single-level array <i>a_phi</i>.
205  Only the valid nodes at this level are counted.
206  The valid nodes are the interior nodes of this level that are not
207  projections of interior nodes of the finer level, if any.
208 
209  The <i>a_IVSVext</i> argument is obtained from the calls:<br>
210  <tt>
211  interiorBoundaryNodes(IVSVint, a_phi.getBoxes(), a_domain);<br>
212  exteriorBoundaryNodes(a_IVSVext, IVSVint, a_phi.getBoxes();
213  </tt>
214 
215  The <i>a_IVSVintFinerCoarsened</i> argument is obtained from the call:<br>
216  <tt>
217  interiorBoundaryNodes(a_IVSVintFinerCoarsened,
218  a_phi.getBoxes(), a_finerGridsCoarsened, a_domain);
219  </tt>
220 */
221 Real integral(/// the data on which to take the norm
222  const LevelData<NodeFArrayBox>& a_phi,
223  /// CELL-centered physical domain on each level
224  const Box& a_domain,
225  /// CELL-centered grids on the next finer level
226  const DisjointBoxLayout& a_finerGridsCoarsened,
227  /// exterior boundary nodes of this level
228  const LayoutData< Vector<IntVectSet> >& a_IVSVext,
229  /// interior boundary nodes of coarsened finer-level grids
230  const LayoutData< Vector<IntVectSet> >& a_IVSVintFinerCoarsened,
231  /// refinement ratio to next finer level
232  const int a_nRefFine,
233  /// mesh spacing at this level
234  const Real a_dx,
235  /// interval of components to use
236  const Interval a_comps,
237  /// verbosity, whether to print norms of each box
238  bool a_verbose = true);
239 
240 
241 /// Computes integral of single-level array, counting only valid nodes, with no finer level.
242 /**
243  Computes integral of single-level array <i>a_phi</i>, where there is no
244  finer level. Only the valid nodes at this level are counted.
245  The valid nodes are the interior nodes of this level.
246 
247  The <i>a_IVSVext</i> argument is obtained from the calls:<br>
248  <tt>
249  interiorBoundaryNodes(IVSVint, a_phi.getBoxes(), a_domain);<br>
250  exteriorBoundaryNodes(a_IVSVext, IVSVint, a_phi.getBoxes();
251  </tt>
252 */
253 Real integral(/// the data on which to take the norm
254  const LevelData<NodeFArrayBox>& a_phi,
255  /// CELL-centered physical domain on each level
256  const ProblemDomain& a_domain,
257  /// exterior boundary nodes of this level
258  const LayoutData< Vector<IntVectSet> >& a_IVSVext,
259  /// mesh spacing at this level
260  const Real a_dx,
261  /// interval of components to use
262  const Interval a_comps,
263  /// verbosity, whether to print norms of each box
264  bool a_verbose = true);
265 
266 
267 /// Computes integral of single-level array, counting only valid nodes, with no finer level.
268 /**
269  Computes integral of single-level array <i>a_phi</i>, where there is no
270  finer level. Only the valid nodes at this level are counted.
271  The valid nodes are the interior nodes of this level.
272 
273  The <i>a_IVSVext</i> argument is obtained from the calls:<br>
274  <tt>
275  interiorBoundaryNodes(IVSVint, a_phi.getBoxes(), a_domain);<br>
276  exteriorBoundaryNodes(a_IVSVext, IVSVint, a_phi.getBoxes();
277  </tt>
278 */
279 Real integral(/// the data on which to take the norm
280  const LevelData<NodeFArrayBox>& a_phi,
281  /// CELL-centered physical domain on each level
282  const Box& a_domain,
283  /// exterior boundary nodes of this level
284  const LayoutData< Vector<IntVectSet> >& a_IVSVext,
285  /// mesh spacing at this level
286  const Real a_dx,
287  /// interval of components to use
288  const Interval a_comps,
289  /// verbosity, whether to print norms of each box
290  bool a_verbose = true);
291 
292 #include "NamespaceFooter.H"
293 #endif
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
one dimensional dynamic array
Definition: Vector.H:52
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: LayoutData.H:46
Structure for passing component ranges in code.
Definition: Interval.H:23
double Real
Definition: REAL.H:33
Real integral(const NodeFArrayBox &a_nfab, const Real a_dx, const Box &a_subbox, const int a_startComp=0, const int a_numComp=1)
Computes integral of a subbox of a NodeFArrayBox.
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
A wrapper for an FArrayBox to contain NODE-centered data.
Definition: NodeFArrayBox.H:87