diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-01-27 18:31:21 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-01-27 18:31:21 +0000 |
commit | 3476a41713d8ba22e68990f9690ec12005298c89 (patch) | |
tree | 47470435cf80f890335c37133540207dfa414117 | |
parent | 532e9ef752cc07970c2d9a83f1129636ee03c80b (diff) |
Latest stuff for the scheduling call function.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1311 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | src/include/cctki_ScheduleBindings.h | 2 | ||||
-rw-r--r-- | src/main/ScheduleInterface.c | 74 |
2 files changed, 72 insertions, 4 deletions
diff --git a/src/include/cctki_ScheduleBindings.h b/src/include/cctki_ScheduleBindings.h index 7b3b6030..2e1d32a8 100644 --- a/src/include/cctki_ScheduleBindings.h +++ b/src/include/cctki_ScheduleBindings.h @@ -52,7 +52,7 @@ int CCTKi_ScheduleGroupComm(const char *group); int CCTKi_ScheduleTraverse(const char *where, void *GH, - int (*CallFunction)(cFunctionData *, void *)); + int (*CallFunction)(void *, cFunctionData *, void *)); int CCTKi_ScheduleGHInit(void *GH); diff --git a/src/main/ScheduleInterface.c b/src/main/ScheduleInterface.c index c3570873..ba16e87d 100644 --- a/src/main/ScheduleInterface.c +++ b/src/main/ScheduleInterface.c @@ -82,7 +82,7 @@ typedef struct /* Stuff passed in in user calls */ - int (*CallFunction)(cFunctionData *, void *); + int (*CallFunction)(void *, cFunctionData *, void *); } t_sched_data; @@ -164,6 +164,56 @@ static t_TimerInfo *timerinfo = NULL; ********************************************************************/ /*@@ + @routine CCTK_CallFunction + @date Thu Jan 27 11:29:47 2000 + @author Tom Goodale + @desc + Calls a function depending upon the data passed in the the + fdata structure. + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ +int CCTK_CallFunction(void *function, + cFunctionData *fdata, + void *data) +{ + void (*standardfunc)(void *); + + int (*noargsfunc)(void); + + switch(fdata->type) + { + case FunctionNoArgs: + noargsfunc = (int (*)(void))function; + noargsfunc(); + break; + case FunctionStandard: + switch(fdata->language) + { + case LangC: + standardfunc = (void (*)(void *))function; + standardfunc(data); + break; + case LangFortran: + fdata->FortranCaller(data, function); + break; + default : + CCTK_WARN(1, "Unknown language."); + } + break; + default : + CCTK_WARN(1, "Unknown function type."); + } + + return 0; +} + + /*@@ @routine CCTKi_ScheduleFunction @date Thu Sep 16 18:19:01 1999 @author Tom Goodale @@ -386,14 +436,22 @@ int CCTKi_ScheduleGroupComm(const char *group) int CCTKi_ScheduleTraverse(const char *where, void *GH, - int (*CallFunction)(cFunctionData *, void *)) + int (*CallFunction)(void *, cFunctionData *, void *)) { t_sched_data data; int (*calling_function)(void *, t_attribute *, t_sched_data *); data.GH = (cGH *)GH; - data.CallFunction = CallFunction; + + if(CallFunction) + { + data.CallFunction = CallFunction; + } + else + { + data.CallFunction = CCTK_CallFunction; + } if(CCTK_Equals(where, "CCTK_STARTUP")) { @@ -792,6 +850,8 @@ static cFunctionType TranslateFunctionType(const char *where) retcode = FunctionStandard; } + printf("I've been called, where is %s\n", where); + return retcode; } @@ -1187,6 +1247,8 @@ static int CCTKi_ScheduleCallFunction(void *function, void (*calledfunc)(void *); CCTK_TimerStartI(attribute->timer_handle); + +#if 0 if(attribute->FunctionData.language == LangFortran) { /* Call the fortran wrapper. */ @@ -1200,6 +1262,12 @@ static int CCTKi_ScheduleCallFunction(void *function, calledfunc(data->GH); } +#endif + + /* Use whatever has been chosen as the calling function for this + * function. + */ + data->CallFunction(function, &(attribute->FunctionData), data->GH); CCTK_TimerStopI(attribute->timer_handle); |