#include #include #include #include "cctk.h" #include "cctk_Parameters.h" #include "defs.hh" #include "dh.hh" #include "th.hh" #include "gh.hh" using namespace std; // Constructors template gh::gh (const int reffact, const centering refcent, const int mgfact, const centering mgcent, const ibbox baseextent) : reffact(reffact), refcent(refcent), mgfact(mgfact), mgcent(mgcent), baseextent(baseextent) { } // Destructors template gh::~gh () { } // Modifiers template void gh::recompose (const rexts& 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 (typename list*>::iterator t=ths.begin(); t!=ths.end(); ++t) { (*t)->recompose(); } for (typename list*>::iterator d=dhs.begin(); d!=dhs.end(); ++d) { (*d)->recompose (do_prolongate); } } template void gh::check_processor_number_consistency () { for (int rl=0; rl void gh::check_multigrid_consistency () { for (int rl=0; rl0); for (int ml=1; ml void gh::check_component_consistency () { for (int rl=0; rl0); for (int c=0; c void gh::check_base_grid_extent () { if (reflevels()>0) { for (int c=0; c void gh::check_refinement_levels () { for (int rl=1; rl all; for (int c=0; c void gh::calculate_base_extents_of_all_levels () { _bases.resize(reflevels()); for (int rl=0; rl int gh::local_components (const int rl) const { int lc = 0; for (int c=0; c void gh::add (th* t) { ths.push_back(t); } template void gh::remove (th* t) { ths.remove(t); } // Data hierarchy management template void gh::add (dh* d) { dhs.push_back(d); } template void gh::remove (dh* d) { dhs.remove(d); } template void gh::do_output_bboxes (ostream& os) const { for (int rl=0; rl:" << "reffactor=" << reffact << ",refcentering=" << refcent << "," << "mgfactor=" << mgfact << ",mgcentering=" << mgcent << "," << "extents=" << extents() << "," << "outer_boundaries=" << outer_boundaries() << "," << "processors=" << processors() << "," << "dhs={"; const char * sep = ""; for (typename list*>::const_iterator d = dhs.begin(); d != dhs.end(); ++d) { os << sep; (*d)->output(os); sep = ","; } os << "}"; return os; } template class gh<3>;