Skip to content

Commit

Permalink
enh: expose conduit dtype to hdf5 dtype helpers
Browse files Browse the repository at this point in the history
added conduit dtype to hdf5 dtype helpers to the relay hdf5 interface
removed unreachable empty case logic in hdf5_dtype_to_conduit_dtype
  • Loading branch information
cyrush committed Jan 4, 2017
1 parent c3eb44d commit aa7bb07
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/libs/relay/conduit_relay_hdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,6 @@ class HDF5ErrorStackSupressor
// helpers for data type conversions
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
hid_t conduit_dtype_to_hdf5_dtype(const DataType &dt,
const std::string &ref_path);

//-----------------------------------------------------------------------------
DataType hdf5_dtype_to_conduit_dtype(hid_t hdf5_dtype_id,
index_t num_elems,
const std::string &ref_path);

//-----------------------------------------------------------------------------
// helpers for checking if compatible
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -237,7 +228,7 @@ hid_t create_hdf5_dataset_for_conduit_leaf(const DataType &dt,
hid_t hdf5_group_id,
const std::string &hdf5_dset_name);

//---------------------------------------------------------------------------//
//-----------------------------------------------------------------------------
void write_conduit_leaf_to_hdf5_dataset(const Node &node,
const std::string &ref_path,
hid_t hdf5_dset_id);
Expand Down Expand Up @@ -292,7 +283,7 @@ join_ref_paths(const std::string &parent, const std::string &child)
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Data Type Helper methods that aren't part of public conduit::relay::io
// Data Type Helper methods that are a part of public conduit::relay::io
//
// conduit_dtype_to_hdf5_dtype
// hdf5_dtype_to_conduit_dtype
Expand Down Expand Up @@ -498,13 +489,6 @@ hdf5_dtype_to_conduit_dtype(hid_t hdf5_dtype_id,
res = DataType::char8_str(num_elems);
}
//-----------------------------------------------
// Empty
//-----------------------------------------------
else if(H5Tequal(hdf5_dtype_id,H5T_C_S1))
{
res = DataType::empty();
}
//-----------------------------------------------
// Unsupported
//-----------------------------------------------
else
Expand Down
29 changes: 29 additions & 0 deletions src/libs/relay/conduit_relay_hdf5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,35 @@ void CONDUIT_RELAY_API hdf5_read(hid_t hdf5_id,
//-----------------------------------------------------------------------------
void CONDUIT_RELAY_API hdf5_read(hid_t hdf5_id,
Node &node);

//-----------------------------------------------------------------------------
/// Read from hdf5 id into the output node
//-----------------------------------------------------------------------------
void CONDUIT_RELAY_API hdf5_read(hid_t hdf5_id,
Node &node);

//-----------------------------------------------------------------------------
/// Helpers for converting between hdf5 dtypes and conduit dtypes
///
/// Throughout the relay hdf5 implementation, we use DataType::Empty when
/// the hdf5 data space is H5S_NULL, regardless of what the hdf5 data type is.
/// That isn't reflected in these helper functions,they handle
/// mapping of endianness and leaf types other than empty.
///
///
/// Note: In these functions, ref_path is used to provide context about the
/// hdf5 tree when an error occurs. Using it is recommend but not required.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
hid_t CONDUIT_RELAY_API conduit_dtype_to_hdf5_dtype(const DataType &dt,
const std::string &ref_path="");

//-----------------------------------------------------------------------------
DataType CONDUIT_RELAY_API hdf5_dtype_to_conduit_dtype(hid_t hdf5_dtype_id,
index_t num_elems,
const std::string &ref_path="");

}
//-----------------------------------------------------------------------------
// -- end conduit::relay::io --
Expand Down

0 comments on commit aa7bb07

Please sign in to comment.