diff options
Diffstat (limited to 'src/Output.c')
-rw-r--r-- | src/Output.c | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/src/Output.c b/src/Output.c index 828e8e1..075ab8b 100644 --- a/src/Output.c +++ b/src/Output.c @@ -21,7 +21,9 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(BetaThorns_IOStreamedHDF5_Output_c) -/* function prototypes */ +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ static void CheckSteerableParameters (ioStreamedHDF5GH *myGH); @@ -41,14 +43,20 @@ static void CheckSteerableParameters (ioStreamedHDF5GH *myGH); @vtype const cGH * @vio in @endvar + + @returntype int + @returndesc + the number of variables which were output at this iteration + (or 0 if it wasn't time to output yet) + @endreturndesc @@*/ int IOStreamedHDF5_OutputGH (const cGH *GH) { - DECLARE_CCTK_PARAMETERS - int vindex; + int vindex, retval; ioStreamedHDF5GH *myGH; const char *name; char *fullname; + DECLARE_CCTK_PARAMETERS /* Get the GH extension for IOStreamedHDF5 */ @@ -62,7 +70,7 @@ int IOStreamedHDF5_OutputGH (const cGH *GH) } /* Loop over all variables */ - for (vindex = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) { if (IOStreamedHDF5_TimeFor (GH, vindex)) @@ -78,16 +86,18 @@ int IOStreamedHDF5_OutputGH (const cGH *GH) "= ('%s' / '%s')", fullname, name); } - IOStreamedHDF5_OutputVarAs (GH, fullname, name); + if (IOStreamedHDF5_OutputVarAs (GH, fullname, name) == 0) + { + /* Register variable as having output this iteration */ + myGH->out_last[vindex] = GH->cctk_iteration; + retval++; + } free (fullname); - - /* Register variable as having output this iteration */ - myGH->out_last[vindex] = GH->cctk_iteration; } } - return (0); + return (retval); } @@ -118,13 +128,18 @@ int IOStreamedHDF5_OutputGH (const cGH *GH) @vtype const char * @vio in @endvar + + @returntype int + @returndesc + return code of @seeroutine IOStreamedHDF5_Write + @endreturndesc @@*/ int IOStreamedHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) { + int vindex, retval; DECLARE_CCTK_PARAMETERS - int vindex; vindex = CCTK_VarIndex (fullname); @@ -137,9 +152,9 @@ int IOStreamedHDF5_OutputVarAs (const cGH *GH, } /* Do the output */ - IOStreamedHDF5_Write (GH, vindex, alias); + retval = IOStreamedHDF5_Write (GH, vindex, alias); - return (0); + return (retval); } @@ -226,14 +241,20 @@ int IOStreamedHDF5_TimeFor (const cGH *GH, @vtype int @vio in @endvar + + @returntype int + @returndesc + return code of @seeroutine IOStreamedHDF5_Write + @endreturndesc @@*/ int IOStreamedHDF5_TriggerOutput (const cGH *GH, int vindex) { - DECLARE_CCTK_PARAMETERS + int retval; ioStreamedHDF5GH *myGH; char *fullname; const char *varname; + DECLARE_CCTK_PARAMETERS varname = CCTK_VarName (vindex); @@ -250,18 +271,21 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH, } /* Do the output */ - IOStreamedHDF5_Write (GH, vindex, varname); + retval = IOStreamedHDF5_Write (GH, vindex, varname); - /* Register variable as having output this iteration */ - myGH->out_last[vindex] = GH->cctk_iteration; + if (retval == 0) + { + /* Register variable as having output this iteration */ + myGH->out_last[vindex] = GH->cctk_iteration; + } - return (0); + return (retval); } -/***************************************************************************/ -/* local functions */ -/***************************************************************************/ +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ /*@@ @routine CheckSteerableParameters @date Mon Oct 10 2000 @@ -281,9 +305,9 @@ int IOStreamedHDF5_TriggerOutput (const cGH *GH, @@*/ static void CheckSteerableParameters (ioStreamedHDF5GH *myGH) { - DECLARE_CCTK_PARAMETERS int times_set; static int out_vars_lastset = -1; + DECLARE_CCTK_PARAMETERS /* How often to output */ @@ -302,5 +326,4 @@ static void CheckSteerableParameters (ioStreamedHDF5GH *myGH) /* Save the last setting of 'out_vars' parameter */ out_vars_lastset = times_set; } - } |