/*************************************************************************** gh.cc - Grid Hierarchy bounding boxes for each multigrid level of each component of each refinement level ------------------- begin : Sun Jun 11 2000 copyright : (C) 2000 by Erik Schnetter email : schnetter@astro.psu.edu $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/gh.cc,v 1.17 2002/10/12 13:02:25 schnetter Exp $ ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include #include #include #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) : dimgeneric_gh (reffact, refcent, mgfact, mgcent), baseextent(baseextent) { } // Destructors template gh::~gh () { } // Modifiers template void gh::recompose (const rexts& exts, const rbnds& outer_bounds, const rprocs& procs) { extents = exts; outer_boundaries = outer_bounds; processors = procs; // Consistency checks // nota bene: there might be 0 refinement levels. // Check processor number consistency for (int rl=0; rl0); for (int ml=1; ml0); for (int c=0; c0) { for (int c=0; c all; for (int c=0; c::iterator t=ths.begin(); t!=ths.end(); ++t) { (*t)->recompose(); } for (typename list*>::iterator d=dhs.begin(); d!=dhs.end(); ++d) { (*d)->recompose(); } } // Helpers template typename gh::cexts gh::make_reflevel_multigrid_boxes (const vector& exts, const int mglevels) const { assert (mglevels>0); cexts mexts (exts.size()); for (int c=0; c<(int)exts.size(); ++c) { mexts[c].resize(mglevels); ibbox ext = exts[c]; for (int ml=0; ml typename gh::rexts gh::make_multigrid_boxes (const vector >& exts, const int mglevels) const { assert (mglevels>0); rexts mexts (exts.size()); for (int rl=0; rl<(int)exts.size(); ++rl) { mexts[rl] = make_reflevel_multigrid_boxes (exts[rl], mglevels); } return mexts; } // Accessors template int gh::local_components (const int rl) const { int lc = 0; for (int c=0; c void gh::add (dh* d) { dhs.push_back(d); } template void gh::remove (dh* d) { dhs.remove(d); } template ostream& gh::output (ostream& os) const { os << "gh<" << D << ">:" << "reffactor=" << reffact << ",refcentering=" << refcent << "," << "mgfactor=" << mgfact << ",mgcentering=" << mgcent << "," << "baseextent=" << baseextent << "," << "extents=" << extents << "," << "dhs={"; int cnt=0; for (typename list*>::const_iterator d = dhs.begin(); d != dhs.end(); ++d) { if (cnt++) os << ","; (*d)->output(os); } os << "}"; return os; } template class gh<3>;