HDF5Interface::list_attributes fails in parallel (patch included)

Issue #412 resolved
Simone Pezzuto created an issue

Small fix.

By the way: why HDF5Interface is not exposed in pyDOLFIN?

diff --git a/dolfin/io/HDF5Interface.cpp b/dolfin/io/HDF5Interface.cpp
index 57a4131..eb40068 100644
--- a/dolfin/io/HDF5Interface.cpp
+++ b/dolfin/io/HDF5Interface.cpp
@@ -218,6 +218,9 @@ HDF5Interface::list_attributes(const hid_t hdf5_file_handle,
   herr_t status = H5Aiterate2(dset_id, H5_INDEX_NAME, H5_ITER_INC, &n,
                               attribute_iteration_function,
                               (void *)&out_string);
+
+  // Close dataset or group
+  status = H5Oclose(dset_id);
   dolfin_assert(status != HDF5_FAIL);

   return out_string;

Comments (2)

  1. Johan Hake

    Fix issue 412 where an HDF dataset or group was not closed. -- Add support for using HDF5File and other Files in a with statement. -- Add HDF5Attribut.list_attributes() which returns a list of str of attributes

    → <<cset 867b6c2389bc>>

  2. Log in to comment