diff options
Diffstat (limited to 'src/RecoverVar.c')
-rw-r--r-- | src/RecoverVar.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/RecoverVar.c b/src/RecoverVar.c index 19a6cb3..ace099c 100644 --- a/src/RecoverVar.c +++ b/src/RecoverVar.c @@ -193,7 +193,7 @@ int IOHDF5Util_RecoverVariables (cGH *GH, const fileinfo_t *fileinfo) int IOHDF5Util_RecoverGHextensions (cGH *GH, const fileinfo_t *fileinfo) { hid_t group; - CCTK_REAL realBuffer; + CCTK_REAL realBuffer[2]; CCTK_INT4 int4Buffer[3]; @@ -208,7 +208,13 @@ int IOHDF5Util_RecoverGHextensions (cGH *GH, const fileinfo_t *fileinfo) { READ_ATTRIBUTE (group, "cctk_iteration", HDF5_INT4, &int4Buffer[1]); READ_ATTRIBUTE (group, "main_loop_index", HDF5_INT4, &int4Buffer[2]); - READ_ATTRIBUTE (group, "cctk_time", HDF5_REAL, &realBuffer); + READ_ATTRIBUTE (group, "cctk_time", HDF5_REAL, &realBuffer[0]); + // pre rev 173 checkpoints do not contain cctk_delta_time. When reading + // such a checkpoint, we output a warning and continue to use the old + // cctk_delta_time. For this we need to initialize realBuffer[1] since we + // cannot tell if READ_ATTRIBUTE succeeded or not. + realBuffer[1] = GH->cctk_delta_time; + READ_ATTRIBUTE (group, "cctk_delta_time", HDF5_REAL, &realBuffer[1]); HDF5_ERROR (H5Gclose (group)); } @@ -227,14 +233,15 @@ int IOHDF5Util_RecoverGHextensions (cGH *GH, const fileinfo_t *fileinfo) CACTUS_MPI_ERROR (MPI_Bcast (int4Buffer, 3, PUGH_MPI_INT4, 0,MPI_COMM_WORLD)); if (int4Buffer[0]) { - CACTUS_MPI_ERROR (MPI_Bcast (&realBuffer, 1, PUGH_MPI_REAL, 0, + CACTUS_MPI_ERROR (MPI_Bcast (realBuffer, 2, PUGH_MPI_REAL, 0, MPI_COMM_WORLD)); } #endif if (int4Buffer[0]) { - GH->cctk_time = realBuffer; + GH->cctk_time = realBuffer[0]; + GH->cctk_delta_time = realBuffer[1]; GH->cctk_iteration = int4Buffer[1]; CCTK_SetMainLoopIndex ((int) int4Buffer[2]); } |