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

EBIndexSpace.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 //  ANAG, LBNL, DTG
00028 
00029 #ifndef _EBINDEXSPACE_H_
00030 #define _EBINDEXSPACE_H_
00031 
00032 #include "REAL.H"
00033 #include "IntVect.H"
00034 #include "IntVectSet.H"
00035 #include "VolIndex.H"
00036 #include "FaceIndex.H"
00037 #include "IntVectSet.H"
00038 #include "DisjointBoxLayout.H"
00039 #include "LevelData.H"
00040 #include "EBISBox.H"
00041 #include "GeometryService.H"
00042 #include "EBISLayout.H"
00043 #include "HDF5.H"
00044 
00046 
00050 class EBISLevel
00051 {
00052 public:
00053 
00054 
00055   void coarsenVoFs(EBISLevel& a_fineEBIS);
00056 
00057   void fixFineToCoarse(EBISLevel& a_fineEBIS);
00058 
00059   void coarsenFaces(EBISLevel& a_fineEBIS);
00060 
00061   EBISLevel();
00063 
00067   EBISLevel(const Box& a_domain,
00068             const RealVect& a_origin,
00069             const Real& a_dx,
00070             const GeometryService& a_geoserver);
00071 
00073 
00079   EBISLevel(EBISLevel& a_finerLevel);
00080 
00082   EBISLevel(HDF5Handle& handle);
00083 
00085   void
00086   write(HDF5Handle& handle);
00087 
00088 
00090 
00096   void sanityCheck();
00097 
00099   void fillEBISLayout(EBISLayout& a_ebis,
00100                       const DisjointBoxLayout& a_grids,
00101                       const int& nghost) const;
00102   ~EBISLevel();
00103 
00104   const Box& getDomain() const;
00105 
00106   const DisjointBoxLayout& getGrids() const;
00107 
00108   DisjointBoxLayout getIrregGrids() const;
00109   
00110   const Real& getDX() const;
00111 
00112   const RealVect& getOrigin() const;
00113 private:
00114 
00116   DisjointBoxLayout m_grids;
00117 
00119   Box m_domain;
00120 
00122   RealVect m_origin;
00123 
00125   Real m_dx;
00126 
00128   LevelData<EBGraph> m_graph;
00129   
00130   static Real s_tolerance;
00132   LevelData<EBData>  m_data;
00133 
00134   //make grids for this level.
00135   static void
00136   makeBoxes(Vector<Box>& a_boxes, 
00137             const Box& a_domain);
00138 
00139   //these are disallowed
00140   void operator=(const EBISLevel& ebiin)
00141   {
00142     MayDay::Error("EBISLevel::operator= not allowed");
00143   }
00144 
00145   EBISLevel(const EBISLevel& ebiin)
00146   {
00147     MayDay::Error("EBISLevel::copy constructor not allowed");
00148   }
00149 };
00150 
00152 
00158 class EBIndexSpace
00159 {
00160 public:
00162 
00167   void
00168   define(const Box& a_domain,
00169          const RealVect& a_origin,
00170          const Real& a_dx,
00171          const GeometryService& a_geoserver,
00172          int a_nCellMax = -1,
00173                  int maxCoarsenings = -1);
00174 
00176   void 
00177   define(HDF5Handle& handle, int maxCoarsenings = -1);
00178 
00180   ~EBIndexSpace();
00181 
00183   int numLevels() const;
00184 
00186 
00191   int getLevel(const Box& a_domain) const;
00192 
00194   void fillEBISLayout(EBISLayout& a_ebis,
00195                       const DisjointBoxLayout& a_grids,
00196                       const Box& a_domain,
00197                       const int & nghost) const;
00198 
00200 
00203   bool isDefined() const;
00204 
00206   void clear();
00207 
00208   int getNCellMax() const;
00210 
00214   friend class Chombo_EBIS;
00215 
00217   void
00218   write(HDF5Handle& handle);
00219 
00220   DisjointBoxLayout getIrregGrids(int level) const
00221   { return m_ebisLevel[level]->getIrregGrids();}
00222   
00223 
00224 private:  
00225   //this is private to force the singleton thing.
00226   EBIndexSpace();
00227 
00228   int  m_nCellMax;
00229   bool m_isDefined;
00230 
00231   Vector<EBISLevel*> m_ebisLevel;
00232   Vector<Box> m_domainLevel;
00233   int m_nlevels;
00234   static Real s_tolerance;
00235 
00236   //disallowed for performance reasons
00237   void operator=(const EBIndexSpace& ebiin)
00238   {
00239     MayDay::Error("no assignment of EBIndexSpace allowed");
00240   }
00241   EBIndexSpace(const EBIndexSpace& ebiin)
00242   {
00243     MayDay::Error("no copy construction of EBIndexSpace allowed");
00244   }
00245 };
00246 
00248 class Chombo_EBIS
00249 {
00250 private:
00252 
00260   static EBIndexSpace* s_instance;
00261 
00262   Chombo_EBIS()
00263   {;}
00264 
00265   ~Chombo_EBIS()
00266   {;}
00267 public:
00269 
00276   static EBIndexSpace* instance();
00277 
00278 };
00279 
00280 #endif

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