diff --git a/include/highfive/bits/H5Converter_misc.hpp b/include/highfive/bits/H5Converter_misc.hpp index 2f84a7bec..d1ba132c4 100644 --- a/include/highfive/bits/H5Converter_misc.hpp +++ b/include/highfive/bits/H5Converter_misc.hpp @@ -69,7 +69,7 @@ struct DeepCopyBuffer { using hdf5_type = typename inspector::hdf5_type; explicit DeepCopyBuffer(const std::vector& _dims) - : buffer(inspector::getSize(_dims)) + : buffer(compute_total_size(_dims)) , dims(_dims) {} hdf5_type* getPointer() { diff --git a/include/highfive/bits/H5Inspector_misc.hpp b/include/highfive/bits/H5Inspector_misc.hpp index b9afe7c69..3f69276c4 100644 --- a/include/highfive/bits/H5Inspector_misc.hpp +++ b/include/highfive/bits/H5Inspector_misc.hpp @@ -129,14 +129,12 @@ inspector { static constexpr size_t recursive_ndim // Is the inner type trivially copyable for optimisation // If this value is true: data() is mandatory - // If this value is false: getSize, serialize, unserialize are mandatory + // If this value is false: serialize, unserialize are mandatory static constexpr bool is_trivially_copyable // Reading: // Allocate the value following dims (should be recursive) static void prepare(type& val, const std::vector dims) - // Return the size of the vector pass to/from hdf5 from a vector of dims - static size_t getSize(const std::vector& dims) // Return a pointer of the first value of val (for reading) static hdf5_type* data(type& val) // Take a serialized vector 'in', some dims and copy value to val (for reading) @@ -169,10 +167,6 @@ struct type_helper { return {}; } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& /* val */, const std::vector& /* dims */) {} static hdf5_type* data(type& val) { @@ -308,10 +302,6 @@ struct inspector> { return sizes; } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& val, const std::vector& dims) { val.resize(dims[0]); std::vector next_dims(dims.begin() + 1, dims.end()); @@ -332,7 +322,7 @@ struct inspector> { static void serialize(const type& val, const std::vector& dims, It m) { if (!val.empty()) { auto subdims = std::vector(dims.begin() + 1, dims.end()); - size_t subsize = inspector::getSize(subdims); + size_t subsize = compute_total_size(subdims); for (auto&& e: val) { inspector::serialize(e, subdims, m); m += subsize; @@ -366,13 +356,6 @@ struct inspector> { return sizes; } - static size_t getSize(const std::vector& dims) { - if (dims.size() > 1) { - throw DataSpaceException("std::vector is only 1 dimension."); - } - return dims[0]; - } - static void prepare(type& val, const std::vector& dims) { if (dims.size() > 1) { throw DataSpaceException("std::vector is only 1 dimension."); @@ -425,10 +408,6 @@ struct inspector> { return sizes; } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& val, const std::vector& dims) { if (dims[0] > N) { std::ostringstream os; @@ -453,7 +432,7 @@ struct inspector> { template static void serialize(const type& val, const std::vector& dims, It m) { auto subdims = std::vector(dims.begin() + 1, dims.end()); - size_t subsize = inspector::getSize(subdims); + size_t subsize = compute_total_size(subdims); for (auto& e: val) { inspector::serialize(e, subdims, m); m += subsize; @@ -555,7 +534,7 @@ struct inspector { we will fix it one day */ static void serialize(const type& val, const std::vector& dims, hdf5_type* m) { auto subdims = std::vector(dims.begin() + 1, dims.end()); - size_t subsize = inspector::getSize(subdims); + size_t subsize = compute_total_size(subdims); for (size_t i = 0; i < N; ++i) { inspector::serialize(val[i], subdims, m + i * subsize); } diff --git a/include/highfive/boost.hpp b/include/highfive/boost.hpp index d389ef5c6..fb8a709c5 100644 --- a/include/highfive/boost.hpp +++ b/include/highfive/boost.hpp @@ -31,10 +31,6 @@ struct inspector> { return sizes; } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& val, const std::vector& dims) { if (dims.size() < ndim) { std::ostringstream os; @@ -67,7 +63,7 @@ struct inspector> { static void serialize(const type& val, const std::vector& dims, It m) { size_t size = val.num_elements(); auto subdims = std::vector(dims.begin() + ndim, dims.end()); - size_t subsize = inspector::getSize(subdims); + size_t subsize = compute_total_size(subdims); for (size_t i = 0; i < size; ++i) { inspector::serialize(*(val.origin() + i), subdims, m + i * subsize); } @@ -104,10 +100,6 @@ struct inspector> { return sizes; } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& val, const std::vector& dims) { if (dims.size() < ndim) { std::ostringstream os; @@ -129,7 +121,7 @@ struct inspector> { static void serialize(const type& val, const std::vector& dims, hdf5_type* m) { size_t size = val.size1() * val.size2(); auto subdims = std::vector(dims.begin() + ndim, dims.end()); - size_t subsize = inspector::getSize(subdims); + size_t subsize = compute_total_size(subdims); for (size_t i = 0; i < size; ++i) { inspector::serialize(*(&val(0, 0) + i), subdims, m + i * subsize); } diff --git a/include/highfive/eigen.hpp b/include/highfive/eigen.hpp index 275a68fad..69c01a7dc 100644 --- a/include/highfive/eigen.hpp +++ b/include/highfive/eigen.hpp @@ -39,10 +39,6 @@ struct inspector> { return sizes; } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& val, const std::vector& dims) { if (dims[0] != static_cast(val.rows()) || dims[1] != static_cast(val.cols())) {