00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _NODEFARRAYBOX_H_
00018 #define _NODEFARRAYBOX_H_
00019
00020 #include "FArrayBox.H"
00021 #include "NamespaceHeader.H"
00022
00024
00087 class NodeFArrayBox
00088 {
00089
00090 public:
00091
00096
00098
00100 NodeFArrayBox();
00101
00103
00106 NodeFArrayBox(const Box& a_bx, int a_nComp, Real* a_alias = NULL);
00107
00109
00111 NodeFArrayBox(const Interval& a_comps, NodeFArrayBox& a_original);
00112
00114
00116 ~NodeFArrayBox();
00117
00119
00123 void define(const Box& a_bx, int a_nComp=1);
00124
00130 void resize(const Box& a_bx, int a_nComp=1, Real* a_alias=NULL);
00131
00138
00140
00142 const Box& box() const;
00143
00145
00148 FArrayBox& getFab();
00149
00151
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
00172
00174
00195 void copy(const NodeFArrayBox& a_src);
00196
00198
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
00223
00225
00232 int size(const Box& a_R, const Interval& a_comps) const;
00233
00235
00244 void linearOut(void* a_buf, const Box& a_R, const Interval& a_comps) const;
00245
00247 void linearIn(void* a_buf, const Box& a_R, const Interval& a_comps);
00248
00249
00251 void linearOut(void* a_buf) const;
00253 void linearIn(const void* const a_buf);
00255 int linearSize(void) const;
00256
00258 static int preAllocatable() {return 0;}
00259
00263
00264
00268 void setVal(Real a_x);
00269
00275 void setVal(Real a_x,
00276 const Box& a_bx,
00277 int a_nstart,
00278 int a_numcomp);
00279
00281
00289 Real norm(const Box& a_subbox,
00290 int a_p = 2,
00291 int a_comp = 0,
00292 int a_numcomp = 1) const
00293 {
00294 return m_fab.norm(a_subbox, a_p, a_comp, a_numcomp);
00295 }
00296
00298
00306 Real norm(int a_p = 2,
00307 int a_comp = 0,
00308 int a_numcomp = 1) const
00309 {
00310 return m_fab.norm(a_p, a_comp, a_numcomp);
00311 }
00312
00313
00315
00319 Real sumPow(const Box& a_subbox,
00320 int a_p = 2,
00321 int a_comp = 0,
00322 int a_numcomp = 1) const
00323
00324 {
00325 return m_fab.sumPow(a_subbox, a_p, a_comp, a_numcomp);
00326 }
00327
00328
00330
00333 Real min(int a_comp = 0) const
00334 {
00335 return m_fab.min(a_comp);
00336 }
00337
00339
00344 Real min(const Box& a_subbox,
00345 int a_comp = 0) const
00346 {
00347 return m_fab.min(a_subbox, a_comp);
00348 }
00349
00351
00354 Real max(int a_comp = 0) const
00355 {
00356 return m_fab.max(a_comp);
00357 }
00358
00360
00365 Real max(const Box& a_subbox,
00366 int a_comp = 0) const
00367
00368 {
00369 return m_fab.max(a_subbox, a_comp);
00370 }
00371
00373
00376 IntVect minIndex(int a_comp = 0) const
00377 {
00378 return m_fab.minIndex(a_comp);
00379 }
00380
00382
00386 IntVect minIndex(const Box& a_subbox,
00387 int a_comp = 0) const
00388 {
00389 return m_fab.minIndex(a_subbox, a_comp);
00390 }
00391
00393
00396 IntVect maxIndex(int a_comp = 0) const
00397 {
00398 return m_fab.maxIndex(a_comp);
00399 }
00400
00402
00406 IntVect maxIndex(const Box& a_subbox,
00407 int a_comp = 0) const
00408 {
00409 return m_fab.maxIndex(a_subbox, a_comp);
00410 }
00411
00413
00418 int maskLT(BaseFab<int>& a_mask,
00419 Real a_val,
00420 int a_comp = 0) const
00421 {
00422 return m_fab.maskLT(a_mask, a_val, a_comp);
00423 }
00424
00425
00427
00433 int maskLE(BaseFab<int>& a_mask,
00434 Real a_val,
00435 int a_comp = 0) const
00436 {
00437 return m_fab.maskLE(a_mask, a_val, a_comp);
00438 }
00439
00441
00447 int maskEQ(BaseFab<int>& a_mask,
00448 Real a_val,
00449 int a_comp = 0) const
00450 {
00451 return m_fab.maskEQ(a_mask, a_val, a_comp);
00452 }
00453
00455
00460 int maskGT(BaseFab<int>& a_mask,
00461 Real a_val,
00462 int a_comp = 0) const
00463 {
00464 return m_fab.maskGT(a_mask, a_val, a_comp);
00465 }
00466
00467
00469
00474 int maskGE(BaseFab<int>& a_mask,
00475 Real a_val,
00476 int a_comp = 0) const
00477 {
00478 return m_fab.maskGE(a_mask, a_val, a_comp);
00479 }
00480
00482
00485 void abs()
00486 {
00487 m_fab.abs();
00488 }
00489
00491
00493 int nComp() const
00494 {
00495 return m_fab.nComp();
00496 }
00497
00499
00503 void abs(int a_comp,
00504 int a_numcomp = 1)
00505 {
00506 m_fab.abs(a_comp, a_numcomp);
00507 }
00508
00510
00514 void abs (const Box& a_subbox,
00515 int a_comp = 0,
00516 int a_numcomp = 1)
00517 {
00518 m_fab.abs(a_subbox, a_comp, a_numcomp);
00519 }
00520
00521
00523
00526 Real sum(int a_comp,
00527 int a_numcomp = 1) const
00528 {
00529 return m_fab.sum(a_comp, a_numcomp);
00530 }
00531
00533
00536 Real sum(const Box& a_subbox,
00537 int a_comp,
00538 int a_numcomp = 1) const
00539 {
00540 return m_fab.sum(a_subbox, a_comp, a_numcomp);
00541 }
00542
00543
00545
00548 NodeFArrayBox& invert(Real a_r)
00549 {
00550 m_fab.invert(a_r);
00551 return *this;
00552 }
00553
00554
00556
00560 NodeFArrayBox& invert(Real a_r,
00561 int a_comp,
00562 int a_numcomp = 1)
00563 {
00564 m_fab.invert(a_r, a_comp, a_numcomp);
00565 return *this;
00566 }
00567
00569
00573 NodeFArrayBox& invert(Real a_r,
00574 const Box& a_subbox,
00575 int a_comp = 0,
00576 int a_numcomp = 1)
00577 {
00578 m_fab.invert(a_r, a_subbox, a_comp, a_numcomp);
00579 return *this;
00580 }
00581
00583
00587 NodeFArrayBox& negate(const Box& a_subbox,
00588 int a_comp = 0,
00589 int a_numcomp = 1)
00590 {
00591 m_fab.negate(a_subbox, a_comp, a_numcomp);
00592 return *this;
00593 }
00594
00596
00600 NodeFArrayBox& negate(int a_comp,
00601 int a_numcomp = 1)
00602 {
00603 m_fab.negate(a_comp, a_numcomp);
00604 return *this;
00605 }
00606
00608
00612 NodeFArrayBox& negate()
00613 {
00614 m_fab.negate();
00615 return *this;
00616 }
00617
00618
00620
00624 NodeFArrayBox& plus(Real a_r,
00625 const Box& a_subbox,
00626 int a_comp = 0,
00627 int a_numcomp = 1)
00628 {
00629 m_fab.plus(a_r, a_subbox, a_comp, a_numcomp);
00630 return *this;
00631 }
00632
00634
00638 NodeFArrayBox& plus(Real a_r,
00639 int a_comp,
00640 int a_numcomp = 1)
00641 {
00642 m_fab.plus(a_r, a_comp, a_numcomp);
00643 return *this;
00644 }
00645
00647 Real& operator() (const IntVect& a_p,
00648 int N = 0)
00649 {
00650 return m_fab(a_p,N);
00651 }
00652
00654 const Real& operator() (const IntVect& a_p,
00655 int N = 0) const
00656 {
00657 return m_fab(a_p,N);
00658 }
00660
00663 NodeFArrayBox& operator += (Real a_r)
00664 {
00665 m_fab += a_r;
00666 return *this;
00667 }
00668
00670
00675 NodeFArrayBox& operator += (const NodeFArrayBox& a_x)
00676 {
00677 m_fab += a_x.m_fab;
00678 return *this;
00679 }
00680
00681
00683
00686 NodeFArrayBox& plus(Real a_r)
00687 {
00688 m_fab += a_r;
00689 return *this;
00690 }
00691
00692 NodeFArrayBox& plus_real(Real a_r)
00693 {
00694 return this->plus(a_r);
00695 }
00696
00698
00704 NodeFArrayBox& plus(const NodeFArrayBox& a_x)
00705 {
00706 m_fab += a_x.m_fab;
00707 return *this;
00708 }
00709
00711
00716 NodeFArrayBox& plus(const NodeFArrayBox& a_src,
00717 const Real& a_scale)
00718 {
00719 m_fab.plus(a_src.m_fab, a_scale);
00720 return *this;
00721 }
00722
00724
00729 NodeFArrayBox& plus(const NodeFArrayBox& a_src,
00730 const Real& a_scale,
00731 int a_srccomp,
00732 int a_destcomp,
00733 int a_numcomp = 1)
00734 {
00735 m_fab.plus(a_src.m_fab, a_scale, a_srccomp, a_destcomp, a_numcomp);
00736 return *this;
00737 }
00738
00740
00746 NodeFArrayBox& plus(const NodeFArrayBox& a_src,
00747 int a_srccomp,
00748 int a_destcomp,
00749 int a_numcomp = 1)
00750 {
00751 m_fab.plus(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp);
00752 return *this;
00753 }
00754
00756
00763 NodeFArrayBox& plus(const NodeFArrayBox& a_src,
00764 const Box& a_subbox,
00765 int a_srccomp,
00766 int a_destcomp,
00767 int a_numcomp = 1)
00768 {
00769 m_fab.plus(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp);
00770 return *this;
00771 }
00772
00773
00775
00786 NodeFArrayBox& plus(const NodeFArrayBox& a_src,
00787 const Box& a_srcbox,
00788 const Box& a_destbox,
00789 int a_srccomp,
00790 int a_destcomp,
00791 int a_numcomp = 1)
00792 {
00793 m_fab.plus(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp);
00794 return *this;
00795 }
00796
00797
00799 NodeFArrayBox& plus(const NodeFArrayBox& a_src,
00800 const Box& a_srcbox,
00801 const Box& a_destbox,
00802 const Real& a_scale,
00803 int a_srccomp,
00804 int a_destcomp,
00805 int a_numcomp = 1)
00806 {
00807 m_fab.plus(a_src.m_fab, a_srcbox, a_destbox, a_scale, a_srccomp, a_destcomp, a_numcomp);
00808 return *this;
00809 }
00810
00812
00816 NodeFArrayBox& operator -= (Real a_r)
00817 {
00818 m_fab -= a_r;
00819 return *this;
00820 }
00821
00823
00828 NodeFArrayBox& operator -= (const NodeFArrayBox& a_x)
00829 {
00830 m_fab -= a_x.m_fab;
00831 return *this;
00832 }
00833
00835
00840 NodeFArrayBox& minus(const NodeFArrayBox& a_x)
00841 {
00842 m_fab -= a_x.m_fab;
00843 return *this;
00844 }
00845
00853 NodeFArrayBox& minus(const NodeFArrayBox& a_src,
00854 int a_srccomp,
00855 int a_destcomp,
00856 int a_numcomp = 1)
00857 {
00858 m_fab.minus(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp);
00859 return *this;
00860 }
00861
00869 NodeFArrayBox& minus(const NodeFArrayBox& a_src,
00870 const Box& a_subbox,
00871 int a_srccomp,
00872 int a_destcomp,
00873 int a_numcomp = 1)
00874 {
00875 m_fab.minus(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp);
00876 return *this;
00877 }
00878
00879
00881
00892 NodeFArrayBox& minus(const NodeFArrayBox& a_src,
00893 const Box& a_srcbox,
00894 const Box& a_destbox,
00895 int a_srccomp,
00896 int a_destcomp,
00897 int a_numcomp = 1)
00898 {
00899 m_fab.minus(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp);
00900 return *this;
00901 }
00902
00903
00905
00908 NodeFArrayBox& operator *= (Real a_r)
00909 {
00910 m_fab *= a_r;
00911 return *this;
00912 }
00913
00915
00918 NodeFArrayBox& mult(Real a_r)
00919 {
00920 m_fab *= a_r;
00921 return *this;
00922 }
00923
00925
00929 NodeFArrayBox& mult(Real a_r,
00930 int a_comp,
00931 int a_numcomp = 1)
00932 {
00933 m_fab.mult(a_r, a_comp, a_numcomp);
00934 return *this;
00935 }
00936
00937
00939
00943 NodeFArrayBox& mult(Real a_r,
00944 const Box& a_subbox,
00945 int a_comp = 0,
00946 int a_numcomp = 1)
00947 {
00948 m_fab.mult(a_r, a_subbox, a_comp, a_numcomp);
00949 return *this;
00950 }
00951
00952
00954
00959 NodeFArrayBox& operator *= (const NodeFArrayBox& a_x)
00960 {
00961 m_fab *= a_x.m_fab;
00962 return *this;
00963 }
00964
00966
00971 NodeFArrayBox& mult(const NodeFArrayBox& a_x)
00972 {
00973 m_fab *= a_x.m_fab;
00974 return *this;
00975 }
00976
00978
00985 NodeFArrayBox& mult(const NodeFArrayBox& a_src,
00986 int a_srccomp,
00987 int a_destcomp,
00988 int a_numcomp = 1)
00989 {
00990 m_fab.mult(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp);
00991 return *this;
00992 }
00993
00994
00996
01003 NodeFArrayBox& mult(const NodeFArrayBox& a_src,
01004 const Box& a_subbox,
01005 int a_srccomp,
01006 int a_destcomp,
01007 int a_numcomp = 1)
01008 {
01009 m_fab.mult(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp);
01010 return *this;
01011 }
01012
01014
01025 NodeFArrayBox& mult(const NodeFArrayBox& a_src,
01026 const Box& a_srcbox,
01027 const Box& a_destbox,
01028 int a_srccomp,
01029 int a_destcomp,
01030 int a_numcomp = 1)
01031 {
01032 m_fab.mult(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp);
01033 return *this;
01034 }
01035
01036
01038
01041 NodeFArrayBox& operator /= (Real a_r)
01042 {
01043 m_fab /= a_r;
01044 return *this;
01045 }
01046
01048
01051 NodeFArrayBox& divide(Real a_r)
01052 {
01053 m_fab /= a_r;
01054 return *this;
01055 }
01056
01057
01059
01063 NodeFArrayBox& divide(Real a_r,
01064 int a_comp,
01065 int a_numcomp = 1)
01066 {
01067 m_fab.divide(a_r, a_comp, a_numcomp);
01068 return *this;
01069 }
01070
01071
01073
01077 NodeFArrayBox& divide(Real a_r,
01078 const Box& a_subbox,
01079 int a_comp = 0,
01080 int a_numcomp = 1)
01081 {
01082 m_fab.divide(a_r, a_subbox, a_comp, a_numcomp);
01083 return *this;
01084 }
01085
01086
01088
01093 NodeFArrayBox& operator /= (const NodeFArrayBox& a_x)
01094 {
01095 m_fab /= a_x.m_fab;
01096 return *this;
01097 }
01098
01100
01105 NodeFArrayBox& divide(const NodeFArrayBox& a_x)
01106 {
01107 m_fab /= a_x.m_fab;
01108 return *this;
01109 }
01110
01112
01118 NodeFArrayBox& divide(const NodeFArrayBox& a_src,
01119 int a_srccomp,
01120 int a_destcomp,
01121 int a_numcomp = 1)
01122 {
01123 m_fab.divide(a_src.m_fab, a_srccomp, a_destcomp, a_numcomp);
01124 return *this;
01125 }
01126
01127
01129
01136 NodeFArrayBox& divide(const NodeFArrayBox& a_src,
01137 const Box& a_subbox,
01138 int a_srccomp,
01139 int a_destcomp,
01140 int a_numcomp = 1)
01141 {
01142 m_fab.divide(a_src.m_fab, a_subbox, a_srccomp, a_destcomp, a_numcomp);
01143 return *this;
01144 }
01145
01146
01148
01158 NodeFArrayBox& divide(const NodeFArrayBox& a_src,
01159 const Box& a_srcbox,
01160 const Box& a_destbox,
01161 int a_srccomp,
01162 int a_destcomp,
01163 int a_numcomp = 1)
01164 {
01165 m_fab.divide(a_src.m_fab, a_srcbox, a_destbox, a_srccomp, a_destcomp, a_numcomp);
01166 return *this;
01167 }
01168
01169
01170
01171 protected:
01172
01173
01174 Box m_box;
01175
01176
01177 FArrayBox m_fab;
01178
01179 private:
01181
01182 NodeFArrayBox (const NodeFArrayBox&);
01183 NodeFArrayBox& operator = (const NodeFArrayBox&);
01184
01185 };
01186
01187 #include "NamespaceFooter.H"
01188 #endif