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

IVSFAB.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 #ifndef _IVSFAB_H_
00029 #define _IVSFAB_H_
00030 
00031 #include <cmath>
00032 #include <cstdlib>
00033 #include <cassert>
00034 #include "Vector.H"
00035 #include "IntVectSet.H"
00036 #include "IntVect.H"
00037 #include "BaseFab.H"
00038 
00040 
00044 template <class T>
00045 class IVSFAB
00046 {
00047 public:
00049 
00053   IVSFAB();
00054 
00056 
00058   IVSFAB(const IntVectSet& a_region, 
00059             const int&        a_nvarin);
00060 
00062   ~IVSFAB();
00063 
00065 
00067   void define(const IntVectSet& a_region, 
00068               const int&        a_nvarin);
00069 
00071 
00074   void setVal(const T& value);
00075 
00077   void copy(const Box& a_fromBox, 
00078             const Interval& a_destInterval,
00079             const Box& a_toBox,
00080             const IVSFAB<T>& a_src, 
00081             const Interval& a_srcInterval);
00082 
00084 
00088   static int preAllocatable()
00089   {
00090     return 1; // symmetric allocatable.  
00091   }
00092 
00094   int size(const Box& R, const Interval& comps) const ;
00095 
00097   void linearOut(void* buf, const Box& R, const Interval& comps) const;
00098 
00100   void linearIn(void* buf, const Box& R, const Interval& comps);
00101 
00103 
00108   void clear();
00109 
00111 
00116   bool 
00117   isDefined() const;
00118 
00120 
00123   int numIvs() const; 
00124 
00126 
00129   int nComp() const;
00130 
00132 
00135   const IntVectSet& getIVS() const;
00136 
00138 
00144   T& operator() (const IntVect& a_iv,const int& varlocin);
00145   const T& operator() (const IntVect& a_iv,const int& varlocin) const;
00146 
00148 
00151   const T* dataPtr(const int& a_comp) const;
00152 
00154 
00157   T* dataPtr(const int& a_comp) ;
00158 
00160   IVSFAB(const Box& a_region, int a_nVar)
00161   {
00162     MayDay::Error("invalid constructor called ");
00163   }
00164 
00166 
00169   const int* loVect() const;
00170 
00172 
00175   const int* hiVect() const;
00176 
00178   static void setVerbose(bool a_verbose);
00179 private:
00180   void
00181   setDefaultValues();
00182 
00183 protected:
00184   //get index into dataPtr
00185   int getIndex(const IntVect& a_iv,const int& a_comp) const;
00186   //has to be a pointer because we are planning to ship
00187   //the damned  thing to fortran.  
00188   T* m_dataPtr;
00189   int m_nComp;
00190   int m_nIvs;
00191   IntVect m_loVect;
00192   IntVect m_hiVect;
00193 
00194   //this is how we map from vof to vector of data.
00195   //grab the vof and its intvect tells you the vector<int>
00196   //the integer in the vof indexes into the vof.
00197   //that tells you the offset into m_dataPtr 
00198   //you further have to account for the variable number.
00199   //the getIndex() function encapsulates the process
00200   BaseFab<int> m_ivmap;
00201   IntVectSet m_ivs;
00202   bool m_isDefined;
00203   
00204   static bool s_verbose;
00205 private:
00206   //disallowed for all the usual reasons
00207   IVSFAB<T>& operator= (const IVSFAB<T>&);
00208   IVSFAB (const IVSFAB<T>&);
00209 };
00210 
00211 #include "IVSFABI.H"
00212 
00213 #endif
00214 

Generated on Wed Jun 2 13:53:33 2004 for Chombo&INSwithParticles by doxygen 1.3.2