From 5bbdc0b0974461beceda96b977696f9a0f18ef14 Mon Sep 17 00:00:00 2001 From: Cyrus Harrison Date: Wed, 5 May 2021 12:50:05 -0700 Subject: [PATCH] bp io read_mesh, use read only i/o handles --- CHANGELOG.md | 3 +++ src/libs/relay/conduit_relay_io_blueprint.cpp | 8 ++++++-- src/libs/relay/conduit_relay_io_hdf5.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb253f433..6f37cbdc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,9 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s - Fixed missing implementation of DataType::is_index_t - Fixed issue with compiling t_h5z_zfp_smoke.cpp against an MPI-enabled HDF5. +#### Blueprint +- `conduit::relay::io::blueprint.read_mesh` now uses read only I/O handles. + ## [0.7.1] - Released 2021-02-11 diff --git a/src/libs/relay/conduit_relay_io_blueprint.cpp b/src/libs/relay/conduit_relay_io_blueprint.cpp index 42fa5ae67..6e39a7450 100644 --- a/src/libs/relay/conduit_relay_io_blueprint.cpp +++ b/src/libs/relay/conduit_relay_io_blueprint.cpp @@ -1659,7 +1659,9 @@ void read_mesh(const std::string &root_file_path, if(data_protocol == "sidre_hdf5") { relay::io::IOHandle hnd; - hnd.open(root_fname,"sidre_hdf5"); + Node open_opts; + open_opts["mode"] = "r"; + hnd.open(root_fname, "sidre_hdf5", open_opts); for(int i = domain_start ; i < domain_end; i++) { oss.str(""); @@ -1670,13 +1672,15 @@ void read_mesh(const std::string &root_file_path, else { relay::io::IOHandle hnd; + Node open_opts; + open_opts["mode"] = "r"; for(int i = domain_start ; i < domain_end; i++) { std::string current, next; utils::rsplit_file_path (root_fname, current, next); std::string domain_file = utils::join_path(next, gen.GenerateFilePath(i)); - hnd.open(domain_file, data_protocol); + hnd.open(domain_file, data_protocol, open_opts); // also need the tree path std::string tree_path = gen.GenerateTreePath(i); diff --git a/src/libs/relay/conduit_relay_io_hdf5.cpp b/src/libs/relay/conduit_relay_io_hdf5.cpp index 8c0827d27..266535cae 100644 --- a/src/libs/relay/conduit_relay_io_hdf5.cpp +++ b/src/libs/relay/conduit_relay_io_hdf5.cpp @@ -3230,7 +3230,7 @@ hdf5_open_file_for_read(const std::string &file_path) h5_fa_plist); CONDUIT_CHECK_HDF5_ERROR(h5_file_id, - "Error opening HDF5 file for reading: " + "Error opening HDF5 file for read only access: " << file_path); CONDUIT_CHECK_HDF5_ERROR(H5Pclose(h5_fa_plist), @@ -3257,7 +3257,7 @@ hdf5_open_file_for_read_write(const std::string &file_path) h5_fa_plist); CONDUIT_CHECK_HDF5_ERROR(h5_file_id, - "Error opening HDF5 file for reading: " + "Error opening HDF5 file for read + write access: " << file_path); CONDUIT_CHECK_HDF5_ERROR(H5Pclose(h5_fa_plist),