// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.hh,v 1.12 2003/01/03 15:49:36 schnetter Exp $ #ifndef GH_HH #define GH_HH #include #include #include #include #include "bbox.hh" #include "defs.hh" #include "dist.hh" #include "vect.hh" using namespace std; // Forward declaration template class dh; template class th; template class gh; // Output template ostream& operator<< (ostream& os, const gh& h); // A refinement hierarchy, where higher levels are finer than the base // level. The extents do not include ghost zones. template class gh { public: // Types typedef vect ivect; typedef bbox ibbox; typedef vect,D> bvect; typedef vector mexts; // ... for each multigrid level typedef vector cexts; // ... for each component typedef vector rexts; // ... for each refinement level typedef vector cbnds; // ... for each component typedef vector rbnds; // ... for each refinement level typedef vector cprocs; // ... for each component typedef vector rprocs; // ... for each refinement level public: // should be readonly // Fields int reffact; // refinement factor centering refcent; // vertex or cell centered int mgfact; // default multigrid factor centering mgcent; // default (vertex or cell centered) list*> ths; // list of all time hierarchies ibbox baseextent; // bounds (inclusive) of base level vector > bases; // [rl][ml] // TODO: invent structure for this rexts extents; // extents of all grids rbnds outer_boundaries; // boundary descriptions of all grids rprocs processors; // processor numbers of all grids list*> dhs; // list of all data hierarchies public: // Constructors gh (const int reffact, const centering refcent, const int mgfact, const centering mgcent, const ibbox& baseextent); // Destructors virtual ~gh (); // Modifiers void recompose (const rexts& exts, const rbnds& outer_bounds, const rprocs& procs); // Helpers cexts make_reflevel_multigrid_boxes (const vector& exts, const int mglevels) const; rexts make_multigrid_boxes (const vector >& exts, const int mglevels) const; // Accessors int reflevels () const { return (int)extents.size(); } int components (const int rl) const { assert (rl>=0 && rl=0 && rl=0 && c=0 && rl=0 && c=0 && rl=0 && c* t); void remove (th* t); // Data hierarchy management void add (dh* d); void remove (dh* d); // Output virtual ostream& output (ostream& os) const; }; template inline ostream& operator<< (ostream& os, const gh& h) { h.output(os); return os; } #endif // GH_HH