00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 // NodeSetOperations.H 00012 // petermc, 12 June 2003 00013 00014 #ifndef _NODESETOPERATIONS_H_ 00015 #define _NODESETOPERATIONS_H_ 00016 00017 #include "NodeFArrayBox.H" 00018 #include "LevelData.H" 00019 #include "IntVectSet.H" 00020 #include "NamespaceHeader.H" 00021 00022 /// Finds interior nodes of a DisjointBoxLayout in a particular box. 00023 /** Returns nodes inside and surrounding CELL-centered box <i>a_box</i> 00024 that are NOT on the interface of (CELL-centered) <i>a_boxes</i> 00025 with the next coarser level. 00026 00027 Example: for two particular boxes in the four-grid layout below, 00028 the interior nodes are those that are marked "O". For the 00029 second box, the nodes marked "Y" are interior nodes if and 00030 only if the domain is periodic in the vertical direction and 00031 the boxes extend to the top and bottom faces of the domain. 00032 <pre> 00033 +-----+ +YY---+ 00034 | | |OOOOO| 00035 | | |OOOOO| 00036 | | |OOOOO| 00037 +---+OOO--+---+ +---+OOOOO+---+ 00038 |OOOOOOO | | | | 00039 |OOOOOOO | | | | 00040 |OOOOOOO | | | | 00041 +---+OOOOOO+------+ +---+------+------+ 00042 | | | | 00043 | | | | 00044 | | | | 00045 +----------+ +----------+ 00046 </pre> 00047 The set of interior nodes of a box is the disjoint union of 00048 the nodes surrounded by cells of the box, and the interior 00049 boundary nodes of the box. 00050 */ 00051 void interiorNodes(/// interior nodes of <i>a_box</i> in the layout <i>a_boxes</i> 00052 IntVectSet& a_ivs, 00053 /// CELL-centered physical domain containing <i>a_boxes</i> 00054 const ProblemDomain& a_base_domain, 00055 /// layout of CELL-centered boxes 00056 const DisjointBoxLayout& a_boxes, 00057 /// the box in <i>a_boxes</i> for which we find interior nodes 00058 const Box& a_box); 00059 00060 00061 /// Finds interior nodes of a DisjointBoxLayout in a particular box. 00062 /** Returns nodes inside and surrounding CELL-centered box <i>a_box</i> 00063 that are NOT on the interface of (CELL-centered) <i>a_boxes</i> 00064 with the next coarser level. 00065 00066 Example: for two particular boxes in the four-grid layout below, 00067 the interior nodes are those that are marked "O". For the 00068 second box, the nodes marked "Y" are interior nodes if and 00069 only if the domain is periodic in the vertical direction and 00070 the boxes extend to the top and bottom faces of the domain. 00071 <pre> 00072 +-----+ +YY---+ 00073 | | |OOOOO| 00074 | | |OOOOO| 00075 | | |OOOOO| 00076 +---+OOO--+---+ +---+OOOOO+---+ 00077 |OOOOOOO | | | | 00078 |OOOOOOO | | | | 00079 |OOOOOOO | | | | 00080 +---+OOOOOO+------+ +---+------+------+ 00081 | | | | 00082 | | | | 00083 | | | | 00084 +----------+ +----------+ 00085 </pre> 00086 The set of interior nodes of a box is the disjoint union of 00087 the nodes surrounded by cells of the box, and the interior 00088 boundary nodes of the box. 00089 */ 00090 void interiorNodes(/// interior nodes of <i>a_box</i> in the layout <i>a_boxes</i> 00091 IntVectSet& a_ivs, 00092 /// CELL-centered physical domain containing <i>a_boxes</i> 00093 const Box& a_base_domain, 00094 /// layout of CELL-centered boxes 00095 const DisjointBoxLayout& a_boxes, 00096 /// the box in <i>a_boxes</i> for which we find interior nodes 00097 const Box& a_box); 00098 00099 00100 /// Finds interior boundary nodes of a DisjointBoxLayout. 00101 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>, 00102 a Vector of IntVectSets that contain the indices of the 00103 nodes that lie on faces of the box but are not on the 00104 interface of <i>a_boxes</i> with the next coarser level. 00105 00106 Example: for two particular boxes, marked "me", in the 00107 four-grid layout below, the interior boundary nodes are those 00108 that are marked with "O". For the second box, the nodes marked "Y" 00109 are also interior boundary nodes if and only if the domain is 00110 periodic in the vertical direction and the grids extend to the 00111 top and bottom faces of the domain. 00112 <pre> 00113 +-----+ +YY---+ 00114 | | | | 00115 | | | me | 00116 | | | | 00117 +---+OOO--+---+ +---+OOOOO+---+ 00118 | O | | | | 00119 | me O | | | | 00120 | O | | | | 00121 +---+OOOOOO+------+ +---+------+------+ 00122 | | | | 00123 | | | | 00124 | | | | 00125 +----------+ +----------+ 00126 </pre> 00127 The result <i>a_IVSV</i> is needed by copyInteriorNodes(). 00128 00129 <b>Question</b>: Why not simply store the indices of all interior 00130 boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than 00131 a LayoutData< Vector<IntVectSet> >? <br> 00132 <b>Answer</b>: Because of the way IntVectSets are stored, this would be 00133 very slow. 00134 00135 The different components of the Vector<IntVectSet> contain 00136 indices of nodes on different faces of the box. 00137 */ 00138 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00139 LayoutData< Vector<IntVectSet> >& a_IVSV, 00140 /// layout of CELL-centered boxes 00141 const DisjointBoxLayout& a_boxes, 00142 /// CELL-centered physical domain containing <i>a_boxes</i> 00143 const ProblemDomain& a_domain); 00144 00145 00146 /// Finds interior boundary nodes of a DisjointBoxLayout. 00147 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>, 00148 a Vector of IntVectSets that contain the indices of the 00149 nodes that lie on faces of the box but are not on the 00150 interface of <i>a_boxes</i> with the next coarser level. 00151 00152 Example: for two particular boxes, marked "me", in the 00153 four-grid layout below, the interior boundary nodes are those 00154 that are marked with "O". For the second box, the nodes marked "Y" 00155 are also interior boundary nodes if and only if the domain is 00156 periodic in the vertical direction and the grids extend to the 00157 top and bottom faces of the domain. 00158 <pre> 00159 +-----+ +YY---+ 00160 | | | | 00161 | | | me | 00162 | | | | 00163 +---+OOO--+---+ +---+OOOOO+---+ 00164 | O | | | | 00165 | me O | | | | 00166 | O | | | | 00167 +---+OOOOOO+------+ +---+------+------+ 00168 | | | | 00169 | | | | 00170 | | | | 00171 +----------+ +----------+ 00172 </pre> 00173 The result <i>a_IVSV</i> is needed by copyInteriorNodes(). 00174 00175 <b>Question</b>: Why not simply store the indices of all interior 00176 boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than 00177 a LayoutData< Vector<IntVectSet> >? <br> 00178 <b>Answer</b>: Because of the way IntVectSets are stored, this would be 00179 very slow. 00180 00181 The different components of the Vector<IntVectSet> contain 00182 indices of nodes on different faces of the box. 00183 */ 00184 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00185 LayoutData< Vector<IntVectSet> >& a_IVSV, 00186 /// layout of CELL-centered boxes 00187 const DisjointBoxLayout& a_boxes, 00188 /// CELL-centered physical domain containing <i>a_boxes</i> 00189 const Box& a_domain); 00190 00191 00192 /// Finds interior boundary nodes of a DisjointBoxLayout. 00193 /** Returns a LayoutData containing, for each destination box, 00194 a Vector of IntVectSets that together represent the nodes 00195 of the destination box that are also interior boundary nodes 00196 of the source boxes. 00197 00198 Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes 00199 of <i>a_src</i>, then the Vector<IntVectSet> <i>a_IVSV</i>[dit()] holds 00200 the intersection of IBN(<i>a_src</i>) and the nodes 00201 surrounding <i>a_dest</i>[dit()]. 00202 00203 The result <i>a_IVSV</i> is used in copyInteriorNodes(). 00204 */ 00205 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00206 LayoutData< Vector<IntVectSet> >& a_IVSV, 00207 /// layout of CELL-centered destination boxes 00208 const DisjointBoxLayout& a_dest, 00209 /// layout of CELL-centered source boxes 00210 const DisjointBoxLayout& a_src, 00211 /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i> 00212 const ProblemDomain& a_domain); 00213 00214 00215 /// Finds interior boundary nodes of a DisjointBoxLayout. 00216 /** Returns a LayoutData containing, for each destination box, 00217 a Vector of IntVectSets that together represent the nodes 00218 of the destination box that are also interior boundary nodes 00219 of the source boxes. 00220 00221 Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes 00222 of <i>a_src</i>, then the Vector<IntVectSet> <i>a_IVSV</i>[dit()] holds 00223 the intersection of IBN(<i>a_src</i>) and the nodes 00224 surrounding <i>a_dest</i>[dit()]. 00225 00226 The result <i>a_IVSV</i> is used in copyInteriorNodes(). 00227 */ 00228 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00229 LayoutData< Vector<IntVectSet> >& a_IVSV, 00230 /// layout of CELL-centered destination boxes 00231 const DisjointBoxLayout& a_dest, 00232 /// layout of CELL-centered source boxes 00233 const DisjointBoxLayout& a_src, 00234 /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i> 00235 const Box& a_domain); 00236 00237 00238 /// Finds exterior boundary nodes of a DisjointBoxLayout. 00239 /** Returns a LayoutData containing, for each box, the exterior boundary 00240 nodes of the box. 00241 00242 The exterior boundary nodes are the nodes on a level that are 00243 not interior nodes: they lie on the physical boundary and on 00244 the interface with the coarser level. 00245 00246 Example: for two particular boxes, marked "me", in the 00247 four-grid layout below, the exterior boundary nodes are those 00248 that are marked "O". For the second box, the nodes marked "Y" 00249 are also exterior boundary nodes, unless the domain is periodic 00250 in the vertical direction and the grids extend to the 00251 top and bottom faces of the domain. 00252 <pre> 00253 +-----+ OYYOOOO 00254 | | O O 00255 | | O me O 00256 | | O O 00257 OOOOO--+--+---+ +---O--+--O---+ 00258 O | | | | | 00259 O me | | | | | 00260 O | | | | | 00261 +---O------O------+ +---+------+------+ 00262 | | | | 00263 | | | | 00264 | | | | 00265 +----------+ +----------+ 00266 </pre> 00267 The argument <i>a_interior</i> is obtained from<br> 00268 <tt> 00269 interiorBoundaryNodes(a_interior, a_boxes, a_domain) 00270 </tt> 00271 where <i>a_domain</i> is the physical domain. 00272 00273 You don't need the physical domain <i>a_domain</i> as an argument 00274 to this function, even to get periodicities, because everything needed 00275 from <i>a_domain</i> is put into <i>a_interior</i>. 00276 */ 00277 void exteriorBoundaryNodes(/// object containing exterior boundary nodes of <i>a_boxes</i> 00278 LayoutData< Vector<IntVectSet> >& a_exterior, 00279 /// object containing interior boundary nodes of <i>a_boxes</i> 00280 const LayoutData< Vector<IntVectSet> >& a_interior, 00281 /// layout of CELL-centered boxes 00282 const DisjointBoxLayout& a_boxes); 00283 00284 00285 /// Sets data to zero on specified boundary nodes. 00286 /** Sets <i>a_dest</i> to zero on the nodes in <i>a_IVSV</i>. 00287 00288 Specifically, <i>a_dest</i>[dit()] is set to zero on 00289 the nodes in <i>a_IVSV</i>[dit()]. 00290 00291 We usually call this function with <i>a_IVSV</i> representing the 00292 exterior boundary nodes of <i>a_dest</i>. These are obtained with 00293 the sequence of calls:<br> 00294 <tt> 00295 interiorBoundaryNodes(a_IVSVint, a_dest.boxLayout(), a_domain) 00296 <tt><br> 00297 where <i>a_domain</i> is the physical domain, and<br> 00298 <tt> 00299 exteriorBoundaryNodes(a_IVSV, a_IVSVint, a_dest.boxLayout()) 00300 <tt>. 00301 */ 00302 void zeroBoundaryNodes(/// the data 00303 BoxLayoutData<NodeFArrayBox>& a_dest, 00304 /// object containing boundary nodes 00305 const LayoutData< Vector<IntVectSet> >& a_IVSV); 00306 00307 /// Copies data at interior nodes from one LevelData<NodeFArrayBox> to another. 00308 /** Copies data from <i>a_src</i> to <i>a_dest</i>, 00309 over the interior nodes of <i>a_src</i>. 00310 They need not have the same layout. 00311 00312 The argument <i>a_IVSV</i> is obtained from<br> 00313 <tt> 00314 interiorBoundaryNodes(a_IVSV, 00315 a_dest.boxLayout(), a_src.boxLayout(), a_domain) 00316 </tt><br> 00317 where <i>a_domain</i> is the physical domain. 00318 00319 If <i>a_dest</i> and <i>a_src</i> have the same layout, 00320 then we may obtain <i>a_IVSV</i> more efficiently from<br> 00321 <tt> 00322 interiorBoundaryNodes(a_IVSV, a_src.boxLayout(), a_domain) 00323 </tt>.<br> 00324 Do not use this shorter form if <i>a_dest</i> and <i>a_src</i> 00325 have different layouts. 00326 00327 Example: if <i>a_src</i> has the four-grid layout on the left below, then 00328 the nodes from which data are copied to <i>a_dest</i> are marked with 00329 "X" and "O" on the right below. (The distinction between "X" and "O" 00330 is that nodes marked "O" are on interior boundaries of the layout.) 00331 Data are copied from the nodes marked "Y" if and only if the domain 00332 is periodic in the vertical direction and the grids extend to the 00333 top and bottom faces of the domain. 00334 <pre> 00335 +-----+ +YY---+ 00336 | | |OOOOO| 00337 | | |OOOOO| 00338 | | |OOOOO| 00339 +---+--+--+---+ +---+XXXXX+---+ 00340 | | | |OOOOOOXOOOOOO| 00341 | | | |OOOOOOXOOOOOO| 00342 | | | |OOOOOOXOOOOOO| 00343 +---+------+------+ +---+XXXXXX+------+ 00344 | | |OOOOOOOOOO| 00345 | | |OOOOOOOOOO| 00346 | | |OOOOOOOOOO| 00347 +----------+ +--------YY+ 00348 </pre> 00349 Both pictures represent the layout of <i>a_src</i>. 00350 The layout of <i>a_dest</i> may be completely different from that 00351 of <i>a_src</i>. 00352 00353 Data at nodes in <i>a_dest</i> that are not interior boundary nodes 00354 of <i>a_src</i> remain unchanged by this function. 00355 */ 00356 void copyInteriorNodes(/// destination data 00357 LevelData<NodeFArrayBox>& a_dest, 00358 /// source data 00359 const LevelData<NodeFArrayBox>& a_src, 00360 /// object containing interior boundary nodes of source layout that are also nodes of destination layout 00361 const LayoutData< Vector<IntVectSet> >& a_IVSV); 00362 00363 /// Determines which IntVectSets are rectangular. 00364 /** Sets the bit <i>a_IVSVfull</i>[dit()][comp] to be true if and only if 00365 <i>a_IVSV</i>[dit()][comp] is a full rectangle. 00366 */ 00367 void 00368 fullIntVectSets(/// object containing bit settings of whether each component is rectangular 00369 LayoutData< BitSet >& a_IVSVfull, 00370 /// object containing interior boundary nodes of a layout 00371 const LayoutData< Vector<IntVectSet> >& a_IVSV); 00372 00373 /* 00374 These routines are the same as above, but use LayoutData< Vector<Box> > 00375 instead of LayoutData< Vector<IntVectSet> >. 00376 */ 00377 00378 /// Finds interior boundary nodes of a DisjointBoxLayout. 00379 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>, 00380 a Vector of IntVectSets that contain the indices of the 00381 nodes that lie on faces of the box but are not on the 00382 interface of <i>a_boxes</i> with the next coarser level. 00383 00384 Example: for two particular boxes, marked "me", in the 00385 four-grid layout below, the interior boundary nodes are those 00386 that are marked with "O". For the second box, the nodes marked "Y" 00387 are also interior boundary nodes if and only if the domain is 00388 periodic in the vertical direction and the grids extend to the 00389 top and bottom faces of the domain. 00390 <pre> 00391 +-----+ +YY---+ 00392 | | | | 00393 | | | me | 00394 | | | | 00395 +---+OOO--+---+ +---+OOOOO+---+ 00396 | O | | | | 00397 | me O | | | | 00398 | O | | | | 00399 +---+OOOOOO+------+ +---+------+------+ 00400 | | | | 00401 | | | | 00402 | | | | 00403 +----------+ +----------+ 00404 </pre> 00405 The result <i>a_IVSV</i> is needed by copyInteriorNodes(). 00406 00407 <b>Question</b>: Why not simply store the indices of all interior 00408 boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than 00409 a LayoutData< Vector<Box> >? <br> 00410 <b>Answer</b>: Because of the way IntVectSets are stored, this would be 00411 very slow. 00412 00413 The different components of the Vector<Box> contain 00414 indices of nodes on different faces of the box. 00415 */ 00416 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00417 LayoutData< Vector<Box> >& a_IVSV, 00418 /// layout of CELL-centered boxes 00419 const DisjointBoxLayout& a_boxes, 00420 /// CELL-centered physical domain containing <i>a_boxes</i> 00421 const Box& a_domain); 00422 00423 00424 /// Finds interior boundary nodes of a DisjointBoxLayout. 00425 /** Returns a LayoutData containing, for each box in <i>a_boxes</i>, 00426 a Vector of IntVectSets that contain the indices of the 00427 nodes that lie on faces of the box but are not on the 00428 interface of <i>a_boxes</i> with the next coarser level. 00429 00430 Example: for two particular boxes, marked "me", in the 00431 four-grid layout below, the interior boundary nodes are those 00432 that are marked with "O". For the second box, the nodes marked "Y" 00433 are also interior boundary nodes if and only if the domain is 00434 periodic in the vertical direction and the grids extend to the 00435 top and bottom faces of the domain. 00436 <pre> 00437 +-----+ +YY---+ 00438 | | | | 00439 | | | me | 00440 | | | | 00441 +---+OOO--+---+ +---+OOOOO+---+ 00442 | O | | | | 00443 | me O | | | | 00444 | O | | | | 00445 +---+OOOOOO+------+ +---+------+------+ 00446 | | | | 00447 | | | | 00448 | | | | 00449 +----------+ +----------+ 00450 </pre> 00451 The result <i>a_IVSV</i> is needed by copyInteriorNodes(). 00452 00453 <b>Question</b>: Why not simply store the indices of all interior 00454 boundary nodes of <i>a_boxes</i> in a single IntVectSet, rather than 00455 a LayoutData< Vector<Box> >? <br> 00456 <b>Answer</b>: Because of the way IntVectSets are stored, this would be 00457 very slow. 00458 00459 The different components of the Vector<Box> contain 00460 indices of nodes on different faces of the box. 00461 */ 00462 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00463 LayoutData< Vector<Box> >& a_IVSV, 00464 /// layout of CELL-centered boxes 00465 const DisjointBoxLayout& a_boxes, 00466 /// CELL-centered physical domain containing <i>a_boxes</i> 00467 const ProblemDomain& a_domain); 00468 00469 00470 /// Finds interior boundary nodes of a DisjointBoxLayout. 00471 /** Returns a LayoutData containing, for each destination box, 00472 a Vector of IntVectSets that together represent the nodes 00473 of the destination box that are also interior boundary nodes 00474 of the source boxes. 00475 00476 Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes 00477 of <i>a_src</i>, then the Vector<Box> <i>a_IVSV</i>[dit()] holds 00478 the intersection of IBN(<i>a_src</i>) and the nodes 00479 surrounding <i>a_dest</i>[dit()]. 00480 00481 The result <i>a_IVSV</i> is used in copyInteriorNodes(). 00482 */ 00483 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00484 LayoutData< Vector<Box> >& a_IVSV, 00485 /// layout of CELL-centered destination boxes 00486 const DisjointBoxLayout& a_dest, 00487 /// layout of CELL-centered source boxes 00488 const DisjointBoxLayout& a_src, 00489 /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i> 00490 const Box& a_domain); 00491 00492 00493 /// Finds interior boundary nodes of a DisjointBoxLayout. 00494 /** Returns a LayoutData containing, for each destination box, 00495 a Vector of IntVectSets that together represent the nodes 00496 of the destination box that are also interior boundary nodes 00497 of the source boxes. 00498 00499 Specifically, if IBN(<i>a_src</i>) is the set of interior boundary nodes 00500 of <i>a_src</i>, then the Vector<Box> <i>a_IVSV</i>[dit()] holds 00501 the intersection of IBN(<i>a_src</i>) and the nodes 00502 surrounding <i>a_dest</i>[dit()]. 00503 00504 The result <i>a_IVSV</i> is used in copyInteriorNodes(). 00505 */ 00506 void interiorBoundaryNodes(/// object containing interior boundary nodes of <i>a_boxes</i> 00507 LayoutData< Vector<Box> >& a_IVSV, 00508 /// layout of CELL-centered destination boxes 00509 const DisjointBoxLayout& a_dest, 00510 /// layout of CELL-centered source boxes 00511 const DisjointBoxLayout& a_src, 00512 /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i> 00513 const ProblemDomain& a_domain); 00514 00515 00516 /// Finds exterior boundary nodes of a DisjointBoxLayout. 00517 /** Returns a LayoutData containing, for each box, the exterior boundary 00518 nodes of the box. 00519 00520 The exterior boundary nodes are the nodes on a level that are 00521 not interior nodes: they lie on the physical boundary and on 00522 the interface with the coarser level. 00523 00524 Example: for two particular boxes, marked "me", in the 00525 four-grid layout below, the exterior boundary nodes are those 00526 that are marked "O". For the second box, the nodes marked "Y" 00527 are also exterior boundary nodes, unless the domain is periodic 00528 in the vertical direction and the grids extend to the 00529 top and bottom faces of the domain. 00530 <pre> 00531 +-----+ OYYOOOO 00532 | | O O 00533 | | O me O 00534 | | O O 00535 OOOOO--+--+---+ +---O--+--O---+ 00536 O | | | | | 00537 O me | | | | | 00538 O | | | | | 00539 +---O------O------+ +---+------+------+ 00540 | | | | 00541 | | | | 00542 | | | | 00543 +----------+ +----------+ 00544 </pre> 00545 The argument <i>a_interior</i> is obtained from<br> 00546 <tt> 00547 interiorBoundaryNodes(a_interior, a_boxes, a_domain) 00548 </tt> 00549 where <i>a_domain</i> is the physical domain. 00550 00551 You don't need the physical domain <i>a_domain</i> as an argument 00552 to this function, even to get periodicities, because everything needed 00553 from <i>a_domain</i> is put into <i>a_interior</i>. 00554 */ 00555 void exteriorBoundaryNodes(/// object containing exterior boundary nodes of <i>a_boxes</i> 00556 LayoutData< Vector<Box> >& a_exterior, 00557 /// object containing interior boundary nodes of <i>a_boxes</i> 00558 const LayoutData< Vector<Box> >& a_interior, 00559 /// layout of CELL-centered boxes 00560 const DisjointBoxLayout& a_boxes); 00561 00562 /// Copies data at interior nodes from one LevelData<NodeFArrayBox> to another. 00563 /** Copies data from <i>a_src</i> to <i>a_dest</i>, 00564 over the interior nodes of <i>a_src</i>. 00565 They need not have the same layout. 00566 00567 The argument <i>a_IVSV</i> is obtained from<br> 00568 <tt> 00569 interiorBoundaryNodes(a_IVSV, 00570 a_dest.boxLayout(), a_src.boxLayout(), a_domain) 00571 </tt><br> 00572 where <i>a_domain</i> is the physical domain. 00573 00574 If <i>a_dest</i> and <i>a_src</i> have the same layout, 00575 then we may obtain <i>a_IVSV</i> more efficiently from<br> 00576 <tt> 00577 interiorBoundaryNodes(a_IVSV, a_src.boxLayout(), a_domain) 00578 </tt>.<br> 00579 Do not use this shorter form if <i>a_dest</i> and <i>a_src</i> 00580 have different layouts. 00581 00582 Example: if <i>a_src</i> has the four-grid layout on the left below, then 00583 the nodes from which data are copied to <i>a_dest</i> are marked with 00584 "X" and "O" on the right below. (The distinction between "X" and "O" 00585 is that nodes marked "O" are on interior boundaries of the layout.) 00586 Data are copied from the nodes marked "Y" if and only if the domain 00587 is periodic in the vertical direction and the grids extend to the 00588 top and bottom faces of the domain. 00589 <pre> 00590 +-----+ +YY---+ 00591 | | |OOOOO| 00592 | | |OOOOO| 00593 | | |OOOOO| 00594 +---+--+--+---+ +---+XXXXX+---+ 00595 | | | |OOOOOOXOOOOOO| 00596 | | | |OOOOOOXOOOOOO| 00597 | | | |OOOOOOXOOOOOO| 00598 +---+------+------+ +---+XXXXXX+------+ 00599 | | |OOOOOOOOOO| 00600 | | |OOOOOOOOOO| 00601 | | |OOOOOOOOOO| 00602 +----------+ +--------YY+ 00603 </pre> 00604 Both pictures represent the layout of <i>a_src</i>. 00605 The layout of <i>a_dest</i> may be completely different from that 00606 of <i>a_src</i>. 00607 00608 Data at nodes in <i>a_dest</i> that are not interior boundary nodes 00609 of <i>a_src</i> remain unchanged by this function. 00610 */ 00611 void copyInteriorNodes(/// destination data 00612 LevelData<NodeFArrayBox>& a_dest, 00613 /// source data 00614 const LevelData<NodeFArrayBox>& a_src, 00615 /// object containing interior boundary nodes of source layout that are also nodes of destination layout 00616 const LayoutData< Vector<Box> >& a_IVSV); 00617 00618 00619 /// Sets data to zero on specified boundary nodes. 00620 /** Sets <i>a_dest</i> to zero on the nodes in <i>a_IVSV</i>. 00621 00622 Specifically, <i>a_dest</i>[dit()] is set to zero on 00623 the nodes in <i>a_IVSV</i>[dit()]. 00624 00625 We usually call this function with <i>a_IVSV</i> representing the 00626 exterior boundary nodes of <i>a_dest</i>. These are obtained with 00627 the sequence of calls:<br> 00628 <tt> 00629 interiorBoundaryNodes(a_IVSVint, a_dest.boxLayout(), a_domain) 00630 <tt><br> 00631 where <i>a_domain</i> is the physical domain, and<br> 00632 <tt> 00633 exteriorBoundaryNodes(a_IVSV, a_IVSVint, a_dest.boxLayout()) 00634 <tt>. 00635 */ 00636 void zeroBoundaryNodes(/// the data 00637 BoxLayoutData<NodeFArrayBox>& a_dest, 00638 /// object containing boundary nodes 00639 const LayoutData< Vector<Box> >& a_IVSV); 00640 00641 /* 00642 Following functions are for Vector<Box> calculus. 00643 */ 00644 00645 /// 00646 /* 00647 To a_boxes, append the new points of the boxes in a_new. 00648 */ 00649 void appendBoxes(Vector<Box>& a_boxes, 00650 const Vector<Box>& a_new); 00651 00652 /// 00653 /* 00654 From a_boxes, remove all points of a_remove. 00655 */ 00656 void removeBoxFromBoxes(Vector<Box>& a_boxes, 00657 const Box& a_remove); 00658 00659 /// 00660 /* 00661 Return in a_boxes the result of removing the boxes in a_remove from a_base. 00662 */ 00663 void removeBoxesFromBox(Vector<Box>& a_boxes, 00664 const Vector<Box>& a_remove, 00665 const Box& a_base); 00666 00667 /// 00668 /* 00669 Return in a_boxes the result of removing the points of a_remove from a_base. 00670 */ 00671 void removeBoxFromBox(Vector<Box>& a_boxes, 00672 const Box& a_remove, 00673 const Box& a_base); 00674 00675 /// 00676 /* 00677 From a_boxes, remove all points in the boxes in a_remove. 00678 */ 00679 void removeBoxesFromBoxes(Vector<Box>& a_boxes, 00680 const Vector<Box>& a_remove); 00681 00682 /// 00683 /* 00684 Replace each box in a_boxes with its intersection with the union of 00685 the boxes in a_new. 00686 */ 00687 void intersectBoxes(Vector<Box>& a_boxes, 00688 const Vector<Box>& a_new); 00689 00690 /// 00691 /* 00692 Replace each box in a_boxes with its intersection with the box a_new. 00693 */ 00694 void intersectBoxes(Vector<Box>& a_boxes, 00695 const Box& a_new); 00696 00697 /// 00698 /* 00699 Shift all boxes in a_boxes by a_offset. 00700 */ 00701 void shiftBoxes(Vector<Box>& a_boxes, 00702 const IntVect& a_offset); 00703 00704 /// 00705 /* 00706 Convert box centerings from CELL to NODE. 00707 */ 00708 void cellsToNodes(Vector<Box>& a_boxes); 00709 00710 /// 00711 /* 00712 Convert box centerings from NODE to CELL. 00713 */ 00714 void nodesToCells(Vector<Box>& a_boxes); 00715 00716 /// 00717 /* 00718 At each level, return exterior boundary nodes. 00719 At each level except for the finest, return the interior boundary nodes 00720 of the coarsened finer level. 00721 */ 00722 void exteriorAndInteriorNodes( 00723 /// object containing exterior boundary nodes of <i>a_boxes</i> at each level 00724 Vector< LayoutData< Vector<Box> >* >& a_exterior, 00725 /// object containing interior boundary nodes of coarsened <i>a_boxes</i> at each level except finest 00726 Vector< LayoutData< Vector<Box> >* >& a_intFinerCoarsened, 00727 /// layouts of CELL-centered boxes 00728 const Vector<DisjointBoxLayout>& a_layouts, 00729 /// domain of each level 00730 const Vector<ProblemDomain>& a_domain, 00731 /// refinement ratio between levels 00732 const Vector<int>& a_nRefFine); 00733 00734 00735 /// 00736 /* 00737 At each level, return exterior boundary nodes. 00738 At each level except for the finest, return the interior boundary nodes 00739 of the coarsened finer level. 00740 */ 00741 void exteriorAndInteriorNodes( 00742 /// object containing exterior boundary nodes of <i>a_boxes</i> at each level 00743 Vector< LayoutData< Vector<IntVectSet> >* >& a_exterior, 00744 /// object containing interior boundary nodes of coarsened <i>a_boxes</i> at each level except finest 00745 Vector< LayoutData< Vector<IntVectSet> >* >& a_intFinerCoarsened, 00746 /// layouts of CELL-centered boxes 00747 const Vector<DisjointBoxLayout>& a_layouts, 00748 /// domain of each level 00749 const Vector<ProblemDomain>& a_domain, 00750 /// refinement ratio between levels 00751 const Vector<int>& a_nRefFine); 00752 00753 00754 /// Returns a mask on interior nodes of a DisjointBoxLayout. 00755 /** Returns a LevelData on nodes of a_dest that is 00756 a_onoff on interior nodes of *a_srcPtr (or of a_dest if a_srcPtr is null); 00757 1 - a_onoff on all other nodes. 00758 */ 00759 void getMaskInteriorNodes(/// mask built on a_dest, representing interior nodes of a_src. 00760 LevelData<NodeFArrayBox>& a_mask, 00761 /// layout of CELL-centered destination boxes 00762 const DisjointBoxLayout& a_dest, 00763 /// layout of CELL-centered source boxes 00764 const DisjointBoxLayout* a_srcPtr, 00765 /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i> 00766 const Box& a_domain, 00767 /// 1 or 0, for interior nodes 00768 int a_onoff = 1); 00769 00770 00771 /// Returns a mask on interior nodes of a DisjointBoxLayout. 00772 /** Returns a LevelData on nodes of a_dest that is 00773 a_onoff on interior nodes of *a_srcPtr (or of a_dest if a_srcPtr is null); 00774 1 - a_onoff on all other nodes. 00775 */ 00776 void getMaskInteriorNodes(/// mask built on a_dest, representing interior boundary nodes of a_src. 00777 LevelData<NodeFArrayBox>& a_mask, 00778 /// layout of CELL-centered destination boxes 00779 const DisjointBoxLayout& a_dest, 00780 /// layout of CELL-centered source boxes 00781 const DisjointBoxLayout* a_srcPtr, 00782 /// CELL-centered physical domain containing <i>a_dest</i> and <i>a_src</i> 00783 const ProblemDomain& a_domain, 00784 /// 1 or 0, for interior nodes 00785 int a_onoff = 1); 00786 00787 00788 /// Returns a mask on interior nodes of a DisjointBoxLayout. 00789 /** Returns a LevelData on nodes of a_dest that is 00790 1. on interior nodes of a_dest, 00791 0. on all other nodes. 00792 */ 00793 void getMaskInteriorNodes(/// mask built on a_dest, representing interior nodes of a_dest. 00794 LevelData<NodeFArrayBox>& a_mask, 00795 /// layout of CELL-centered destination boxes 00796 const DisjointBoxLayout& a_dest, 00797 /// CELL-centered physical domain containing <i>a_dest</i> 00798 const Box& a_domain); 00799 00800 00801 /// Returns a mask on valid nodes on a level. 00802 /** Returns a LevelData on a_layout that is 00803 1. on valid nodes of a_layout, 00804 0. on all other nodes. 00805 */ 00806 void getMaskValidNodes(/// mask built on a_dest, representing valid nodes of a_layout. 00807 LevelData<NodeFArrayBox>& a_mask, 00808 /// layout of CELL-centered boxes on this level 00809 const DisjointBoxLayout& a_layout, 00810 /// layout of CELL-centered coarsened boxes on finer level 00811 const DisjointBoxLayout* a_finerCoarsenedPtr, 00812 /// CELL-centered physical domain containing <i>a_layout</i> and <i>a_finerCoarsened</i> 00813 const ProblemDomain& a_domain); 00814 00815 00816 /// Returns a mask on valid nodes on a level. 00817 /** Returns a LevelData on a_layout that is 00818 1. on valid nodes of a_layout, 00819 0. on all other nodes. 00820 */ 00821 void getMaskValidNodes(/// mask built on a_dest, representing valid nodes of a_layout. 00822 LevelData<NodeFArrayBox>& a_mask, 00823 /// layout of CELL-centered boxes on this level 00824 const DisjointBoxLayout& a_layout, 00825 /// layout of CELL-centered coarsened boxes on finer level 00826 const DisjointBoxLayout* a_finerCoarsenedPtr, 00827 /// CELL-centered physical domain containing <i>a_layout</i> and <i>a_finerCoarsened</i> 00828 const Box& a_domain); 00829 00830 00831 /// 00832 /* 00833 At each level, return mask for valid nodes. 00834 */ 00835 void getMaskValidNodes( 00836 /// at each level, a mask for valid nodes 00837 Vector< LevelData<NodeFArrayBox>* >& a_masks, 00838 /// layouts of CELL-centered boxes 00839 const Vector<DisjointBoxLayout>& a_layouts, 00840 /// domain of each level 00841 const Vector<ProblemDomain>& a_domain, 00842 /// refinement ratio between levels 00843 const Vector<int>& a_nRefFine); 00844 00845 00846 /// 00847 /** Return the NODE-centered layout of NODEs surrounding a 00848 CELL-centered layout. 00849 */ 00850 void getSurroundingNodes(BoxLayout& a_gridsNodes, 00851 const BoxLayout& a_gridsCells); 00852 00853 00854 /// 00855 /** Return the CELL-centered layout of CELLs enclosed by a 00856 NODE-centered layout. 00857 */ 00858 void getEnclosedCells(BoxLayout& a_gridsCells, 00859 const BoxLayout& a_gridsNodes); 00860 00861 /// 00862 /** Divide a_intFab by 2 on faces of a_bx (and by 4 on edges, 8 on corners) 00863 */ 00864 void halveIntFaces(BaseFab<int>& a_intFab, 00865 const Box& a_bx); 00866 00867 #include "NamespaceFooter.H" 00868 #endif