diff options
author | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2001-12-28 21:22:52 +0000 |
---|---|---|
committer | tradke <tradke@b589c3ab-70e8-4b4d-a09f-cba2dd200880> | 2001-12-28 21:22:52 +0000 |
commit | feb8726f2ab8a7004de5a3a9117d91d916ca86ae (patch) | |
tree | a268e18148368a30529419935604808475b365c3 /src/OutputInfo.c | |
parent | 246994c0b838df1ce00b5bd31c7b355a961089f6 (diff) |
Fixed return code of I/O methods.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOBasic/trunk@110 b589c3ab-70e8-4b4d-a09f-cba2dd200880
Diffstat (limited to 'src/OutputInfo.c')
-rw-r--r-- | src/OutputInfo.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/OutputInfo.c b/src/OutputInfo.c index 5b9fe5b..96af228 100644 --- a/src/OutputInfo.c +++ b/src/OutputInfo.c @@ -79,15 +79,16 @@ static void PrintHeader (iobasicGH *myGH, int num_vars); @returntype int @returndesc - 0 for success + the number of variables which were output at this iteration + (or 0 if it wasn't time to output yet) @endreturndesc @@*/ int IOBasic_InfoOutputGH (const cGH *GH) { - DECLARE_CCTK_PARAMETERS - int vindex, num_vars; + int vindex, num_vars, retval; iobasic_reduction_t *reduction; iobasicGH *myGH; + DECLARE_CCTK_PARAMETERS /* get the GH extensions for IOBasic */ @@ -105,7 +106,7 @@ int IOBasic_InfoOutputGH (const cGH *GH) /* print header if neccessary */ num_vars = CCTK_NumVars (); if (myGH->info_reductions_changed) - { + { PrintHeader (myGH, num_vars); } @@ -120,7 +121,7 @@ int IOBasic_InfoOutputGH (const cGH *GH) } /* loop over all variables */ - for (vindex = 0; vindex < num_vars; vindex++) + for (vindex = retval = 0; vindex < num_vars; vindex++) { /* check this variable should be output */ if (myGH->info_reductions[vindex].num_reductions == 0) @@ -139,10 +140,12 @@ int IOBasic_InfoOutputGH (const cGH *GH) #endif /* get the data to output */ - IOBasic_WriteInfo (GH, vindex); - - /* register variable as having info output this iteration */ - myGH->outInfo_last[vindex] = GH->cctk_iteration; + if (IOBasic_WriteInfo (GH, vindex) == 0) + { + /* register variable as having info output this iteration */ + myGH->outInfo_last[vindex] = GH->cctk_iteration; + retval++; + } } /* finally print the stuff to screen */ @@ -158,7 +161,7 @@ int IOBasic_InfoOutputGH (const cGH *GH) putchar ('\n'); fflush (stdout); - return (0); + return (retval); } @@ -189,10 +192,10 @@ int IOBasic_InfoOutputGH (const cGH *GH) @@*/ int IOBasic_TimeForInfoOutput (const cGH *GH, int vindex) { - DECLARE_CCTK_PARAMETERS int retval; char *fullname; iobasicGH *myGH; + DECLARE_CCTK_PARAMETERS /* get the GH extensions for IOBasic */ @@ -247,13 +250,14 @@ int IOBasic_TimeForInfoOutput (const cGH *GH, int vindex) @returntype int @returndesc - 0 for success + return code of @seeroutine IOBasic_WriteInfo @endreturndesc @@*/ int IOBasic_TriggerInfoOutput (const cGH *GH, int vindex) { - DECLARE_CCTK_PARAMETERS + int retval; iobasicGH *myGH; + DECLARE_CCTK_PARAMETERS /* get the GH extension for IOBasic */ @@ -266,12 +270,15 @@ int IOBasic_TriggerInfoOutput (const cGH *GH, int vindex) #endif /* get the data values to output */ - IOBasic_WriteInfo (GH, vindex); + retval = IOBasic_WriteInfo (GH, vindex); - /* gegister variable as having Info output at this iteration */ - myGH->outInfo_last[vindex] = GH->cctk_iteration; + if (retval == 0) + { + /* gegister variable as having Info output at this iteration */ + myGH->outInfo_last[vindex] = GH->cctk_iteration; + } - return (0); + return (retval); } |