Use a type alias to ensure compatibility with more versions of HDF5
This commit is contained in:
parent
aa42376cbe
commit
2cf9274b2e
@ -51,6 +51,11 @@ knowledge of the CeCILL license and that you accept its terms.
|
||||
#include <H5Cpp.h>
|
||||
|
||||
namespace CosmoTool {
|
||||
#if (H5_VERS_MAJOR == 1) && (H5_VERS_MINOR <= 8)
|
||||
typedef H5::CommonFG H5_CommonFileGroup;
|
||||
#else
|
||||
typedef H5::Group H5_CommonFileGroup;
|
||||
#endif
|
||||
|
||||
//!_______________________________________________________________________________________
|
||||
//!
|
||||
@ -129,7 +134,7 @@ namespace CosmoTool {
|
||||
//!
|
||||
//!_______________________________________________________________________________________
|
||||
template<typename ArrayType, typename hdf5_data_type>
|
||||
void hdf5_write_array(H5::H5Location& fg, const std::string& data_set_name,
|
||||
void hdf5_write_array(H5_CommonFileGroup& fg, const std::string& data_set_name,
|
||||
const ArrayType& data,
|
||||
const hdf5_data_type& datatype,
|
||||
const std::vector<hsize_t>& dimensions,
|
||||
@ -156,7 +161,7 @@ namespace CosmoTool {
|
||||
|
||||
|
||||
template<typename ArrayType, typename hdf5_data_type>
|
||||
void hdf5_write_array(H5::H5Location& fg, const std::string& data_set_name,
|
||||
void hdf5_write_array(H5_CommonFileGroup& fg, const std::string& data_set_name,
|
||||
const ArrayType& data,
|
||||
const hdf5_data_type& datatype,
|
||||
bool doCreate = true,
|
||||
@ -165,7 +170,7 @@ namespace CosmoTool {
|
||||
std::vector<hsize_t> dimensions(data.shape(), data.shape() + data.num_dimensions());
|
||||
hdf5_write_array(fg, data_set_name, data, datatype, dimensions, doCreate, useBases);
|
||||
}
|
||||
|
||||
|
||||
/* HDF5 complex type */
|
||||
template<typename T>
|
||||
class hdf5_ComplexType
|
||||
@ -255,14 +260,14 @@ namespace CosmoTool {
|
||||
};
|
||||
|
||||
template<typename ArrayType>
|
||||
void hdf5_write_array(H5::H5Location& fg, const std::string& data_set_name, const ArrayType& data )
|
||||
void hdf5_write_array(H5_CommonFileGroup& fg, const std::string& data_set_name, const ArrayType& data )
|
||||
{
|
||||
typedef typename ArrayType::element T;
|
||||
get_hdf5_data_type<T> hdf_data_type;
|
||||
|
||||
hdf5_write_array(fg, data_set_name, data, hdf_data_type.type());
|
||||
}
|
||||
|
||||
|
||||
// HDF5 array reader
|
||||
//
|
||||
// Author Guilhem Lavaux (May 2014)
|
||||
@ -341,7 +346,7 @@ namespace CosmoTool {
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
template<typename ArrayType, typename hdf5_data_type>
|
||||
void hdf5_read_array_typed(H5::H5Location& fg, const std::string& data_set_name,
|
||||
void hdf5_read_array_typed(H5_CommonFileGroup& fg, const std::string& data_set_name,
|
||||
ArrayType& data,
|
||||
const hdf5_data_type& datatype, bool auto_resize = true, bool useBases = false)
|
||||
{
|
||||
@ -377,7 +382,7 @@ namespace CosmoTool {
|
||||
}
|
||||
|
||||
template<typename ArrayType>
|
||||
void hdf5_read_array(H5::H5Location& fg, const std::string& data_set_name, ArrayType& data, bool auto_resize = true,
|
||||
void hdf5_read_array(H5_CommonFileGroup& fg, const std::string& data_set_name, ArrayType& data, bool auto_resize = true,
|
||||
bool useBases = false )
|
||||
{
|
||||
typedef typename ArrayType::element T;
|
||||
|
Loading…
Reference in New Issue
Block a user