diff options
author | tradke <tradke@eff87b29-5268-4891-90a3-a07138403961> | 2001-12-28 21:38:32 +0000 |
---|---|---|
committer | tradke <tradke@eff87b29-5268-4891-90a3-a07138403961> | 2001-12-28 21:38:32 +0000 |
commit | 9d721ff733351c380fc657d44cdad0847a1d87ab (patch) | |
tree | cd71a8d92099129465b077f4af3b5954e11c3d18 | |
parent | 8c15860162540adb92a0fc0f97d5b698d2a7a846 (diff) |
Fixed return codes of I/O methods.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusIO/IOJpeg/trunk@49 eff87b29-5268-4891-90a3-a07138403961
-rw-r--r-- | src/Output2D.c | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/src/Output2D.c b/src/Output2D.c index a548ce4..58fb05b 100644 --- a/src/Output2D.c +++ b/src/Output2D.c @@ -1,3 +1,14 @@ + /*@@ + @file Output2D.c + @date Sun 23 Dec 2001 + @author Thomas Radke + @desc + Functions to deal with 2D JPeg output. + @enddesc + @version $Id$ + @@*/ + + #include "cctk.h" #include <stdio.h> @@ -32,15 +43,15 @@ static void SetOutputFlag (int vindex, const char *optstring, void *arg); @@*/ int IOJpeg_Output2DGH (const cGH *GH) { - DECLARE_CCTK_PARAMETERS - int i; + int i, retval; IOJpegGH *myGH; const char *name; char *fullname; - int ierr=0; + DECLARE_CCTK_PARAMETERS + /* Get the GH extension for IOJpeg */ - myGH = (IOJpegGH *) GH->extensions [CCTK_GHExtensionHandle ("IOJpeg")]; + myGH = (IOJpegGH *) CCTK_GHExtension (GH, "IOJpeg"); CheckSteerableParameters (myGH); @@ -50,12 +61,10 @@ int IOJpeg_Output2DGH (const cGH *GH) } /* Loop over all variables */ - for (i = 0; i < CCTK_NumVars (); i++) + for (i = retval = 0; i < CCTK_NumVars (); i++) { - if (IOJpeg_TimeFor2D (GH, i)) { - name = CCTK_VarName (i); fullname = CCTK_FullName (i); @@ -65,27 +74,26 @@ int IOJpeg_Output2DGH (const cGH *GH) "%s / %s", fullname, name); } - ierr=IOJpeg_Output2DVarAs (GH, fullname, name); + if (IOJpeg_Output2DVarAs (GH, fullname, name) == 0) + { + /* Register variable as having 2D output this iteration */ + myGH->out2D_last [i] = GH->cctk_iteration; + retval++; + } free (fullname); - - /* Register variable as having 2D output this iteration */ - myGH->out2D_last [i] = GH->cctk_iteration; } } - if (!CCTK_Equals(verbose,"no")) - { - CCTK_INFO("IOJpeg_Output2DGH Done"); - } - return (ierr); + return (retval); } int IOJpeg_Output2DVarAs (const cGH *GH, const char *fullname, const char *alias) { + int vindex, retval; DECLARE_CCTK_PARAMETERS - int vindex,ierr=0; + vindex = CCTK_VarIndex (fullname); @@ -104,11 +112,12 @@ int IOJpeg_Output2DVarAs (const cGH *GH, const char *fullname, const char *alias } /* Do the 2D output */ - ierr=IOJpeg_Write2D (GH, vindex, alias); + retval = IOJpeg_Write2D (GH, vindex, alias); - return (ierr); + return (retval); } + int IOJpeg_TimeFor2D (const cGH *GH, int vindex) { IOJpegGH *myGH; @@ -142,16 +151,18 @@ int IOJpeg_TimeFor2D (const cGH *GH, int vindex) return (1); } + int IOJpeg_TriggerOutput2D (const cGH *GH, int vindex) { - DECLARE_CCTK_PARAMETERS + int retval; IOJpegGH *myGH; const char *varname; - int ierr=0; + DECLARE_CCTK_PARAMETERS + varname = CCTK_VarName (vindex); - myGH = (IOJpegGH *) GH->extensions [CCTK_GHExtensionHandle ("IOJpeg")]; + myGH = (IOJpegGH *) CCTK_GHExtension (GH, "IOJpeg"); if (!CCTK_Equals(verbose,"no")) { @@ -160,12 +171,15 @@ int IOJpeg_TriggerOutput2D (const cGH *GH, int vindex) } /* Do the 2D output */ - ierr=IOJpeg_Write2D (GH, vindex, varname); + retval = IOJpeg_Write2D (GH, vindex, varname); - /* Register variable as having 2D output this iteration */ - myGH->out2D_last [vindex] = GH->cctk_iteration; + if (retval == 0) + { + /* Register variable as having 2D output this iteration */ + myGH->out2D_last [vindex] = GH->cctk_iteration; + } - return (ierr); + return (retval); } @@ -229,8 +243,6 @@ static void CheckSteerableParameters (IOJpegGH *myGH) } - - /* callback for CCTK_TraverseString() to set the output flag for the given variable */ static void SetOutputFlag (int vindex, const char *optstring, void *arg) |