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

BaseIVFAB.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 _BaseIVFAB_H_
00029 #define _BaseIVFAB_H_
00030 
00031 #include <cmath>
00032 #include <cstdlib>
00033 #include <cassert>
00034 #include "Vector.H"
00035 #include "IntVectSet.H"
00036 #include "VolIndex.H"
00037 #include "BaseFab.H"
00038 #include "EBGraph.H"
00039 
00041 
00045 template <class T>
00046 class BaseIVFAB
00047 {
00048 public:
00050 
00054   BaseIVFAB();
00055 
00057 
00063   BaseIVFAB(const IntVectSet& a_region, 
00064             const EBGraph&    a_ebgraph, 
00065             const int&        a_nvarin);
00066 
00068   ~BaseIVFAB();
00069 
00071 
00078   void define(const IntVectSet& a_region, 
00079               const EBGraph&    a_ebgraph,
00080               const int&        a_nvarin);
00081 
00083 
00086   void setVal(const T& value);
00087 
00089   void copy(const Box& a_fromBox, 
00090             const Interval& a_destInterval,
00091             const Box& a_toBox,
00092             const BaseIVFAB<T>& a_src, 
00093             const Interval& a_srcInterval);
00094 
00096 
00100   static int preAllocatable()
00101   {
00102     return 1; // symmetric allocatable.  
00103   }
00104 
00106   int size(const Box& R, const Interval& comps) const ;
00107 
00109   void linearOut(void* buf, const Box& R, const Interval& comps) const;
00110 
00112   void linearIn(void* buf, const Box& R, const Interval& comps);
00113 
00115 
00120   void clear();
00121 
00123 
00128   bool 
00129   isDefined() const;
00130 
00132 
00135   int numVoFs() const; 
00136 
00138 
00141   int nComp() const;
00142 
00144 
00147   const IntVectSet& getIVS() const;
00148 
00150 
00156   T& operator() (const VolIndex& a_vof,const int& varlocin);
00157   const T& operator() (const VolIndex& a_vof,const int& varlocin) const;
00158 
00160 
00163   const T* dataPtr(const int& a_comp) const;
00164 
00166 
00169   T* dataPtr(const int& a_comp) ;
00170 
00172   BaseIVFAB(const Box& a_region, int a_nVar)
00173   {
00174     MayDay::Error("invalid constructor called for baseebcellfab");
00175   }
00176 
00178 
00181   const int* loVect() const;
00182 
00184 
00187   const int* hiVect() const;
00188 
00190   const EBGraph& getEBGraph() const;
00191 private:
00192   void
00193   setDefaultValues();
00194 
00195 protected:
00196   //get index into dataPtr
00197   int getIndex(const VolIndex& a_vof,const int& a_comp) const;
00198   //has to be a pointer because we are planning to ship
00199   //the damned  thing to fortran.  
00200   T* m_dataPtr;
00201   int m_nComp;
00202   int m_nVoFs;
00203   IntVect m_loVect;
00204   IntVect m_hiVect;
00205   EBGraph m_ebgraph;
00206 
00207   //this is how we map from vof to vector of data.
00208   //grab the vof and its intvect tells you the vector<int>
00209   //the integer in the vof indexes into the vof.
00210   //that tells you the offset into m_dataPtr 
00211   //you further have to account for the variable number.
00212   //the getIndex() function encapsulates the process
00213   BaseFab<Vector<int> > m_ivmap;
00214   IntVectSet m_ivs;
00215   bool m_isDefined;
00216 private:
00217   //disallowed for all the usual reasons
00218   BaseIVFAB<T>& operator= (const BaseIVFAB<T>&);
00219   BaseIVFAB (const BaseIVFAB<T>&);
00220 };
00221 
00222 #include "BaseIVFABI.H"
00223 
00224 #endif
00225 

Generated on Wed Apr 16 14:31:03 2003 for EBChombo by doxygen1.2.16