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 #ifndef _FARRAYBOX_H_ 00012 #define _FARRAYBOX_H_ 00013 00014 #ifndef WRAPPER 00015 #include <iostream> 00016 00017 // #include <Pointers.H> 00018 #include "Box.H" 00019 #include "BaseFab.H" 00020 #endif 00021 00022 #include "REAL.H" 00023 #include "SPACE.H" 00024 #include "NamespaceHeader.H" 00025 00026 00027 /// 00028 /** 00029 Fortran Array Boxes (generally called FABs) are objects constructed 00030 to interface with arrays in Fortran. Useful operations can be performed 00031 upon FABs in C++, and they provide a convenient interface to 00032 Fortran when it is necessary to retreat into that language for 00033 doing arithmetic operations when performance matters. 00034 00035 FArrayBox is derived from BaseFab<Real>. 00036 FArrayBox adds additional useful capabilities which make sense 00037 for Real types, such as I/O and L**p norms. 00038 00039 The C pre-processor macro `CH_SPACEDIM' must be defined to use 00040 this class. The internal precision of FArrayBox objects is 00041 set by defining either `CH_USE_FLOAT' or `CH_USE_DOUBLE' 00042 00043 This class does NOT provide a copy constructor or assignment operator. 00044 */ 00045 class FArrayBox: public BaseFab<Real> 00046 { 00047 public: 00048 00049 /// 00050 /** 00051 Constructs an invalid FArrayBox with no memory. 00052 */ 00053 FArrayBox (); 00054 00055 /// 00056 /** 00057 Constructs an initial FArrayBox with the data space allocated but not 00058 inititialized. a_ncomp is the number of components (variables) at each 00059 data point in the Box. 00060 */ 00061 FArrayBox(const Box& a_box, 00062 int a_ncomp, 00063 Real* a_alias); 00064 00065 FArrayBox(const Box& a_box, 00066 int a_ncomp); 00067 /// 00068 /** 00069 Construct an aliaed FArrayBox. See BaseFab class for details. 00070 */ 00071 FArrayBox(const Interval& a_comps, 00072 FArrayBox& a_original) 00073 : 00074 BaseFab<Real>(a_comps, a_original) 00075 {} 00076 00077 /// 00078 /** 00079 Defines FArrayBox with the data space allocated but not 00080 inititialized. a_ncomp is the number of components (variables) at each 00081 data point in the Box. 00082 */ 00083 virtual void define(const Box& a_box, 00084 int a_ncomp, 00085 Real* a_alias = NULL) 00086 { 00087 BaseFab<Real>::define(a_box, a_ncomp, a_alias); 00088 } 00089 00090 /// 00091 /** 00092 The (virtual) destructor. 00093 */ 00094 virtual ~FArrayBox (); 00095 00096 /// 00097 /** 00098 Constructs an 'aliased' BaseFab of the requested interval of the 00099 argument BaseFab. This BaseFab does not allocate any memory, but 00100 sets its data pointer into the memory pointed to by the argument 00101 BaseFab. It is the users responsiblity to ensure this aliased 00102 BaseFab is not used after the original BaseFab has deleted its data ptr 00103 (resize, define(..) called, or destruction, etc.). 00104 00105 This aliased BaseFab will also generate side effects (modifying the values 00106 of data in one will modify the other's data). 00107 00108 This aliased BaseFab will have a_comps.size() components, starting at zero. 00109 */ 00110 virtual void define(const Interval& a_comps, 00111 FArrayBox& a_original) 00112 { 00113 BaseFab<Real>::define(a_comps, a_original); 00114 } 00115 00116 /// 00117 /** 00118 * This is here only to make the Intel compiler stop warning about 00119 * partial override. 00120 */ 00121 virtual void define(const Interval& a_comps, 00122 BaseFab<Real>& a_original) 00123 { 00124 BaseFab<Real>::define(a_comps, a_original); 00125 } 00126 00127 /// 00128 /** override resize. I'm going to try and get rid of this function in the future (bvs) 00129 */ 00130 virtual void resize(const Box& a_box, 00131 int a_comps, 00132 Real* a_alias = NULL) 00133 { 00134 BaseFab<Real>::resize(a_box, a_comps, a_alias); 00135 } 00136 /// 00137 /** 00138 Constructs FArrayBox by reading it from istream. 00139 */ 00140 explicit FArrayBox(std::istream& a_is); 00141 00142 /// 00143 /** 00144 Returns the Lp-norm of this FAB using components 00145 (a_comp : a_comp+a_numcomp-1) and within the a_subbox. 00146 a_p < 0 -> ERROR 00147 a_p = 0 -> infinity norm (max norm) 00148 a_p = 1 -> sum of ABS(FAB) 00149 a_p > 1 -> Lp-norm 00150 */ 00151 virtual Real norm(const Box& a_subbox, 00152 int a_p = 2, 00153 int a_comp = 0, 00154 int a_numcomp = 1) const; 00155 00156 /// 00157 /** 00158 Returns the Lp-norm of this FAB using components 00159 (a_comp : a_comp+a_numcomp-1). 00160 a_p < 0 -> ERROR 00161 a_p = 0 -> infinity norm (max norm) 00162 a_p = 1 -> sum of ABS(FAB) 00163 a_p > 1 -> Lp-norm 00164 */ 00165 virtual Real norm(int a_p = 2, 00166 int a_comp = 0, 00167 int a_numcomp = 1) const; 00168 00169 /// 00170 /** 00171 Returns sum of pow(fab[i,c],p): i in a_subbox, a_comp <= c < 00172 a_comp+a_numcomp, a_p >= 2 only 00173 */ 00174 virtual Real sumPow(const Box& a_subbox, 00175 int a_p = 2, 00176 int a_comp = 0, 00177 int a_numcomp = 1) const; 00178 00179 /// Return the dot product of this FArrayBox with another 00180 /** 00181 Return the dot product of this FArrayBox and "a_fab2" over their common 00182 box and all components. 00183 */ 00184 Real dotProduct(const FArrayBox& a_fab2) const; 00185 00186 /// Return the dot product of this FArrayBox with another 00187 /** 00188 Return the dot product of this FArrayBox and "a_fab2" over the 00189 a_box box and all components. 00190 */ 00191 Real dotProduct(const FArrayBox& a_fab2, const Box& a_box) const; 00192 00193 /// 00194 /** 00195 Returns the minimum value of given component of this FArrayBox. 00196 */ 00197 Real min(int a_comp = 0) const; 00198 00199 /// 00200 /** 00201 Returns the minimum value of given component of this FArrayBox in 00202 given a_subbox. 00203 00204 */ 00205 Real min(const Box& a_subbox, 00206 int a_comp = 0) const; 00207 00208 /// 00209 /** 00210 Returns the maximum value of given component of this FArrayBox. 00211 */ 00212 Real max(int a_comp = 0) const; 00213 00214 /// 00215 /** 00216 Returns the maximum value of given component of this FArrayBox in 00217 given a_subbox. 00218 00219 */ 00220 Real max(const Box& a_subbox, 00221 int a_comp = 0) const; 00222 00223 /// 00224 /** 00225 Finds location of minimum value in given component of this FArrayBox. 00226 */ 00227 IntVect minIndex(int a_comp = 0) const; 00228 00229 /// 00230 /** 00231 Returns location of minimum value in given component of this FArrayBox 00232 in given a_subbox. 00233 */ 00234 IntVect minIndex(const Box& a_subbox, 00235 int a_comp = 0) const; 00236 00237 /// 00238 /** 00239 Returns location of maximum value in given component of this FArrayBox. 00240 */ 00241 IntVect maxIndex(int a_comp = 0) const; 00242 00243 /// 00244 /** 00245 Returns location of maximum value in given component of this FArrayBox 00246 in given a_subbox. 00247 */ 00248 IntVect maxIndex(const Box& a_subbox, 00249 int a_comp = 0) const; 00250 00251 /// 00252 /** 00253 Computes a_mask array with value of 1 in cells where this FArrayBox 00254 has value less than a_val, 0 otherwise. a_mask is resized by this 00255 function. The number of cells marked with 1 returned. 00256 */ 00257 int maskLT(BaseFab<int>& a_mask, 00258 Real a_val, 00259 int a_comp = 0) const; 00260 00261 /// 00262 /** 00263 Computes a_mask array with value of 1 in cells where this FArrayBox 00264 has value less than or equal to a_val, 0 otherwise. a_mask is 00265 resized by this function. The number of cells marked with 1 00266 returned. 00267 */ 00268 int maskLE(BaseFab<int>& a_mask, 00269 Real a_val, 00270 int a_comp = 0) const; 00271 /// 00272 /** 00273 Computes a_mask array with value of 1 in cells where this FArrayBox 00274 has value equal to a_val, 0 otherwise. a_mask is resized by this 00275 function. The number of cells marked with 1 returned. 00276 00277 */ 00278 int maskEQ(BaseFab<int>& a_mask, 00279 Real a_val, 00280 int a_comp = 0) const; 00281 /// 00282 /** 00283 Computes a_mask array with value of 1 in cells where this FArrayBox 00284 has value greater than a_val, 0 otherwise. a_mask is resized by this 00285 function. The number of cells marked with 1 returned. 00286 */ 00287 int maskGT(BaseFab<int>& a_mask, 00288 Real a_val, 00289 int a_comp = 0) const; 00290 00291 /// 00292 /** 00293 Computes a_mask array with value of 1 in cells where this FArrayBox 00294 has value greater than or equal to a_val, 0 otherwise. a_mask is 00295 resized by this function. The number of cells marked with 1 returned. 00296 */ 00297 int maskGE(BaseFab<int>& a_mask, 00298 Real a_val, 00299 int a_comp = 0) const; 00300 00301 00302 /// 00303 /** 00304 Modifies this FArrayBox by replacing each value with its absolute value. 00305 */ 00306 void abs(); 00307 00308 /// 00309 /** 00310 Modifies this FArrayBox by replacing each value with its absolute value, 00311 for components (a_comp : a_comp+a_numcomp-1). 00312 */ 00313 void abs(int a_comp, 00314 int a_numcomp = 1); 00315 00316 /// 00317 /** 00318 Modifies this FArrayBox by replacing eahc value with its absolute value, 00319 for components (a_comp : a_comp+a_numcomp-1) and within the a_subbox. 00320 */ 00321 void abs (const Box& a_subbox, 00322 int a_comp = 0, 00323 int a_numcomp = 1); 00324 00325 /// 00326 /** 00327 Returns sum of given component of FArrayBox. 00328 */ 00329 Real sum(int a_comp, 00330 int a_numcomp = 1) const; 00331 00332 /// 00333 /** 00334 Returns sum of component of this FArrayBox in given a_subbox. 00335 */ 00336 Real sum(const Box& a_subbox, 00337 int a_comp, 00338 int a_numcomp = 1) const; 00339 00340 /// 00341 /** 00342 Modifies this FArrayBox by replacing each value x with a_r/x. 00343 */ 00344 FArrayBox& invert(Real a_r); 00345 00346 /// 00347 /** 00348 Modifies this FArrayBox by replacing each value x with a_r/x. For 00349 given range of components. 00350 */ 00351 FArrayBox& invert(Real a_r, 00352 int a_comp, 00353 int a_numcomp = 1); 00354 00355 /// 00356 /** 00357 Modifies this FArrayBox by replacing each value x with a_r/x. For 00358 given range of components and within given a_subbox. 00359 */ 00360 FArrayBox& invert(Real a_r, 00361 const Box& a_subbox, 00362 int a_comp = 0, 00363 int a_numcomp = 1); 00364 00365 /// 00366 /** 00367 Modifies this FArrayBox by replacing each value with its additive 00368 inverse. For given range of components and within given a_subbox. 00369 */ 00370 FArrayBox& negate(const Box& a_subbox, 00371 int a_comp = 0, 00372 int a_numcomp = 1); 00373 00374 /// 00375 /** 00376 Modifies this FArrayBox by replacing each value with its additive 00377 inverse. For given range of components. 00378 */ 00379 FArrayBox& negate(int a_comp, 00380 int a_numcomp = 1); 00381 00382 /// 00383 /** 00384 Modifies this FArrayBox by replacing each value with its additive 00385 inverse. 00386 */ 00387 FArrayBox& negate(); 00388 00389 /// 00390 /** 00391 Modifies this FArrayBox by adding the scalar Real a_r to all values. For 00392 given range of components and within given a_subbox. 00393 */ 00394 FArrayBox& plus(Real a_r, 00395 const Box& a_subbox, 00396 int a_comp = 0, 00397 int a_numcomp = 1); 00398 00399 /// 00400 /** 00401 Modifies this FArrayBox by adding the scalar Real a_r to all values. For 00402 given range of components. 00403 */ 00404 FArrayBox& plus(Real a_r, 00405 int a_comp, 00406 int a_numcomp = 1); 00407 00408 /// 00409 /** 00410 Modifies this FArrayBox by adding the scalar Real a_r to all values. 00411 */ 00412 FArrayBox& operator += (Real a_r); 00413 00414 /// 00415 /** 00416 Modifies this FArrayBox by pointwise addition of the values of the 00417 argument FArrayBox. You might come to grief if the domains of the 00418 FArrayBoxes don't match. 00419 */ 00420 FArrayBox& operator += (const FArrayBox& a_x); 00421 00422 /// 00423 /** 00424 Modifies this FArrayBox by adding the scalar Real a_r to all values. 00425 */ 00426 FArrayBox& plus(Real a_r); 00427 00428 FArrayBox& plus_real(Real a_r) 00429 { 00430 return this->plus(a_r); 00431 } 00432 00433 /// 00434 /** 00435 Modifies this FArrayBox by pointwise addition of the values of the 00436 argument FArrayBox. You might come to grief if the domains of the 00437 FArrayBoxes don't match. The same as += operator. 00438 00439 */ 00440 FArrayBox& plus(const FArrayBox& a_x); 00441 00442 /// 00443 /** 00444 Modifies this FArrayBox by pointwise scaled addition of the 00445 argument FArrayBox (a[i] <- a[i] + a_scale * a_src[i]). Uses domain 00446 of the intersection of these two FArrayBoxes. 00447 */ 00448 FArrayBox& plus(const FArrayBox& a_src, 00449 const Real& a_scale); 00450 00451 /// 00452 /** 00453 Modifies this FArrayBox by pointwise scaled addition of the 00454 argument FArrayBox (a[i] <- a[i] + a_scale * a_src[i]). Uses domain 00455 of the intersection of these two FArrayBoxes. 00456 */ 00457 FArrayBox& plus(const FArrayBox& a_src, 00458 const Real& a_scale, 00459 int a_srccomp, 00460 int a_destcomp, 00461 int a_numcomp = 1); 00462 00463 /// 00464 /** 00465 Modifies this FArrayBox by pointwise addition of values in the argument 00466 FArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1) 00467 to this FArrayBox's components (a_destcomp : a_destcomp+a_numcomp-1) 00468 where the domains of the two FArrayBoxes intersect. 00469 */ 00470 FArrayBox& plus(const FArrayBox& a_src, 00471 int a_srccomp, 00472 int a_destcomp, 00473 int a_numcomp = 1); 00474 00475 /// 00476 /** 00477 Modifies this FArrayBox by pointwise addition of values in the argument 00478 FArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1) 00479 to this FArrayBox's components (a_destcomp : a_destcomp+numcomp-1) 00480 where the domain of this FArrayBox intersects the a_subbox. NOTE: 00481 a_subbox must be contained in this FAB. 00482 */ 00483 FArrayBox& plus(const FArrayBox& a_src, 00484 const Box& a_subbox, 00485 int a_srccomp, 00486 int a_destcomp, 00487 int a_numcomp = 1); 00488 00489 /// 00490 /** 00491 Modifies this FArrayBox by pointwise addition of values in the argument 00492 FArrayBox. Adds src's components (a_srccomp : a_srccomp+a_numcomp-1) 00493 in the Box a_srcbox to this FArrayBox's components (a_destcomp : 00494 a_destcomp+a_numcomp-1) in the Box a_destbox. Corresponding locations 00495 within the two FArrayBoxes are indexed relative to a_srcbox and a_destbox, 00496 and will in general not be the same. The a_srcbox and a_destbox must be 00497 same size. The results are UNDEFINED if the a_src and dest FArrayBoxes 00498 are the same and the a_srcbox and a_destbox overlap. 00499 00500 */ 00501 FArrayBox& plus(const FArrayBox& a_src, 00502 const Box& a_srcbox, 00503 const Box& a_destbox, 00504 int a_srccomp, 00505 int a_destcomp, 00506 int a_numcomp = 1); 00507 00508 /// 00509 FArrayBox& plus(const FArrayBox& a_src, 00510 const Box& a_srcbox, 00511 const Box& a_destbox, 00512 const Real& a_scale, 00513 int a_srccomp, 00514 int a_destcomp, 00515 int a_numcomp = 1); 00516 00517 /// 00518 /** 00519 Modifies this FArrayBox by subtracting the scalar Real a_r to all values. 00520 Note: use plus(-a_r) for more general operations. 00521 */ 00522 FArrayBox& operator -= (Real a_r); 00523 00524 /// 00525 /** 00526 Modifies this FArrayBox by pointwise subtraction of the values of the 00527 argument FArrayBox. You might come to grief if the domains of the 00528 FArrayBoxes don't match. 00529 */ 00530 FArrayBox& operator -= (const FArrayBox& a_x); 00531 00532 /// 00533 /** 00534 Modifies this FArrayBox by pointwise subtraction of the values of the 00535 argument FArrayBox. You might come to grief if the domains of the 00536 FArrayBoxes don't match. The same as -= operator. 00537 */ 00538 FArrayBox& minus(const FArrayBox& a_x); 00539 00540 /** 00541 Modifies this FArrayBox by pointwise subtraction of values in the 00542 argument FArrayBox. Subtracts a_src's components (a_srccomp : 00543 a_srccomp+a_numcomp-1) from this FArrayBox's components (a_destcomp : 00544 a_destcomp+a_numcomp-1) where the domains of the two FArrayBoxes 00545 intersect. 00546 */ 00547 FArrayBox& minus(const FArrayBox& a_src, 00548 int a_srccomp, 00549 int a_destcomp, 00550 int a_numcomp = 1); 00551 00552 /** 00553 Modifies this FArrayBox by pointwise subtraction of values in the 00554 argument FArrayBox. Subtracts a_src's components (a_srccomp : 00555 a_srccomp+a_numcomp-1) from this FArrayBox's components (a_destcomp : 00556 a_destcomp+a_numcomp-1) where the domain of this FArrayBox intersects 00557 the a_subbox. NOTE: a_subbox must be contained in this FAB. 00558 */ 00559 FArrayBox& minus(const FArrayBox& a_src, 00560 const Box& a_subbox, 00561 int a_srccomp, 00562 int a_destcomp, 00563 int a_numcomp = 1); 00564 00565 /// 00566 /** 00567 Modifies this FArrayBox by pointwise subtraction of values in the 00568 argument FArrayBox. Subtracts a_src's components (a_srccomp : 00569 a_srccomp+a_numcomp-1) in the Box a_srcbox from this FArrayBox's 00570 components (a_destcomp : a_destcomp+a_numcomp-1) in the Box a_destbox. 00571 Corresponding locations within the two FArrayBoxes are indexed relative 00572 to a_srcbox and a_destbox, and will in general not be the same. The 00573 a_srcbox and a_destbox must be same size. The results are UNDEFINED 00574 if the a_src and dest FArrayBoxes are the same and the a_srcbox and 00575 a_destbox overlap. 00576 */ 00577 FArrayBox& minus(const FArrayBox& a_src, 00578 const Box& a_srcbox, 00579 const Box& a_destbox, 00580 int a_srccomp, 00581 int a_destcomp, 00582 int a_numcomp = 1); 00583 00584 /// 00585 /** 00586 Modifies this FArrayBox by multiplying all values by the scalar Real a_r. 00587 */ 00588 FArrayBox& operator *= (Real a_r); 00589 00590 /// 00591 /** 00592 Modifies this FArrayBox by multiplying all values by the scalar Real a_r. 00593 */ 00594 FArrayBox& mult(Real a_r); 00595 00596 /// 00597 /** 00598 Modifies this FArrayBox by multiplying all values by the scalar 00599 Real a_r. For given range of components. 00600 */ 00601 FArrayBox& mult(Real a_r, 00602 int a_comp, 00603 int a_numcomp = 1); 00604 00605 /// 00606 /** 00607 Modifies this FArrayBox by multiplying all values by the scalar 00608 Real a_r. For given range of components and within given a_subbox. 00609 */ 00610 FArrayBox& mult(Real a_r, 00611 const Box& a_subbox, 00612 int a_comp = 0, 00613 int a_numcomp = 1); 00614 00615 /// 00616 /** 00617 Modifies this FArrayBox by pointwise multiplication of the values by the 00618 argument FArrayBox. You might come to grief if the domains of the 00619 FArrayBoxes don't match. 00620 */ 00621 FArrayBox& operator *= (const FArrayBox& a_x); 00622 00623 /// 00624 /** 00625 Modifies this FArrayBox by pointwise multiplication by the values in the 00626 argument FArrayBox. You might come to grief if the domains of the 00627 FArrayBoxes don't match. The same as the *= operator. 00628 */ 00629 FArrayBox& mult(const FArrayBox& a_x); 00630 00631 /// 00632 /** 00633 Modifies this FArrayBox by pointwise multiplication by values in the 00634 argument FArrayBox. Multiplies a_src's components (a_srccomp : 00635 a_srccomp+a_numcomp-1) by this FArrayBox's components (a_destcomp : 00636 a_destcomp+a_numcomp-1) where the domains of the two FArrayBoxes 00637 intersect. 00638 */ 00639 FArrayBox& mult(const FArrayBox& a_src, 00640 int a_srccomp, 00641 int a_destcomp, 00642 int a_numcomp = 1); 00643 00644 /// 00645 /** 00646 Modifies this FArrayBox by pointwise multiplication by values in the 00647 argument FArrayBox. Multiplies a_src's components (a_srccomp : 00648 a_srccomp+a_numcomp-1) by this FArrayBox's components (a_destcomp : 00649 a_destcomp+a_numcomp-1) where the domain of this FArrayBox intersects 00650 the a_subbox. NOTE: a_subbox must be contained in this FAB. 00651 */ 00652 FArrayBox& mult(const FArrayBox& a_src, 00653 const Box& a_subbox, 00654 int a_srccomp, 00655 int a_destcomp, 00656 int a_numcomp = 1); 00657 00658 /// 00659 /** 00660 Modifies this FArrayBox by pointwise multiplication by values in the 00661 argument FArrayBox. Multiplies a_src's components (a_srccomp : 00662 a_srccomp+a_numcomp-1) in the Box a_srcbox by this FArrayBox's 00663 components (a_destcomp : a_destcomp+a_numcomp-1) in the Box a_destbox. 00664 Corresponding locations within the two FArrayBoxes are indexed relative 00665 to a_srcbox and a_destbox, and will in general not be the same. The 00666 a_srcbox and a_destbox must be same size. The results are UNDEFINED if 00667 the a_src and dest FArrayBoxes are the same and the a_srcbox and a_destbox 00668 overlap. 00669 */ 00670 FArrayBox& mult(const FArrayBox& a_src, 00671 const Box& a_srcbox, 00672 const Box& a_destbox, 00673 int a_srccomp, 00674 int a_destcomp, 00675 int a_numcomp = 1); 00676 00677 /// 00678 /** 00679 Modifies this FArrayBox by dividing all values by the scalar Real a_r. 00680 */ 00681 FArrayBox& operator /= (Real a_r); 00682 00683 /// 00684 /** 00685 Modifies this FArrayBox by dividing all values by the scalar Real a_r. 00686 */ 00687 FArrayBox& divide(Real a_r); 00688 00689 /// 00690 /** 00691 Modifies this FArrayBox by dividing all values by the scalar Real a_r. 00692 For given range of components. 00693 */ 00694 FArrayBox& divide(Real a_r, 00695 int a_comp, 00696 int a_numcomp = 1); 00697 00698 /// 00699 /** 00700 Modifies this FArrayBox by dividing all values by the scalar Real 00701 a_r. For given range of components and within given a_subbox. 00702 */ 00703 FArrayBox& divide(Real a_r, 00704 const Box& a_subbox, 00705 int a_comp = 0, 00706 int a_numcomp = 1); 00707 00708 /// 00709 /** 00710 Modifies this FArrayBox by pointwise division of the values by the 00711 argument FArrayBox. You might come to grief if the domains of the 00712 FArrayBoxes don't match. 00713 */ 00714 FArrayBox& operator /= (const FArrayBox& a_x); 00715 00716 /// 00717 /** 00718 Modifies this FArrayBox by pointwise division by the values in the 00719 argument FArrayBox. You might come to grief if the domains of the 00720 FArrayBoxes don't match. The same as the /= operator. 00721 */ 00722 FArrayBox& divide(const FArrayBox& a_x); 00723 00724 /// 00725 /** 00726 Modifies this FArrayBox by pointwise division by values in the argument 00727 FArrayBox. Divides this FArrayBox's components (a_destcomp : 00728 a_destcomp+a_numcomp-1) by a_src's components (a_srccomp : 00729 a_srccomp+a_numcomp-1) where the domains of the two FArrayBoxes intersect. 00730 */ 00731 FArrayBox& divide(const FArrayBox& a_src, 00732 int a_srccomp, 00733 int a_destcomp, 00734 int a_numcomp = 1); 00735 00736 /// 00737 /** 00738 Modifies this FArrayBox by pointwise division by values in the argument 00739 FArrayBox. Divides this FArrayBox's components (a_destcomp : 00740 a_destcomp+a_numcomp-1) by a_src's components (a_srccomp : 00741 a_srccomp+a_numcomp-1) where the domain of this FArrayBox intersects 00742 the a_subbox. NOTE: a_subbox must be contained in this FAB. 00743 */ 00744 FArrayBox& divide(const FArrayBox& a_src, 00745 const Box& a_subbox, 00746 int a_srccomp, 00747 int a_destcomp, 00748 int a_numcomp = 1); 00749 00750 /// 00751 /** 00752 Modifies this FArrayBox by pointwise division by values in the argument 00753 FArrayBox. Divides this FArrayBox's components (a_destcomp : 00754 a_destcomp+a_numcomp-1) in the Box a_destbox by a_src's components 00755 (a_srccomp : a_srccomp+a_numcomp-1) in the Box a_srcbox. Corresponding 00756 locations within the two FArrayBoxes are indexed relative to a_srcbox and 00757 a_destbox, and will in general not be the same. The a_srcbox and 00758 a_destbox must be same size. The results are UNDEFINED if the a_src and 00759 dest FArrayBoxes are the same and the a_srcbox and a_destbox overlap. 00760 */ 00761 FArrayBox& divide(const FArrayBox& a_src, 00762 const Box& a_srcbox, 00763 const Box& a_destbox, 00764 int a_srccomp, 00765 int a_destcomp, 00766 int a_numcomp = 1); 00767 00768 /// 00769 Real get(const IntVect& a_iv, 00770 int a_comp) const 00771 { 00772 return this->operator()(a_iv, a_comp); 00773 } 00774 00775 /// 00776 void set(const IntVect& a_iv, 00777 int a_comp, 00778 Real a_val) 00779 { 00780 this->operator()(a_iv, a_comp) = a_val; 00781 } 00782 00783 //! Computes a_A * a_X + a_B * a_Y, placing the result in this FArrayBox. 00784 FArrayBox& axby(const FArrayBox& a_X, const FArrayBox& a_Y, 00785 Real a_A, Real a_B); 00786 00787 //! Computes a_A * a_X + a_B * a_Y, placing the result in this FArrayBox. 00788 //! This version performs this operation only for the given component 00789 //! in each FArrayBox. 00790 FArrayBox& axby(const FArrayBox& a_X, const FArrayBox& a_Y, 00791 Real a_A, Real a_B, 00792 int a_destComp, int a_xComp, int a_yComp); 00793 00794 00795 00796 FArrayBox(FArrayBox&& a_in)=default; 00797 FArrayBox& operator=(FArrayBox&& a_in)=default; 00798 protected: 00799 virtual void performCopy(const BaseFab<Real>& a_src, 00800 const Box& a_srcbox, 00801 int a_srccomp, 00802 const Box& a_destbox, 00803 int a_destcomp, 00804 int a_numcomp); 00805 00806 00807 private: 00808 // 00809 // These are disallowed. 00810 // 00811 //FArrayBox (const FArrayBox&); 00812 //FArrayBox& operator = (const FArrayBox&); 00813 }; 00814 00815 #include "NamespaceFooter.H" 00816 #endif