// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/dh.hh,v 1.20 2004/08/07 19:47:11 schnetter Exp $ #ifndef DH_HH #define DH_HH #include #include #include #include #include #include "bbox.hh" #include "bboxset.hh" #include "defs.hh" #include "gh.hh" #include "vect.hh" using namespace std; // Forward declaration template class ggf; template class dh; // Output template ostream& operator<< (ostream& os, const dh& d); // A data hierarchy (grid hierarchy plus ghost zones) template class dh { // Types typedef vect ivect; typedef bbox ibbox; typedef bboxset ibset; typedef list iblist; typedef vector iblistvect; // vector of lists public: // in here, the term "boundary" means both ghost zones and // refinement boundaries, but does not refer to outer (physical) // boundaries. // ghost zones, refinement boundaries, and outer boundaries are not // used as sources for synchronisation. this design choice might // not be good. struct dboxes { ibbox exterior; // whole region (including boundaries) ibbox interior; // interior (without boundaries) iblist send_mg_fine; iblist send_mg_coarse; iblist recv_mg_fine; iblist recv_mg_coarse; iblistvect send_ref_fine; iblistvect send_ref_coarse; iblistvect recv_ref_fine; iblistvect recv_ref_coarse; iblistvect send_sync; // send while syncing iblistvect send_ref_bnd_fine; // sent to finer grids ibset boundaries; // boundaries iblistvect recv_sync; // received while syncing iblistvect recv_ref_bnd_coarse; // received from coarser grids ibset sync_not; // not received while syncing (outer boundary of that level) ibset recv_not; // not received while syncing or prolongating (globally outer boundary) #if 0 // after regridding: iblistvect prev_send; // sent from previous dh iblistvect recv_prev; // received from previous dh iblistvect send_prev_fine; // sent to finer iblistvect recv_prev_coarse; // received from coarser #endif }; private: struct dbases { ibbox exterior; // whole region (including boundaries) ibbox interior; // interior (without boundaries) ibset boundaries; // boundaries }; typedef vector mboxes; // ... for each multigrid level typedef vector cboxes; // ... for each component typedef vector rboxes; // ... for each refinement level typedef vector mbases; // ... for each multigrid level typedef vector rbases; // ... for each refinement level public: // should be readonly // Fields gh& h; // hierarchy ivect lghosts, ughosts; // ghost zones int prolongation_order_space; // order of spatial prolongation operator int buffer_width; // buffer inside refined grids rboxes boxes; rbases bases; list*> gfs; // list of all grid functions public: // Constructors dh (gh& h, const ivect& lghosts, const ivect& ughosts, int prolongation_order_space, int buffer_width); // Destructors virtual ~dh (); // Helpers int prolongation_stencil_size () const; // Modifiers void recompose (const bool do_prolongate); // Grid function management void add (ggf* f); void remove (ggf* f); // Output virtual void output (ostream& os) const; }; template inline ostream& operator<< (ostream& os, const dh& d) { d.output(os); return os; } #endif // DH_HH