From 12fcc775ea386198b9d0f1c55f8e8b2be520dfac Mon Sep 17 00:00:00 2001 From: swhite Date: Fri, 10 Dec 2004 13:14:00 +0000 Subject: CarpetLib:gh exposed data clamp-down Made all variables in CarpetLib:gh to be const or non-public, to avoid confusion and insanity. Toward this end, created four member accessors for gh: const rexts & extents() const const rbnds & outer_boundaries() const const rprocs & processors() const const vector > & bases() const This involved a few changes in several files throughout the repository: M ./Carpet/Carpet/src/Initialise.cc -2 +2 M ./Carpet/Carpet/src/Recompose.cc -8 +8 M ./Carpet/Carpet/src/SetupGH.cc -2 +2 M ./Carpet/Carpet/src/modes.cc -3 +3 M ./Carpet/CarpetIOHDF5/src/Recover.cc -4 +4 M ./Carpet/CarpetInterp/src/interp.cc -5 +5 M ./Carpet/CarpetLib/src/dh.cc -3 +3 M ./Carpet/CarpetLib/src/gh.cc -33 +33 M ./Carpet/CarpetLib/src/gh.hh -10 +28 M ./Carpet/CarpetReduce/src/mask_carpet.cc -4 +4 M ./Carpet/CarpetRegrid/src/automatic.cc -2 +2 darcs-hash:20041210131459-32473-ff0835ff0e57f6693fbe1ec23b350d1b1d18e3bc.gz --- Carpet/CarpetLib/src/dh.cc | 6 ++--- Carpet/CarpetLib/src/gh.cc | 66 +++++++++++++++++++++++----------------------- Carpet/CarpetLib/src/gh.hh | 38 +++++++++++++++++++------- 3 files changed, 64 insertions(+), 46 deletions(-) (limited to 'Carpet/CarpetLib/src') diff --git a/Carpet/CarpetLib/src/dh.cc b/Carpet/CarpetLib/src/dh.cc index 13a780a18..0502342d3 100644 --- a/Carpet/CarpetLib/src/dh.cc +++ b/Carpet/CarpetLib/src/dh.cc @@ -93,7 +93,7 @@ void dh::allocate_bboxes() { for (int c=0; c::allocate_bboxes() { // the exterior is redundant) ivect ldist(lghosts), udist(ughosts); for (int d=0; d::recompose (const rexts& exts, { DECLARE_CCTK_PARAMETERS; - extents = exts; - outer_boundaries = outer_bounds; - processors = procs; + _extents = exts; + _outer_boundaries = outer_bounds; + _processors = procs; // Consistency checks @@ -76,11 +76,11 @@ void gh::recompose (const rexts& exts, template void gh::check_processor_number_consistency () { for (int rl=0; rl::check_multigrid_consistency () { for (int c=0; c0); for (int ml=1; ml::check_component_consistency () { assert (components(rl)>0); for (int c=0; c::check_base_grid_extent () { // TODO: put the check back in, taking outer boundaries into // account #if 0 - assert (extents.at(0).at(c).at(0).is_contained_in(baseextent)); + assert (extents().at(0).at(c).at(0).is_contained_in(baseextent)); #endif } } @@ -139,19 +139,19 @@ void gh::check_base_grid_extent () { template void gh::check_refinement_levels () { for (int rl=1; rl all; for (int c=0; c::check_refinement_levels () { template void gh::calculate_base_extents_of_all_levels () { - bases.resize(reflevels()); + _bases.resize(reflevels()); for (int rl=0; rl::do_output_bboxes (ostream& os) const { os << endl; os << "gh bboxes:" << endl; os << "rl=" << rl << " c=" << c << " ml=" << ml << endl; - os << "extent=" << extents.at(rl).at(c).at(ml) << endl; - os << "outer_boundary=" << outer_boundaries.at(rl).at(c) << endl; - os << "processor=" << processors.at(rl).at(c) << endl; + os << "extent=" << extents().at(rl).at(c).at(ml) << endl; + os << "outer_boundary=" << outer_boundaries().at(rl).at(c) << endl; + os << "processor=" << processors().at(rl).at(c) << endl; } } } @@ -238,7 +238,7 @@ void gh::do_output_bases (ostream& os) const { os << endl; os << "gh bases:" << endl; os << "rl=" << rl << " ml=" << ml << endl; - os << "base=" << bases.at(rl).at(ml) << endl; + os << "base=" << bases().at(rl).at(ml) << endl; } } } @@ -249,9 +249,9 @@ ostream& gh::output (ostream& os) const { os << "gh<" << D << ">:" << "reffactor=" << reffact << ",refcentering=" << refcent << "," << "mgfactor=" << mgfact << ",mgcentering=" << mgcent << "," - << "extents=" << extents << "," - << "outer_boundaries=" << outer_boundaries << "," - << "processors=" << processors << "," + << "extents=" << extents() << "," + << "outer_boundaries=" << outer_boundaries() << "," + << "processors=" << processors() << "," << "dhs={"; int cnt=0; for (typename list*>::const_iterator d = dhs.begin(); diff --git a/Carpet/CarpetLib/src/gh.hh b/Carpet/CarpetLib/src/gh.hh index 0bad3540a..462564f5c 100644 --- a/Carpet/CarpetLib/src/gh.hh +++ b/Carpet/CarpetLib/src/gh.hh @@ -62,14 +62,15 @@ public: // should be readonly const centering mgcent; // default (vertex or cell centered) const ibbox baseextent; - 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 private: + 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*> ths; // list of all time hierarchies list*> dhs; // list of all data hierarchies @@ -87,26 +88,42 @@ public: void recompose (const rexts& exts, const rbnds& outer_bounds, const rprocs& procs, const bool do_prolongate); + + const rexts & extents() const { + return _extents; + } + + const rbnds & outer_boundaries() const { + return _outer_boundaries; + } + + const rprocs & processors() const { + return _processors; + } + + const vector > & bases() const { + return _bases; + } // Accessors int reflevels () const { - return (int)extents.size(); + return (int)_extents.size(); } int components (const int rl) const { - return (int)extents.at(rl).size(); + return (int)_extents.at(rl).size(); } int mglevels (const int rl, const int c) const { - return (int)extents.at(rl).at(c).size(); + return (int)_extents.at(rl).at(c).size(); } bvect outer_boundary (const int rl, const int c) const { - return outer_boundaries.at(rl).at(c); + return _outer_boundaries.at(rl).at(c); } int proc (const int rl, const int c) const { - return processors.at(rl).at(c); + return _processors.at(rl).at(c); } bool is_local (const int rl, const int c) const { @@ -137,6 +154,7 @@ private: void calculate_base_extents_of_all_levels (); void do_output_bboxes (ostream& os) const; void do_output_bases (ostream& os) const; + }; -- cgit v1.2.3