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