diff --git a/src/hdf5_array.hpp b/src/hdf5_array.hpp index abcdc79..68c3dcb 100644 --- a/src/hdf5_array.hpp +++ b/src/hdf5_array.hpp @@ -97,13 +97,13 @@ namespace CosmoTool { //! \author leo Goodstadt (04 March 2013) //! //!_______________________________________________________________________________________ - template + template void hdf5_write_array(H5::CommonFG& fg, const std::string& data_set_name, - const boost::multi_array& data, + const ArrayType& data, const hdf5_data_type& datatype) { - std::vector dimensions(data.shape(), data.shape() + DIMENSIONS); - H5::DataSpace dataspace(DIMENSIONS, dimensions.data()); + std::vector dimensions(data.shape(), data.shape() + data.num_dimensions()); + H5::DataSpace dataspace(data.num_dimensions(), dimensions.data()); H5::DataSet dataset = fg.createDataSet(data_set_name, datatype, dataspace); @@ -134,19 +134,27 @@ namespace CosmoTool { } }; - template - void hdf5_write_array(H5::CommonFG& fg, const std::string& data_set_name, const boost::multi_array& data ) + template<> struct get_hdf5_data_type > { + static H5::DataType type() { + return hdf5_ComplexType::ctype()->type; + } + }; + + template<> struct get_hdf5_data_type > { + static H5::DataType type() { + return hdf5_ComplexType::ctype()->type; + } + }; + + + template + void hdf5_write_array(H5::CommonFG& fg, const std::string& data_set_name, const ArrayType& data ) { + typedef typename ArrayType::value_type T; get_hdf5_data_type hdf_data_type; + hdf5_write_array(fg, data_set_name, data, hdf_data_type.type()); } - - template - void hdf5_write_array(H5::CommonFG& fg, const std::string& data_set_name, const boost::multi_array, DIMENSIONS>& data ) - { - hdf5_write_array(fg, data_set_name, data, hdf5_ComplexType::ctype()->type); - } - // HDF5 array reader //