diff options
author | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2000-09-21 13:27:24 +0000 |
---|---|---|
committer | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2000-09-21 13:27:24 +0000 |
commit | a5d7feeaab6b0403614556138cfe14ac7bae0a52 (patch) | |
tree | 93939672de22f8542a074f96ce526fb496c5bdd5 /src/OutputInfo.c | |
parent | 7114a790a7a4ab16decbb344656c93f41fae18b6 (diff) |
Removed ioGH.h from include list.
Use CCTK_TraverseString() to parse the output strings.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@69 b589c3ab-70e8-4b4d-a09f-cba2dd200880
Diffstat (limited to 'src/OutputInfo.c')
-rw-r--r-- | src/OutputInfo.c | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/src/OutputInfo.c b/src/OutputInfo.c index b077375..2847554 100644 --- a/src/OutputInfo.c +++ b/src/OutputInfo.c @@ -7,7 +7,7 @@ @enddesc @@*/ -/*#define IO_DEBUG*/ +/*#define IO_DEBUG 1*/ #include <math.h> #include <stdio.h> @@ -16,7 +16,6 @@ #include "cctk.h" #include "cctk_Parameters.h" -#include "CactusBase/IOUtil/src/ioGH.h" #include "iobasicGH.h" @@ -27,9 +26,12 @@ ((x) == 0.0) || \ (fabs(x) < DECIMAL_TOOBIG)) +/* function prototypes */ +static void SetOutputFlag (int index, const char *optstring, void *arg); + /* static variables */ -static int print_header = 0; -static int outInfo_vars_lastset = 0; +static int print_header = 1; +static int outInfo_vars_lastset = -1; /*@@ @@ -57,9 +59,9 @@ int IOBasic_OutputInfoGH (cGH *GH) int i; int ierr1; int ierr2; + int times_set; const char *varname; iobasicGH *myGH; - const cParamData *paramdata; /* Get the GH extensions for IOBasic */ @@ -79,24 +81,20 @@ int IOBasic_OutputInfoGH (cGH *GH) return (0); } - /* Check the 'outInfo_vars' parameter */ - paramdata = CCTK_ParameterData ("outInfo_vars", CCTK_THORNSTRING); - if (! paramdata) - { - CCTK_WARN (1, "Couldn't get info on parameter 'outInfo_vars'"); - return (0); - } - /* re-parse the 'outInfo_vars' parameter if it was changed and also print a header */ - if (paramdata->n_set != outInfo_vars_lastset) + times_set = CCTK_ParameterQueryTimesSet ("outInfo_vars", CCTK_THORNSTRING); + if (times_set != outInfo_vars_lastset) { int do_outInfo; - IOUtil_ParseVarsForOutput (outInfo_vars, myGH->do_outInfo); + + memset (myGH->do_outInfo, 0, CCTK_NumVars ()); + CCTK_TraverseString (outInfo_vars, SetOutputFlag, myGH->do_outInfo, + CCTK_GROUP_OR_VAR); /* Save the last setting of 'outInfo_vars' parameter */ - outInfo_vars_lastset = paramdata->n_set; + outInfo_vars_lastset = times_set; do_outInfo = 0; for (i = 0; i < CCTK_NumVars (); i++) @@ -264,8 +262,8 @@ int IOBasic_TimeForInfo (cGH *GH, int index) { DECLARE_CCTK_PARAMETERS int retval; + int times_set; iobasicGH *myGH; - const cParamData *paramdata; /* Default is do not do output */ @@ -287,22 +285,17 @@ int IOBasic_TimeForInfo (cGH *GH, int index) return (0); } - /* Check the 'outInfo_vars' parameter */ - paramdata = CCTK_ParameterData ("outInfo_vars", CCTK_THORNSTRING); - if (! paramdata) - { - CCTK_WARN (1, "Couldn't get info on parameter 'outInfo_vars'"); - return (0); - } - /* re-parse the 'outInfo_vars' parameter if it was changed and also print a header */ - if (paramdata->n_set != outInfo_vars_lastset) + times_set = CCTK_ParameterQueryTimesSet ("outInfo_vars", CCTK_THORNSTRING); + if (times_set != outInfo_vars_lastset) { - IOUtil_ParseVarsForOutput (outInfo_vars, myGH->do_outInfo); + memset (myGH->do_outInfo, 0, CCTK_NumVars ()); + CCTK_TraverseString (outInfo_vars, SetOutputFlag, myGH->do_outInfo, + CCTK_GROUP_OR_VAR); /* Save the last setting of 'outInfo_vars' parameter */ - outInfo_vars_lastset = paramdata->n_set; + outInfo_vars_lastset = times_set; print_header = 1; } @@ -319,7 +312,7 @@ int IOBasic_TimeForInfo (cGH *GH, int index) CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING, - "Already done Info output for variable '%s' in current " + "Already done Info output for '%s' in current " "iteration (probably via triggers)", fullname); free (fullname); } @@ -384,3 +377,21 @@ int IOBasic_TriggerOutputInfo (cGH *GH, int index) return 0; } + + +/**************************** local functions ******************************/ +/* callback for CCTK_TraverseString() to set the output flag + for the given variable */ +static void SetOutputFlag (int index, const char *optstring, void *arg) +{ + char *flags = (char *) arg; + + + flags[index] = 1; + + if (optstring) + { + CCTK_VWarn (5, __LINE__, __FILE__, CCTK_THORNSTRING, + "Optional string '%s' in variable name ignored", optstring); + } +} |