diff --git a/src/hdf5.cpp b/src/hdf5.cpp index 4b486b06f2..bf21ae143d 100644 --- a/src/hdf5.cpp +++ b/src/hdf5.cpp @@ -84,23 +84,9 @@ void checkEventDimensionsCompatible(hsize_t m, hsize_t n, Model const& model) { void createGroup(H5::H5File const& file, std::string const& groupPath, bool recursively) { - - 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); + H5::LinkCreatPropList lcpl; + lcpl.setCreateIntermediateGroup(recursively); + file.createGroup(groupPath.c_str(), lcpl); } std::unique_ptr readSimulationExpData(std::string const& hdf5Filename,