Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

FluxBox.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 
00007 // FluxBox.H
00008 
00009 //
00010 // This software is copyright (C) by the Lawrence Berkeley
00011 // National Laboratory.  Permission is granted to reproduce
00012 // this software for non-commercial purposes provided that
00013 // this notice is left intact.
00014 // 
00015 // It is acknowledged that the U.S. Government has rights to
00016 // this software under Contract DE-AC03-765F00098 between
00017 // the U.S.  Department of Energy and the University of
00018 // California.
00019 //
00020 // This software is provided as a professional and academic
00021 // contribution for joint exchange. Thus it is experimental,
00022 // is provided ``as is'', with no warranties of any kind
00023 // whatsoever, no support, no promise of updates, or printed
00024 // documentation. By using this software, you acknowledge
00025 // that the Lawrence Berkeley National Laboratory and
00026 // Regents of the University of California shall have no
00027 // liability with respect to the infringement of other
00028 // copyrights by any part of this software.
00029 //
00030 // Dan Martin, Fri, Jan 14, 2000
00031 
00032 #ifndef _FluxBox_H_
00033 #define _FluxBox_H_
00034 
00035 #include "Box.H"
00036 #include "Vector.H"
00037 #include "FArrayBox.H"
00038 
00040 class FluxBox
00043 {
00044 
00045 public:
00047   FluxBox();
00048 
00050   FluxBox(const Box& bx, int n=1);
00051 
00053   ~FluxBox();
00054 
00056   void resize(const Box& bx, int n=1);
00057 
00059   void define(const Box& bx, int n=1);
00060 
00062   void clear();
00063 
00065 
00067   int nComp() const;
00068 
00070   const Box& box() const;
00071 
00073   FArrayBox& getFlux(const int dir);
00074 
00076   const FArrayBox& getFlux(const int dir) const;
00077 
00079   FArrayBox& operator[] (const int dir);
00080 
00082   const FArrayBox& operator[] (const int dir) const;
00083 
00084 
00087   void setVal(const Real val);
00088 
00090   void setVal(const Real val, const int dir);
00091 
00093   void setVal(const Real val, const int dir, const int startComp,
00094               const int nComp);
00095 
00097   void setVal(const Real val, const Box& bx);
00098 
00099   /*@ManMemo: most specific setVal -- sets fluxes on edges surrounding 
00100     cell-centered box bx */
00101   void setVal(const Real val, const Box& bx, const int dir, 
00102               const int startComp, const int nComp);
00103 
00105   void copy(const FluxBox& src);
00106 
00108   void copy(const FluxBox& src, const int srcComp, 
00109             const int destComp, const int numComp);
00110 
00112   void copy(const FluxBox& src, const int dir, const int srcComp,
00113             const int destComp, const int numComp);
00114 
00115   /*@ManMemo: copies from a subsection of one box into another. 
00116     Assumes the boxes are both in the same index space, and that 
00117     box R is completely contained in both the src and destination 
00118     boxes.  This function required by BoxLayoutData */
00119   void copy(const Box& R, const Interval& Cdest,  const FluxBox& src,
00120             const Interval& Csrc);
00121 
00122   /*@ManDoc: Modifies this FluxBox by coping the contents of the
00123                argument FluxBox into it.  This, the most general form
00124                of copy, specifies the contents of any sub-box srcbox
00125                in `FluxBox' src may be copied into a (possibly
00126                different) destbox in the destination `FluxBox'.  Note
00127                that although the srcbox and the destbox may be
00128                disjoint, they must be the same size and shape.  If the
00129                sizes differ, the copy is undefined and a runtime error
00130                results.  This copy function is the only one of the
00131                copy functions to allow a copy between differing
00132                boxes. The user also specifies how many components are
00133                copied, starting at component srccomp in src and stored
00134                starting at component destcomp.  The results are
00135                UNDEFINED if the src and dest FluxBoxes are the same and
00136                the srcbox and destbox overlap.
00137 */
00138   void copy (const Box&        srcbox,
00139              const Interval&   srccomps,
00140              const Box&        destbox,
00141              const FluxBox&    src,
00142              const Interval&    destcomps);
00143 
00144   
00145 
00147 
00148   FluxBox& shift (const IntVect& v);
00149 
00150 
00152   
00153   /*@ManMemo: returns size, in number of bytes, of a flat linear
00154     representation of data in components comps in edges around 
00155     cell-centered box R */
00156   int size(const Box& bx, const Interval& comps) const;
00157 
00158 
00159   /*@ManMemo:Write a linear representaion of the internal data for
00160     the edges surrounding cell-centered box R.  Assumes that sufficient
00161     memory for the buffer has already been allocated by the caller */
00162   void linearOut(void*buf, const Box& R, const Interval& comps) const;
00163   
00165   void linearIn(void* buf);
00166 
00168   void linearIn(void*buf, const Box& R, const Interval& comps);
00169 
00171   static int preAllocatable() {return 0;}
00172 
00173   
00174 
00175 protected:
00177   Box m_bx;
00178 
00180   int m_nvar;
00181 
00183   Vector<FArrayBox*> m_fluxes;
00184 
00185 
00186 private:
00188   
00189   FluxBox (const FluxBox&);
00190   FluxBox& operator = (const FluxBox&);
00191 
00192 };
00193 
00194   
00195 
00196 #endif
00197 
00198 

Generated on Tue Jul 2 10:42:19 2002 for Chombo by doxygen1.2.16