#include #include #include #include #include "cctk.h" #include "cctk_Parameters.h" #include "defs.hh" #include "dh.hh" #include "th.hh" #include "vect.hh" #include "gh.hh" using namespace std; // Constructors gh::gh (const vector & reffacts_, const centering refcent_, const int mgfact_, const centering mgcent_, const ibbox baseextent_) : reffacts(reffacts_), refcent(refcent_), mgfact(mgfact_), mgcent(mgcent_), baseextent(baseextent_) { assert (reffacts.size() >= 1); assert (all (reffacts.front() == 1)); for (size_t n = 1; n < reffacts.size(); ++ n) { assert (all (reffacts.at(n) >= reffacts.at(n-1))); assert (all (reffacts.at(n) % reffacts.at(n-1) == 0)); } } // Destructors gh::~gh () { } // Modifiers void gh::recompose (const mexts& exts, const rbnds& outer_bounds, const rprocs& procs, const bool do_prolongate) { DECLARE_CCTK_PARAMETERS; _extents = exts; _outer_boundaries = outer_bounds; _processors = procs; // Consistency checks // nota bene: there might be 0 refinement levels. check_processor_number_consistency (); check_multigrid_consistency (); check_component_consistency (); check_base_grid_extent (); check_refinement_levels (); calculate_base_extents_of_all_levels (); if (output_bboxes) { do_output_bboxes (cout); do_output_bases (cout); } // Recompose the other hierarchies for (list::iterator t=ths.begin(); t!=ths.end(); ++t) { (*t)->recompose(); } for (list::iterator d=dhs.begin(); d!=dhs.end(); ++d) { (*d)->recompose (do_prolongate); } } void gh::check_processor_number_consistency () { for (int rl=0; rl0); for (int ml=1; ml0); for (int c=0; c0) { for (int c=0; c::const_iterator d = dhs.begin(); d != dhs.end(); ++d) { os << sep; (*d)->output(os); sep = ","; } os << "}"; return os; }