Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

FArrayBox.H

Go to the documentation of this file.
00001 /*   _______              __
00002     / ___/ /  ___  __ _  / /  ___
00003    / /__/ _ \/ _ \/  V \/ _ \/ _ \
00004    \___/_//_/\___/_/_/_/_.__/\___/
00005 */
00006 // CHOMBO Copyright (c) 2000-2004, The Regents of the University of
00007 // California, through Lawrence Berkeley National Laboratory (subject to
00008 // receipt of any required approvals from U.S. Dept. of Energy).  All
00009 // rights reserved.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are met:
00013 //
00014 // (1) Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 // (2) Redistributions in binary form must reproduce the above copyright
00017 // notice, this list of conditions and the following disclaimer in the
00018 // documentation and/or other materials provided with the distribution.
00019 // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S.
00020 // Dept. of Energy nor the names of its contributors may be used to endorse
00021 // or promote products derived from this software without specific prior
00022 // written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035 //
00036 // You are under no obligation whatsoever to provide any bug fixes,
00037 // patches, or upgrades to the features, functionality or performance of
00038 // the source code ("Enhancements") to anyone; however, if you choose to
00039 // make your Enhancements available either publicly, or directly to
00040 // Lawrence Berkeley National Laboratory, without imposing a separate
00041 // written license agreement for such Enhancements, then you hereby grant
00042 // the following license: a non-exclusive, royalty-free perpetual license
00043 // to install, use, modify, prepare derivative works, incorporate into
00044 // other computer software, distribute, and sublicense such Enhancements or
00045 // derivative works thereof, in binary and source code form.
00046 //
00047 // TRADEMARKS. Product and company names mentioned herein may be the
00048 // trademarks of their respective owners.  Any rights not expressly granted
00049 // herein are reserved.
00050 //
00051 
00052 #ifndef _FARRAYBOX_H_
00053 #define _FARRAYBOX_H_
00054 
00055 #ifndef WRAPPER
00056 #include <iostream>
00057 
00058 // #include <Pointers.H>
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   // These are disallowed.
00816   //
00817   FArrayBox (const FArrayBox&);
00818   FArrayBox& operator = (const FArrayBox&);
00819 };
00820 
00821 #endif

Generated on Wed Oct 5 13:52:08 2005 for Chombo&AMRSelfGravity by  doxygen 1.4.1