aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/Evolve.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-09-14 15:52:47 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 18:25:22 +0000
commit90a9fb3f728b1236bb13c11a25cb769a985c2a21 (patch)
tree927b4dd7704cf34cc27961c7ece11309fc2c8702 /Carpet/Carpet/src/Evolve.cc
parent2907e498f41bd84e512d4f35ff9552498e71375c (diff)
Carpet: Execute postrestrict bin finest-to-coarsest
Execute the postrestrict and postrestrictinitial bins from finest to coarsest level, so that the restriction to level L+1 is complete (including boundary conditions, synchronisation etc.) before level L is restricted.
Diffstat (limited to 'Carpet/Carpet/src/Evolve.cc')
-rw-r--r--Carpet/Carpet/src/Evolve.cc38
1 files changed, 35 insertions, 3 deletions
diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc
index 38efe537f..1747df301 100644
--- a/Carpet/Carpet/src/Evolve.cc
+++ b/Carpet/Carpet/src/Evolve.cc
@@ -426,11 +426,18 @@ namespace Carpet {
void
CallRestrict (cGH * const cctkGH)
{
- static Timer timer ("Evolve::CallRestrict");
+ char const * const where = "Evolve::CallRestrict";
+ static Timer timer (where);
timer.start();
for (int ml=mglevels-1; ml>=0; --ml) {
- for (int rl=reflevels-1; rl>=0; --rl) {
+
+ bool have_done_global_mode = false;
+ bool have_done_early_global_mode = false;
+ bool have_done_late_global_mode = false;
+ bool have_done_anything = false;
+
+ for (int rl=reflevels-2; rl>=0; --rl) {
int const do_every
= ipow(mgfact, ml) * (maxtimereflevelfact / timereffacts.AT(rl));
if (cctkGH->cctk_iteration % do_every == 0) {
@@ -438,17 +445,40 @@ namespace Carpet {
ENTER_LEVEL_MODE (cctkGH, rl) {
BeginTimingLevel (cctkGH);
+ do_early_global_mode = reflevel==reflevels-2;
+ do_late_global_mode = not have_done_late_global_mode;
+ do_early_meta_mode = do_early_global_mode and mglevel==mglevels-1;
+ do_late_meta_mode = do_late_global_mode and mglevel==0;
+ do_global_mode = do_late_global_mode;
+ do_meta_mode = do_global_mode and do_late_meta_mode;
+ assert (not (have_done_global_mode and do_global_mode));
+ assert (not (have_done_early_global_mode and
+ do_early_global_mode));
+ assert (not (have_done_late_global_mode and
+ do_late_global_mode));
+ have_done_global_mode |= do_global_mode;
+ have_done_early_global_mode |= do_early_global_mode;
+ have_done_late_global_mode |= do_late_global_mode;
+ have_done_anything = true;
+
Waypoint ("Evolution/Restrict at iteration %d time %g",
cctkGH->cctk_iteration, (double)cctkGH->cctk_time);
Restrict (cctkGH);
+ ScheduleTraverse (where, "CCTK_POSTRESTRICT", cctkGH);
+
EndTimingLevel (cctkGH);
} LEAVE_LEVEL_MODE;
} LEAVE_GLOBAL_MODE;
} // if do_every
} // for rl
- } // for ml
+
+ if (have_done_anything) assert (have_done_global_mode);
+ if (have_done_anything) assert (have_done_early_global_mode);
+ if (have_done_anything) assert (have_done_late_global_mode);
+
+ } // for ml
timer.stop();
}
@@ -510,9 +540,11 @@ namespace Carpet {
(do_meta_mode ? " (meta)" : ""),
(do_taper ? " (tapering)" : ""));
+#if 0
if (reflevel < reflevels-1) {
ScheduleTraverse (where, "CCTK_POSTRESTRICT", cctkGH);
}
+#endif
// Poststep
ScheduleTraverse (where, "CCTK_POSTSTEP", cctkGH);