00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _FARRAYBOX_H_
00012 #define _FARRAYBOX_H_
00013
00014 #ifndef WRAPPER
00015 #include <iostream>
00016
00017
00018 #include "Box.H"
00019 #include "BaseFab.H"
00020 #endif
00021
00022 #include "REAL.H"
00023 #include "SPACE.H"
00024 #include "NamespaceHeader.H"
00025
00027
00044 class FArrayBox: public BaseFab<Real>
00045 {
00046 public:
00047
00049
00052 FArrayBox ();
00053
00055
00060 FArrayBox(const Box& a_box,
00061 int a_ncomp,
00062 Real* a_alias = NULL);
00063
00065
00068 FArrayBox(const Interval& a_comps,
00069 FArrayBox& a_original)
00070 :
00071 BaseFab<Real>(a_comps, a_original)
00072 {}
00073
00075
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
00088
00091 virtual ~FArrayBox ();
00092
00094
00107 virtual void define(const Interval& a_comps,
00108 FArrayBox& a_original)
00109 {
00110 BaseFab<Real>::define(a_comps, a_original);
00111 }
00112
00114
00118 virtual void define(const Interval& a_comps,
00119 BaseFab<Real>& a_original)
00120 {
00121 BaseFab<Real>::define(a_comps, a_original);
00122 }
00123
00125
00128 explicit FArrayBox(std::istream& a_is);
00129
00131
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
00145
00153 virtual Real norm(int a_p = 2,
00154 int a_comp = 0,
00155 int a_numcomp = 1) const;
00156
00158
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
00168
00172 Real dotProduct(const FArrayBox& a_fab2) const;
00173
00175
00179 Real dotProduct(const FArrayBox& a_fab2, const Box& a_box) const;
00180
00182
00185 Real min(int a_comp = 0) const;
00186
00188
00193 Real min(const Box& a_subbox,
00194 int a_comp = 0) const;
00195
00197
00200 Real max(int a_comp = 0) const;
00201
00203
00208 Real max(const Box& a_subbox,
00209 int a_comp = 0) const;
00210
00212
00215 IntVect minIndex(int a_comp = 0) const;
00216
00218
00222 IntVect minIndex(const Box& a_subbox,
00223 int a_comp = 0) const;
00224
00226
00229 IntVect maxIndex(int a_comp = 0) const;
00230
00232
00236 IntVect maxIndex(const Box& a_subbox,
00237 int a_comp = 0) const;
00238
00240
00245 int maskLT(BaseFab<int>& a_mask,
00246 Real a_val,
00247 int a_comp = 0) const;
00248
00250
00256 int maskLE(BaseFab<int>& a_mask,
00257 Real a_val,
00258 int a_comp = 0) const;
00260
00266 int maskEQ(BaseFab<int>& a_mask,
00267 Real a_val,
00268 int a_comp = 0) const;
00270
00275 int maskGT(BaseFab<int>& a_mask,
00276 Real a_val,
00277 int a_comp = 0) const;
00278
00280
00285 int maskGE(BaseFab<int>& a_mask,
00286 Real a_val,
00287 int a_comp = 0) const;
00288
00290
00293 void abs();
00294
00296
00300 void abs(int a_comp,
00301 int a_numcomp = 1);
00302
00304
00308 void abs (const Box& a_subbox,
00309 int a_comp = 0,
00310 int a_numcomp = 1);
00311
00313
00316 Real sum(int a_comp,
00317 int a_numcomp = 1) const;
00318
00320
00323 Real sum(const Box& a_subbox,
00324 int a_comp,
00325 int a_numcomp = 1) const;
00326
00328
00331 FArrayBox& invert(Real a_r);
00332
00334
00338 FArrayBox& invert(Real a_r,
00339 int a_comp,
00340 int a_numcomp = 1);
00341
00343
00347 FArrayBox& invert(Real a_r,
00348 const Box& a_subbox,
00349 int a_comp = 0,
00350 int a_numcomp = 1);
00351
00353
00357 FArrayBox& negate(const Box& a_subbox,
00358 int a_comp = 0,
00359 int a_numcomp = 1);
00360
00362
00366 FArrayBox& negate(int a_comp,
00367 int a_numcomp = 1);
00368
00370
00374 FArrayBox& negate();
00375
00377
00381 FArrayBox& plus(Real a_r,
00382 const Box& a_subbox,
00383 int a_comp = 0,
00384 int a_numcomp = 1);
00385
00387
00391 FArrayBox& plus(Real a_r,
00392 int a_comp,
00393 int a_numcomp = 1);
00394
00396
00399 FArrayBox& operator += (Real a_r);
00400
00402
00407 FArrayBox& operator += (const FArrayBox& a_x);
00408
00410
00413 FArrayBox& plus(Real a_r);
00414
00415 FArrayBox& plus_real(Real a_r)
00416 {
00417 return this->plus(a_r);
00418 }
00419
00421
00427 FArrayBox& plus(const FArrayBox& a_x);
00428
00430
00435 FArrayBox& plus(const FArrayBox& a_src,
00436 const Real& a_scale);
00437
00439
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
00451
00457 FArrayBox& plus(const FArrayBox& a_src,
00458 int a_srccomp,
00459 int a_destcomp,
00460 int a_numcomp = 1);
00461
00463
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
00477
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
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
00505
00509 FArrayBox& operator -= (Real a_r);
00510
00512
00517 FArrayBox& operator -= (const FArrayBox& a_x);
00518
00520
00525 FArrayBox& minus(const FArrayBox& a_x);
00526
00534 FArrayBox& minus(const FArrayBox& a_src,
00535 int a_srccomp,
00536 int a_destcomp,
00537 int a_numcomp = 1);
00538
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
00553
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
00572
00575 FArrayBox& operator *= (Real a_r);
00576
00578
00581 FArrayBox& mult(Real a_r);
00582
00584
00588 FArrayBox& mult(Real a_r,
00589 int a_comp,
00590 int a_numcomp = 1);
00591
00593
00597 FArrayBox& mult(Real a_r,
00598 const Box& a_subbox,
00599 int a_comp = 0,
00600 int a_numcomp = 1);
00601
00603
00608 FArrayBox& operator *= (const FArrayBox& a_x);
00609
00611
00616 FArrayBox& mult(const FArrayBox& a_x);
00617
00619
00626 FArrayBox& mult(const FArrayBox& a_src,
00627 int a_srccomp,
00628 int a_destcomp,
00629 int a_numcomp = 1);
00630
00632
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
00646
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
00665
00668 FArrayBox& operator /= (Real a_r);
00669
00671
00674 FArrayBox& divide(Real a_r);
00675
00677
00681 FArrayBox& divide(Real a_r,
00682 int a_comp,
00683 int a_numcomp = 1);
00684
00686
00690 FArrayBox& divide(Real a_r,
00691 const Box& a_subbox,
00692 int a_comp = 0,
00693 int a_numcomp = 1);
00694
00696
00701 FArrayBox& operator /= (const FArrayBox& a_x);
00702
00704
00709 FArrayBox& divide(const FArrayBox& a_x);
00710
00712
00718 FArrayBox& divide(const FArrayBox& a_src,
00719 int a_srccomp,
00720 int a_destcomp,
00721 int a_numcomp = 1);
00722
00724
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
00738
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
00756 Real get(const IntVect& a_iv,
00757 int a_comp) const
00758 {
00759 return this->operator()(a_iv, a_comp);
00760 }
00761
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
00771 protected:
00772 virtual void performCopy(const BaseFab<Real>& a_src,
00773 const Box& a_srcbox,
00774 int a_srccomp,
00775 const Box& a_destbox,
00776 int a_destcomp,
00777 int a_numcomp);
00778
00779
00780 private:
00781
00782
00783
00784 FArrayBox (const FArrayBox&);
00785 FArrayBox& operator = (const FArrayBox&);
00786 };
00787
00788 #include "NamespaceFooter.H"
00789 #endif