diff options
author | Erik Schnetter <schnetter@aei.mpg.de> | 2005-02-01 22:58:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@aei.mpg.de> | 2005-02-01 22:58:00 +0000 |
commit | 0914bc88c7aea61eedf470a903c8fa252bdc97dd (patch) | |
tree | c11153db9c2272c28d1861a42e543942c49a7dd1 /Carpet/CarpetLib/src/th.cc | |
parent | f9fe6d4b5a573027170f45784dae4b094160c546 (diff) |
global: Change the way in which the grid hierarchy is stored
Change the way in which the grid hierarchy is stored. The new hierarchy is
map
mglevel
reflevel
component
timelevel
i.e., mglevel moved from the bottom to almost the top. This is
because mglevel used to be a true multigrid level, but is now meant to
be a convergence level.
Do not allocate all storage all the time. Allow storage to be
switched on an off per refinement level (and for a single mglevel,
which prompted the change above). Handle storage management with
CCTK_{In,De}creaseGroupStorage instead of
CCTK_{En,Dis}ableGroupStorage.
darcs-hash:20050201225827-891bb-eae3b6bd092ae8d6b5e49be84c6f09f0e882933e.gz
Diffstat (limited to 'Carpet/CarpetLib/src/th.cc')
-rw-r--r-- | Carpet/CarpetLib/src/th.cc | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/Carpet/CarpetLib/src/th.cc b/Carpet/CarpetLib/src/th.cc index 18559ae75..77415fffc 100644 --- a/Carpet/CarpetLib/src/th.cc +++ b/Carpet/CarpetLib/src/th.cc @@ -25,29 +25,29 @@ th::~th () { } // Modifiers -void th::recompose () { - times.resize(h.reflevels()); - deltas.resize(h.reflevels()); - for (int rl=0; rl<h.reflevels(); ++rl) { - const int old_mglevels = times.at(rl).size(); - CCTK_REAL mgtime; - // Select default time - if (old_mglevels==0 && rl==0) { - mgtime = 0; - } else if (old_mglevels==0) { - mgtime = times.at(rl-1).at(0); - } else { - mgtime = times.at(rl).at(old_mglevels-1); - } - times.at(rl).resize(h.mglevels(rl,0), mgtime); - deltas.at(rl).resize(h.mglevels(rl,0)); - for (int ml=0; ml<h.mglevels(rl,0); ++ml) { - if (rl==0 && ml==0) { - deltas.at(rl).at(ml) = delta; +void th::recompose () +{ + const int old_mglevels = times.size(); + times.resize(h.mglevels()); + deltas.resize(h.mglevels()); + for (int ml=0; ml<h.mglevels(); ++ml) { + const int old_reflevels = times.at(ml).size(); + times.at(ml).resize(h.reflevels()); + deltas.at(ml).resize(h.reflevels()); + for (int rl=0; rl<h.reflevels(); ++rl) { + if (old_mglevels==0) { + times.at(ml).at(rl) = 0; + } else if (rl < old_reflevels) { + // do nothing + } else { + times.at(ml).at(rl) = times.at(ml).at(rl-1); + } + if (ml==0 and rl==0) { + deltas.at(ml).at(rl) = delta; } else if (ml==0) { - deltas.at(rl).at(ml) = deltas.at(rl-1).at(ml) / h.reffact; + deltas.at(ml).at(rl) = deltas.at(ml).at(rl-1) / h.reffact; } else { - deltas.at(rl).at(ml) = deltas.at(rl).at(ml-1) * h.mgfact; + deltas.at(ml).at(rl) = deltas.at(ml-1).at(rl) * h.mgfact; } } } @@ -59,11 +59,13 @@ void th::recompose () { void th::output (ostream& os) const { os << "th:" << "times={"; - for (int rl=0; rl<h.reflevels(); ++rl) { - for (int ml=0; ml<h.mglevels(rl,0); ++ml) { - if (!(rl==0 && ml==0)) os << ","; - os << rl << ":" << ml << ":" - << times.at(rl).at(ml) << "(" << deltas.at(rl).at(ml) << ")"; + const char * sep = ""; + for (int ml=0; ml<h.mglevels(); ++ml) { + for (int rl=0; rl<h.reflevels(); ++rl) { + os << sep + << ml << ":" << rl << ":" + << times.at(ml).at(rl) << "(" << deltas.at(ml).at(rl) << ")"; + sep = ","; } } os << "}"; |