diff options
Diffstat (limited to 'src/Output.c')
-rw-r--r-- | src/Output.c | 72 |
1 files changed, 23 insertions, 49 deletions
diff --git a/src/Output.c b/src/Output.c index 418a5f0..50749d6 100644 --- a/src/Output.c +++ b/src/Output.c @@ -20,8 +20,8 @@ static char *rcsid = "$Id$"; CCTK_FILEVERSION(AlphaThorns_IOHDF5_Output_c) -/* function prototypes */ -int IOHDF5_TimeFor (cGH *GH, int index); +/* prototypes of routines defined in this source file */ +int IOHDF5_TimeFor (cGH *GH, int vindex); int IOHDF5_OutputVarAs (cGH *GH, const char *var, const char *alias); static void CheckSteerableParameters (ioHDF5GH *myGH); @@ -46,7 +46,7 @@ static void CheckSteerableParameters (ioHDF5GH *myGH); int IOHDF5_OutputGH (cGH *GH) { DECLARE_CCTK_PARAMETERS - int index; + int vindex; ioHDF5GH *myGH; const char *name; char *fullname; @@ -63,13 +63,13 @@ int IOHDF5_OutputGH (cGH *GH) } /* Loop over all variables */ - for (index = 0; index < CCTK_NumVars (); index++) + for (vindex = 0; vindex < CCTK_NumVars (); vindex++) { - if (IOHDF5_TimeFor (GH, index)) + if (IOHDF5_TimeFor (GH, vindex)) { - name = CCTK_VarName (index); - fullname = CCTK_FullName (index); + name = CCTK_VarName (vindex); + fullname = CCTK_FullName (vindex); if (verbose) { @@ -82,7 +82,7 @@ int IOHDF5_OutputGH (cGH *GH) free (fullname); /* Register variable as having output this iteration */ - myGH->out_last[index] = GH->cctk_iteration; + myGH->out_last[vindex] = GH->cctk_iteration; } } @@ -121,17 +121,17 @@ int IOHDF5_OutputGH (cGH *GH) int IOHDF5_OutputVarAs (cGH *GH, const char *fullname, const char *alias) { DECLARE_CCTK_PARAMETERS - int index; + int vindex; - index = CCTK_VarIndex (fullname); + vindex = CCTK_VarIndex (fullname); if (verbose) CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_OutputVarAs: fullname, alias, " - "index = (%s, %s, %d)", fullname, alias, index); + "index = (%s, %s, %d)", fullname, alias, vindex); /* Do the output */ - IOHDF5_Write (GH, index, alias); + IOHDF5_Write (GH, vindex, alias); return (0); } @@ -153,7 +153,7 @@ int IOHDF5_OutputVarAs (cGH *GH, const char *fullname, const char *alias) @vtype cGH * @vio in @endvar - @var index + @var vindex @vdesc index of variable @vtype int @vio in @@ -165,7 +165,7 @@ int IOHDF5_OutputVarAs (cGH *GH, const char *fullname, const char *alias) 0 if not @endreturndesc @@*/ -int IOHDF5_TimeFor (cGH *GH, int index) +int IOHDF5_TimeFor (cGH *GH, int vindex) { ioHDF5GH *myGH; @@ -182,13 +182,13 @@ int IOHDF5_TimeFor (cGH *GH, int index) } /* Check this variable should be output */ - if (! (myGH->do_output[index] && GH->cctk_iteration % myGH->out_every == 0)) + if (! (myGH->out_geo[vindex] && GH->cctk_iteration % myGH->out_every == 0)) { return (0); } /* Check variable not already output this iteration */ - if (myGH->out_last[index] == GH->cctk_iteration) + if (myGH->out_last[vindex] == GH->cctk_iteration) { CCTK_WARN (2, "Already done output in IOHDF5"); return (0); @@ -213,13 +213,13 @@ int IOHDF5_TimeFor (cGH *GH, int index) @vtype cGH * @vio in @endvar - @var index + @var vindex @vdesc index of variable @vtype int @vio in @endvar @@*/ -int IOHDF5_TriggerOutput (cGH *GH, int index) +int IOHDF5_TriggerOutput (cGH *GH, int vindex) { DECLARE_CCTK_PARAMETERS ioHDF5GH *myGH; @@ -227,13 +227,13 @@ int IOHDF5_TriggerOutput (cGH *GH, int index) const char *varname; - varname = CCTK_VarName (index); + varname = CCTK_VarName (vindex); myGH = (ioHDF5GH *) CCTK_GHExtension (GH, "IOHDF5"); if (verbose) { - fullname = CCTK_FullName (index); + fullname = CCTK_FullName (vindex); CCTK_VInfo (CCTK_THORNSTRING, "IOHDF5_TriggerOutput: " "output of (varname, fullname) " "= ('%s', '%s')", varname, fullname); @@ -241,10 +241,10 @@ int IOHDF5_TriggerOutput (cGH *GH, int index) } /* Do the output */ - IOHDF5_Write (GH, index, varname); + IOHDF5_Write (GH, vindex, varname); /* Register variable as having output this iteration */ - myGH->out_last[index] = GH->cctk_iteration; + myGH->out_last[vindex] = GH->cctk_iteration; return (0); } @@ -288,35 +288,9 @@ static void CheckSteerableParameters (ioHDF5GH *myGH) times_set = CCTK_ParameterQueryTimesSet ("out_vars", CCTK_THORNSTRING); if (times_set != out_vars_lastset) { - IOHDF5Util_ParseVarsForOutput (out_vars, myGH->do_output, myGH->out_geo); - -#if 0 - FIXME: replace this with real parsing routine - memset (myGH->do_output, 0, CCTK_NumVars ()); - CCTK_TraverseString (out_vars, SetOutputFlag, myGH->do_output, - CCTK_GROUP_OR_VAR); -#endif + IOHDF5Util_ParseVarsForOutput (out_vars, myGH->out_geo); /* Save the last setting of 'out_vars' parameter */ out_vars_lastset = times_set; } } - - -#if 0 -/* 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); - } -} -#endif |