Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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 
00114   void define(const Box& a_box,
00115               int        a_ncomp,
00116               Real*      a_alias = NULL)
00117   {
00118     resize(a_box, a_ncomp, a_alias);
00119   }
00120 
00122 
00125   virtual ~FArrayBox ();
00126 
00128   void define(const Interval& a_comps,
00129               FArrayBox&      a_original)
00130   {
00131     BaseFab<Real>::define(a_comps, a_original);
00132   }
00133 
00135 
00138   explicit FArrayBox(std::istream& a_is);
00139 
00141 
00149   virtual Real norm(const Box& a_subbox,
00150                     int        a_p = 2,
00151                     int        a_comp = 0,
00152                     int        a_numcomp = 1) const;
00153 
00155 
00163   virtual Real norm(int a_p = 2,
00164                     int a_comp = 0,
00165                     int a_numcomp = 1) const;
00166 
00168 
00172   virtual Real sumPow(const Box& a_subbox,
00173                       int        a_p = 2,
00174                       int        a_comp = 0,
00175                       int        a_numcomp = 1) const;
00176 
00178 
00182   Real dotProduct(const FArrayBox& a_fab2) const;
00183 
00185 
00188   Real min(int a_comp = 0) const;
00189 
00191 
00196   Real min(const Box& a_subbox,
00197            int        a_comp = 0) const;
00198 
00200 
00203   Real max(int a_comp = 0) const;
00204 
00206 
00211   Real max(const Box& a_subbox,
00212            int        a_comp = 0) const;
00213 
00215 
00218   IntVect minIndex(int a_comp = 0) const;
00219 
00221 
00225   IntVect minIndex(const Box& a_subbox,
00226                    int        a_comp = 0) const;
00227 
00229 
00232   IntVect maxIndex(int a_comp = 0) const;
00233 
00235 
00239   IntVect maxIndex(const Box& a_subbox,
00240                    int        a_comp = 0) const;
00241 
00243 
00248   int maskLT(BaseFab<int>& a_mask,
00249              Real          a_val,
00250              int           a_comp = 0) const;
00251 
00253 
00259   int maskLE(BaseFab<int>& a_mask,
00260              Real          a_val,
00261              int           a_comp = 0) const;
00263 
00269   int maskEQ(BaseFab<int>& a_mask,
00270              Real          a_val,
00271              int           a_comp = 0) const;
00273 
00278   int maskGT(BaseFab<int>& a_mask,
00279              Real          a_val,
00280              int           a_comp = 0) const;
00281 
00283 
00288   int maskGE(BaseFab<int>& a_mask,
00289              Real          a_val,
00290              int           a_comp = 0) const;
00291 
00293 
00296   void abs();
00297 
00299 
00303   void abs(int a_comp,
00304            int a_numcomp = 1);
00305 
00307 
00311   void abs (const Box& a_subbox,
00312             int        a_comp = 0,
00313             int        a_numcomp = 1);
00314 
00316 
00319   Real sum(int a_comp,
00320            int a_numcomp = 1) const;
00321 
00323 
00326   Real sum(const Box& a_subbox,
00327            int        a_comp,
00328            int        a_numcomp = 1) const;
00329 
00331 
00334   FArrayBox& invert(Real a_r);
00335 
00337 
00341   FArrayBox& invert(Real a_r,
00342                     int  a_comp,
00343                     int  a_numcomp = 1);
00344 
00346 
00350   FArrayBox& invert(Real       a_r,
00351                     const Box& a_subbox,
00352                     int        a_comp = 0,
00353                     int        a_numcomp = 1);
00354 
00356 
00360   FArrayBox& negate(const Box& a_subbox,
00361                     int        a_comp = 0,
00362                     int        a_numcomp = 1);
00363 
00365 
00369   FArrayBox& negate(int a_comp,
00370                     int a_numcomp = 1);
00371 
00373 
00377   FArrayBox& negate();
00378 
00380 
00384   FArrayBox& plus(Real       a_r,
00385                   const Box& a_subbox,
00386                   int        a_comp = 0,
00387                   int        a_numcomp = 1);
00388 
00390 
00394   FArrayBox& plus(Real a_r,
00395                   int  a_comp,
00396                   int  a_numcomp = 1);
00397 
00399 
00402   FArrayBox& operator += (Real a_r);
00403 
00405 
00410   FArrayBox& operator += (const FArrayBox& a_x);
00411 
00413 
00416   FArrayBox& plus(Real a_r);
00417 
00418   FArrayBox& plus_real(Real a_r)
00419   {
00420     return this->plus(a_r);
00421   }
00422 
00424 
00430   FArrayBox& plus(const FArrayBox& a_x);
00431 
00433 
00438   FArrayBox& plus(const FArrayBox& a_src,
00439                   const Real&      a_scale);
00440 
00442 
00447   FArrayBox& plus(const FArrayBox& a_src,
00448                   const Real&      a_scale,
00449                   int              a_srccomp,
00450                   int              a_destcomp,
00451                   int              a_numcomp = 1);
00452 
00454 
00460   FArrayBox& plus(const FArrayBox& a_src,
00461                   int              a_srccomp,
00462                   int              a_destcomp,
00463                   int              a_numcomp = 1);
00464 
00466 
00473   FArrayBox& plus(const FArrayBox& a_src,
00474                   const Box&       a_subbox,
00475                   int              a_srccomp,
00476                   int              a_destcomp,
00477                   int              a_numcomp = 1);
00478 
00480 
00491   FArrayBox& plus(const FArrayBox& a_src,
00492                   const Box&       a_srcbox,
00493                   const Box&       a_destbox,
00494                   int              a_srccomp,
00495                   int              a_destcomp,
00496                   int              a_numcomp = 1);
00497 
00499   FArrayBox& plus(const FArrayBox& a_src,
00500                   const Box&       a_srcbox,
00501                   const Box&       a_destbox,
00502                   const Real&      a_scale,
00503                   int              a_srccomp,
00504                   int              a_destcomp,
00505                   int              a_numcomp = 1);
00506 
00508 
00512   FArrayBox& operator -= (Real a_r);
00513 
00515 
00520   FArrayBox& operator -= (const FArrayBox& a_x);
00521 
00523 
00528   FArrayBox& minus(const FArrayBox& a_x);
00529 
00537   FArrayBox& minus(const FArrayBox& a_src,
00538                    int              a_srccomp,
00539                    int              a_destcomp,
00540                    int              a_numcomp = 1);
00541 
00549   FArrayBox& minus(const FArrayBox& a_src,
00550                    const Box&       a_subbox,
00551                    int              a_srccomp,
00552                    int              a_destcomp,
00553                    int              a_numcomp = 1);
00554 
00556 
00567   FArrayBox& minus(const FArrayBox& a_src,
00568                    const Box&       a_srcbox,
00569                    const Box&       a_destbox,
00570                    int              a_srccomp,
00571                    int              a_destcomp,
00572                    int              a_numcomp = 1);
00573 
00575 
00578   FArrayBox& operator *= (Real a_r);
00579 
00581 
00584   FArrayBox& mult(Real a_r);
00585 
00587 
00591   FArrayBox& mult(Real a_r,
00592                   int  a_comp,
00593                   int  a_numcomp = 1);
00594 
00596 
00600   FArrayBox& mult(Real       a_r,
00601                   const Box& a_subbox,
00602                   int        a_comp = 0,
00603                   int        a_numcomp = 1);
00604 
00606 
00611   FArrayBox& operator *= (const FArrayBox& a_x);
00612 
00614 
00619   FArrayBox& mult(const FArrayBox& a_x);
00620 
00622 
00629   FArrayBox& mult(const FArrayBox& a_src,
00630                   int              a_srccomp,
00631                   int              a_destcomp,
00632                   int              a_numcomp = 1);
00633 
00635 
00642   FArrayBox& mult(const FArrayBox& a_src,
00643                   const Box&       a_subbox,
00644                   int              a_srccomp,
00645                   int              a_destcomp,
00646                   int              a_numcomp = 1);
00647 
00649 
00660   FArrayBox& mult(const FArrayBox& a_src,
00661                   const Box&       a_srcbox,
00662                   const Box&       a_destbox,
00663                   int              a_srccomp,
00664                   int              a_destcomp,
00665                   int              a_numcomp = 1);
00666 
00668 
00671   FArrayBox& operator /= (Real a_r);
00672 
00674 
00677   FArrayBox& divide(Real a_r);
00678 
00680 
00684   FArrayBox& divide(Real a_r,
00685                     int  a_comp,
00686                     int  a_numcomp = 1);
00687 
00689 
00693   FArrayBox& divide(Real       a_r,
00694                     const Box& a_subbox,
00695                     int        a_comp = 0,
00696                     int        a_numcomp = 1);
00697 
00699 
00704   FArrayBox& operator /= (const FArrayBox& a_x);
00705 
00707 
00712   FArrayBox& divide(const FArrayBox& a_x);
00713 
00715 
00721   FArrayBox& divide(const FArrayBox& a_src,
00722                     int              a_srccomp,
00723                     int              a_destcomp,
00724                     int              a_numcomp = 1);
00725 
00727 
00734   FArrayBox& divide(const FArrayBox& a_src,
00735                     const Box&       a_subbox,
00736                     int              a_srccomp,
00737                     int              a_destcomp,
00738                     int              a_numcomp = 1);
00739 
00741 
00751   FArrayBox& divide(const FArrayBox& a_src,
00752                     const Box&       a_srcbox,
00753                     const Box&       a_destbox,
00754                     int              a_srccomp,
00755                     int              a_destcomp,
00756                     int              a_numcomp = 1);
00757 
00759   Real get(const IntVect& a_iv,
00760            int            a_comp) const
00761   {
00762     return this->operator()(a_iv, a_comp);
00763   }
00764 
00766   void set(const IntVect& a_iv,
00767            int            a_comp,
00768            Real           a_val)
00769   {
00770     this->operator()(a_iv, a_comp) = a_val;
00771   }
00772 
00773 
00774 protected:
00775   virtual void performCopy(const BaseFab<Real>& a_src,
00776                            const Box&           a_srcbox,
00777                            int                  a_srccomp,
00778                            const Box&           a_destbox,
00779                            int                  a_destcomp,
00780                            int                  a_numcomp);
00781 
00782 
00783 private:
00784   //
00785   // These are disallowed.
00786   //
00787   FArrayBox (const FArrayBox&);
00788   FArrayBox& operator = (const FArrayBox&);
00789 };
00790 
00791 #endif

Generated on Wed Jan 19 17:51:24 2005 for Chombo&INSwithParticles by doxygen1.2.16