Skip to content

Commit

Permalink
set hdf5 libver to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Jun 6, 2017
1 parent 295ff9d commit 9403dbe
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions src/libs/relay/conduit_relay_hdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,16 @@ read_hdf5_tree_into_conduit_node(hid_t hdf5_id,
}


//---------------------------------------------------------------------------//
hid_t
create_hdf5_libver_plist_for_open_and_create()
{
// create property list and set use latest lib ver settings
hid_t h5_fa_props = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_libver_bounds(h5_fa_props, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
return h5_fa_props;
}


//---------------------------------------------------------------------------//
//---------------------------------------------------------------------------//
Expand Down Expand Up @@ -1840,11 +1850,17 @@ hdf5_write(const Node &node,
"Failed to set creation order options for "
<< "property list");

hid_t h5_libver_plist = create_hdf5_libver_plist_for_open_and_create();

CONDUIT_CHECK_HDF5_ERROR(h5_libver_plist,
"Failed to create libver "
<< "property list");

// open the hdf5 file for writing
hid_t h5_file_id = H5Fcreate(file_path.c_str(),
H5F_ACC_TRUNC,
h5_file_plist,
H5P_DEFAULT);
h5_libver_plist);

CONDUIT_CHECK_HDF5_ERROR(h5_file_id,
"Error opening HDF5 file for writing: "
Expand All @@ -1853,7 +1869,11 @@ hdf5_write(const Node &node,
CONDUIT_CHECK_HDF5_ERROR(H5Pclose(h5_file_plist),
"Failed to close HDF5 H5P_GROUP_CREATE "
<< "property list: " << h5_file_plist);


CONDUIT_CHECK_HDF5_ERROR(H5Pclose(h5_libver_plist),
"Failed to close HDF5 H5P_FILE_ACCESS "
<< "property list: " << h5_libver_plist);

hdf5_write(node,
h5_file_id,
hdf5_path);
Expand Down Expand Up @@ -2010,15 +2030,27 @@ hdf5_read(const std::string &file_path,
const std::string &hdf5_path,
Node &node)
{

hid_t h5_libver_plist = create_hdf5_libver_plist_for_open_and_create();

CONDUIT_CHECK_HDF5_ERROR(h5_libver_plist,
"Failed to create libver "
<< "property list");

// open the hdf5 file for reading
hid_t h5_file_id = H5Fopen(file_path.c_str(),
H5F_ACC_RDONLY,
H5P_DEFAULT);
h5_libver_plist);

CONDUIT_CHECK_HDF5_ERROR(h5_file_id,
"Error opening HDF5 file for reading: "
<< file_path);

CONDUIT_CHECK_HDF5_ERROR(H5Pclose(h5_libver_plist),
"Failed to close HDF5 H5P_FILE_ACCESS "
<< "property list: " << h5_libver_plist);


hdf5_read(h5_file_id,
hdf5_path,
node);
Expand Down

0 comments on commit 9403dbe

Please sign in to comment.