Skip to content

Commit

Permalink
version switch
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Mar 25, 2022
1 parent ff3c1f0 commit 637862b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/hdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,28 @@ void checkEventDimensionsCompatible(hsize_t m, hsize_t n, Model const& model) {
void createGroup(H5::H5File const& file,
std::string const& groupPath,
bool recursively) {
#if H5_VERSION_GE(1, 10, 6)
H5::LinkCreatPropList lcpl;
lcpl.setCreateIntermediateGroup(recursively);
file.createGroup(groupPath.c_str(), lcpl);
#else
auto groupCreationPropertyList = H5P_DEFAULT;

if (recursively) {
groupCreationPropertyList = H5Pcreate(H5P_LINK_CREATE);
H5Pset_create_intermediate_group(groupCreationPropertyList, 1);
}

hid_t group = H5Gcreate(file.getId(), groupPath.c_str(),
groupCreationPropertyList,
H5P_DEFAULT, H5P_DEFAULT);
H5Pclose(groupCreationPropertyList);

if (group < 0)
throw(AmiException("Failed to create group in hdf5CreateGroup: %s",
groupPath.c_str()));
H5Gclose(group);
#endif
}

std::unique_ptr<ExpData> readSimulationExpData(std::string const& hdf5Filename,
Expand Down

0 comments on commit 637862b

Please sign in to comment.