From 6fe9c70afc3f9fa7f439101bb0351575ebe51219 Mon Sep 17 00:00:00 2001 From: tradke Date: Thu, 28 Feb 2002 10:52:18 +0000 Subject: Some better error checking for checkpointing. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5Util/trunk@55 7842ec3a-9562-4be5-9c5b-06ba18f2b668 --- src/DumpUtils.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/DumpUtils.c b/src/DumpUtils.c index a45a5ed..8e244e9 100644 --- a/src/DumpUtils.c +++ b/src/DumpUtils.c @@ -50,15 +50,15 @@ CCTK_FILEVERSION(BetaThorns_IOHDF5Util_DumpUtils_c) @returntype int @returndesc - always 0 (for success) + the accumulated return code from @seeroutine IOHDF5Util_DumpVar + (should be 0 for success, or negative if some error occured) @endreturndesc @@*/ int IOHDF5Util_DumpGH (const cGH *GH, const int *timers, hid_t file) { - DECLARE_CCTK_PARAMETERS - int maxdim; + int retval, maxdim; int first_vindex, vindex, gindex; int timelevel, last_timelevel; cGroup gdata; @@ -71,7 +71,10 @@ int IOHDF5Util_DumpGH (const cGH *GH, const cGH *const_ptr; cGH *non_const_ptr; } GH_fake_const; + DECLARE_CCTK_PARAMETERS + + retval = 0; GH_fake_const.const_ptr = GH; @@ -87,8 +90,8 @@ int IOHDF5Util_DumpGH (const cGH *GH, for (vindex = 0; vindex < maxdim; vindex++) { - request.length[vindex] = -1; - request.downsample[vindex] = 1; + request.length[vindex] = -1; + request.downsample[vindex] = 1; } /* disable output in single precision */ @@ -171,7 +174,7 @@ int IOHDF5Util_DumpGH (const cGH *GH, /* loop over all timelevels of this variable */ for (timelevel = 0; timelevel < last_timelevel; timelevel++) { - IOHDF5Util_DumpVar (GH, vindex, timelevel, &request, file, 0); + retval += IOHDF5Util_DumpVar (GH, vindex, timelevel, &request, file, 0); } } /* end of loop over all variables */ @@ -189,7 +192,7 @@ int IOHDF5Util_DumpGH (const cGH *GH, /* free temporary resources */ free (request.origin); - return (0); + return (retval); } @@ -248,13 +251,13 @@ void IOHDF5Util_DumpCommonAttributes (const cGH *GH, const ioHDF5Geo_t *request, hid_t dataset) { - DECLARE_CCTK_PARAMETERS char *groupname; int dim, vdim; CCTK_INT attr_int; CCTK_REAL *attr_real; ioHDF5UtilGH *myGH; char coord_system_name[20]; + DECLARE_CCTK_PARAMETERS /* prevent compiler warning about unused parameter */ @@ -365,10 +368,10 @@ void IOHDF5Util_DumpCommonAttributes (const cGH *GH, void IOHDF5Util_DumpParameters (const cGH *GH, hid_t file) { - DECLARE_CCTK_PARAMETERS ioHDF5UtilGH *myGH; char *parameters; hid_t group; + DECLARE_CCTK_PARAMETERS if (verbose) @@ -417,13 +420,13 @@ void IOHDF5Util_DumpParameters (const cGH *GH, void IOHDF5Util_DumpGHExtensions (const cGH *GH, hid_t file) { - DECLARE_CCTK_PARAMETERS int value; hid_t group; char buffer[128]; const char *version; ioGH *ioUtilGH; ioHDF5UtilGH *myGH; + DECLARE_CCTK_PARAMETERS if (verbose) -- cgit v1.2.3