diff options
author | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2001-12-28 21:40:25 +0000 |
---|---|---|
committer | tradke <tradke@4825ed28-b72c-4eae-9704-e50c059e567d> | 2001-12-28 21:40:25 +0000 |
commit | 8a6b1bab6403eb67ccb68492506087ed9a211b57 (patch) | |
tree | 6902be465ca3877b18a5726293219413e17e806a /src/Output.c | |
parent | b95e1324355fb675877cae4c5e491bf8b2bd5d8e (diff) |
Fixed return codes of I/O methods.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@76 4825ed28-b72c-4eae-9704-e50c059e567d
Diffstat (limited to 'src/Output.c')
-rw-r--r-- | src/Output.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/Output.c b/src/Output.c index 7a42230..cfad37b 100644 --- a/src/Output.c +++ b/src/Output.c @@ -20,9 +20,9 @@ static const char *rcsid = "$Id$"; CCTK_FILEVERSION(AlphaThorns_IOHDF5_Output_c) -/* prototypes of routines defined in this source file */ -int IOHDF5_TimeFor (const cGH *GH, int vindex); -int IOHDF5_OutputVarAs (const cGH *GH, const char *var, const char *alias); +/******************************************************************** + ******************** Internal Routines ************************ + ********************************************************************/ static void CheckSteerableParameters (ioHDF5GH *myGH); @@ -45,13 +45,14 @@ static void CheckSteerableParameters (ioHDF5GH *myGH); @returntype int @returndesc - always 0 + the number of variables which were output at this iteration + (or 0 if it wasn't time to output yet) @endreturndesc @@*/ int IOHDF5_OutputGH (const cGH *GH) { DECLARE_CCTK_PARAMETERS - int vindex; + int vindex, retval; ioHDF5GH *myGH; const char *name; char *fullname; @@ -68,7 +69,7 @@ int IOHDF5_OutputGH (const cGH *GH) } /* Loop over all variables */ - for (vindex = 0; vindex < CCTK_NumVars (); vindex++) + for (vindex = retval = 0; vindex < CCTK_NumVars (); vindex++) { if (IOHDF5_TimeFor (GH, vindex)) @@ -82,16 +83,18 @@ int IOHDF5_OutputGH (const cGH *GH) "(%s / %s)", fullname, name); } - IOHDF5_OutputVarAs (GH, fullname, name); + if (IOHDF5_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); } @@ -173,7 +176,7 @@ int IOHDF5_OutputVarAs (const cGH *GH, const char *fullname, const char *alias) @returntype int @returndesc - 1 if output should take place + 1 if output should take place at this iteration, or<BR> 0 if not @endreturndesc @@*/ @@ -261,8 +264,11 @@ int IOHDF5_TriggerOutput (const cGH *GH, int vindex) /* Do the output */ retval = IOHDF5_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 (retval); } |