This commit is contained in:
2021-07-02 16:09:57 +02:00
parent 0e4fd598b1
commit c30716db12
13 changed files with 422 additions and 146 deletions

View File

@ -31,11 +31,7 @@ void HDF5MasterFile::CreateMasterFile(const std::string filePath,
std::ostringstream os;
os << filePath << "/" << fileNamePrefix << "_master"
<< "_" << fileIndex << ".h5";
fileName_ = os.str();
if (!(silentMode)) {
LOG(logINFO) << "Master File: " << fileName_;
}
std::string fileName = os.str();
std::lock_guard<std::mutex> lock(*hdf5Lib_);
@ -46,12 +42,19 @@ void HDF5MasterFile::CreateMasterFile(const std::string filePath,
flist.setFcloseDegree(H5F_CLOSE_STRONG);
fd_ = nullptr;
if (!(overWriteEnable))
fd_ = new H5File(fileName_.c_str(), H5F_ACC_EXCL,
fd_ = new H5File(fileName.c_str(), H5F_ACC_EXCL,
FileCreatPropList::DEFAULT, flist);
else
fd_ = new H5File(fileName_.c_str(), H5F_ACC_TRUNC,
fd_ = new H5File(fileName.c_str(), H5F_ACC_TRUNC,
FileCreatPropList::DEFAULT, flist);
// attributes - version
double dValue = HDF5_WRITER_VERSION;
DataSpace dataspace_attr = DataSpace(H5S_SCALAR);
Attribute attribute = fd_->createAttribute(
"version", PredType::NATIVE_DOUBLE, dataspace_attr);
attribute.write(PredType::NATIVE_DOUBLE, &dValue);
// Create a group in the file
Group group1(fd_->createGroup("entry"));
Group group2(group1.createGroup("data"));
@ -69,4 +72,7 @@ void HDF5MasterFile::CreateMasterFile(const std::string filePath,
throw sls::RuntimeError(
"Could not create/overwrite master HDF5 handles");
}
if (!silentMode) {
LOG(logINFO) << "Master File: " << fileName;
}
}