diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-06-06 20:35:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-06-06 20:35:00 +0000 |
commit | 655377e610caecf75121b8b9689d3100ff852026 (patch) | |
tree | 1f3e0a543bd9240a6be7fcaf3a3ec663c6303e4d | |
parent | 3d629bc66083287138bca6d51c30d5c916dea45b (diff) |
Carpet: Forbid accessing past timelevels in certain scheduling bins
Certain scheduling bins do not allow accessing past time levels. Set
the grid function pointers to past time levels to null in these.
darcs-hash:20070606203504-dae7b-df075bdeb5bea053b84d9e6f162796a5aac50540.gz
-rw-r--r-- | Carpet/Carpet/src/Evolve.cc | 6 | ||||
-rw-r--r-- | Carpet/Carpet/src/Initialise.cc | 31 | ||||
-rw-r--r-- | Carpet/Carpet/src/SetupGH.cc | 1 | ||||
-rw-r--r-- | Carpet/Carpet/src/modes.cc | 5 | ||||
-rw-r--r-- | Carpet/Carpet/src/variables.cc | 3 | ||||
-rw-r--r-- | Carpet/Carpet/src/variables.hh | 3 |
6 files changed, 45 insertions, 4 deletions
diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc index 2b02de5f9..6cc937c64 100644 --- a/Carpet/Carpet/src/Evolve.cc +++ b/Carpet/Carpet/src/Evolve.cc @@ -265,6 +265,10 @@ namespace Carpet { int const num_tl = prolongation_order_time+1; + bool const old_do_allow_past_timelevels = + do_allow_past_timelevels; + do_allow_past_timelevels = false; + // Rewind times for (int m=0; m<maps; ++m) { vtt.at(m)->set_delta @@ -302,6 +306,8 @@ namespace Carpet { } // for tl cctkGH->cctk_time = old_cctk_time; + do_allow_past_timelevels = old_do_allow_past_timelevels; + } LEAVE_LEVEL_MODE; } END_MGLEVEL_LOOP; } // if did_recompose diff --git a/Carpet/Carpet/src/Initialise.cc b/Carpet/Carpet/src/Initialise.cc index 8049b86e4..f8651d60c 100644 --- a/Carpet/Carpet/src/Initialise.cc +++ b/Carpet/Carpet/src/Initialise.cc @@ -287,6 +287,8 @@ namespace Carpet { int const num_tl = init_each_timelevel ? prolongation_order_time+1 : 1; + bool const old_do_allow_past_timelevels = do_allow_past_timelevels; + do_allow_past_timelevels = not init_each_timelevel; for (int m=0; m<maps; ++m) { vtt.at(m)->set_delta @@ -316,10 +318,12 @@ namespace Carpet { Checkpoint ("Scheduling INITIAL"); CCTK_ScheduleTraverse ("CCTK_INITIAL", cctkGH, CallFunction); + // Checking + PoisonCheck (cctkGH, currenttime); + } // for tl - // Checking - PoisonCheck (cctkGH, currenttime); + do_allow_past_timelevels = old_do_allow_past_timelevels; if (regrid_during_initialisation and mglevel==0) { // Regrid after initialising each level @@ -511,6 +515,10 @@ namespace Carpet { ? (init_each_timelevel ? prolongation_order_time+1 : 1) : prolongation_order_time+1; + bool const old_do_allow_past_timelevels = + do_allow_past_timelevels; + do_allow_past_timelevels = false; + // Rewind times for (int m=0; m<maps; ++m) { vtt.at(m)->set_delta @@ -554,6 +562,8 @@ namespace Carpet { } // for tl cctkGH->cctk_time = old_cctk_time; + do_allow_past_timelevels = old_do_allow_past_timelevels; + } LEAVE_LEVEL_MODE; } END_MGLEVEL_LOOP; } // if did_recompose @@ -595,6 +605,9 @@ namespace Carpet { int const num_tl = prolongation_order_time + 1; + bool const old_do_allow_past_timelevels = do_allow_past_timelevels; + do_allow_past_timelevels = false; + // Rewind times for (int m=0; m<maps; ++m) { vtt.at(m)->set_delta @@ -630,6 +643,8 @@ namespace Carpet { } // for tl cctkGH->cctk_time = old_cctk_time; + do_allow_past_timelevels = old_do_allow_past_timelevels; + } LEAVE_LEVEL_MODE; } END_MGLEVEL_LOOP; @@ -690,6 +705,10 @@ namespace Carpet { int const num_tl = prolongation_order_time + 1; + bool const old_do_allow_past_timelevels = + do_allow_past_timelevels; + do_allow_past_timelevels = false; + // Rewind times for (int m=0; m<maps; ++m) { vtt.at(m)->set_delta @@ -727,6 +746,8 @@ namespace Carpet { } // for tl cctkGH->cctk_time = old_cctk_time; + do_allow_past_timelevels = old_do_allow_past_timelevels; + } LEAVE_LEVEL_MODE; } END_MGLEVEL_LOOP; } // if did_recompose @@ -838,6 +859,10 @@ namespace Carpet { int const num_tl = init_each_timelevel ? prolongation_order_time+1 : 1; + bool const old_do_allow_past_timelevels = + do_allow_past_timelevels; + do_allow_past_timelevels = false; + // Rewind times for (int m=0; m<maps; ++m) { vtt.at(m)->set_delta @@ -875,6 +900,8 @@ namespace Carpet { } // for tl cctkGH->cctk_time = old_cctk_time; + do_allow_past_timelevels = old_do_allow_past_timelevels; + } LEAVE_LEVEL_MODE; } END_MGLEVEL_LOOP; } // if did_recompose diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc index 3cbab2c7a..42e69fe4b 100644 --- a/Carpet/Carpet/src/SetupGH.cc +++ b/Carpet/Carpet/src/SetupGH.cc @@ -233,6 +233,7 @@ namespace Carpet { set_state (cctkGH); // Enable prolongating + do_allow_past_timelevels = true; do_prolongate = true; do_warn_about_storage = false; // This is enabled later diff --git a/Carpet/Carpet/src/modes.cc b/Carpet/Carpet/src/modes.cc index bba8aa370..1f4e392c2 100644 --- a/Carpet/Carpet/src/modes.cc +++ b/Carpet/Carpet/src/modes.cc @@ -511,15 +511,16 @@ namespace Carpet { assert (max_tl>=0); const int active_tl = CCTK_ActiveTimeLevelsGI (cctkGH, group); assert (active_tl>=0 and active_tl<=max_tl); + const int available_tl = do_allow_past_timelevels ? active_tl : 1; - // assert (vhh.at(map)->is_local(reflevel,component)); + // assert (vhh.at(map)->is_local(reflevel,component)); assert (group<(int)arrdata.size()); for (int var=0; var<numvars; ++var) { assert (firstvar+var<CCTK_NumVars()); ggf * const ff = arrdata.at(group).at(map).data.at(var); for (int tl=0; tl<max_tl; ++tl) { - if (ff and tl<active_tl) { + if (ff and tl<available_tl) { gdata * const data = (*ff) (tl, reflevel, component, mglevel); assert (data); cctkGH->data[firstvar+var][tl] = data->storage(); diff --git a/Carpet/Carpet/src/variables.cc b/Carpet/Carpet/src/variables.cc index a44d6efc5..a0667ca89 100644 --- a/Carpet/Carpet/src/variables.cc +++ b/Carpet/Carpet/src/variables.cc @@ -82,6 +82,9 @@ namespace Carpet { bool do_meta_mode; bool do_global_mode; + // Can past time levels be accessed? + bool do_allow_past_timelevels; + // Is prolongation enabled? bool do_prolongate; diff --git a/Carpet/Carpet/src/variables.hh b/Carpet/Carpet/src/variables.hh index 093eaee93..82179047e 100644 --- a/Carpet/Carpet/src/variables.hh +++ b/Carpet/Carpet/src/variables.hh @@ -118,6 +118,9 @@ namespace Carpet { extern bool do_meta_mode; extern bool do_global_mode; + // Can past time levels be accessed? + extern bool do_allow_past_timelevels; + // Is prolongation enabled? extern bool do_prolongate; |