diff options
author | tradke <schnetter@cct.lsu.edu> | 2004-12-03 15:28:00 +0000 |
---|---|---|
committer | tradke <schnetter@cct.lsu.edu> | 2004-12-03 15:28:00 +0000 |
commit | b81d42125b6d40fa74fe7c5388d1321898643d58 (patch) | |
tree | e61767d7d909a65dbaaf77cfff2e475fe1207de0 /Carpet | |
parent | 924731274c8fad79433b6853d808b97ed520530d (diff) |
CarpetIOHDF5/src/Output.cc: check for already existing datasets in an output file
After recovery, it may happen that HDF5 output is requested at the same
iteration when it had been done before.
Therefore the code must check for this case, and remove an already existing
dataset from the output file before it can be created anew.
darcs-hash:20041203152858-3fd61-7703c468af4f84b6a737f9fa9a5272f4d2313724.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetIOHDF5/src/Output.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Carpet/CarpetIOHDF5/src/Output.cc b/Carpet/CarpetIOHDF5/src/Output.cc index baa9c0df9..9c19fe213 100644 --- a/Carpet/CarpetIOHDF5/src/Output.cc +++ b/Carpet/CarpetIOHDF5/src/Output.cc @@ -348,6 +348,15 @@ int WriteVar (const cGH* const cctkGH, const hid_t writer, HDF5_ERROR (dataspace = H5Screate_simple (group.dim, shape, NULL)); HDF5_ERROR (memdataset = H5Dcreate (memfile, datasetname.str().c_str(), filedatatype, dataspace, H5P_DEFAULT)); + + // remove an already existing dataset of the same name + if (request->check_exist) + { + H5E_BEGIN_TRY + { + H5Gunlink (writer, datasetname.str().c_str()); + } H5E_END_TRY; + } HDF5_ERROR (dataset = H5Dcreate (writer, datasetname.str().c_str(), filedatatype, dataspace, H5P_DEFAULT)); } |