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

EBGraph.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
00028 
00029 #ifndef _EBGRAPH_H_
00030 #define _EBGRAPH_H_
00031 
00032 #include "REAL.H"
00033 #include "IntVect.H"
00034 #include "IntVectSet.H"
00035 #include "VolIndex.H"
00036 #include "Interval.H"
00037 #include "FaceIndex.H"
00038 #include "IntVectSet.H"
00039 #include "RealVect.H"
00040 #include "BaseFab.H"
00041 #include "SPMD.H"
00042 #include "IrregNode.H"
00043 #include "GraphNode.H"
00044 #include "RefCountedPtr.H"
00045 
00047 
00052 class EBGraphImplem
00053 {
00054 public:
00056 
00060   enum TAG {AllRegular = 0, AllCovered, HasIrregular};
00061 
00063 
00066   EBGraphImplem();
00067 
00069   ~EBGraphImplem();
00070 
00072 
00075   Vector<VolIndex> getVoFs(const IntVect& a_iv) const;
00076 
00078   int numVoFs(const IntVect& a_iv) const;
00079 
00081 
00084   bool isAllRegular() const;
00085 
00087 
00090   bool hasIrregular() const;
00091 
00093 
00096   bool isAllCovered() const;
00097 
00099 
00102   bool isIrregular(const IntVect& a_iv) const;
00103 
00105 
00109   bool isCovered(const Box& a_box) const;
00110 
00112 
00116   bool isRegular(const Box& a_box) const;
00117   
00119   bool isRegular(const IntVect& a_iv) const;
00120 
00122   bool isCovered(const IntVect& a_iv) const;
00123 
00125   bool isConnected(const VolIndex& a_vof1,
00126                    const VolIndex& a_vof2) const;
00128 
00132   Vector<FaceIndex> getFaces(const VolIndex& a_vof, 
00133                              const int& a_idir, 
00134                              const Side::LoHiSide& a_sd) const;
00135 
00137   Vector<Vector<VolIndex> >  getVoFSets(const Box& a_region) const;
00139 
00144   Vector<VolIndex> refine(const VolIndex& a_coarVoF) const;
00145 
00146 
00148 
00153   Vector<FaceIndex> refine(const FaceIndex& a_coarFace, const EBGraphImplem& a_fineGraph) const;
00154 
00156 
00161   FaceIndex coarsen(const FaceIndex& a_coarFace) const;
00162 
00164 
00169   VolIndex coarsen(const VolIndex& a_fineVoF) const;
00170 
00171 
00173 
00187   void
00188   buildGraph(const BaseFab<int>&      a_regIrregCovered,
00189              const Vector<IrregNode>& a_irregGraph,
00190              const Box&               a_validRegion,
00191              const Box&               a_domain);
00192 
00194   void 
00195   checkGraph(const BaseFab<int>&      a_regIrregCovered,
00196              const Vector<IrregNode>& a_irregGraph,
00197              const Box&               a_validRegion,
00198              const Box&               a_domain)  ;
00199 
00201 
00204   void setToAllRegular();
00205 
00207 
00210   void setToAllCovered();
00211 
00213 
00217   void define(const Box& box);
00218 
00219 
00220   EBGraphImplem(const Box& box);
00221 
00222 
00224 
00230   void copy(const Box& a_regionFrom, 
00231             const Interval& Cd, 
00232             const Box& a_regionto, 
00233             const EBGraphImplem& a_source, 
00234             const Interval& Cs);
00235 
00236 
00238   const Box& getRegion() const;
00239 
00241   const Box& getDomain() const;
00242 
00244 
00247   int size(const Box& R, const Interval& comps) const;
00248 
00250   void linearOut(void* buf, const Box& R, const Interval& comps) const;
00251 
00253   void linearIn(void* buf, const Box& R, const Interval& comps);
00254 
00256   static int preAllocatable()
00257   {
00258     return 2; // dyanmic allocatable.  
00259   }
00260 
00262   bool isDefined() const;
00263 
00265   bool isDomainSet() const;
00266 
00267   //stuff below is not part of the public API
00268   
00269   //define vofs to be the coarsened vofs of the inputs
00270   //this must go first in coarsening.  defines happen here
00271   void coarsenVoFs(const EBGraphImplem&   a_fineGraph, 
00272                    const Box& a_coarRegion);
00273   
00274   //define the faces to be the coarsened faces of the input
00275   void coarsenFaces(const EBGraphImplem& a_coarGhostGraph,
00276                     const EBGraphImplem& a_fineEBIS);
00277 
00278   //fix fineVoF->coarseVoF information of the input
00279   void fixFineToCoarse(EBGraphImplem& a_fineEBIS) const;
00280  
00281   //don't ask
00282   Vector<int> 
00283   coarsenFaces(const VolIndex&       a_coarVoF,
00284                const EBGraphImplem&        a_coarGhostGraph,
00285                const EBGraphImplem&        a_fineGraph,
00286                const int&            a_idir,
00287                const Side::LoHiSide& a_sd);
00288 
00290   void setDomain(const Box& box);
00291 
00293   IntVectSet getIrregCells(const Box& a_subbox) const;
00294   
00296   IntVectSet getMultiCells(const Box& a_subbox) const;
00297 
00299   Vector<FaceIndex> 
00300   getAllFaces(const IntVect& a_iv, 
00301               const int& a_idir, 
00302               const Side::LoHiSide& a_sd) const;
00303 private:
00304 
00306   Box m_region;
00307 
00309   Box m_domain;
00310 
00312 
00316   TAG m_tag;
00317 
00319 
00325   BaseFab<GraphNode>  m_graph;
00326 
00328   bool m_isDefined;
00329 
00331   bool m_isDomainSet;
00332 
00334   IntVectSet m_irregIVS;
00335   
00337   IntVectSet m_multiIVS;
00338 private:
00339   
00340   void operator=(const EBGraphImplem& ebiin)
00341   {
00342     MayDay::Error("invalid operator");
00343   }
00344   EBGraphImplem(const EBGraphImplem& ebiin)
00345   {
00346     MayDay::Error("invalid operator");
00347   }
00348 };
00349 
00350 
00352 
00359 class EBGraph
00360 {
00361 public:
00363 
00367   enum TAG {AllRegular = 0, AllCovered, HasIrregular};
00368 
00370 
00373   EBGraph();
00374 
00376   ~EBGraph();
00377 
00379 
00382   Vector<VolIndex> getVoFs(const IntVect& a_iv) const;
00383 
00385   int numVoFs(const IntVect& a_iv) const;
00386 
00388 
00391   bool isAllRegular() const;
00392 
00394 
00397   bool hasIrregular() const;
00398 
00400 
00403   bool isAllCovered() const;
00404 
00406 
00409   bool isIrregular(const IntVect& a_iv) const;
00410 
00412 
00416   bool isCovered(const Box& a_box) const;
00417 
00419 
00423   bool isRegular(const Box& a_box) const;
00424   
00426   bool isRegular(const IntVect& a_iv) const;
00427 
00429   bool isCovered(const IntVect& a_iv) const;
00430 
00432   bool isConnected(const VolIndex& a_vof1,
00433                    const VolIndex& a_vof2) const;
00435 
00439   Vector<FaceIndex> getFaces(const VolIndex& a_vof, 
00440                              const int& a_idir, 
00441                              const Side::LoHiSide& a_sd) const;
00442 
00444   Vector<Vector<VolIndex> >  getVoFSets(const Box& a_region) const;
00446 
00451   Vector<VolIndex> refine(const VolIndex& a_coarVoF) const;
00452 
00453 
00455 
00460   Vector<FaceIndex> refine(const FaceIndex& a_coarFace, const EBGraph& a_fineGraph) const;
00461 
00463 
00468   FaceIndex coarsen(const FaceIndex& a_coarFace) const;
00469 
00471 
00476   VolIndex coarsen(const VolIndex& a_fineVoF) const;
00477 
00478 
00480 
00485   EBGraph(const Box& a_box, int a_comps);
00486 
00488 
00502   void
00503   buildGraph(const BaseFab<int>&      a_regIrregCovered,
00504              const Vector<IrregNode>& a_irregGraph,
00505              const Box&               a_validRegion,
00506              const Box&               a_domain);
00507 
00509   void 
00510   checkGraph(const BaseFab<int>&      a_regIrregCovered,
00511              const Vector<IrregNode>& a_irregGraph,
00512              const Box&               a_validRegion,
00513              const Box&               a_domain)  ;
00514 
00516 
00519   void setToAllRegular();
00520 
00522 
00525   void setToAllCovered();
00526 
00528 
00532   void define(const Box& box);
00533 
00534 
00536 
00542   void copy(const Box& a_regionFrom, 
00543             const Interval& Cd, 
00544             const Box& a_regionto, 
00545             const EBGraph& a_source, 
00546             const Interval& Cs);
00547 
00548 
00550   const Box& getRegion() const;
00551 
00553   const Box& getDomain() const;
00554 
00556   bool isDefined() const;
00557 
00559   bool isDomainSet() const;
00560 
00561   //stuff below is not part of the public API
00562   
00563   //define vofs to be the coarsened vofs of the inputs
00564   //this must go first in coarsening.  defines happen here
00565   void coarsenVoFs(const EBGraph&   a_fineGraph, 
00566                    const Box& a_coarRegion);
00567   
00568   //define the faces to be the coarsened faces of the input
00569   void coarsenFaces(const EBGraph& a_coarGhostGraph,
00570                     const EBGraph& a_fineEBIS);
00571 
00572   //fix fineVoF->coarseVoF information of the input
00573   void fixFineToCoarse(EBGraph& a_fineEBIS) const;
00574  
00575   //don't ask
00576   Vector<int> 
00577   coarsenFaces(const VolIndex&       a_coarVoF,
00578                const EBGraph&        a_coarGhostGraph,
00579                const EBGraph&        a_fineGraph,
00580                const int&            a_idir,
00581                const Side::LoHiSide& a_sd);
00582 
00584   void setDomain(const Box& box);
00585 
00587   IntVectSet getIrregCells(const Box& a_subbox) const;
00588   
00590   IntVectSet getMultiCells(const Box& a_subbox) const;
00591 
00593   EBGraph& operator=(const EBGraph& ebiin);
00594 
00596   EBGraph(const EBGraph& a_ebiin);
00597 
00599   Vector<FaceIndex> 
00600   getAllFaces(const IntVect& a_iv, 
00601               const int& a_idir, 
00602               const Side::LoHiSide& a_sd) const;
00603   
00605   EBGraph(const Box& box);
00607   bool operator==(const EBGraph& a_ebiin);
00608 
00610 
00613   int size(const Box& R, const Interval& comps) const;
00614 
00616   void linearOut(void* buf, const Box& R, const Interval& comps) const;
00617 
00619   void linearIn(void* buf, const Box& R, const Interval& comps);
00620 
00622   static int preAllocatable()
00623   {
00624     return 2; // dyanmic allocatable.  
00625   }
00626 
00627 private:
00628 
00630   RefCountedPtr<EBGraphImplem> m_implem;
00631 };
00632 
00633 #endif

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