diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-01-20 09:02:19 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-01-20 09:02:19 +0000 |
commit | 5531da65218951b61b3b4e9961a897ac110cb3bf (patch) | |
tree | b3d9e8c474898d9f406e5a342e9dba4f9b046719 | |
parent | eaa1066a2272dbb3f9cf8eb457bfab69d8d51ab5 (diff) |
Now call the functions in the CatusBindings library.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@86 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | src/main/CallStartupFunctions.c | 4 | ||||
-rw-r--r-- | src/main/InitialiseDataStructures.c | 150 | ||||
-rw-r--r-- | src/main/SetParams.c | 92 |
3 files changed, 24 insertions, 222 deletions
diff --git a/src/main/CallStartupFunctions.c b/src/main/CallStartupFunctions.c index bcc17c14..4de330c8 100644 --- a/src/main/CallStartupFunctions.c +++ b/src/main/CallStartupFunctions.c @@ -34,6 +34,8 @@ int dummy(tFleshConfig *); int CallStartupFunctions(tFleshConfig *ConfigData) { + CCTK_BindingsScheduleRegister("STARTUP", NULL); + /* RegisterMainFunction(0, dummy); RegisterMainFunction(1, dummy); @@ -42,6 +44,8 @@ int CallStartupFunctions(tFleshConfig *ConfigData) */ SetupMainFunctions(); SetupCommFunctions(); + SetupIOFunctions(); + return 0; } diff --git a/src/main/InitialiseDataStructures.c b/src/main/InitialiseDataStructures.c index 98cd9364..7abb8f50 100644 --- a/src/main/InitialiseDataStructures.c +++ b/src/main/InitialiseDataStructures.c @@ -13,150 +13,36 @@ #include "flesh.h" -#include "Implementations.h" -#include "StoreVariableData.h" - static char *rcsid = "$Id$"; -#define TEST_THORNREGISTRATION -#ifdef TEST_THORNREGISTRATION - -int test_startup(); -int test_rfr_init(cGH *); -int test_param_init(); -int test_param_set(const char *, const char *); -int test_param_get(const char *, void **); -int test_private_group_setup(cGH *); -int test_protected_group_setup(cGH *); -int test_public_group_setup(cGH *); - - -static t_thorndata thorndata[] = {"test", "test", test_startup, test_rfr_init, test_param_init, test_param_set, test_param_get, test_private_group_setup, test_protected_group_setup, test_public_group_setup}; - -static int n_thorns=1; - -#else -#include "thorndata.h" - -#endif + /*@@ + @routine InitialiseDataStructures + @date Wed Jan 20 09:27:56 1999 + @author Tom Goodale + @desc + + @enddesc + @calls + @calledby + @history + + @endhistory +@@*/ int InitialiseDataStructures(tFleshConfig *ConfigData) { - int i; - ConfigData->nGHs = 0; ConfigData->GH = NULL; - for(i=0; i < n_thorns; i++) - { - CCTK_RegisterThorn(thorndata[i].name, thorndata[i].implementation, - &(thorndata[i])); - } - - return 0; -} - -#ifdef TEST_THORNREGISTRATION - -static struct -{ - int test_int; - double test_double; - char test_keyword[20]; -} test_params = {1,1.5,"alpha"}; - -int test_startup() -{ -} - -int test_rfr_init(cGH *GH) -{ -} - -int test_param_init() -{ -} - -int test_param_set(const char *param, const char *value) -{ - char temp[1001]; - char *test; - int p; - - if(!strcmp(param, "test_int")) - { - test_params.test_int = atoi(value); - } - - if(!strcmp(param, "test_double")) - { - strncpy(temp, value, 1000); - - for (p=0;p<strlen(temp);p++) - if (temp[p] == 'E' || temp[p] == 'd' || temp[p] == 'D') - temp[p] = 'e'; - test_params.test_double = atof(temp); - } - - if(!strcmp(param, "test_keyword")) - { - if(!strcmp(value,"alpha")|| - !strcmp(value,"beta")) - { - strcpy(test_params.test_keyword, value); - } - } - -} - -int test_param_get(const char *param, void **value) -{ - int retval; - - int *temp_int; - double *temp_double; - char *temp_char; + /* Initialise appropriate subsystems. */ - retval = 0; - if(!strcmp(param, "test_int")) - { - temp_int = (int *)malloc(sizeof(int)); - *temp_int = test_params.test_int; - *value = (void *)temp_int; - retval = 1; - } + CCTK_BindingsParametersInitialise(); + CCTK_BindingsVariablesInitialise(); + CCTK_BindingsScheduleInitialise(); - if(!strcmp(param, "test_double")) - { - temp_double = (double *)malloc(sizeof(double)); - *temp_double = test_params.test_double; - *value = (void *)temp_double; - retval = 2; - } - if(!strcmp(param, "test_keyword")) - { - temp_char = (char *)malloc(strlen((test_params.test_keyword)+1)*sizeof(char)); - strcpy(temp_char, test_params.test_keyword); - *value = (void *)temp_char; - retval = 3; - } - - return retval; - -} -int test_private_group_setup(cGH *GH) -{ -} -int test_protected_group_setup(cGH *GH) -{ -} -int test_public_group_setup(cGH *GH) -{ + return 0; } - -#endif - diff --git a/src/main/SetParams.c b/src/main/SetParams.c index 45da1178..cce1c646 100644 --- a/src/main/SetParams.c +++ b/src/main/SetParams.c @@ -16,12 +16,6 @@ static char *rcsid = "$Id$"; -int CCTK_ExtractImplementation(char **imp, char **name, const char *parameter); -int CCTK_FindImpOfGlobalParam(char **imp, char **name, const char *parameter); -int CCTK_SetImplementationParameter(const char *imp, - const char *name, - const char *value); - /*@@ @routine CCTK_SetParameter @date Tue Jan 12 19:25:37 1999 @@ -39,29 +33,15 @@ int CCTK_SetImplementationParameter(const char *imp, int CCTK_SetParameter(const char *parameter, const char *value) { int retval; - char *imp; - char *name; - CCTK_ExtractImplementation(&imp, &name, parameter); + retval = CCTK_BindingsParameterSet(parameter, value); - if(!imp) - { - CCTK_FindImpOfGlobalParam(&imp, &name, parameter); - } - if(imp) - { - retval = CCTK_SetImplementationParameter(imp, name, value); - } - else + if(!retval) { fprintf(stderr, "Unknown parameter %s\n", parameter); - retval = 1; } - free(imp); - free(name); - return retval; } @@ -125,71 +105,3 @@ int CCTK_ExtractImplementation(char **imp, char **name, const char *parameter) return retval; } - /*@@ - @routine CCTK_FindImpOfGlobalParam - @date Wed Jan 13 11:25:00 1999 - @author Tom Goodale - @desc - Finds the implementation name of a global (public) parameter. - @enddesc - @calls - @calledby - @history - - @endhistory - -@@*/ -int CCTK_FindImpOfGlobalParam(char **imp, char **name, const char *parameter) -{ - *imp = NULL; - *name = NULL; - - - return 1; -} - - - /*@@ - @routine CCTK_SetImplementationParameter - @date Wed Jan 13 11:25:53 1999 - @author Tom Goodale - @desc - Sets the value of the parameter in an implementation. - @enddesc - @calls - @calledby - @history - - @endhistory - -@@*/ -int CCTK_SetImplementationParameter(const char *imp, - const char *name, - const char *value) -{ - int n_thorns; - int thorn; - - char **thornlist; - t_thorndata *thorndata; - - if((n_thorns = GetImplementationThorns(imp, þlist))) - { - for(thorn = 0; thorn < n_thorns; thorn++) - { - if(GetThornData(thornlist[thorn], þdata)) - { - thorndata->param_set(name, value); - } - } - } - else - { - if(GetThornData(imp, þdata)) - { - thorndata->param_set(name, value); - } - } - - return 0; -} |