aboutsummaryrefslogtreecommitdiff
path: root/src/RestoreFile.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2001-04-19 22:02:41 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2001-04-19 22:02:41 +0000
commite0434816ab8354125c24d64e798df31d4698da17 (patch)
tree8f30b9f07ae71ae1ac6cda8b22be0da9d8457fbe /src/RestoreFile.c
parent373c9dd8f0ba051d74402f3df37f925ea6799911 (diff)
Add the Cactus version as an attribute to the global attributes group.
This is also used during recovery to distinguish checkpoint and data files which were created before/after the recent changes to the timelevel naming scheme. This fixes PR IOFlexIO-620. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@184 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/RestoreFile.c')
-rw-r--r--src/RestoreFile.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/RestoreFile.c b/src/RestoreFile.c
index 3e46799..79329d5 100644
--- a/src/RestoreFile.c
+++ b/src/RestoreFile.c
@@ -39,7 +39,7 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_RestoreFile_c)
/* prototypes of routines defined in this source file */
int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file);
static int GetCommonAttributes (cGH *GH, IOFile fid, int unchunked, int *vindex,
- int *grouptype, int *timelevel);
+ int *grouptype, int *timelevel,int has_version);
#ifdef CCTK_MPI
static int GetChunkAttributes (IOFile fid, int vindex);
#endif
@@ -85,8 +85,8 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file)
int timelevel; /* current timelevel to be restored */
pGH *pughGH; /* PUGH extension handle */
ioGH *ioUtilGH; /* IOUtil extension handle */
- pGExtras *extras;
#ifdef CCTK_MPI
+ pGExtras *extras;
int i, proc;
CCTK_INT info [3]; /* communication buffer for MPI */
#endif
@@ -144,7 +144,7 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file)
/* read in the next dataset's attributes and verify them */
if (GetCommonAttributes (GH, file->fid, file->unchunked, &vindex,
- &gtype, &timelevel) < 0) {
+ &gtype, &timelevel, file->has_version) < 0) {
CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
"Ignoring dataset %d", currentDataset);
continue;
@@ -371,7 +371,7 @@ int IOFlexIOi_RecoverVariables (cGH *GH, fileinfo_t *file)
*/
static int GetCommonAttributes (cGH *GH, IOFile fid, int unchunked, int *vindex,
- int *grouptype, int *timelevel)
+ int *grouptype, int *timelevel, int has_version)
{
int i, flag;
int atype;
@@ -471,6 +471,11 @@ static int GetCommonAttributes (cGH *GH, IOFile fid, int unchunked, int *vindex,
"Number of timelevels don't match for '%s'", fullname);
return (-1);
}
+ /* increment the timelevel for data from old checkpoint files */
+ if (! has_version && numtimelevels_stored > 1)
+ {
+ (*timelevel)++;
+ }
/* The CCTK variable type defines do not correlate with the IEEEIO defines
so compare them explicitely here. */
if ((vartype_stored == FLEXIO_REAL &&