diff options
author | Thomas Radke <tradke@aei.mpg.de> | 2006-06-07 10:24:00 +0000 |
---|---|---|
committer | Thomas Radke <tradke@aei.mpg.de> | 2006-06-07 10:24:00 +0000 |
commit | 4b43f32c5055a2340bc78de5d87604364bb0f524 (patch) | |
tree | 0d87d944006c8c5146994ba31129cd5d254e7b97 /Carpet/CarpetIOHDF5/src/Input.cc | |
parent | 150a97c180bf109f1dd82bfe0ffd90745b95eb76 (diff) |
CarpetIOHDF5: evaluate IO::recover_and_remove parameter
If IO::recover_and_remove is set, the recovery file will also be removed after
IO::checkpoint_keep successful checkpoints have been written.
darcs-hash:20060607102431-776a0-92edd93f6dc004ab824b237fbd03ee732f7a3841.gz
Diffstat (limited to 'Carpet/CarpetIOHDF5/src/Input.cc')
-rw-r--r-- | Carpet/CarpetIOHDF5/src/Input.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Carpet/CarpetIOHDF5/src/Input.cc b/Carpet/CarpetIOHDF5/src/Input.cc index aa0f52854..b45dd21b8 100644 --- a/Carpet/CarpetIOHDF5/src/Input.cc +++ b/Carpet/CarpetIOHDF5/src/Input.cc @@ -339,6 +339,22 @@ int Recover (cGH* cctkGH, const char *basefilename, int called_from) } const ioGH* ioUtilGH = (const ioGH*) CCTK_GHExtension (cctkGH, "IO"); + CarpetIOHDF5GH* myGH = + (CarpetIOHDF5GH*) CCTK_GHExtension (cctkGH, CCTK_THORNSTRING); + // allocate list of recovery filenames + // if the recovery checkpoint should be removed eventually + if (in_recovery and not recover_and_remove and checkpoint_keep > 0) { + if (not myGH->recovery_filename_list) { + myGH->recovery_num_filenames = fileset->files.size(); + myGH->recovery_filename_list = + (char **) calloc (fileset->files.size(), sizeof (char **)); + assert (myGH->cp_filename_index == 0); + + // add a dummy entry in the checkpoint filename ring buffer + myGH->cp_filename_list[myGH->cp_filename_index] = "bla"; + myGH->cp_filename_index = (myGH->cp_filename_index+1) % checkpoint_keep; + } + } // loop over all input files of this set for (unsigned int i = 0; i < fileset->files.size(); i++) { @@ -364,6 +380,9 @@ int Recover (cGH* cctkGH, const char *basefilename, int called_from) HDF5_ERROR (H5Giterate (file.file, "/", NULL, BrowseDatasets, &file)); } assert (file.patches.size() > 0); + if (myGH->recovery_filename_list and not myGH->recovery_filename_list[i]) { + myGH->recovery_filename_list[i] = strdup (file.filename); + } // some optimisation for the case when all processors recover // from a single chunked checkpoint file: |