00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef _FARRAYBOX_H_
00053 #define _FARRAYBOX_H_
00054
00055 #ifndef WRAPPER
00056 #include <iostream>
00057
00058
00059 #include "Box.H"
00060 #include "BaseFab.H"
00061 #endif
00062
00063 #include "REAL.H"
00064 #include "SPACE.H"
00065
00067
00084 class FArrayBox: public BaseFab<Real>
00085 {
00086 public:
00087
00089
00092 FArrayBox ();
00093
00095
00100 FArrayBox(const Box& a_box,
00101 int a_ncomp,
00102 Real* a_alias = NULL);
00103
00105
00108 FArrayBox(const Interval& a_comps,
00109 FArrayBox& a_original)
00110 :
00111 BaseFab<Real>(a_comps, a_original)
00112 {}
00113
00115
00120 virtual void define(const Box& a_box,
00121 int a_ncomp,
00122 Real* a_alias = NULL)
00123 {
00124 resize(a_box, a_ncomp, a_alias);
00125 }
00126
00128
00131 virtual ~FArrayBox ();
00132
00134
00147 virtual void define(const Interval& a_comps,
00148 FArrayBox& a_original)
00149 {
00150 BaseFab<Real>::define(a_comps, a_original);
00151 }
00152
00154
00158 virtual void define(const Interval& a_comps,
00159 BaseFab<Real>& a_original)
00160 {
00161 BaseFab<Real>::define(a_comps, a_original);
00162 }
00163
00165
00168 explicit FArrayBox(std::istream& a_is);
00169
00171
00179 virtual Real norm(const Box& a_subbox,
00180 int a_p = 2,
00181 int a_comp = 0,
00182 int a_numcomp = 1) const;
00183
00185
00193 virtual Real norm(int a_p = 2,
00194 int a_comp = 0,
00195 int a_numcomp = 1) const;
00196
00198
00202 virtual Real sumPow(const Box& a_subbox,
00203 int a_p = 2,
00204 int a_comp = 0,
00205 int a_numcomp = 1) const;
00206
00208
00212 Real dotProduct(const FArrayBox& a_fab2) const;
00213
00215
00218 Real min(int a_comp = 0) const;
00219
00221
00226 Real min(const Box& a_subbox,
00227 int a_comp = 0) const;
00228
00230
00233 Real max(int a_comp = 0) const;
00234
00236
00241 Real max(const Box& a_subbox,
00242 int a_comp = 0) const;
00243
00245
00248 IntVect minIndex(int a_comp = 0) const;
00249
00251
00255 IntVect minIndex(const Box& a_subbox,
00256 int a_comp = 0) const;
00257
00259
00262 IntVect maxIndex(int a_comp = 0) const;
00263
00265
00269 IntVect maxIndex(const Box& a_subbox,
00270 int a_comp = 0) const;
00271
00273
00278 int maskLT(BaseFab<int>& a_mask,
00279 Real a_val,
00280 int a_comp = 0) const;
00281
00283
00289 int maskLE(BaseFab<int>& a_mask,
00290 Real a_val,
00291 int a_comp = 0) const;
00293
00299 int maskEQ(BaseFab<int>& a_mask,
00300 Real a_val,
00301 int a_comp = 0) const;
00303
00308 int maskGT(BaseFab<int>& a_mask,
00309 Real a_val,
00310 int a_comp = 0) const;
00311
00313
00318 int maskGE(BaseFab<int>& a_mask,
00319 Real a_val,
00320 int a_comp = 0) const;
00321
00323
00326 void abs();
00327
00329
00333 void abs(int a_comp,
00334 int a_numcomp = 1);
00335
00337
00341 void abs (const Box& a_subbox,
00342 int a_comp = 0,
00343 int a_numcomp = 1);
00344
00346
00349 Real sum(int a_comp,
00350 int a_numcomp = 1) const;
00351
00353
00356 Real sum(const Box& a_subbox,
00357 int a_comp,
00358 int a_numcomp = 1) const;
00359
00361
00364 FArrayBox& invert(Real a_r);
00365
00367
00371 FArrayBox& invert(Real a_r,
00372 int a_comp,
00373 int a_numcomp = 1);
00374
00376
00380 FArrayBox& invert(Real a_r,
00381 const Box& a_subbox,
00382 int a_comp = 0,
00383 int a_numcomp = 1);
00384
00386
00390 FArrayBox& negate(const Box& a_subbox,
00391 int a_comp = 0,
00392 int a_numcomp = 1);
00393
00395
00399 FArrayBox& negate(int a_comp,
00400 int a_numcomp = 1);
00401
00403
00407 FArrayBox& negate();
00408
00410
00414 FArrayBox& plus(Real a_r,
00415 const Box& a_subbox,
00416 int a_comp = 0,
00417 int a_numcomp = 1);
00418
00420
00424 FArrayBox& plus(Real a_r,
00425 int a_comp,
00426 int a_numcomp = 1);
00427
00429
00432 FArrayBox& operator += (Real a_r);
00433
00435
00440 FArrayBox& operator += (const FArrayBox& a_x);
00441
00443
00446 FArrayBox& plus(Real a_r);
00447
00448 FArrayBox& plus_real(Real a_r)
00449 {
00450 return this->plus(a_r);
00451 }
00452
00454
00460 FArrayBox& plus(const FArrayBox& a_x);
00461
00463
00468 FArrayBox& plus(const FArrayBox& a_src,
00469 const Real& a_scale);
00470
00472
00477 FArrayBox& plus(const FArrayBox& a_src,
00478 const Real& a_scale,
00479 int a_srccomp,
00480 int a_destcomp,
00481 int a_numcomp = 1);
00482
00484
00490 FArrayBox& plus(const FArrayBox& a_src,
00491 int a_srccomp,
00492 int a_destcomp,
00493 int a_numcomp = 1);
00494
00496
00503 FArrayBox& plus(const FArrayBox& a_src,
00504 const Box& a_subbox,
00505 int a_srccomp,
00506 int a_destcomp,
00507 int a_numcomp = 1);
00508
00510
00521 FArrayBox& plus(const FArrayBox& a_src,
00522 const Box& a_srcbox,
00523 const Box& a_destbox,
00524 int a_srccomp,
00525 int a_destcomp,
00526 int a_numcomp = 1);
00527
00529 FArrayBox& plus(const FArrayBox& a_src,
00530 const Box& a_srcbox,
00531 const Box& a_destbox,
00532 const Real& a_scale,
00533 int a_srccomp,
00534 int a_destcomp,
00535 int a_numcomp = 1);
00536
00538
00542 FArrayBox& operator -= (Real a_r);
00543
00545
00550 FArrayBox& operator -= (const FArrayBox& a_x);
00551
00553
00558 FArrayBox& minus(const FArrayBox& a_x);
00559
00567 FArrayBox& minus(const FArrayBox& a_src,
00568 int a_srccomp,
00569 int a_destcomp,
00570 int a_numcomp = 1);
00571
00579 FArrayBox& minus(const FArrayBox& a_src,
00580 const Box& a_subbox,
00581 int a_srccomp,
00582 int a_destcomp,
00583 int a_numcomp = 1);
00584
00586
00597 FArrayBox& minus(const FArrayBox& a_src,
00598 const Box& a_srcbox,
00599 const Box& a_destbox,
00600 int a_srccomp,
00601 int a_destcomp,
00602 int a_numcomp = 1);
00603
00605
00608 FArrayBox& operator *= (Real a_r);
00609
00611
00614 FArrayBox& mult(Real a_r);
00615
00617
00621 FArrayBox& mult(Real a_r,
00622 int a_comp,
00623 int a_numcomp = 1);
00624
00626
00630 FArrayBox& mult(Real a_r,
00631 const Box& a_subbox,
00632 int a_comp = 0,
00633 int a_numcomp = 1);
00634
00636
00641 FArrayBox& operator *= (const FArrayBox& a_x);
00642
00644
00649 FArrayBox& mult(const FArrayBox& a_x);
00650
00652
00659 FArrayBox& mult(const FArrayBox& a_src,
00660 int a_srccomp,
00661 int a_destcomp,
00662 int a_numcomp = 1);
00663
00665
00672 FArrayBox& mult(const FArrayBox& a_src,
00673 const Box& a_subbox,
00674 int a_srccomp,
00675 int a_destcomp,
00676 int a_numcomp = 1);
00677
00679
00690 FArrayBox& mult(const FArrayBox& a_src,
00691 const Box& a_srcbox,
00692 const Box& a_destbox,
00693 int a_srccomp,
00694 int a_destcomp,
00695 int a_numcomp = 1);
00696
00698
00701 FArrayBox& operator /= (Real a_r);
00702
00704
00707 FArrayBox& divide(Real a_r);
00708
00710
00714 FArrayBox& divide(Real a_r,
00715 int a_comp,
00716 int a_numcomp = 1);
00717
00719
00723 FArrayBox& divide(Real a_r,
00724 const Box& a_subbox,
00725 int a_comp = 0,
00726 int a_numcomp = 1);
00727
00729
00734 FArrayBox& operator /= (const FArrayBox& a_x);
00735
00737
00742 FArrayBox& divide(const FArrayBox& a_x);
00743
00745
00751 FArrayBox& divide(const FArrayBox& a_src,
00752 int a_srccomp,
00753 int a_destcomp,
00754 int a_numcomp = 1);
00755
00757
00764 FArrayBox& divide(const FArrayBox& a_src,
00765 const Box& a_subbox,
00766 int a_srccomp,
00767 int a_destcomp,
00768 int a_numcomp = 1);
00769
00771
00781 FArrayBox& divide(const FArrayBox& a_src,
00782 const Box& a_srcbox,
00783 const Box& a_destbox,
00784 int a_srccomp,
00785 int a_destcomp,
00786 int a_numcomp = 1);
00787
00789 Real get(const IntVect& a_iv,
00790 int a_comp) const
00791 {
00792 return this->operator()(a_iv, a_comp);
00793 }
00794
00796 void set(const IntVect& a_iv,
00797 int a_comp,
00798 Real a_val)
00799 {
00800 this->operator()(a_iv, a_comp) = a_val;
00801 }
00802
00803
00804 protected:
00805 virtual void performCopy(const BaseFab<Real>& a_src,
00806 const Box& a_srcbox,
00807 int a_srccomp,
00808 const Box& a_destbox,
00809 int a_destcomp,
00810 int a_numcomp);
00811
00812
00813 private:
00814
00815
00816
00817 FArrayBox (const FArrayBox&);
00818 FArrayBox& operator = (const FArrayBox&);
00819 };
00820
00821 #endif