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 // NodeFArrayBox.H 00012 // adapted from dMartin/Chombo-IAMR/util/FluxBox.H 00013 // by Dan Martin, Fri, Jan 14, 2000 00014 // petermc, 1 Nov 2000 00015 // 8 Jan 2001 added 00016 00017 #ifndef _NODEFARRAYBOX_H_ 00018 #define _NODEFARRAYBOX_H_ 00019 00020 #include "FArrayBox.H" 00021 #include "NamespaceHeader.H" 00022 00023 /// A wrapper for an FArrayBox to contain NODE-centered data. 00024 /** This is a class to contain NODE-centered data on a box.<br> 00025 <b>Question</b>: Why not just use NODE-centered FArrayBox?<br> 00026 <b>Answer</b>: We want to use LevelData<NodeFArrayBox>, 00027 which requires that the underlying BoxLayout be a DisjointBoxLayout. 00028 Adjacent NODE-centered boxes intersect, but adjacent CELL-centered 00029 boxes do not.<br> 00030 The underlying DisjointBoxLayout will be CELL-centered. 00031 00032 In a LevelData<NodeFArrayBox>, some of the grids may share nodes. 00033 The data on shared nodes must be the same. 00034 00035 Example: A four-grid layout is shown on the left. As shown on 00036 the right, the nodes marked "2" are shared by two grids, and 00037 those marked "3" are shared by three grids. 00038 <pre> 00039 +-----+ YYYY--+ 00040 | | | | 00041 | | | | 00042 | | | | 00043 +---+--+--+---+ +---2223222---+ 00044 | | | | 2 | 00045 | | | | 2 | 00046 | | | | 2 | 00047 +---+------+------+ X---22222223------X 00048 | | | | 00049 | | | | 00050 | | | | 00051 +----------+ +-------YYYY 00052 </pre> 00053 Additional nodes may be shared if the boxes extend to the faces 00054 of a domain that is periodic in one or more directions. 00055 In the example above, these nodes are marked "X" and "Y".<br> 00056 Horizontally periodic domain: node "X" shared by two grids.<br> 00057 Vertically periodic domain: nodes "Y" shared by two grids. 00058 00059 One of the most useful features of LevelData<NodeFArrayBox> is the 00060 copyTo() function. THE copyTo() FUNCTION MUST BE USED WITH CAUTION 00061 if the source and destination have different layouts. 00062 00063 Consider an example where A and B are on layouts of one box 00064 each, and these two boxes abut: 00065 <pre> 00066 +-------+ 00067 | | 00068 | A | 00069 | | 00070 ========= 00071 | | 00072 | B | 00073 | | 00074 +-------+ 00075 </pre> 00076 If we do A.copyTo(B), then the data on the nodes of the interface 00077 (marked "=") are NOT copied, because the underlying CELL-centered 00078 DisjointBoxLayouts of the LevelDatas do not intersect. 00079 00080 So whenever we want to use src.copyTo(dest), unless we are sure 00081 that src and dest have the same layout, we do the following: 00082 - define BoxLayoutData<NodeFArrayBox> destExpanded on the BoxLayout of 00083 dest with each box expanded by one in each dimension; 00084 - do src.copyTo(destExpanded); 00085 - box by box, copy destExpanded to dest. 00086 */ 00087 class NodeFArrayBox 00088 { 00089 00090 public: 00091 00092 /** 00093 \name Constructors, destructor and defines 00094 */ 00095 /*@{*/ 00096 00097 /// 00098 /** Default constructor. User must subsequently call define(). 00099 */ 00100 NodeFArrayBox(); 00101 00102 /// 00103 /** Constructs NodeFArrayBox on CELL-centered box <i>a_bx</i> 00104 with <i>a_nComp</i> components using the aliased data space. 00105 */ 00106 NodeFArrayBox(const Box& a_bx, int a_nComp, Real* a_alias = NULL); 00107 00108 /// 00109 /** Constructs an aliased NodeFArrayBox. 00110 */ 00111 NodeFArrayBox(const Interval& a_comps, NodeFArrayBox& a_original); 00112 00113 /// 00114 /** Destructor. 00115 */ 00116 ~NodeFArrayBox(); 00117 00118 /// 00119 /** Defines NodeFArrayBox on CELL-centered box <i>a_bx</i> 00120 with <i>a_nComp</i> components. If called more than once 00121 on the same instance, the box and FAB will be resize()d. 00122 */ 00123 void define(const Box& a_bx, int a_nComp=1); 00124 00125 /** 00126 Change this NodeFArrayBox so it covers the Box a_bx with a_nComps 00127 components. If a_alias is not NULL, it is used as the data memory 00128 (and is assumed to be large enough). 00129 */ 00130 void resize(const Box& a_bx, int a_nComp=1, Real* a_alias=NULL); 00131 00132 /*@}*/ 00133 00134 /** 00135 \name Accessors 00136 */ 00137 /*@{*/ 00138 00139 /// 00140 /** Returns the CELL-centered domain where the array is defined. 00141 */ 00142 const Box& box() const; 00143 00144 /// 00145 /** Returns a modifiable reference to the NODE-centered FArrayBox 00146 containing the data. 00147 */ 00148 FArrayBox& getFab(); 00149 00150 /// 00151 /** Returns a constant reference to the NODE-centered FArrayBox 00152 containing the data. 00153 */ 00154 const FArrayBox& getFab() const; 00155 00156 Real dotProduct(const NodeFArrayBox& a_fab2) const 00157 { 00158 return m_fab.dotProduct(a_fab2.m_fab); 00159 } 00160 00161 Real dotProduct(const NodeFArrayBox& a_fab2, const Box& box) const 00162 { 00163 return m_fab.dotProduct(a_fab2.m_fab, box); 00164 } 00165 00166 /*@}*/ 00167 00168 /** 00169 \name Data modification functions 00170 */ 00171 /*@{*/ 00172 00173 /// 00174 /** Modifies the data in this NodeFArrayBox by copying data 00175 from <i>a_src</i> into it, over the nodes that they have in common.<br> 00176 If this NodeFArrayBox and <i>a_src</i> have abutting grids, 00177 as shown: 00178 <pre> 00179 +--------+ 00180 | | 00181 | this | 00182 | | 00183 ========== <- data copied here from a_src to this 00184 | | 00185 | a_src | 00186 | | 00187 +--------+ 00188 </pre> 00189 then the data in this NodeFArrayBox WILL be modified along the 00190 edge nodes where they abut -- even though this.box() and 00191 <i>a_src</i>.box(), being CELL-centered, do NOT intersect. 00192 00193 All components are copied. 00194 */ 00195 void copy(const NodeFArrayBox& a_src); 00196 00197 /// 00198 /** Modifies the data in this NodeFArrayBox by copying the data 00199 from <i>a_src</i> into it, over the intersection of: 00200 - the nodes surrounding the CELL-centered box <i>a_regionFrom</i>; 00201 - the nodes surrounding the CELL-centered box <i>a_regionTo</i>; 00202 - the nodes containing data in this NodeFArrayBox; 00203 - the nodes containing data in <i>a_src</i>. 00204 00205 The components in the interval <i>a_Csrc</i> in <i>a_src</i> 00206 are copied to the components in the interval <i>a_Cdest</i> 00207 in this NodeFArrayBox. 00208 00209 This function is required in order to have BoxLayoutData<NodeFArrayBox>. 00210 */ 00211 void copy(const Box& a_regionFrom, 00212 const Interval& a_Cdest, 00213 const Box& a_regionTo, 00214 const NodeFArrayBox& a_src, 00215 const Interval& a_Csrc); 00216 00217 /*@}*/ 00218 00219 /** 00220 \name Linearization functions 00221 */ 00222 /*@{*/ 00223 00224 /// 00225 /** Returns size, in number of bytes, of a flat linear 00226 representation of the data in this object in the area 00227 defined by the nodes in CELL-centered box <i>a_R</i> and the 00228 component Interval <i>a_comps</i>. 00229 00230 This function is required in order to have BoxLayoutData<NodeFArrayBox>. 00231 */ 00232 int size(const Box& a_R, const Interval& a_comps) const; 00233 00234 /// 00235 /** Writes into <i>a_buf</i> a linear representation of the internal data for 00236 the nodes surrounding CELL-centered box <i>a_R</i>, over the component 00237 Interval <i>a_comps</i>. 00238 00239 Assumes that sufficient 00240 memory for the buffer has already been allocated by the caller. 00241 00242 This function is required in order to have BoxLayoutData<NodeFArrayBox>. 00243 */ 00244 void linearOut(void* a_buf, const Box& a_R, const Interval& a_comps) const; 00245 00246 /// 00247 void linearIn(void* a_buf, const Box& a_R, const Interval& a_comps); 00248 00249 00250 /// These functions are required for broadcast & gather. 00251 void linearOut(void* a_buf) const; 00252 /// 00253 void linearIn(const void* const a_buf); 00254 /// 00255 int linearSize(void) const; 00256 00257 /// 00258 static int preAllocatable() 00259 { 00260 return 0; 00261 } 00262 00263 /*@}*/ 00264 00265 00266 /// 00267 /** 00268 Modifies this NodeFArrayBox so that all values of all components are set to 00269 the given value, a_x. (FArrayBox inherits such a function from BaseFab.) 00270 */ 00271 void setVal(Real a_x); 00272 00273 /** 00274 The setVal functions set subregions in the `BaseFab' to a constant value. 00275 This most general form specifies the subbox, the starting component 00276 number, and the number of components to be set. 00277 */ 00278 void setVal(Real a_x, 00279 const Box& a_bx, 00280 int a_nstart, 00281 int a_numcomp); 00282 00283 /// 00284 /** HERE 00285 Returns the Lp-norm of this FAB using components 00286 (a_comp : a_comp+a_numcomp-1) and within the a_subbox. 00287 a_p < 0 -> ERROR 00288 a_p = 0 -> infinity norm (max norm) 00289 a_p = 1 -> sum of ABS(FAB) 00290 a_p > 1 -> Lp-norm 00291 */ 00292 Real norm(const Box& a_subbox, 00293 int a_p = 2, 00294 int a_comp = 0, 00295 int a_numcomp = 1) const 00296 { 00297 return m_fab.norm(a_subbox, a_p, a_comp, a_numcomp); 00298 } 00299 00300 /// 00301 /** 00302 Returns the Lp-norm of this FAB using components 00303 (a_comp : a_comp+a_numcomp-1). 00304 a_p < 0 -> ERROR 00305 a_p = 0 -> infinity norm (max norm) 00306 a_p = 1 -> sum of ABS(FAB) 00307 a_p > 1 -> Lp-norm 00308 */ 00309 Real norm(int a_p = 2, 00310 int a_comp = 0, 00311 int a_numcomp = 1) const 00312 { 00313 return m_fab.norm(a_p, a_comp, a_numcomp); 00314 } 00315 00316 00317 /// 00318 /** 00319 Returns sum of pow(fab[i,c],p): i in a_subbox, a_comp <= c < 00320 a_comp+a_numcomp, a_p >= 2 only 00321 */ 00322 Real sumPow(const Box& a_subbox, 00323 int a_p = 2, 00324 int a_comp = 0, 00325 int a_numcomp = 1) const 00326 00327 { 00328 return m_fab.sumPow(a_subbox, a_p, a_comp, a_numcomp); 00329 } 00330 00331 00332 /// 00333 /** 00334 Returns the minimum value of given component of this NodeFArrayBox. 00335 */ 00336 Real min(int a_comp = 0) const 00337 { 00338 return m_fab.min(a_comp); 00339 } 00340 00341 /// 00342 /** 00343 Returns the minimum value of given component of this NodeFArrayBox in 00344 given a_subbox. 00345 00346 */ 00347 Real min(const Box& a_subbox, 00348 int a_comp = 0) const 00349 { 00350 return m_fab.min(a_subbox, a_comp); 00351 } 00352 00353 /// 00354 /** 00355 Returns the maximum value of given component of this NodeFArrayBox. 00356 */ 00357 Real max(int a_comp = 0) const 00358 { 00359 return m_fab.max(a_comp); 00360 } 00361 00362 /// 00363 /** 00364 Returns the maximum value of given component of this NodeFArrayBox in 00365 given a_subbox. 00366 00367 */ 00368 Real max(const Box& a_subbox, 00369 int a_comp = 0) const 00370 00371 { 00372 return m_fab.max(a_subbox, a_comp); 00373 } 00374 00375 /// 00376 /** 00377 Finds location of minimum value in given component of this NodeFArrayBox. 00378 */ 00379 IntVect minIndex(int a_comp = 0) const 00380 { 00381 return m_fab.minIndex(a_comp); 00382 } 00383 00384 /// 00385 /** 00386 Returns location of minimum value in given component of this NodeFArrayBox 00387 in given a_subbox. 00388 */ 00389 IntVect minIndex(const Box& a_subbox, 00390 int a_comp = 0) const 00391 { 00392 return m_fab.minIndex(a_subbox, a_comp); 00393 } 00394 00395 /// 00396 /** 00397 Returns location of maximum value in given component of this NodeFArrayBox. 00398 */ 00399 IntVect maxIndex(int a_comp = 0) const 00400 { 00401 return m_fab.maxIndex(a_comp); 00402 } 00403 00404 /// 00405 /** 00406 Returns location of maximum value in given component of this NodeFArrayBox 00407 in given a_subbox. 00408 */ 00409 IntVect maxIndex(const Box& a_subbox, 00410 int a_comp = 0) const 00411 { 00412 return m_fab.maxIndex(a_subbox, a_comp); 00413 } 00414 00415 /// 00416 /** 00417 Computes a_mask array with value of 1 in cells where this NodeFArrayBox 00418 has value less than a_val, 0 otherwise. a_mask is resized by this 00419 function. The number of cells marked with 1 returned. 00420 */ 00421 int maskLT(BaseFab<int>& a_mask, 00422 Real a_val, 00423 int a_comp = 0) const 00424 { 00425 return m_fab.maskLT(a_mask, a_val, a_comp); 00426 } 00427 00428 00429 /// 00430 /** 00431 Computes a_mask array with value of 1 in cells where this NodeFArrayBox 00432 has value less than or equal to a_val, 0 otherwise. a_mask is 00433 resized by this function. The number of cells marked with 1 00434 returned. 00435 */ 00436 int maskLE(BaseFab<int>& a_mask, 00437 Real a_val, 00438 int a_comp = 0) const 00439 { 00440 return m_fab.maskLE(a_mask, a_val, a_comp); 00441 } 00442 00443 /// 00444 /** 00445 Computes a_mask array with value of 1 in cells where this NodeFArrayBox 00446 has value equal to a_val, 0 otherwise. a_mask is resized by this 00447 function. The number of cells marked with 1 returned. 00448 00449 */ 00450 int maskEQ(BaseFab<int>& a_mask, 00451 Real a_val, 00452 int a_comp = 0) const 00453 { 00454 return m_fab.maskEQ(a_mask, a_val, a_comp); 00455 } 00456 00457 /// 00458 /** 00459 Computes a_mask array with value of 1 in cells where this NodeFArrayBox 00460 has value greater than a_val, 0 otherwise. a_mask is resized by this 00461 function. The number of cells marked with 1 returned. 00462 */ 00463 int maskGT(BaseFab<int>& a_mask, 00464 Real a_val, 00465 int a_comp = 0) const 00466 { 00467 return m_fab.maskGT(a_mask, a_val, a_comp); 00468 } 00469 00470 00471 /// 00472 /** 00473 Computes a_mask array with value of 1 in cells where this NodeFArrayBox 00474 has value greater than or equal to a_val, 0 otherwise. a_mask is 00475 resized by this function. The number of cells marked with 1 returned. 00476 */ 00477 int maskGE(BaseFab<int>& a_mask, 00478 Real a_val, 00479 int a_comp = 0) const 00480 { 00481 return m_fab.maskGE(a_mask, a_val, a_comp); 00482 } 00483 00484 /// 00485 /** 00486 Modifies this NodeFArrayBox by replacing each value with its absolute value. 00487 */ 00488 void abs() 00489 { 00490 m_fab.abs(); 00491 } 00492 00493 /// 00494 /** 00495 */ 00496 int nComp() const 00497 { 00498 return m_fab.nComp(); 00499 } 00500 00501 /// 00502 /** 00503 Modifies this NodeFArrayBox by replacing each value with its absolute value, 00504 for components (a_comp : a_comp+a_numcomp-1). 00505 */ 00506 void abs(int a_comp, 00507 int a_numcomp = 1) 00508 { 00509 m_fab.abs(a_comp, a_numcomp); 00510 } 00511 00512 /// 00513 /** 00514 Modifies this NodeFArrayBox by replacing eahc value with its absolute value, 00515 for components (a_comp : a_comp+a_numcomp-1) and within the a_subbox. 00516 */ 00517 void abs (const Box& a_subbox, 00518 int a_comp = 0, 00519 int a_numcomp = 1) 00520 { 00521 m_fab.abs(a_subbox, a_comp, a_numcomp); 00522 } 00523 00524 00525 /// 00526 /** 00527 Returns sum of given component of NodeFArrayBox. 00528 */ 00529 Real sum(int a_comp, 00530 int a_numcomp = 1) const 00531 { 00532 return m_fab.sum(a_comp, a_numcomp); 00533 } 00534 00535 /// 00536 /** 00537 Returns sum of component of this NodeFArrayBox in given a_subbox. 00538 */ 00539 Real sum(const Box& a_subbox, 00540 int a_comp, 00541 int a_numcomp = 1) const 00542 { 00543 return m_fab.sum(a_subbox, a_comp, a_numcomp); 00544 } 00545 00546 00547 /// 00548 /** 00549 Modifies this NodeFArrayBox by replacing each value x with a_r/x. 00550 */ 00551 NodeFArrayBox& invert(Real a_r) 00552 { 00553 m_fab.invert(a_r); 00554 return *this; 00555 } 00556 00557 00558 /// 00559 /** 00560 Modifies this NodeFArrayBox by replacing each value x with a_r/x. For 00561 given range of components. 00562 */ 00563 NodeFArrayBox& invert(Real a_r, 00564 int a_comp, 00565 int a_numcomp = 1) 00566 { 00567 m_fab.invert(a_r, a_comp, a_numcomp); 00568 return *this; 00569 } 00570 00571 /// 00572 /** 00573 Modifies this NodeFArrayBox by replacing each value x with a_r/x. For 00574 given range of components and within given a_subbox. 00575 */ 00576 NodeFArrayBox& invert(Real a_r, 00577 const Box& a_subbox, 00578 int a_comp = 0, 00579 int a_numcomp = 1) 00580 { 00581 m_fab.invert(a_r, a_subbox, a_comp, a_numcomp); 00582 return *this; 00583 } 00584 00585 /// 00586 /** 00587 Modifies this NodeFArrayBox by replacing each value with its additive 00588 inverse. For given range of components and within given a_subbox. 00589 */ 00590 NodeFArrayBox& negate(const Box& a_subbox, 00591 int a_comp = 0, 00592 int a_numcomp = 1) 00593 { 00594 m_fab.negate(a_subbox, a_comp, a_numcomp); 00595 return *this; 00596 } 00597 00598 /// 00599 /** 00600 Modifies this NodeFArrayBox by replacing each value with its additive 00601 inverse. For given range of components. 00602 */ 00603 NodeFArrayBox& negate(int a_comp, 00604 int a_numcomp = 1) 00605 { 00606 m_fab.negate(a_comp, a_numcomp); 00607 return *this; 00608 } 00609 00610 /// 00611 /** 00612 Modifies this NodeFArrayBox by replacing each value with its additive 00613 inverse. 00614 */ 00615 NodeFArrayBox& negate() 00616 { 00617 m_fab.negate(); 00618 return *this; 00619 } 00620 00621 00622 /// 00623 /** 00624 Modifies this NodeFArrayBox by adding the scalar Real a_r to all values. For 00625 given range of components and within given a_subbox. 00626 */ 00627 NodeFArrayBox& plus(Real a_r, 00628 const Box& a_subbox, 00629 int a_comp = 0, 00630 int a_numcomp = 1) 00631 { 00632 m_fab.plus(a_r, a_subbox, a_comp, a_numcomp); 00633 return *this; 00634 } 00635 00636 /// 00637 /** 00638 Modifies this NodeFArrayBox by adding the scalar Real a_r to all values. For 00639 given range of components. 00640 */ 00641 NodeFArrayBox& plus(Real a_r, 00642 int a_comp, 00643 int a_numcomp = 1) 00644 { 00645 m_fab.plus(a_r, a_comp, a_numcomp); 00646 return *this; 00647 } 00648 00649 /// 00650 Real& operator() (const IntVect& a_p, 00651 int N = 0) 00652 { 00653 return m_fab(a_p,N); 00654 } 00655 00656 /// 00657 const Real& operator() (const IntVect& a_p, 00658 int N = 0) const 00659 { 00660 return m_fab(a_p,N); 00661 } 00662 /// 00663 /** 00664 Modifies this NodeFArrayBox by adding the scalar Real a_r to all values. 00665 */ 00666 NodeFArrayBox& operator += (Real a_r) 00667 { 00668 m_fab += a_r; 00669 return *this; 00670 } 00671 00672 /// 00673 /** 00674 Modifies this NodeFArrayBox by pointwise addition of the values of the 00675 argument NodeFArrayBox. You might come to grief if the domains of the 00676 NodeFArrayBoxes don't match. 00677 */ 00678 NodeFArrayBox& operator += (const NodeFArrayBox& a_x) 00679 { 00680 m_fab += a_x.m_fab; 00681 return *this; 00682 } 00683 00684 00685 /// 00686 /** 00687 Modifies this NodeFArrayBox by adding the scalar Real a_r to all values. 00688 */ 00689 NodeFArrayBox& plus(Real a_r) 00690 { 00691 m_fab += a_r; 00692 return *this; 00693 } 00694 00695 NodeFArrayBox& plus_real(Real a_r) 00696 { 00697 return this->plus(a_r); 00698 } 00699 00700 /// 00701 /** 00702 Modifies this NodeFArrayBox by pointwise addition of the values of the 00703 argument NodeFArrayBox. You might come to grief if the domains of the 00704 NodeFArrayBoxes don't match. The same as += operator. 00705 00706 */ 00707 NodeFArrayBox& plus(const NodeFArrayBox& a_x) 00708 { 00709 m_fab += a_x.m_fab; 00710 return *this; 00711 } 00712 00713 /// 00714 /** 00715 Modifies this NodeFArrayBox by pointwise scaled addition of the 00716 argument NodeFArrayBox (a[i] <- a[i] + a_scale * a_src[i]). Uses domain 00717 of the intersection of these two NodeFArrayBoxes. 00718 */ 00719 NodeFArrayBox& plus(const NodeFArrayBox& a_src, 00720 const Real& a_scale) 00721 { 00722 m_fab.plus(a_src.m_fab, a_scale); 00723 return *this; 00724 } 00725 00726 /// 00727 /** 00728 Modifies this NodeFArrayBox by pointwise scaled addition of the 00729 argument NodeFArrayBox (a[i] <- a[i] + a_scale * a_src[i]). Uses domain 00730 of the intersection of these two NodeFArrayBoxes. 00731 */ 00732 NodeFArrayBox& plus(const NodeFArrayBox& a_src, 00733 const Real& a_scale, 00734 int a_srccomp, 00735 int a_destcomp, 00736 int a_numcomp = 1) 00737 { 00738 m_fab.plus(a_src.m_fab, a_scale, a_srccomp, a_destcomp, a_numcomp); 00739 return *this; 00740 } 00741 00742 /// 00743 /** 00744 Modifies this NodeFArrayBox by pointwise addition of values in the argument 00745 NodeFArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1) 00746 to this NodeFArrayBox's components (a_destcomp : a_destcomp+a_numcomp-1) 00747 where the domains of the two NodeFArrayBoxes intersect. 00748 */ 00749 NodeFArrayBox& plus(const NodeFArrayBox& a_src, 00750 int a_srccomp, 00751 int a_destcomp, 00752 int a_numcomp = 1) 00753 { 00754 m_fab.plus(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp); 00755 return *this; 00756 } 00757 00758 /// 00759 /** 00760 Modifies this NodeFArrayBox by pointwise addition of values in the argument 00761 NodeFArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1) 00762 to this NodeFArrayBox's components (a_destcomp : a_destcomp+numcomp-1) 00763 where the domain of this NodeFArrayBox intersects the a_subbox. NOTE: 00764 a_subbox must be contained in this FAB. 00765 */ 00766 NodeFArrayBox& plus(const NodeFArrayBox& a_src, 00767 const Box& a_subbox, 00768 int a_srccomp, 00769 int a_destcomp, 00770 int a_numcomp = 1) 00771 { 00772 m_fab.plus(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp); 00773 return *this; 00774 } 00775 00776 00777 /// 00778 /** 00779 Modifies this NodeFArrayBox by pointwise addition of values in the argument 00780 NodeFArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1) 00781 in the Box a_srcbox to this NodeFArrayBox's components (a_destcomp : 00782 a_destcomp+a_numcomp-1) in the Box a_destbox. Corresponding locations 00783 within the two NodeFArrayBoxes are indexed relative to a_srcbox and a_destbox, 00784 and will in general not be the same. The a_srcbox and a_destbox must be 00785 same size. The results are UNDEFINED if the a_src and dest NodeFArrayBoxes 00786 are the same and the a_srcbox and a_destbox overlap. 00787 00788 */ 00789 NodeFArrayBox& plus(const NodeFArrayBox& a_src, 00790 const Box& a_srcbox, 00791 const Box& a_destbox, 00792 int a_srccomp, 00793 int a_destcomp, 00794 int a_numcomp = 1) 00795 { 00796 m_fab.plus(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp); 00797 return *this; 00798 } 00799 00800 00801 /// 00802 NodeFArrayBox& plus(const NodeFArrayBox& a_src, 00803 const Box& a_srcbox, 00804 const Box& a_destbox, 00805 const Real& a_scale, 00806 int a_srccomp, 00807 int a_destcomp, 00808 int a_numcomp = 1) 00809 { 00810 m_fab.plus(a_src.m_fab, a_srcbox, a_destbox, a_scale, a_srccomp, a_destcomp, a_numcomp); 00811 return *this; 00812 } 00813 00814 /// 00815 /** 00816 Modifies this NodeFArrayBox by subtracting the scalar Real a_r to all values. 00817 Note: use plus(-a_r) for more general operations. 00818 */ 00819 NodeFArrayBox& operator -= (Real a_r) 00820 { 00821 m_fab -= a_r; 00822 return *this; 00823 } 00824 00825 /// 00826 /** 00827 Modifies this NodeFArrayBox by pointwise subtraction of the values of the 00828 argument NodeFArrayBox. You might come to grief if the domains of the 00829 NodeFArrayBoxes don't match. 00830 */ 00831 NodeFArrayBox& operator -= (const NodeFArrayBox& a_x) 00832 { 00833 m_fab -= a_x.m_fab; 00834 return *this; 00835 } 00836 00837 /// 00838 /** 00839 Modifies this NodeFArrayBox by pointwise subtraction of the values of the 00840 argument NodeFArrayBox. You might come to grief if the domains of the 00841 NodeFArrayBoxes don't match. The same as -= operator. 00842 */ 00843 NodeFArrayBox& minus(const NodeFArrayBox& a_x) 00844 { 00845 m_fab -= a_x.m_fab; 00846 return *this; 00847 } 00848 00849 /** 00850 Modifies this NodeFArrayBox by pointwise subtraction of values in the 00851 argument NodeFArrayBox. Subtracts a_src's components (a_srccomp : 00852 a_srccomp+a_numcomp-1) from this NodeFArrayBox's components (a_destcomp : 00853 a_destcomp+a_numcomp-1) where the domains of the two NodeFArrayBoxes 00854 intersect. 00855 */ 00856 NodeFArrayBox& minus(const NodeFArrayBox& a_src, 00857 int a_srccomp, 00858 int a_destcomp, 00859 int a_numcomp = 1) 00860 { 00861 m_fab.minus(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp); 00862 return *this; 00863 } 00864 00865 /** 00866 Modifies this NodeFArrayBox by pointwise subtraction of values in the 00867 argument NodeFArrayBox. Subtracts a_src's components (a_srccomp : 00868 a_srccomp+a_numcomp-1) from this NodeFArrayBox's components (a_destcomp : 00869 a_destcomp+a_numcomp-1) where the domain of this NodeFArrayBox intersects 00870 the a_subbox. NOTE: a_subbox must be contained in this FAB. 00871 */ 00872 NodeFArrayBox& minus(const NodeFArrayBox& a_src, 00873 const Box& a_subbox, 00874 int a_srccomp, 00875 int a_destcomp, 00876 int a_numcomp = 1) 00877 { 00878 m_fab.minus(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp); 00879 return *this; 00880 } 00881 00882 00883 /// 00884 /** 00885 Modifies this NodeFArrayBox by pointwise subtraction of values in the 00886 argument NodeFArrayBox. Subtracts a_src's components (a_srccomp : 00887 a_srccomp+a_numcomp-1) in the Box a_srcbox from this NodeFArrayBox's 00888 components (a_destcomp : a_destcomp+a_numcomp-1) in the Box a_destbox. 00889 Corresponding locations within the two NodeFArrayBoxes are indexed relative 00890 to a_srcbox and a_destbox, and will in general not be the same. The 00891 a_srcbox and a_destbox must be same size. The results are UNDEFINED 00892 if the a_src and dest NodeFArrayBoxes are the same and the a_srcbox and 00893 a_destbox overlap. 00894 */ 00895 NodeFArrayBox& minus(const NodeFArrayBox& a_src, 00896 const Box& a_srcbox, 00897 const Box& a_destbox, 00898 int a_srccomp, 00899 int a_destcomp, 00900 int a_numcomp = 1) 00901 { 00902 m_fab.minus(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp); 00903 return *this; 00904 } 00905 00906 00907 /// 00908 /** 00909 Modifies this NodeFArrayBox by multiplying all values by the scalar Real a_r. 00910 */ 00911 NodeFArrayBox& operator *= (Real a_r) 00912 { 00913 m_fab *= a_r; 00914 return *this; 00915 } 00916 00917 /// 00918 /** 00919 Modifies this NodeFArrayBox by multiplying all values by the scalar Real a_r. 00920 */ 00921 NodeFArrayBox& mult(Real a_r) 00922 { 00923 m_fab *= a_r; 00924 return *this; 00925 } 00926 00927 /// 00928 /** 00929 Modifies this NodeFArrayBox by multiplying all values by the scalar 00930 Real a_r. For given range of components. 00931 */ 00932 NodeFArrayBox& mult(Real a_r, 00933 int a_comp, 00934 int a_numcomp = 1) 00935 { 00936 m_fab.mult(a_r, a_comp, a_numcomp); 00937 return *this; 00938 } 00939 00940 00941 /// 00942 /** 00943 Modifies this NodeFArrayBox by multiplying all values by the scalar 00944 Real a_r. For given range of components and within given a_subbox. 00945 */ 00946 NodeFArrayBox& mult(Real a_r, 00947 const Box& a_subbox, 00948 int a_comp = 0, 00949 int a_numcomp = 1) 00950 { 00951 m_fab.mult(a_r, a_subbox, a_comp, a_numcomp); 00952 return *this; 00953 } 00954 00955 00956 /// 00957 /** 00958 Modifies this NodeFArrayBox by pointwise multiplication of the values by the 00959 argument NodeFArrayBox. You might come to grief if the domains of the 00960 NodeFArrayBoxes don't match. 00961 */ 00962 NodeFArrayBox& operator *= (const NodeFArrayBox& a_x) 00963 { 00964 m_fab *= a_x.m_fab; 00965 return *this; 00966 } 00967 00968 /// 00969 /** 00970 Modifies this NodeFArrayBox by pointwise multiplication by the values in the 00971 argument NodeFArrayBox. You might come to grief if the domains of the 00972 NodeFArrayBoxes don't match. The same as the *= operator. 00973 */ 00974 NodeFArrayBox& mult(const NodeFArrayBox& a_x) 00975 { 00976 m_fab *= a_x.m_fab; 00977 return *this; 00978 } 00979 00980 /// 00981 /** 00982 Modifies this NodeFArrayBox by pointwise multiplication by values in the 00983 argument NodeFArrayBox. Multiplies a_src's components (a_srccomp : 00984 a_srccomp+a_numcomp-1) by this NodeFArrayBox's components (a_destcomp : 00985 a_destcomp+a_numcomp-1) where the domains of the two NodeFArrayBoxes 00986 intersect. 00987 */ 00988 NodeFArrayBox& mult(const NodeFArrayBox& a_src, 00989 int a_srccomp, 00990 int a_destcomp, 00991 int a_numcomp = 1) 00992 { 00993 m_fab.mult(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp); 00994 return *this; 00995 } 00996 00997 00998 /// 00999 /** 01000 Modifies this NodeFArrayBox by pointwise multiplication by values in the 01001 argument NodeFArrayBox. Multiplies a_src's components (a_srccomp : 01002 a_srccomp+a_numcomp-1) by this NodeFArrayBox's components (a_destcomp : 01003 a_destcomp+a_numcomp-1) where the domain of this NodeFArrayBox intersects 01004 the a_subbox. NOTE: a_subbox must be contained in this FAB. 01005 */ 01006 NodeFArrayBox& mult(const NodeFArrayBox& a_src, 01007 const Box& a_subbox, 01008 int a_srccomp, 01009 int a_destcomp, 01010 int a_numcomp = 1) 01011 { 01012 m_fab.mult(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp); 01013 return *this; 01014 } 01015 01016 /// 01017 /** 01018 Modifies this NodeFArrayBox by pointwise multiplication by values in the 01019 argument NodeFArrayBox. Multiplies a_src's components (a_srccomp : 01020 a_srccomp+a_numcomp-1) in the Box a_srcbox by this NodeFArrayBox's 01021 components (a_destcomp : a_destcomp+a_numcomp-1) in the Box a_destbox. 01022 Corresponding locations within the two NodeFArrayBoxes are indexed relative 01023 to a_srcbox and a_destbox, and will in general not be the same. The 01024 a_srcbox and a_destbox must be same size. The results are UNDEFINED if 01025 the a_src and dest NodeFArrayBoxes are the same and the a_srcbox and a_destbox 01026 overlap. 01027 */ 01028 NodeFArrayBox& mult(const NodeFArrayBox& a_src, 01029 const Box& a_srcbox, 01030 const Box& a_destbox, 01031 int a_srccomp, 01032 int a_destcomp, 01033 int a_numcomp = 1) 01034 { 01035 m_fab.mult(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp); 01036 return *this; 01037 } 01038 01039 01040 /// 01041 /** 01042 Modifies this NodeFArrayBox by dividing all values by the scalar Real a_r. 01043 */ 01044 NodeFArrayBox& operator /= (Real a_r) 01045 { 01046 m_fab /= a_r; 01047 return *this; 01048 } 01049 01050 /// 01051 /** 01052 Modifies this NodeFArrayBox by dividing all values by the scalar Real a_r. 01053 */ 01054 NodeFArrayBox& divide(Real a_r) 01055 { 01056 m_fab /= a_r; 01057 return *this; 01058 } 01059 01060 01061 /// 01062 /** 01063 Modifies this NodeFArrayBox by dividing all values by the scalar Real a_r. 01064 For given range of components. 01065 */ 01066 NodeFArrayBox& divide(Real a_r, 01067 int a_comp, 01068 int a_numcomp = 1) 01069 { 01070 m_fab.divide(a_r, a_comp, a_numcomp); 01071 return *this; 01072 } 01073 01074 01075 /// 01076 /** 01077 Modifies this NodeFArrayBox by dividing all values by the scalar Real 01078 a_r. For given range of components and within given a_subbox. 01079 */ 01080 NodeFArrayBox& divide(Real a_r, 01081 const Box& a_subbox, 01082 int a_comp = 0, 01083 int a_numcomp = 1) 01084 { 01085 m_fab.divide(a_r, a_subbox, a_comp, a_numcomp); 01086 return *this; 01087 } 01088 01089 01090 /// 01091 /** 01092 Modifies this NodeFArrayBox by pointwise division of the values by the 01093 argument NodeFArrayBox. You might come to grief if the domains of the 01094 NodeFArrayBoxes don't match. 01095 */ 01096 NodeFArrayBox& operator /= (const NodeFArrayBox& a_x) 01097 { 01098 m_fab /= a_x.m_fab; 01099 return *this; 01100 } 01101 01102 /// 01103 /** 01104 Modifies this NodeFArrayBox by pointwise division by the values in the 01105 argument NodeFArrayBox. You might come to grief if the domains of the 01106 NodeFArrayBoxes don't match. The same as the /= operator. 01107 */ 01108 NodeFArrayBox& divide(const NodeFArrayBox& a_x) 01109 { 01110 m_fab /= a_x.m_fab; 01111 return *this; 01112 } 01113 01114 /// 01115 /** 01116 Modifies this NodeFArrayBox by pointwise division by values in the argument 01117 NodeFArrayBox. Divides this NodeFArrayBox's components (a_destcomp : 01118 a_destcomp+a_numcomp-1) by a_src's components (a_srccomp : 01119 a_srccomp+a_numcomp-1) where the domains of the two NodeFArrayBoxes intersect. 01120 */ 01121 NodeFArrayBox& divide(const NodeFArrayBox& a_src, 01122 int a_srccomp, 01123 int a_destcomp, 01124 int a_numcomp = 1) 01125 { 01126 m_fab.divide(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp); 01127 return *this; 01128 } 01129 01130 01131 /// 01132 /** 01133 Modifies this NodeFArrayBox by pointwise division by values in the argument 01134 NodeFArrayBox. Divides this NodeFArrayBox's components (a_destcomp : 01135 a_destcomp+a_numcomp-1) by a_src's components (a_srccomp : 01136 a_srccomp+a_numcomp-1) where the domain of this NodeFArrayBox intersects 01137 the a_subbox. NOTE: a_subbox must be contained in this FAB. 01138 */ 01139 NodeFArrayBox& divide(const NodeFArrayBox& a_src, 01140 const Box& a_subbox, 01141 int a_srccomp, 01142 int a_destcomp, 01143 int a_numcomp = 1) 01144 { 01145 m_fab.divide(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp); 01146 return *this; 01147 } 01148 01149 01150 /// 01151 /** 01152 Modifies this NodeFArrayBox by pointwise division by values in the argument 01153 NodeFArrayBox. Divides this NodeFArrayBox's components (a_destcomp : 01154 a_destcomp+a_numcomp-1) in the Box a_destbox by a_src's components 01155 (a_srccomp : a_srccomp+a_numcomp-1) in the Box a_srcbox. Corresponding 01156 locations within the two NodeFArrayBoxes are indexed relative to a_srcbox and 01157 a_destbox, and will in general not be the same. The a_srcbox and 01158 a_destbox must be same size. The results are UNDEFINED if the a_src and 01159 dest NodeFArrayBoxes are the same and the a_srcbox and a_destbox overlap. 01160 */ 01161 NodeFArrayBox& divide(const NodeFArrayBox& a_src, 01162 const Box& a_srcbox, 01163 const Box& a_destbox, 01164 int a_srccomp, 01165 int a_destcomp, 01166 int a_numcomp = 1) 01167 { 01168 m_fab.divide(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp); 01169 return *this; 01170 } 01171 01172 01173 01174 protected: 01175 01176 // CELL-centered box. data are defined on the surrounding nodes. 01177 Box m_box; 01178 01179 // NODE-centered data 01180 FArrayBox m_fab; 01181 01182 private: 01183 /// These are disallowed for performance reasons 01184 01185 NodeFArrayBox (const NodeFArrayBox&); 01186 NodeFArrayBox& operator = (const NodeFArrayBox&); 01187 01188 }; 01189 01190 #include "NamespaceFooter.H" 01191 #endif
1.5.5