Chombo + EB + MF  3.2
NodeSetOperations.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 // NodeSetOperations.H
12 // petermc, 12 June 2003
13 
14 #ifndef _NODESETOPERATIONS_H_
15 #define _NODESETOPERATIONS_H_
16 
17 #include "NodeFArrayBox.H"
18 #include "LevelData.H"
19 #include "IntVectSet.H"
20 #include "NamespaceHeader.H"
21 
22 /// Finds interior nodes of a DisjointBoxLayout in a particular box.
23 /** Returns nodes inside and surrounding CELL-centered box <i>a_box</i>
24  that are NOT on the interface of (CELL-centered) <i>a_boxes</i>
25  with the next coarser level.
26 
27  Example: for two particular boxes in the four-grid layout below,
28  the interior nodes are those that are marked "O". For the
29  second box, the nodes marked "Y" are interior nodes if and
30  only if the domain is periodic in the vertical direction and
31  the boxes extend to the top and bottom faces of the domain.
32 <pre>
33  +-----+ +YY---+
34  | | |OOOOO|
35  | | |OOOOO|
36  | | |OOOOO|
37  +---+OOO--+---+ +---+OOOOO+---+
38  |OOOOOOO | | | |
39  |OOOOOOO | | | |
40  |OOOOOOO | | | |
41  +---+OOOOOO+------+ +---+------+------+
42  | | | |
43  | | | |
44  | | | |
45  +----------+ +----------+
46 </pre>
47  The set of interior nodes of a box is the disjoint union of
48  the nodes surrounded by cells of the box, and the interior
49  boundary nodes of the box.
50  */
51 void interiorNodes(/// interior nodes of <i>a_box</i> in the layout <i>a_boxes</i>
52  IntVectSet& a_ivs,
53  /// CELL-centered physical domain containing <i>a_boxes</i>
54  const ProblemDomain& a_base_domain,
55  /// layout of CELL-centered boxes
56  const DisjointBoxLayout& a_boxes,
57  /// the box in <i>a_boxes</i> for which we find interior nodes
58  const Box& a_box);
59 
60 
61 /// Finds interior nodes of a DisjointBoxLayout in a particular box.
62 /** Returns nodes inside and surrounding CELL-centered box <i>a_box</i>
63  that are NOT on the interface of (CELL-centered) <i>a_boxes</i>
64  with the next coarser level.
65 
66  Example: for two particular boxes in the four-grid layout below,
67  the interior nodes are those that are marked "O". For the
68  second box, the nodes marked "Y" are interior nodes if and
69  only if the domain is periodic in the vertical direction and
70  the boxes extend to the top and bottom faces of the domain.
71 <pre>
72  +-----+ +YY---+
73  | | |OOOOO|
74  | | |OOOOO|
75  | | |OOOOO|
76  +---+OOO--+---+ +---+OOOOO+---+
77  |OOOOOOO | | | |
78  |OOOOOOO | | | |
79  |OOOOOOO | | | |
80  +---+OOOOOO+------+ +---+------+------+
81  | | | |
82  | | | |
83  | | | |
84  +----------+ +----------+
85 </pre>
86  The set of interior nodes of a box is the disjoint union of
87  the nodes surrounded by cells of the box, and the interior
88  boundary nodes of the box.
89  */
90 void interiorNodes(/// interior nodes of <i>a_box</i> in the layout <i>a_boxes</i>
91  IntVectSet& a_ivs,
92  /// CELL-centered physical domain containing <i>a_boxes</i>
93  const Box& a_base_domain,
94  /// layout of CELL-centered boxes
95  const DisjointBoxLayout& a_boxes,
96  /// the box in <i>a_boxes</i> for which we find interior nodes
97  const Box& a_box);
98 
99 
100 /// Finds interior boundary nodes of a DisjointBoxLayout.
101 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>,
102  a Vector of IntVectSets that contain the indices of the
103  nodes that lie on faces of the box but are not on the
104  interface of <i>a_boxes</i> with the next coarser level.
105 
106  Example: for two particular boxes, marked "me", in the
107  four-grid layout below, the interior boundary nodes are those
108  that are marked with "O". For the second box, the nodes marked "Y"
109  are also interior boundary nodes if and only if the domain is
110  periodic in the vertical direction and the grids extend to the
111  top and bottom faces of the domain.
112 <pre>
113  +-----+ +YY---+
114  | | | |
115  | | | me |
116  | | | |
117  +---+OOO--+---+ +---+OOOOO+---+
118  | O | | | |
119  | me O | | | |
120  | O | | | |
121  +---+OOOOOO+------+ +---+------+------+
122  | | | |
123  | | | |
124  | | | |
125  +----------+ +----------+
126 </pre>
127  The result <i>a_IVSV</i> is needed by copyInteriorNodes().
128 
129  <b>Question</b>: Why not simply store the indices of all interior
130  boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than
131  a LayoutData< Vector<IntVectSet> >? <br>
132  <b>Answer</b>: Because of the way IntVectSets are stored, this would be
133  very slow.
134 
135  The different components of the Vector<IntVectSet> contain
136  indices of nodes on different faces of the box.
137  */
138 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
139  LayoutData< Vector<IntVectSet> >& a_IVSV,
140  /// layout of CELL-centered boxes
141  const DisjointBoxLayout& a_boxes,
142  /// CELL-centered physical domain containing <i>a_boxes</i>
143  const ProblemDomain& a_domain);
144 
145 
146 /// Finds interior boundary nodes of a DisjointBoxLayout.
147 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>,
148  a Vector of IntVectSets that contain the indices of the
149  nodes that lie on faces of the box but are not on the
150  interface of <i>a_boxes</i> with the next coarser level.
151 
152  Example: for two particular boxes, marked "me", in the
153  four-grid layout below, the interior boundary nodes are those
154  that are marked with "O". For the second box, the nodes marked "Y"
155  are also interior boundary nodes if and only if the domain is
156  periodic in the vertical direction and the grids extend to the
157  top and bottom faces of the domain.
158 <pre>
159  +-----+ +YY---+
160  | | | |
161  | | | me |
162  | | | |
163  +---+OOO--+---+ +---+OOOOO+---+
164  | O | | | |
165  | me O | | | |
166  | O | | | |
167  +---+OOOOOO+------+ +---+------+------+
168  | | | |
169  | | | |
170  | | | |
171  +----------+ +----------+
172 </pre>
173  The result <i>a_IVSV</i> is needed by copyInteriorNodes().
174 
175  <b>Question</b>: Why not simply store the indices of all interior
176  boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than
177  a LayoutData< Vector<IntVectSet> >? <br>
178  <b>Answer</b>: Because of the way IntVectSets are stored, this would be
179  very slow.
180 
181  The different components of the Vector<IntVectSet> contain
182  indices of nodes on different faces of the box.
183  */
184 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
185  LayoutData< Vector<IntVectSet> >& a_IVSV,
186  /// layout of CELL-centered boxes
187  const DisjointBoxLayout& a_boxes,
188  /// CELL-centered physical domain containing <i>a_boxes</i>
189  const Box& a_domain);
190 
191 
192 /// Finds interior boundary nodes of a DisjointBoxLayout.
193 /** Returns a LayoutData containing, for each destination box,
194  a Vector of IntVectSets that together represent the nodes
195  of the destination box that are also interior boundary nodes
196  of the source boxes.
197 
198  Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes
199  of <i>a_src</i>, then the Vector<IntVectSet> <i>a_IVSV</i>[dit()] holds
200  the intersection of IBN(<i>a_src</i>) and the nodes
201  surrounding <i>a_dest</i>[dit()].
202 
203  The result <i>a_IVSV</i> is used in copyInteriorNodes().
204  */
205 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
206  LayoutData< Vector<IntVectSet> >& a_IVSV,
207  /// layout of CELL-centered destination boxes
208  const DisjointBoxLayout& a_dest,
209  /// layout of CELL-centered source boxes
210  const DisjointBoxLayout& a_src,
211  /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i>
212  const ProblemDomain& a_domain);
213 
214 
215 /// Finds interior boundary nodes of a DisjointBoxLayout.
216 /** Returns a LayoutData containing, for each destination box,
217  a Vector of IntVectSets that together represent the nodes
218  of the destination box that are also interior boundary nodes
219  of the source boxes.
220 
221  Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes
222  of <i>a_src</i>, then the Vector<IntVectSet> <i>a_IVSV</i>[dit()] holds
223  the intersection of IBN(<i>a_src</i>) and the nodes
224  surrounding <i>a_dest</i>[dit()].
225 
226  The result <i>a_IVSV</i> is used in copyInteriorNodes().
227  */
228 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
229  LayoutData< Vector<IntVectSet> >& a_IVSV,
230  /// layout of CELL-centered destination boxes
231  const DisjointBoxLayout& a_dest,
232  /// layout of CELL-centered source boxes
233  const DisjointBoxLayout& a_src,
234  /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i>
235  const Box& a_domain);
236 
237 
238 /// Finds exterior boundary nodes of a DisjointBoxLayout.
239 /** Returns a LayoutData containing, for each box, the exterior boundary
240  nodes of the box.
241 
242  The exterior boundary nodes are the nodes on a level that are
243  not interior nodes: they lie on the physical boundary and on
244  the interface with the coarser level.
245 
246  Example: for two particular boxes, marked "me", in the
247  four-grid layout below, the exterior boundary nodes are those
248  that are marked "O". For the second box, the nodes marked "Y"
249  are also exterior boundary nodes, unless the domain is periodic
250  in the vertical direction and the grids extend to the
251  top and bottom faces of the domain.
252 <pre>
253  +-----+ OYYOOOO
254  | | O O
255  | | O me O
256  | | O O
257  OOOOO--+--+---+ +---O--+--O---+
258  O | | | | |
259  O me | | | | |
260  O | | | | |
261  +---O------O------+ +---+------+------+
262  | | | |
263  | | | |
264  | | | |
265  +----------+ +----------+
266 </pre>
267  The argument <i>a_interior</i> is obtained from<br>
268  <tt>
269  interiorBoundaryNodes(a_interior, a_boxes, a_domain)
270  </tt>
271  where <i>a_domain</i> is the physical domain.
272 
273  You don't need the physical domain <i>a_domain</i> as an argument
274  to this function, even to get periodicities, because everything needed
275  from <i>a_domain</i> is put into <i>a_interior</i>.
276  */
277 void exteriorBoundaryNodes(/// object containing exterior boundary nodes of <i>a_boxes</i>
278  LayoutData< Vector<IntVectSet> >& a_exterior,
279  /// object containing interior boundary nodes of <i>a_boxes</i>
280  const LayoutData< Vector<IntVectSet> >& a_interior,
281  /// layout of CELL-centered boxes
282  const DisjointBoxLayout& a_boxes);
283 
284 
285 /// Sets data to zero on specified boundary nodes.
286 /** Sets <i>a_dest</i> to zero on the nodes in <i>a_IVSV</i>.
287 
288  Specifically, <i>a_dest</i>[dit()] is set to zero on
289  the nodes in <i>a_IVSV</i>[dit()].
290 
291  We usually call this function with <i>a_IVSV</i> representing the
292  exterior boundary nodes of <i>a_dest</i>. These are obtained with
293  the sequence of calls:<br>
294  <tt>
295  interiorBoundaryNodes(a_IVSVint, a_dest.boxLayout(), a_domain)
296  <tt><br>
297  where <i>a_domain</i> is the physical domain, and<br>
298  <tt>
299  exteriorBoundaryNodes(a_IVSV, a_IVSVint, a_dest.boxLayout())
300  <tt>.
301 */
302 void zeroBoundaryNodes(/// the data
304  /// object containing boundary nodes
305  const LayoutData< Vector<IntVectSet> >& a_IVSV);
306 
307 /// Copies data at interior nodes from one LevelData<NodeFArrayBox> to another.
308 /** Copies data from <i>a_src</i> to <i>a_dest</i>,
309  over the interior nodes of <i>a_src</i>.
310  They need not have the same layout.
311 
312  The argument <i>a_IVSV</i> is obtained from<br>
313  <tt>
314  interiorBoundaryNodes(a_IVSV,
315  a_dest.boxLayout(), a_src.boxLayout(), a_domain)
316  </tt><br>
317  where <i>a_domain</i> is the physical domain.
318 
319  If <i>a_dest</i> and <i>a_src</i> have the same layout,
320  then we may obtain <i>a_IVSV</i> more efficiently from<br>
321  <tt>
322  interiorBoundaryNodes(a_IVSV, a_src.boxLayout(), a_domain)
323  </tt>.<br>
324  Do not use this shorter form if <i>a_dest</i> and <i>a_src</i>
325  have different layouts.
326 
327  Example: if <i>a_src</i> has the four-grid layout on the left below, then
328  the nodes from which data are copied to <i>a_dest</i> are marked with
329  "X" and "O" on the right below. (The distinction between "X" and "O"
330  is that nodes marked "O" are on interior boundaries of the layout.)
331  Data are copied from the nodes marked "Y" if and only if the domain
332  is periodic in the vertical direction and the grids extend to the
333  top and bottom faces of the domain.
334 <pre>
335  +-----+ +YY---+
336  | | |OOOOO|
337  | | |OOOOO|
338  | | |OOOOO|
339  +---+--+--+---+ +---+XXXXX+---+
340  | | | |OOOOOOXOOOOOO|
341  | | | |OOOOOOXOOOOOO|
342  | | | |OOOOOOXOOOOOO|
343  +---+------+------+ +---+XXXXXX+------+
344  | | |OOOOOOOOOO|
345  | | |OOOOOOOOOO|
346  | | |OOOOOOOOOO|
347  +----------+ +--------YY+
348 </pre>
349  Both pictures represent the layout of <i>a_src</i>.
350  The layout of <i>a_dest</i> may be completely different from that
351  of <i>a_src</i>.
352 
353  Data at nodes in <i>a_dest</i> that are not interior boundary nodes
354  of <i>a_src</i> remain unchanged by this function.
355  */
356 void copyInteriorNodes(/// destination data
357  LevelData<NodeFArrayBox>& a_dest,
358  /// source data
359  const LevelData<NodeFArrayBox>& a_src,
360  /// object containing interior boundary nodes of source layout that are also nodes of destination layout
361  const LayoutData< Vector<IntVectSet> >& a_IVSV);
362 
363 /// Determines which IntVectSets are rectangular.
364 /** Sets the bit <i>a_IVSVfull</i>[dit()][comp] to be true if and only if
365  <i>a_IVSV</i>[dit()][comp] is a full rectangle.
366  */
367 void
368 fullIntVectSets(/// object containing bit settings of whether each component is rectangular
369  LayoutData< BitSet >& a_IVSVfull,
370  /// object containing interior boundary nodes of a layout
371  const LayoutData< Vector<IntVectSet> >& a_IVSV);
372 
373 /*
374  These routines are the same as above, but use LayoutData< Vector<Box> >
375  instead of LayoutData< Vector<IntVectSet> >.
376 */
377 
378 /// Finds interior boundary nodes of a DisjointBoxLayout.
379 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>,
380  a Vector of IntVectSets that contain the indices of the
381  nodes that lie on faces of the box but are not on the
382  interface of <i>a_boxes</i> with the next coarser level.
383 
384  Example: for two particular boxes, marked "me", in the
385  four-grid layout below, the interior boundary nodes are those
386  that are marked with "O". For the second box, the nodes marked "Y"
387  are also interior boundary nodes if and only if the domain is
388  periodic in the vertical direction and the grids extend to the
389  top and bottom faces of the domain.
390 <pre>
391  +-----+ +YY---+
392  | | | |
393  | | | me |
394  | | | |
395  +---+OOO--+---+ +---+OOOOO+---+
396  | O | | | |
397  | me O | | | |
398  | O | | | |
399  +---+OOOOOO+------+ +---+------+------+
400  | | | |
401  | | | |
402  | | | |
403  +----------+ +----------+
404 </pre>
405  The result <i>a_IVSV</i> is needed by copyInteriorNodes().
406 
407  <b>Question</b>: Why not simply store the indices of all interior
408  boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than
409  a LayoutData< Vector<Box> >? <br>
410  <b>Answer</b>: Because of the way IntVectSets are stored, this would be
411  very slow.
412 
413  The different components of the Vector<Box> contain
414  indices of nodes on different faces of the box.
415  */
416 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
417  LayoutData< Vector<Box> >& a_IVSV,
418  /// layout of CELL-centered boxes
419  const DisjointBoxLayout& a_boxes,
420  /// CELL-centered physical domain containing <i>a_boxes</i>
421  const Box& a_domain);
422 
423 
424 /// Finds interior boundary nodes of a DisjointBoxLayout.
425 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>,
426  a Vector of IntVectSets that contain the indices of the
427  nodes that lie on faces of the box but are not on the
428  interface of <i>a_boxes</i> with the next coarser level.
429 
430  Example: for two particular boxes, marked "me", in the
431  four-grid layout below, the interior boundary nodes are those
432  that are marked with "O". For the second box, the nodes marked "Y"
433  are also interior boundary nodes if and only if the domain is
434  periodic in the vertical direction and the grids extend to the
435  top and bottom faces of the domain.
436 <pre>
437  +-----+ +YY---+
438  | | | |
439  | | | me |
440  | | | |
441  +---+OOO--+---+ +---+OOOOO+---+
442  | O | | | |
443  | me O | | | |
444  | O | | | |
445  +---+OOOOOO+------+ +---+------+------+
446  | | | |
447  | | | |
448  | | | |
449  +----------+ +----------+
450 </pre>
451  The result <i>a_IVSV</i> is needed by copyInteriorNodes().
452 
453  <b>Question</b>: Why not simply store the indices of all interior
454  boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than
455  a LayoutData< Vector<Box> >? <br>
456  <b>Answer</b>: Because of the way IntVectSets are stored, this would be
457  very slow.
458 
459  The different components of the Vector<Box> contain
460  indices of nodes on different faces of the box.
461  */
462 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
463  LayoutData< Vector<Box> >& a_IVSV,
464  /// layout of CELL-centered boxes
465  const DisjointBoxLayout& a_boxes,
466  /// CELL-centered physical domain containing <i>a_boxes</i>
467  const ProblemDomain& a_domain);
468 
469 
470 /// Finds interior boundary nodes of a DisjointBoxLayout.
471 /** Returns a LayoutData containing, for each destination box,
472  a Vector of IntVectSets that together represent the nodes
473  of the destination box that are also interior boundary nodes
474  of the source boxes.
475 
476  Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes
477  of <i>a_src</i>, then the Vector<Box> <i>a_IVSV</i>[dit()] holds
478  the intersection of IBN(<i>a_src</i>) and the nodes
479  surrounding <i>a_dest</i>[dit()].
480 
481  The result <i>a_IVSV</i> is used in copyInteriorNodes().
482  */
483 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
484  LayoutData< Vector<Box> >& a_IVSV,
485  /// layout of CELL-centered destination boxes
486  const DisjointBoxLayout& a_dest,
487  /// layout of CELL-centered source boxes
488  const DisjointBoxLayout& a_src,
489  /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i>
490  const Box& a_domain);
491 
492 
493 /// Finds interior boundary nodes of a DisjointBoxLayout.
494 /** Returns a LayoutData containing, for each destination box,
495  a Vector of IntVectSets that together represent the nodes
496  of the destination box that are also interior boundary nodes
497  of the source boxes.
498 
499  Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes
500  of <i>a_src</i>, then the Vector<Box> <i>a_IVSV</i>[dit()] holds
501  the intersection of IBN(<i>a_src</i>) and the nodes
502  surrounding <i>a_dest</i>[dit()].
503 
504  The result <i>a_IVSV</i> is used in copyInteriorNodes().
505  */
506 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i>
507  LayoutData< Vector<Box> >& a_IVSV,
508  /// layout of CELL-centered destination boxes
509  const DisjointBoxLayout& a_dest,
510  /// layout of CELL-centered source boxes
511  const DisjointBoxLayout& a_src,
512  /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i>
513  const ProblemDomain& a_domain);
514 
515 
516 /// Finds exterior boundary nodes of a DisjointBoxLayout.
517 /** Returns a LayoutData containing, for each box, the exterior boundary
518  nodes of the box.
519 
520  The exterior boundary nodes are the nodes on a level that are
521  not interior nodes: they lie on the physical boundary and on
522  the interface with the coarser level.
523 
524  Example: for two particular boxes, marked "me", in the
525  four-grid layout below, the exterior boundary nodes are those
526  that are marked "O". For the second box, the nodes marked "Y"
527  are also exterior boundary nodes, unless the domain is periodic
528  in the vertical direction and the grids extend to the
529  top and bottom faces of the domain.
530 <pre>
531  +-----+ OYYOOOO
532  | | O O
533  | | O me O
534  | | O O
535  OOOOO--+--+---+ +---O--+--O---+
536  O | | | | |
537  O me | | | | |
538  O | | | | |
539  +---O------O------+ +---+------+------+
540  | | | |
541  | | | |
542  | | | |
543  +----------+ +----------+
544 </pre>
545  The argument <i>a_interior</i> is obtained from<br>
546  <tt>
547  interiorBoundaryNodes(a_interior, a_boxes, a_domain)
548  </tt>
549  where <i>a_domain</i> is the physical domain.
550 
551  You don't need the physical domain <i>a_domain</i> as an argument
552  to this function, even to get periodicities, because everything needed
553  from <i>a_domain</i> is put into <i>a_interior</i>.
554  */
555 void exteriorBoundaryNodes(/// object containing exterior boundary nodes of <i>a_boxes</i>
556  LayoutData< Vector<Box> >& a_exterior,
557  /// object containing interior boundary nodes of <i>a_boxes</i>
558  const LayoutData< Vector<Box> >& a_interior,
559  /// layout of CELL-centered boxes
560  const DisjointBoxLayout& a_boxes);
561 
562 /// Copies data at interior nodes from one LevelData<NodeFArrayBox> to another.
563 /** Copies data from <i>a_src</i> to <i>a_dest</i>,
564  over the interior nodes of <i>a_src</i>.
565  They need not have the same layout.
566 
567  The argument <i>a_IVSV</i> is obtained from<br>
568  <tt>
569  interiorBoundaryNodes(a_IVSV,
570  a_dest.boxLayout(), a_src.boxLayout(), a_domain)
571  </tt><br>
572  where <i>a_domain</i> is the physical domain.
573 
574  If <i>a_dest</i> and <i>a_src</i> have the same layout,
575  then we may obtain <i>a_IVSV</i> more efficiently from<br>
576  <tt>
577  interiorBoundaryNodes(a_IVSV, a_src.boxLayout(), a_domain)
578  </tt>.<br>
579  Do not use this shorter form if <i>a_dest</i> and <i>a_src</i>
580  have different layouts.
581 
582  Example: if <i>a_src</i> has the four-grid layout on the left below, then
583  the nodes from which data are copied to <i>a_dest</i> are marked with
584  "X" and "O" on the right below. (The distinction between "X" and "O"
585  is that nodes marked "O" are on interior boundaries of the layout.)
586  Data are copied from the nodes marked "Y" if and only if the domain
587  is periodic in the vertical direction and the grids extend to the
588  top and bottom faces of the domain.
589 <pre>
590  +-----+ +YY---+
591  | | |OOOOO|
592  | | |OOOOO|
593  | | |OOOOO|
594  +---+--+--+---+ +---+XXXXX+---+
595  | | | |OOOOOOXOOOOOO|
596  | | | |OOOOOOXOOOOOO|
597  | | | |OOOOOOXOOOOOO|
598  +---+------+------+ +---+XXXXXX+------+
599  | | |OOOOOOOOOO|
600  | | |OOOOOOOOOO|
601  | | |OOOOOOOOOO|
602  +----------+ +--------YY+
603 </pre>
604  Both pictures represent the layout of <i>a_src</i>.
605  The layout of <i>a_dest</i> may be completely different from that
606  of <i>a_src</i>.
607 
608  Data at nodes in <i>a_dest</i> that are not interior boundary nodes
609  of <i>a_src</i> remain unchanged by this function.
610  */
611 void copyInteriorNodes(/// destination data
612  LevelData<NodeFArrayBox>& a_dest,
613  /// source data
614  const LevelData<NodeFArrayBox>& a_src,
615  /// object containing interior boundary nodes of source layout that are also nodes of destination layout
616  const LayoutData< Vector<Box> >& a_IVSV);
617 
618 
619 /// Sets data to zero on specified boundary nodes.
620 /** Sets <i>a_dest</i> to zero on the nodes in <i>a_IVSV</i>.
621 
622  Specifically, <i>a_dest</i>[dit()] is set to zero on
623  the nodes in <i>a_IVSV</i>[dit()].
624 
625  We usually call this function with <i>a_IVSV</i> representing the
626  exterior boundary nodes of <i>a_dest</i>. These are obtained with
627  the sequence of calls:<br>
628  <tt>
629  interiorBoundaryNodes(a_IVSVint, a_dest.boxLayout(), a_domain)
630  <tt><br>
631  where <i>a_domain</i> is the physical domain, and<br>
632  <tt>
633  exteriorBoundaryNodes(a_IVSV, a_IVSVint, a_dest.boxLayout())
634  <tt>.
635 */
636 void zeroBoundaryNodes(/// the data
638  /// object containing boundary nodes
639  const LayoutData< Vector<Box> >& a_IVSV);
640 
641 /*
642  Following functions are for Vector<Box> calculus.
643 */
644 
645 ///
646 /*
647  To a_boxes, append the new points of the boxes in a_new.
648 */
649 void appendBoxes(Vector<Box>& a_boxes,
650  const Vector<Box>& a_new);
651 
652 ///
653 /*
654  From a_boxes, remove all points of a_remove.
655 */
656 void removeBoxFromBoxes(Vector<Box>& a_boxes,
657  const Box& a_remove);
658 
659 ///
660 /*
661  Return in a_boxes the result of removing the boxes in a_remove from a_base.
662 */
663 void removeBoxesFromBox(Vector<Box>& a_boxes,
664  const Vector<Box>& a_remove,
665  const Box& a_base);
666 
667 ///
668 /*
669  Return in a_boxes the result of removing the points of a_remove from a_base.
670 */
671 void removeBoxFromBox(Vector<Box>& a_boxes,
672  const Box& a_remove,
673  const Box& a_base);
674 
675 ///
676 /*
677  From a_boxes, remove all points in the boxes in a_remove.
678 */
679 void removeBoxesFromBoxes(Vector<Box>& a_boxes,
680  const Vector<Box>& a_remove);
681 
682 ///
683 /*
684  Replace each box in a_boxes with its intersection with the union of
685  the boxes in a_new.
686 */
687 void intersectBoxes(Vector<Box>& a_boxes,
688  const Vector<Box>& a_new);
689 
690 ///
691 /*
692  Replace each box in a_boxes with its intersection with the box a_new.
693 */
694 void intersectBoxes(Vector<Box>& a_boxes,
695  const Box& a_new);
696 
697 ///
698 /*
699  Shift all boxes in a_boxes by a_offset.
700 */
701 void shiftBoxes(Vector<Box>& a_boxes,
702  const IntVect& a_offset);
703 
704 ///
705 /*
706  Convert box centerings from CELL to NODE.
707 */
708 void cellsToNodes(Vector<Box>& a_boxes);
709 
710 ///
711 /*
712  Convert box centerings from NODE to CELL.
713 */
714 void nodesToCells(Vector<Box>& a_boxes);
715 
716 ///
717 /*
718  At each level, return exterior boundary nodes.
719  At each level except for the finest, return the interior boundary nodes
720  of the coarsened finer level.
721 */
723  /// object containing exterior boundary nodes of <i>a_boxes</i> at each level
724  Vector< LayoutData< Vector<Box> >* >& a_exterior,
725  /// object containing interior boundary nodes of coarsened <i>a_boxes</i> at each level except finest
726  Vector< LayoutData< Vector<Box> >* >& a_intFinerCoarsened,
727  /// layouts of CELL-centered boxes
728  const Vector<DisjointBoxLayout>& a_layouts,
729  /// domain of each level
730  const Vector<ProblemDomain>& a_domain,
731  /// refinement ratio between levels
732  const Vector<int>& a_nRefFine);
733 
734 
735 ///
736 /*
737  At each level, return exterior boundary nodes.
738  At each level except for the finest, return the interior boundary nodes
739  of the coarsened finer level.
740 */
742  /// object containing exterior boundary nodes of <i>a_boxes</i> at each level
743  Vector< LayoutData< Vector<IntVectSet> >* >& a_exterior,
744  /// object containing interior boundary nodes of coarsened <i>a_boxes</i> at each level except finest
745  Vector< LayoutData< Vector<IntVectSet> >* >& a_intFinerCoarsened,
746  /// layouts of CELL-centered boxes
747  const Vector<DisjointBoxLayout>& a_layouts,
748  /// domain of each level
749  const Vector<ProblemDomain>& a_domain,
750  /// refinement ratio between levels
751  const Vector<int>& a_nRefFine);
752 
753 
754 /// Returns a mask on interior nodes of a DisjointBoxLayout.
755 /** Returns a LevelData on nodes of a_dest that is
756  a_onoff on interior nodes of *a_srcPtr (or of a_dest if a_srcPtr is null);
757  1 - a_onoff on all other nodes.
758  */
759 void getMaskInteriorNodes(/// mask built on a_dest, representing interior nodes of a_src.
760  LevelData<NodeFArrayBox>& a_mask,
761  /// layout of CELL-centered destination boxes
762  const DisjointBoxLayout& a_dest,
763  /// layout of CELL-centered source boxes
764  const DisjointBoxLayout* a_srcPtr,
765  /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i>
766  const Box& a_domain,
767  /// 1 or 0, for interior nodes
768  int a_onoff = 1);
769 
770 
771 /// Returns a mask on interior nodes of a DisjointBoxLayout.
772 /** Returns a LevelData on nodes of a_dest that is
773  a_onoff on interior nodes of *a_srcPtr (or of a_dest if a_srcPtr is null);
774  1 - a_onoff on all other nodes.
775  */
776 void getMaskInteriorNodes(/// mask built on a_dest, representing interior boundary nodes of a_src.
777  LevelData<NodeFArrayBox>& a_mask,
778  /// layout of CELL-centered destination boxes
779  const DisjointBoxLayout& a_dest,
780  /// layout of CELL-centered source boxes
781  const DisjointBoxLayout* a_srcPtr,
782  /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i>
783  const ProblemDomain& a_domain,
784  /// 1 or 0, for interior nodes
785  int a_onoff = 1);
786 
787 
788 /// Returns a mask on interior nodes of a DisjointBoxLayout.
789 /** Returns a LevelData on nodes of a_dest that is
790  1. on interior nodes of a_dest,
791  0. on all other nodes.
792  */
793 void getMaskInteriorNodes(/// mask built on a_dest, representing interior nodes of a_dest.
794  LevelData<NodeFArrayBox>& a_mask,
795  /// layout of CELL-centered destination boxes
796  const DisjointBoxLayout& a_dest,
797  /// CELL-centered physical domain containing <i>a_dest</i>
798  const Box& a_domain);
799 
800 
801 /// Returns a mask on valid nodes on a level.
802 /** Returns a LevelData on a_layout that is
803  1. on valid nodes of a_layout,
804  0. on all other nodes.
805  */
806 void getMaskValidNodes(/// mask built on a_dest, representing valid nodes of a_layout.
807  LevelData<NodeFArrayBox>& a_mask,
808  /// layout of CELL-centered boxes on this level
809  const DisjointBoxLayout& a_layout,
810  /// layout of CELL-centered coarsened boxes on finer level
811  const DisjointBoxLayout* a_finerCoarsenedPtr,
812  /// CELL-centered physical domain containing <i>a_layout</i> and <i>a_finerCoarsened</i>
813  const ProblemDomain& a_domain);
814 
815 
816 /// Returns a mask on valid nodes on a level.
817 /** Returns a LevelData on a_layout that is
818  1. on valid nodes of a_layout,
819  0. on all other nodes.
820  */
821 void getMaskValidNodes(/// mask built on a_dest, representing valid nodes of a_layout.
822  LevelData<NodeFArrayBox>& a_mask,
823  /// layout of CELL-centered boxes on this level
824  const DisjointBoxLayout& a_layout,
825  /// layout of CELL-centered coarsened boxes on finer level
826  const DisjointBoxLayout* a_finerCoarsenedPtr,
827  /// CELL-centered physical domain containing <i>a_layout</i> and <i>a_finerCoarsened</i>
828  const Box& a_domain);
829 
830 
831 ///
832 /*
833  At each level, return mask for valid nodes.
834 */
835 void getMaskValidNodes(
836  /// at each level, a mask for valid nodes
837  Vector< LevelData<NodeFArrayBox>* >& a_masks,
838  /// layouts of CELL-centered boxes
839  const Vector<DisjointBoxLayout>& a_layouts,
840  /// domain of each level
841  const Vector<ProblemDomain>& a_domain,
842  /// refinement ratio between levels
843  const Vector<int>& a_nRefFine);
844 
845 
846 ///
847 /** Return the NODE-centered layout of NODEs surrounding a
848  CELL-centered layout.
849 */
850 void getSurroundingNodes(BoxLayout& a_gridsNodes,
851  const BoxLayout& a_gridsCells);
852 
853 
854 ///
855 /** Return the CELL-centered layout of CELLs enclosed by a
856  NODE-centered layout.
857 */
858 void getEnclosedCells(BoxLayout& a_gridsCells,
859  const BoxLayout& a_gridsNodes);
860 
861 ///
862 /** Divide a_intFab by 2 on faces of a_bx (and by 4 on edges, 8 on corners)
863  */
864 void halveIntFaces(BaseFab<int>& a_intFab,
865  const Box& a_bx);
866 
867 #include "NamespaceFooter.H"
868 #endif
void appendBoxes(Vector< Box > &a_boxes, const Vector< Box > &a_new)
void removeBoxesFromBoxes(Vector< Box > &a_boxes, const Vector< Box > &a_remove)
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
void getMaskValidNodes(LevelData< NodeFArrayBox > &a_mask, const DisjointBoxLayout &a_layout, const DisjointBoxLayout *a_finerCoarsenedPtr, const ProblemDomain &a_domain)
Returns a mask on valid nodes on a level.
void cellsToNodes(Vector< Box > &a_boxes)
void shiftBoxes(Vector< Box > &a_boxes, const IntVect &a_offset)
void halveIntFaces(BaseFab< int > &a_intFab, const Box &a_bx)
void interiorBoundaryNodes(LayoutData< Vector< IntVectSet > > &a_IVSV, const DisjointBoxLayout &a_boxes, const ProblemDomain &a_domain)
Finds interior boundary nodes of a DisjointBoxLayout.
void intersectBoxes(Vector< Box > &a_boxes, const Vector< Box > &a_new)
void getSurroundingNodes(BoxLayout &a_gridsNodes, const BoxLayout &a_gridsCells)
void exteriorBoundaryNodes(LayoutData< Vector< IntVectSet > > &a_exterior, const LayoutData< Vector< IntVectSet > > &a_interior, const DisjointBoxLayout &a_boxes)
Finds exterior boundary nodes of a DisjointBoxLayout.
void getEnclosedCells(BoxLayout &a_gridsCells, const BoxLayout &a_gridsNodes)
void interiorNodes(IntVectSet &a_ivs, const ProblemDomain &a_base_domain, const DisjointBoxLayout &a_boxes, const Box &a_box)
Finds interior nodes of a DisjointBoxLayout in a particular box.
void removeBoxFromBox(Vector< Box > &a_boxes, const Box &a_remove, const Box &a_base)
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
void zeroBoundaryNodes(BoxLayoutData< NodeFArrayBox > &a_dest, const LayoutData< Vector< IntVectSet > > &a_IVSV)
Sets data to zero on specified boundary nodes.
void copyInteriorNodes(LevelData< NodeFArrayBox > &a_dest, const LevelData< NodeFArrayBox > &a_src, const LayoutData< Vector< IntVectSet > > &a_IVSV)
Copies data at interior nodes from one LevelData<NodeFArrayBox> to another.
void nodesToCells(Vector< Box > &a_boxes)
void removeBoxesFromBox(Vector< Box > &a_boxes, const Vector< Box > &a_remove, const Box &a_base)
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
void getMaskInteriorNodes(LevelData< NodeFArrayBox > &a_mask, const DisjointBoxLayout &a_dest, const DisjointBoxLayout *a_srcPtr, const Box &a_domain, int a_onoff=1)
Returns a mask on interior nodes of a DisjointBoxLayout.
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
void fullIntVectSets(LayoutData< BitSet > &a_IVSVfull, const LayoutData< Vector< IntVectSet > > &a_IVSV)
Determines which IntVectSets are rectangular.
void removeBoxFromBoxes(Vector< Box > &a_boxes, const Box &a_remove)
void exteriorAndInteriorNodes(Vector< LayoutData< Vector< Box > > * > &a_exterior, Vector< LayoutData< Vector< Box > > * > &a_intFinerCoarsened, const Vector< DisjointBoxLayout > &a_layouts, const Vector< ProblemDomain > &a_domain, const Vector< int > &a_nRefFine)