Skip to content

Commit

Permalink
Fix HDF5 OSX intermediate group creation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Mar 25, 2022
1 parent fee0d5a commit ff3c1f0
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/hdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExpData> readSimulationExpData(std::string const& hdf5Filename,
Expand Down

0 comments on commit ff3c1f0

Please sign in to comment.