From ef3e20db42b8facbf3c468f03d62346910022cb4 Mon Sep 17 00:00:00 2001 From: schnetter <> Date: Mon, 30 Jun 2003 15:27:00 +0000 Subject: Correctly handle "Cactus::terminate=time". darcs-hash:20030630152734-07bb3-b6387124fc2a8717f7b538a1de9fc59d4837ec65.gz --- Carpet/Carpet/src/Evolve.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc index 245293bbb..3e23f2fd5 100644 --- a/Carpet/Carpet/src/Evolve.cc +++ b/Carpet/Carpet/src/Evolve.cc @@ -18,7 +18,7 @@ #include "carpet.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Evolve.cc,v 1.23 2003/06/18 18:28:07 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Evolve.cc,v 1.24 2003/06/30 17:27:34 schnetter Exp $"; CCTK_FILEVERSION(Carpet_Carpet_Evolve_cc); } @@ -34,7 +34,8 @@ namespace Carpet { - static bool do_terminate (const cGH *cgh, CCTK_REAL time, int iteration) + static bool do_terminate (const cGH *cgh, + const CCTK_REAL time, const int iteration) { DECLARE_CCTK_PARAMETERS; @@ -47,10 +48,11 @@ namespace Carpet { } else { - bool term_iter = iteration >= cctk_itlast; - bool term_time = (cctk_initial_time < cctk_final_time - ? time >= cctk_final_time - : time <= cctk_final_time); + const bool term_iter = iteration >= cctk_itlast; + const bool term_time = ((cctk_initial_time < cctk_final_time + ? time >= cctk_final_time + : time <= cctk_final_time) + && iteration % maxreflevelfact == 0); double runtime; #ifdef HAVE_TIME_GETTIMEOFDAY // get the current time @@ -60,7 +62,8 @@ namespace Carpet { #else runtime = 0; #endif - bool term_runtime = max_runtime > 0 && runtime >= 60.0 * max_runtime; + const bool term_runtime = (max_runtime > 0 + && runtime >= 60.0 * max_runtime); if (CCTK_Equals(terminate, "never")) { term = false; @@ -119,7 +122,7 @@ namespace Carpet { int next_global_mode_iter_loop3 = 0; // Main loop - while (! do_terminate(cgh, cgh->cctk_time, cgh->cctk_iteration)) { + while (! do_terminate(cgh, refleveltimes[0], cgh->cctk_iteration)) { // Advance time ++cgh->cctk_iteration; -- cgit v1.2.3