From 13aea89ecef5589f2af9aa93376f182517c4665c Mon Sep 17 00:00:00 2001 From: tradke Date: Tue, 28 Oct 2003 21:10:44 +0000 Subject: Fixed a problem with checkpointing of grid scalars. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@294 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- src/DumpVar.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/DumpVar.c b/src/DumpVar.c index d2cf4ca..7c9ea2e 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -539,7 +539,8 @@ static void AddCommonAttributes (const cGH *GH, const ioRequest *request, DECLARE_CCTK_PARAMETERS - itmp = malloc (request->hdim * sizeof (CCTK_INT4)); + /* allocate at least one CCTK_INT4 if hdim is 0 */ + itmp = malloc ((request->hdim+1) * sizeof (CCTK_INT4)); name = CCTK_FullName (request->vindex); FLEXIO_ERROR (IOwriteAttribute (file, "name", FLEXIO_CHAR, @@ -602,12 +603,20 @@ static void AddCommonAttributes (const cGH *GH, const ioRequest *request, free (dtmp); } - for (i = 0; i < request->hdim; i++) + if (request->hdim) + { + for (i = 0; i < request->hdim; i++) + { + itmp[i] = request->hsize[i]; + } + FLEXIO_ERROR (IOwriteAttribute (file, "global_size", FLEXIO_INT4, + request->hdim, itmp)); + } + else { - itmp[i] = request->hsize[i]; + itmp[0] = 0; + FLEXIO_ERROR (IOwriteAttribute (file, "global_size", FLEXIO_INT4, 1, itmp)); } - FLEXIO_ERROR (IOwriteAttribute (file, "global_size", FLEXIO_INT4, - request->hdim, itmp)); itmp[0] = CCTK_nProcs (GH); FLEXIO_ERROR (IOwriteAttribute (file, "nprocs", FLEXIO_INT4, 1, itmp)); -- cgit v1.2.3