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

BaseIFFAB.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 // DTG, ANAG, LBNL
00028 
00029 #ifndef _BaseIFFAB_H_
00030 #define _BaseIFFAB_H_
00031 
00032 #include <cmath>
00033 #include <cstdlib>
00034 #include <cassert>
00035 #include "Vector.H"
00036 #include "IntVectSet.H"
00037 #include "FaceIndex.H"
00038 #include "BaseFab.H"
00039 #include "EBGraph.H"
00040 
00042 
00046 template <class T>
00047 class BaseIFFAB
00048 {
00049 public:
00051 
00055   BaseIFFAB();
00056 
00057 
00059 
00065   BaseIFFAB(const IntVectSet& a_region, 
00066             const EBGraph& a_ebgraph,
00067             const int& a_direction,
00068             const int& a_nvarin);
00069 
00071   ~BaseIFFAB();
00072 
00074 
00081   void define(const IntVectSet& a_region, 
00082               const EBGraph& a_ebgraph,
00083               const int& a_direction,
00084               const int& a_nvarin);
00085 
00086 
00088 
00091   void setVal(const T& value);
00092 
00093 
00095 
00098   void copy(const Box& a_intBox, 
00099             const Interval& a_destInterval,
00100             const Box& a_toBox,
00101             const BaseIFFAB<T>& a_src, 
00102             const Interval& a_srcInterval);
00103             
00104 
00105 
00107 
00113   void clear();
00114 
00115 
00117 
00122   bool 
00123   isDefined() const;
00124 
00125 
00127 
00130   int numFaces() const; 
00131 
00133 
00136   int nComp() const;
00137 
00139 
00141 
00144   int direction() const;
00145 
00147 
00151   const IntVectSet& getIVS() const;
00152 
00153 
00155 
00161   T& operator() (const FaceIndex& a_face,const int& varlocin);
00162   const T& operator()(const FaceIndex& a_face,const int& varlocin) const;
00163 
00165 
00168   const T* dataPtr(const int& a_comp) const;
00169 
00171 
00174   T* dataPtr(const int& a_comp) ;
00175 
00177 
00180   const int* loVect() const;
00181 
00183 
00186   const int* hiVect() const;
00187 
00189   const EBGraph& getEBGraph() const;
00190 
00191   static int preAllocatable()
00192   {
00193     return 1; // symmetric allocatable.  
00194   }
00195 
00197   int size(const Box& R, const Interval& comps) const ;
00198 
00200   void linearOut(void* buf, const Box& R, const Interval& comps) const;
00201 
00203   void linearIn(void* buf, const Box& R, const Interval& comps);
00204 
00205 private:
00206   void
00207   setDefaultValues();
00208 
00209 protected:
00210   //get index vector<int> at the face location
00211   //using lexographic ordering of vof's indicies
00212   int getLocalVecIndex(const FaceIndex& a_face) const;
00213   //get index into dataPtr
00214   int getIndex(const FaceIndex& a_face,const int& a_comp) const;
00215   //has to be a pointer because we are planning to ship
00216   //the damned  thing to fortran.  
00217   T* m_dataPtr;
00218   int m_nComp;
00219   int m_nFaces;
00220   int m_direction;
00221   IntVect m_loVect;
00222   IntVect m_hiVect;
00223   // This is how we map from face to vector of data:
00224   // The low  intvect (by convention)
00225   // tells you the vector<int>
00226   // To index into the vector<int> use the lexigraphic
00227   // ordering of the cellindicies of the VoF (low, high).
00228   // That tells you the offset into m_dataPtr.
00229   // you further have to account for the variable number.
00230   // the getIndex() function encapsulates the process
00231   BaseFab<Vector<int> > m_ivmap;
00232   IntVectSet m_ivs;
00233   EBGraph m_ebgraph;
00234   bool m_isDefined;
00235 private:
00236   BaseIFFAB<T>& operator= (const BaseIFFAB<T>&);
00237   BaseIFFAB (const BaseIFFAB<T>&);
00238 };
00239 
00240 #include "BaseIFFABI.H"
00241 
00242 #endif

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