summaryrefslogtreecommitdiff
path: root/src/main/ScheduleInterface.c
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-01-27 23:18:16 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-01-27 23:18:16 +0000
commit1a53d2c962018be2fa3f7299f4fbdae342149768 (patch)
tree3c3b8afc80b4190cfe2839d172fa1391b6dbf4f6 /src/main/ScheduleInterface.c
parent56543d22f0bdfe6c45d557ecf1d7872b4ad47a98 (diff)
Added the mechanism for allowing drivers to specify a function to be
called at the bottm of a schedule traverse, and changed the flesh to use the new calls. rfrTraverse is now obsolete and will be removed soon. Drivers may now call int CCTK_RegisterGHExtensionScheduleTraverseGH(int handle, int (*func)(cGH *, const char *)) to register a ScheduleTraverse function. This is precisely equivalent to the deprecated CCTK_RegisterGHExtensionrfrTraverseGH except the registered function now takes a string and not a constant. The registered function should then fill out the cGH as per normal, and call int CCTK_ScheduleTraverse(const char *where, void *GH, int (*CallFunction)(void *, cFunctionData *, void *)) with the string and GH passed in, and either NULL or a function which takes a function pointer, a cFunctionData data structure, and a cGH. This function, in turn, may call int CCTK_CallFunction(void *function, cFunctionData *fdata, void *data) with these arguments, or may call the function in some other way if it desires. This allows a driver to loop over all sub-grids at a particular level filling out the cGH at this level of the schedule tree rather than at the top, which was the only option available before. Unigrid drivers should probably still fill out at the top and pass NULL down as it's more efficient to fill out the cGH only once, but AMR or multi-block/patch drivers can now use this mechanism. The old CCTK_rfrTraverse routine has similarly been replaced by int CCTK_Traverse(cGH *GH, const char *where) which loops over all GH extensions calling their registered ScheduleTraverseGH routines. Tom NB these names may change at the next naming meeting, but the functionality should remain. git-svn-id: http://svn.cactuscode.org/flesh/trunk@1317 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/ScheduleInterface.c')
-rw-r--r--src/main/ScheduleInterface.c85
1 files changed, 11 insertions, 74 deletions
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 *********************
********************************************************************/