diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/CactusDefaultEvolve.c | 46 | ||||
-rw-r--r-- | src/main/CactusDefaultInitialise.c | 23 | ||||
-rw-r--r-- | src/main/CallStartupFunctions.c | 4 | ||||
-rw-r--r-- | src/main/GHExtensions.c | 121 | ||||
-rw-r--r-- | src/main/ScheduleInterface.c | 85 | ||||
-rw-r--r-- | src/main/rfrInterface.c | 42 |
6 files changed, 191 insertions, 130 deletions
diff --git a/src/main/CactusDefaultEvolve.c b/src/main/CactusDefaultEvolve.c index 880dc8a8..771471fc 100644 --- a/src/main/CactusDefaultEvolve.c +++ b/src/main/CactusDefaultEvolve.c @@ -13,8 +13,6 @@ #include "cctk_Flesh.h" #include "cctk_Parameters.h" -#include "rfrConstants.h" -#include "rfrInterface.h" #include "CactusIOFunctions.h" @@ -124,10 +122,10 @@ int CactusDefaultEvolve(tFleshConfig *config) /*** Call OUTPUT for this GH (this routine ***/ /*** checks if output is necessary) and makes ***/ - /*** an rfrTraverse with CCTK_ANALYSIS ***/ + /*** a Traverse with CCTK_ANALYSIS ***/ ForallConvLevels(iteration, convergence_level) { - CCTK_rfrTraverse(config->GH[convergence_level],CCTK_ANALYSIS); + CCTK_Traverse(config->GH[convergence_level], "CCTK_ANALYSIS"); CCTK_OutputGH(config->GH[convergence_level]); } EndForallConvLevels; @@ -171,7 +169,7 @@ int CactusDefaultEvolve(tFleshConfig *config) /* Dump out checkpoint data on all levels */ ForallConvLevels(iteration, convergence_level) { - CCTK_rfrTraverse(config->GH[convergence_level],CCTK_CHECKPOINT); + CCTK_Traverse(config->GH[convergence_level], "CCTK_CHECKPOINT"); } EndForallConvLevels; @@ -181,10 +179,10 @@ int CactusDefaultEvolve(tFleshConfig *config) #endif /*** Call OUTPUT for this GH (this routine ***/ /*** checks if output is necessary) and makes ***/ - /*** an rfrTraverse with CCTK_ANALYSIS ***/ + /*** an Traverse with CCTK_ANALYSIS ***/ ForallConvLevels(iteration, convergence_level) { - CCTK_rfrTraverse(config->GH[convergence_level],CCTK_ANALYSIS); + CCTK_Traverse(config->GH[convergence_level], "CCTK_ANALYSIS"); CCTK_OutputGH(config->GH[convergence_level]); } EndForallConvLevels; @@ -221,9 +219,9 @@ int CactusDefaultEvolve(tFleshConfig *config) @date Fri Aug 14 12:39:49 1998 @author Gerd Lanfermann @desc - The full set of routines used to execute all rfr steps + The full set of routines used to execute all schedule point int the main iteration loop. Makes calls to the individual - routines for each rfr step. + routines for each schedule point. @enddesc @calls PreStepper, EvolStepper, PostStepper @calledby main @@ -272,7 +270,7 @@ int StepGH(cGH *GH) @date Fri Aug 14 12:43:20 1998 @author Gerd Lanfermann @desc - calls RFR-PRESTEP + calls PRESTEP @enddesc @calls @calledby @@ -282,18 +280,19 @@ int StepGH(cGH *GH) @@*/ -void PreStepper(cGH *GH) { +void PreStepper(cGH *GH) +{ int Rstep; - /* Call the rfr with CCTK_PRESTEP */ - CCTK_rfrTraverse(GH, CCTK_PRESTEP); + /* Call the schedular with CCTK_PRESTEP */ + CCTK_Traverse(GH, "CCTK_PRESTEP"); } /*@@ @routine EvolStepper @date Fri Aug 14 12:44:00 1998 @author Gerd Lanfermann @desc - calls RFR-EVOLUTION, checks for nans, increases physical time + calls EVOLUTION, checks for nans, increases physical time @enddesc @calls @calledby @@ -305,8 +304,8 @@ void PreStepper(cGH *GH) { void EvolStepper(cGH *GH) { - /* Call the rfr with Evolution */ - CCTK_rfrTraverse(GH, CCTK_EVOL); + /* Call the schedular with Evolution */ + CCTK_Traverse(GH, "CCTK_EVOL"); /* after Evolution check for NANs */ } @@ -325,10 +324,10 @@ void EvolStepper(cGH *GH) @endhistory @@*/ -void PostStepper(cGH *GH) { - int Rstep; - /* Call the rfr with post step */ - CCTK_rfrTraverse(GH, CCTK_POSTSTEP); +void PostStepper(cGH *GH) +{ + /* Call the scheduler with post step */ + CCTK_Traverse(GH, "CCTK_POSTSTEP"); } /*@@ @@ -341,7 +340,7 @@ void PostStepper(cGH *GH) { TERMINATION_RAISED_LOCAL : signaled on one PE, not reduced (MPI_LOR) to all PEs yet (main.c) TERMINATION_RAISED_BRDCAST: reduced -> can now be used to terminate - (chkpnt_terminate.c) by RFR + (chkpnt_terminate.c) by the scheduler the raised termiantion signal is caught on 1 PE only and has to be recduced on all PEs before a termination sequenced can be launched (I like that) @enddesc @@ -353,7 +352,8 @@ void PostStepper(cGH *GH) { @@*/ -void TerminationStepper(cGH *GH) { +void TerminationStepper(cGH *GH) +{ int cactus_terminate_global; cactus_terminate_global=cactus_terminate; @@ -369,5 +369,5 @@ void TerminationStepper(cGH *GH) { cactus_terminate=TERMINATION_RAISED_BRDCAST; printf("RECEIVED GLOBAL TERMINATION SIGNAL \n"); } - CCTK_rfrTraverse(GH,CCTK_TERMINATE); + CCTK_Traverse(GH, "CCTK_TERMINATE"); } diff --git a/src/main/CactusDefaultInitialise.c b/src/main/CactusDefaultInitialise.c index 6aa2cf9f..35580673 100644 --- a/src/main/CactusDefaultInitialise.c +++ b/src/main/CactusDefaultInitialise.c @@ -20,15 +20,12 @@ #include "CactusrfrInterface.h" #include "CactusMainDefaults.h" #include "CactusCommFunctions.h" -#include "rfrConstants.h" -#include "rfrInterface.h" static char *rcsid = "$Id$"; /* Local function prototypes */ int CactusInitialiseGH(cGH *GH); - /*@@ @routine CactusDefaultInitialise @date Tue Sep 29 12:45:04 1998 @@ -113,10 +110,6 @@ int CactusInitialiseGH(cGH *GH) CCTK_PRINTSEPARATOR #endif - /* Setup the rfr_top on this GH */ - - GH->rfr_top = NULL; - /* Do the rfr initialisation on this GH */ CCTKi_ScheduleGHInit((void *)GH); @@ -126,25 +119,25 @@ int CactusInitialiseGH(cGH *GH) #define PUGH #ifdef PUGH - /* Do various rfr traversals. Will tidy up later. */ + /* Do various schedule traversals. Will tidy up later. */ /* FIXME : PARAM_CHECK SHOULD BE BEFORE HERE */ - CCTK_rfrTraverse(GH, CCTK_PARAMCHECK); + CCTK_Traverse(GH, "CCTK_PARAMCHECK"); CCTKi_FinaliseParamWarn(); - CCTK_rfrTraverse(GH, CCTK_BASEGRID); + CCTK_Traverse(GH, "CCTK_BASEGRID"); /* Traverse routines setting up initial data */ - CCTK_rfrTraverse(GH,CCTK_INITIAL); + CCTK_Traverse(GH, "CCTK_INITIAL"); /* Traverse poststep initial routines which should only be done once */ - CCTK_rfrTraverse(GH,CCTK_POSTINITIAL); + CCTK_Traverse(GH, "CCTK_POSTINITIAL"); /* Traverse recovery and ID checkpoint routines */ - CCTK_rfrTraverse(GH,CCTK_RECOVER_VARIABLES); - CCTK_rfrTraverse(GH,CCTK_CPINITIAL); + CCTK_Traverse(GH, "CCTK_RECOVER_VARIABLES"); + CCTK_Traverse(GH, "CCTK_CPINITIAL"); - CCTK_rfrTraverse(GH,CCTK_POSTSTEP); + CCTK_Traverse(GH, "CCTK_POSTSTEP"); #endif diff --git a/src/main/CallStartupFunctions.c b/src/main/CallStartupFunctions.c index 3005cc01..caf44190 100644 --- a/src/main/CallStartupFunctions.c +++ b/src/main/CallStartupFunctions.c @@ -13,7 +13,7 @@ static char *rcsid = "$Header$"; #include <stdio.h> #include "cctk_Flesh.h" -#include "cctki_Schedule.h" +#include "cctk_Schedule.h" /*@@ @@ -34,7 +34,7 @@ static char *rcsid = "$Header$"; int CCTKi_CallStartupFunctions(tFleshConfig *ConfigData) { - CCTKi_ScheduleTraverse("CCTK_STARTUP", NULL, NULL); + CCTK_ScheduleTraverse("CCTK_STARTUP", NULL, NULL); return 0; } diff --git a/src/main/GHExtensions.c b/src/main/GHExtensions.c index f66b2fa4..5512c3a2 100644 --- a/src/main/GHExtensions.c +++ b/src/main/GHExtensions.c @@ -43,6 +43,7 @@ struct GHExtension void *(*SetupGH)(tFleshConfig *, int, cGH *); int (*InitGH)(cGH *); int (*rfrTraverseGH)(cGH *, int); + int (*ScheduleTraverseGH)(cGH *, const char *); }; @@ -53,9 +54,14 @@ static int CheckAllExtensionsSetup(void); /* Dummy function prototypes. */ -static void *DummySetupGH(tFleshConfig *config, int convergence_level, cGH *GH); +static void *DummySetupGH(tFleshConfig *config, + int convergence_level, + cGH *GH); static int DummyInitGH(cGH *GH); -static int DummyrfrTraverseGH(cGH *GH, int rfrpoint); +static int DummyrfrTraverseGH(cGH *GH, + int rfrpoint); +static int DummyScheduleTraverseGH(cGH *GH, + const char *where); /************************************************************************** @@ -105,6 +111,7 @@ int CCTK_RegisterGHExtension(const char *name) new_extension->InitGH = NULL; new_extension->SetupGH = NULL; new_extension->rfrTraverseGH = NULL; + new_extension->ScheduleTraverseGH = NULL; /* Remember how many extensions there are */ num_extensions++; @@ -180,7 +187,8 @@ int CCTK_RegisterGHExtensionSetupGH(int handle, @endhistory @@*/ -int CCTK_RegisterGHExtensionInitGH(int handle, int (*func)(cGH *)) +int CCTK_RegisterGHExtensionInitGH(int handle, + int (*func)(cGH *)) { int return_code; struct GHExtension *extension; @@ -215,7 +223,8 @@ int CCTK_RegisterGHExtensionInitGH(int handle, int (*func)(cGH *)) @endhistory @@*/ -int CCTK_RegisterGHExtensionrfrTraverseGH(int handle, int (*func)(cGH *, int)) +int CCTK_RegisterGHExtensionrfrTraverseGH(int handle, + int (*func)(cGH *, int)) { int return_code; struct GHExtension *extension; @@ -236,6 +245,42 @@ int CCTK_RegisterGHExtensionrfrTraverseGH(int handle, int (*func)(cGH *, int)) return return_code; } + /*@@ + @routine CCTK_RegisterGHExtensionScheduleTraverseGH + @date Thu Jan 27 14:37:09 2000 + @author Tom Goodale + @desc + Registers a GH extension Schedule traversal routine routine. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTK_RegisterGHExtensionScheduleTraverseGH(int handle, + int (*func)(cGH *, const char *)) +{ + int return_code; + struct GHExtension *extension; + + /* Get the extension. */ + extension = Util_GetHandledData(GHExtensions, handle); + + if(extension) + { + extension->ScheduleTraverseGH = func; + return_code = 1; + } + else + { + return_code = 0; + } + + return return_code; +} + /*************************************************************************** * @@ -345,7 +390,8 @@ int CCTKi_InitGHExtensions(cGH *GH) @endhistory @@*/ -int CCTKi_rfrTraverseGHExtensions(cGH *GH, int rfrpoint) +int CCTKi_rfrTraverseGHExtensions(cGH *GH, + int rfrpoint) { int handle; struct GHExtension *extension; @@ -359,6 +405,34 @@ int CCTKi_rfrTraverseGHExtensions(cGH *GH, int rfrpoint) return 0; } + /*@@ + @routine CCTKi_ScheduleTraverseGHExtensions + @date Thu Jan 27 14:47:06 2000 + @author Tom Goodale + @desc + Calls the routines which an extension needs called at a schedule traversal. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTKi_ScheduleTraverseGHExtensions(cGH *GH, + const char *where) +{ + int handle; + struct GHExtension *extension; + + for(handle = 0; handle < num_extensions; handle++) + { + extension = (struct GHExtension *)Util_GetHandledData(GHExtensions, handle); + extension->ScheduleTraverseGH(GH, where); + } + + return 0; +} /*************************************************************************** * @@ -431,6 +505,17 @@ static int CheckAllExtensionsSetup(void) extension->rfrTraverseGH=DummyrfrTraverseGH; } + /* ScheduleTraverse */ + if(!extension->ScheduleTraverseGH) + { + const char *handlename = Util_GetHandleName(GHExtensions, handle); + char *message = (char *)malloc(300*sizeof(char)); + sprintf(message,"GH Extension '%s' has not registered a ScheduleTraverse routine",handlename); + CCTK_Warn(4,__LINE__,__FILE__,"Cactus",message) ; + free(message); + extension->ScheduleTraverseGH=DummyScheduleTraverseGH; + } + } return return_code; @@ -491,7 +576,9 @@ void FMODIFIER FORTRAN_NAME(CCTK_GHExtensionHandle)(int *handle,ONE_FORTSTRING_ @endhistory @@*/ -static void *DummySetupGH(tFleshConfig *config, int convergence_level, cGH *GH) +static void *DummySetupGH(tFleshConfig *config, + int convergence_level, + cGH *GH) { return NULL; } @@ -531,8 +618,28 @@ static int DummyInitGH(cGH *GH) @endhistory @@*/ -static int DummyrfrTraverseGH(cGH *GH, int rfrpoint) +static int DummyrfrTraverseGH(cGH *GH, + int rfrpoint) { return 0; } + /*@@ + @routine DummyScheduleTraverseGH + @date Thu Jan 27 14:34:41 2000 + @author Tom Goodale + @desc + + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +static int DummyScheduleTraverseGH(cGH *GH, + const char *where) +{ + return 0; +} diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c index 2c6f9e69..d14a053b 100644 --- a/src/main/ScheduleInterface.c +++ b/src/main/ScheduleInterface.c @@ -5,6 +5,7 @@ @desc Routines to interface the main part of Cactus to the schedular. @enddesc + @version $Header$ @@*/ static char *rcsid = "$Header$"; @@ -34,8 +35,8 @@ static char *rcsid = "$Header$"; ********************* Local Data Types *********************** ********************************************************************/ -typedef enum {sched_none, sched_group, sched_function} t_sched_type; -typedef enum {schedpoint_misc, schedpoint_analysis} t_schedpoint; +typedef enum {sched_none, sched_group, sched_function} iSchedType; +typedef enum {schedpoint_misc, schedpoint_analysis} iSchedPoint; typedef struct { @@ -45,7 +46,7 @@ typedef struct char *thorn; char *implementation; - t_sched_type type; + iSchedType type; cFunctionData FunctionData; @@ -73,7 +74,7 @@ typedef struct typedef struct { cGH *GH; - t_schedpoint schedpoint; + iSchedPoint schedpoint; int whiling; @@ -420,7 +421,7 @@ int CCTKi_ScheduleGroupComm(const char *group) /*@@ - @routine CCTKi_ScheduleTraverse + @routine CCTK_ScheduleTraverse @date Fri Sep 17 21:52:44 1999 @author Tom Goodale @desc @@ -434,9 +435,9 @@ int CCTKi_ScheduleGroupComm(const char *group) @@*/ -int CCTKi_ScheduleTraverse(const char *where, - void *GH, - int (*CallFunction)(void *, cFunctionData *, void *)) +int CCTK_ScheduleTraverse(const char *where, + void *GH, + int (*CallFunction)(void *, cFunctionData *, void *)) { t_sched_data data; @@ -453,15 +454,6 @@ int CCTKi_ScheduleTraverse(const char *where, data.CallFunction = CCTK_CallFunction; } - if(CCTK_Equals(where, "CCTK_STARTUP")) - { - calling_function = CCTKi_ScheduleStartupFunction; - } - else - { - calling_function = CCTKi_ScheduleCallFunction; - } - if(CCTK_Equals(where, "CCTK_ANALYSIS")) { data.schedpoint = schedpoint_analysis; @@ -470,6 +462,8 @@ int CCTKi_ScheduleTraverse(const char *where, { data.schedpoint = schedpoint_misc; } + + calling_function = CCTKi_ScheduleCallFunction; CCTKi_DoScheduleTraverse ( @@ -850,8 +844,6 @@ static cFunctionType TranslateFunctionType(const char *where) retcode = FunctionStandard; } - printf("I've been called, where is %s\n", where); - return retcode; } @@ -1243,27 +1235,8 @@ static int CCTKi_ScheduleCallFunction(void *function, t_attribute *attribute, t_sched_data *data) { - - void (*calledfunc)(void *); - CCTK_TimerStartI(attribute->timer_handle); -#if 0 - if(attribute->FunctionData.language == LangFortran) - { - /* Call the fortran wrapper. */ - attribute->FunctionData.FortranCaller(data->GH, function); - } - else - { - calledfunc = (void (*)(void *))function; - - /* Call the function. */ - - calledfunc(data->GH); - } -#endif - /* Use whatever has been chosen as the calling function for this * function. */ @@ -1275,42 +1248,6 @@ static int CCTKi_ScheduleCallFunction(void *function, } /******************************************************************** - *************** Specialised Startup Routines ******************** - ********************************************************************/ - - /*@@ - @routine CCTKi_ScheduleStartupFunction - @date Sun Sep 19 13:30:00 1999 - @author Tom Goodale - @desc - Startup routines take no arguments, so use this calling function instead - of the one generally used. - @enddesc - @calls - @calledby - @history - - @endhistory - -@@*/ -static int CCTKi_ScheduleStartupFunction(void *function, - t_attribute *attribute, - t_sched_data *data) -{ - - int (*calledfunc)(void); - - calledfunc = (int (*)(void))function; - - /* Call the function. */ - - calledfunc(); - - return 1; -} - - -/******************************************************************** **************** Timer Printing Routines ********************* ********************************************************************/ diff --git a/src/main/rfrInterface.c b/src/main/rfrInterface.c index 96d0edcc..0adc2ab9 100644 --- a/src/main/rfrInterface.c +++ b/src/main/rfrInterface.c @@ -5,6 +5,7 @@ @desc Routine used by cactus to talk to the rfr. @enddesc + @version $Header$ @@*/ /*#define RFRDEBUG*/ @@ -12,17 +13,14 @@ #include <stdio.h> #include <stdlib.h> +#include "cctk.h" +#include "cctk_WarnLevel.h" #include "cctk_Flesh.h" #include "cctk_GHExtensions.h" -#include "cctk_Groups.h" -#include "cctk_WarnLevel.h" -#include "cctk_IOMethods.h" -#include "cctk_Parameters.h" - -#include "CactusCommFunctions.h" #include "CactusrfrInterface.h" #include "rfrConstants.h" #include "rfrInterface.h" +#include "cctk_Schedule.h" static char *rcsid = "$Header$"; @@ -43,6 +41,8 @@ static char *rcsid = "$Header$"; @@*/ int CCTK_rfrTraverse(cGH *GH, int rfrpoint) { + + CCTK_WARN(1, "CCTK_rfrTraverse is deprecated, please use CCTK_Traverse"); CCTKi_rfrTraverseGHExtensions(GH, rfrpoint); @@ -51,12 +51,13 @@ int CCTK_rfrTraverse(cGH *GH, int rfrpoint) #include "cctki_Schedule.h" -/*#define SCHEDULE(x) case CCTK_ ## x : CCTKi_ScheduleTraverse("CCTK_" #x, data); break*/ - -#define SCHEDULE(x) case CCTK_ ## x : CCTKi_ScheduleTraverse("CCTK_" #x, data, NULL); break +#define SCHEDULE(x) case CCTK_ ## x : CCTK_ScheduleTraverse("CCTK_" #x, data, NULL); break void rfrTraverse(void *rfr_top, void *data, int when) { + + CCTK_WARN(1, "rfrTraverse is deprecated, please use CCTK_ScheduleTraverse"); + switch(when) { SCHEDULE(PARAMCHECK); @@ -80,3 +81,26 @@ void rfrTraverse(void *rfr_top, void *data, int when) return; } + + /*@@ + @routine CCTK_Traverse + @date Thu Jan 27 14:42:16 2000 + @author Tom Goodale + @desc + Routine called to traverse functions + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTK_Traverse(cGH *GH, const char *where) +{ + int retcode; + + retcode = CCTKi_ScheduleTraverseGHExtensions(GH, where); + + return retcode; +} |