diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-03-19 16:31:14 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-03-19 16:31:14 +0000 |
commit | c704efaa663c97edeafdecd28e0a313e3494d93f (patch) | |
tree | ef6ca0042f10486c5b45e6411f06fc46dd4ec8cc /src | |
parent | 15e00eab68a080c9039a965b1dfe74ca664f334a (diff) |
Added new KEYWORD parameter 'Cactus::recovery_mode' (steerable at RECOVER).
This is evaluated during recovery and can be set to
- 'strict' meaning all CCTK variables must be recovered successfully,
and no INITIAL timebins will be scheduled
This is the default.
- 'relaxed' saying: recover variables if possible,
and schedule INITIAL timebins afterwards
Also added a new scheduling bin CCTK_POST_RECOVER_VARIABLES at which
routines can be scheduling which want to modify (recovered) initial data.
This closes PR Cactus/629, Cactus/893, Cactus/921.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2653 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r-- | src/main/CactusDefaultInitialise.c | 154 | ||||
-rw-r--r-- | src/param.ccl | 8 |
2 files changed, 95 insertions, 67 deletions
diff --git a/src/main/CactusDefaultInitialise.c b/src/main/CactusDefaultInitialise.c index 0306e84d..2f7aee35 100644 --- a/src/main/CactusDefaultInitialise.c +++ b/src/main/CactusDefaultInitialise.c @@ -2,21 +2,18 @@ @file CactusDefaultInitialise.c @date Tue Sep 29 12:45:04 1998 @author Tom Goodale - @desc - Default cactus initialisation routine. - @enddesc + @desc + Default Cactus initialisation routine. + @enddesc + @version $Id$ @@*/ -/*#define DEBUG_CCTK*/ - #include <stdio.h> -#include <stdlib.h> +#include "cctk_Misc.h" #include "cctk_Flesh.h" -#include "cctk_GHExtensions.h" #include "cctk_Parameter.h" -#include "cctki_Bindings.h" #include "cctki_GHExtensions.h" #include "cctki_ScheduleBindings.h" #include "cctki_WarnLevel.h" @@ -24,55 +21,68 @@ #include "CactusMainDefaults.h" #include "CactusCommFunctions.h" -static const char *rcsid = "$Id$"; +static const char *rcsid = "$Header$"; CCTK_FILEVERSION(main_CactusDefaultInitialise_c) -/* Local function prototypes */ -int CactusInitialiseGH(cGH *GH); +/*# define DEBUG_CCTK 1 */ + +/******************************************************************** + ********************* Local Routine Prototypes ********************* + ********************************************************************/ +static void CactusInitialiseGH (const tFleshConfig *config, cGH *GH); + /*@@ @routine CactusDefaultInitialise @date Tue Sep 29 12:45:04 1998 @author Tom Goodale - @desc - Default initialisation routine. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Default initialisation routine. + @enddesc + @calls CCTK_SetupGH + CCTKi_AddGH + CactusInitialiseGH + + @var config + @vdesc flesh configuration structure + @vtype tFleshConfig * + @vio inout + @endvar + + @returntype int + @returndesc + 0 for success + @endreturndesc @@*/ -int CactusDefaultInitialise(tFleshConfig *config) +int CactusDefaultInitialise (tFleshConfig *config) { cGH *GH; int convergence_level; #if 0 - CactusResetTimer(config->timer[INITIALISATION]); - CactusResetTimer(config->timer[EVOLUTION]); - CactusResetTimer(config->timer[ELLIPTIC]); + CactusResetTimer (config->timer[INITIALISATION]); + CactusResetTimer (config->timer[EVOLUTION]); + CactusResetTimer (config->timer[ELLIPTIC]); - CactusStartTimer(config->timer[INITIALISATION]); + CactusStartTimer (config->timer[INITIALISATION]); #endif convergence_level = 0; - while((GH = CCTK_SetupGH(config, convergence_level))) + while ((GH = CCTK_SetupGH (config, convergence_level))) { - CCTKi_AddGH(config, convergence_level, GH); + CCTKi_AddGH (config, convergence_level, GH); - CactusInitialiseGH(GH); + CactusInitialiseGH (config, GH); convergence_level++; }; #if 0 - CactusStopTimer(config->timer[INITIALISATION]); + CactusStopTimer (config->timer[INITIALISATION]); #endif - return 0; + return (0); } @@ -80,62 +90,74 @@ int CactusDefaultInitialise(tFleshConfig *config) @routine CactusInitialiseGH @date Mon Feb 1 12:13:09 1999 @author Tom Goodale - @desc - Responsible for initialising a GH. - @enddesc - @calls - @calledby - @history - - @endhistory - + @desc + Responsible for initialising a GH. + @enddesc + @calls CCTKi_ScheduleGHInit + CCTKi_InitGHExtensions + CCTKi_FinaliseParamWarn + CCTK_Traverse + + @var config + @vdesc flesh configuration structure + @vtype tFleshConfig * + @vio inout + @endvar + @var GH + @vdesc the GH to initialize + @vtype cGH * + @vio inout + @endvar @@*/ -int CactusInitialiseGH(cGH *GH) +static void CactusInitialiseGH (const tFleshConfig *config, cGH *GH) { - int param_type; - const CCTK_REAL *cctk_initial_time; + const char *recovery_mode; + - cctk_initial_time = (const CCTK_REAL *) CCTK_ParameterGet("cctk_initial_time", - "Cactus", ¶m_type); + recovery_mode = *(const char **) + CCTK_ParameterGet ("recovery_mode", "Cactus", NULL); /* Initialise time */ - GH->cctk_time = *cctk_initial_time; + GH->cctk_time = *(const CCTK_REAL *) + CCTK_ParameterGet ("cctk_initial_time", "Cactus", NULL); /* Initialise iteration number */ GH->cctk_iteration = 0; - + #ifdef DEBUG_CCTK CCTK_PRINTSEPARATOR - printf("In Cactus_Initialise\n--------------------\n"); - printf(" Initializing GH->cctk_time = %f\n",GH->cctk_time); - printf(" Initializing GH->cctk_iteration = %u\n",GH->cctk_iteration); + printf ("In Cactus_Initialise\n--------------------\n"); + printf (" Initializing GH->cctk_time = %f\n", GH->cctk_time); + printf (" Initializing GH->cctk_iteration = %u\n", GH->cctk_iteration); CCTK_PRINTSEPARATOR #endif - + /* Do the schedule initialisation on this GH */ - CCTKi_ScheduleGHInit((void *)GH); + CCTKi_ScheduleGHInit (GH); /* Initialise all the extensions. */ - CCTKi_InitGHExtensions(GH); + CCTKi_InitGHExtensions (GH); /* FIXME : PARAM_CHECK SHOULD BE BEFORE HERE */ - CCTK_Traverse(GH, "CCTK_PARAMCHECK"); - CCTKi_FinaliseParamWarn(); - - CCTK_Traverse(GH, "CCTK_BASEGRID"); + CCTK_Traverse (GH, "CCTK_PARAMCHECK"); + CCTKi_FinaliseParamWarn (); - /* Traverse routines setting up initial data */ - CCTK_Traverse(GH, "CCTK_INITIAL"); + CCTK_Traverse (GH, "CCTK_BASEGRID"); - /* Traverse poststep initial routines which should only be done once */ - CCTK_Traverse(GH, "CCTK_POSTINITIAL"); - - CCTK_Traverse(GH, "CCTK_POSTSTEP"); + if (! (config->recovered && CCTK_Equals (recovery_mode, "strict"))) + { + /* Traverse routines setting up initial data */ + CCTK_Traverse (GH, "CCTK_INITIAL"); - /* Traverse recovery and ID checkpoint routines */ - CCTK_Traverse(GH, "CCTK_RECOVER_VARIABLES"); - CCTK_Traverse(GH, "CCTK_CPINITIAL"); + /* Traverse poststep initial routines which should only be done once */ + CCTK_Traverse (GH, "CCTK_POSTINITIAL"); + CCTK_Traverse (GH, "CCTK_POSTSTEP"); + } - return 1; + /* Traverse recovery and post-recovery routines */ + CCTK_Traverse (GH, "CCTK_RECOVER_VARIABLES"); + CCTK_Traverse (GH, "CCTK_POST_RECOVER_VARIABLES"); + /* Traverse ID checkpoint routines */ + CCTK_Traverse (GH, "CCTK_CPINITIAL"); } diff --git a/src/param.ccl b/src/param.ccl index a69099da..4c8659af 100644 --- a/src/param.ccl +++ b/src/param.ccl @@ -53,6 +53,13 @@ BOOLEAN allow_mixeddim_gfs "Allow use of GFs from different dimensions" { } "no" +KEYWORD recovery_mode "How to behave when recovering from a checkpoint" STEERABLE=RECOVER +{ + "strict" :: "All CCTK variables must be recovered successfully, no INITIAL timebins will be scheduled" + "relaxed" :: "Recover variables if possible, schedule INITIAL timebins afterwards" +} "strict" + + restricted: BOOLEAN terminate_next "Terminate on next iteration?" STEERABLE=ALWAYS @@ -82,4 +89,3 @@ INT cctk_itlast "Final iteration number" STEERABLE = ALWAYS { : :: "Any integer" } 10 - |