diff options
-rw-r--r-- | src/RecoverVar.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/RecoverVar.c b/src/RecoverVar.c index 29f48f2..0e09cb8 100644 --- a/src/RecoverVar.c +++ b/src/RecoverVar.c @@ -15,6 +15,7 @@ #include "cctk.h" #include "cctk_Parameters.h" +#include "util_String.h" #include "CactusBase/IOUtil/src/ioGH.h" #include "CactusBase/IOUtil/src/ioutil_CheckpointRecovery.h" #include "CactusPUGH/PUGH/src/include/pugh.h" @@ -361,7 +362,8 @@ static int GetCommonAttributes (cGH *GH, hid_t datatype, dataspace; hsize_t rank_stored, *dims_stored; int grouptype_stored, ndims_stored, numtimelevels_stored; - char *groupname, groupname_stored[128], fullvarname[128]; + char *groupname, *msg; + char groupname_stored[128], fullvarname[128]; /* decompose the datasetname, ignore the iteration number */ @@ -486,13 +488,37 @@ static int GetCommonAttributes (cGH *GH, } } - free (dims_stored); if (flag) { - CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, - "Variable sizes don't match for '%s'", fullvarname); + if (group_static_data.dim != (int) rank_stored) + { + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, + "Variable dimensions don't match for '%s', got %d, expected " + "%d", fullvarname, (int) rank_stored, group_static_data.dim); + } + else + { + msg = NULL; + Util_asprintf (&msg, "Variable sizes don't match for '%s', got (%d", + fullvarname, (int) dims_stored[0]); + for (i = 1; i < group_static_data.dim; i++) + { + Util_asprintf (&msg, "%s, %d", msg, (int) dims_stored[i]); + } + dims = unchunked ? group_dynamic_data.gsh : group_dynamic_data.lsh; + Util_asprintf (&msg, "%s), expected (%d", msg, + dims[group_static_data.dim - 1]); + for (i = 1; i < group_static_data.dim; i++) + { + Util_asprintf (&msg, "%s, %d", msg, dims[group_static_data.dim-i-1]); + } + Util_asprintf (&msg, "%s)", msg); + CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, msg); + free (msg); + } return (-1); } + free (dims_stored); if (! CCTK_QueryGroupStorageI (GH, groupindex)) { |