From 4fe27096e9a9bfabf6059c5cb795acbfb584bab3 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 26 Nov 2024 15:57:31 +0100 Subject: [PATCH] .. --- src/hdf5.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/hdf5.cpp b/src/hdf5.cpp index 009c667913..0004b2e9cd 100644 --- a/src/hdf5.cpp +++ b/src/hdf5.cpp @@ -503,12 +503,6 @@ void writeReturnData( int_buffer.data(), 1 ); - if (!rdata.pscale.empty()) { - int_buffer.resize(rdata.pscale.size()); - for (int i = 0; (unsigned)i < rdata.pscale.size(); i++) - int_buffer[i] = static_cast(rdata.pscale[i]); - createAndWriteInt1DDataset(file, hdf5Location + "/pscale", int_buffer); - } int_buffer[0] = static_cast(rdata.o2mode); H5LTset_attribute_int( @@ -530,6 +524,13 @@ void writeReturnData( file.getId(), hdf5Location.c_str(), "rdrm", int_buffer.data(), 1 ); + if (!rdata.pscale.empty()) { + int_buffer.resize(rdata.pscale.size()); + for (int i = 0; (unsigned)i < rdata.pscale.size(); i++) + int_buffer[i] = static_cast(rdata.pscale[i]); + createAndWriteInt1DDataset(file, hdf5Location + "/pscale", int_buffer); + } + writeLogItemsToHDF5(file, rdata.messages, hdf5Location + "/messages"); writeReturnDataDiagnosis(rdata, file, hdf5Location + "/diagnosis"); @@ -837,6 +838,7 @@ void createAndWriteDouble2DDataset( const H5::H5File& file, std::string const& datasetName, gsl::span buffer, hsize_t m, hsize_t n ) { + Expects(buffer.size() == m * n); hsize_t const adims[]{m, n}; H5::DataSpace dataspace(2, adims); auto dataset = file.createDataSet( @@ -849,6 +851,7 @@ void createAndWriteInt2DDataset( H5::H5File const& file, std::string const& datasetName, gsl::span buffer, hsize_t m, hsize_t n ) { + Expects(buffer.size() == m * n); hsize_t const adims[]{m, n}; H5::DataSpace dataspace(2, adims); auto dataset = file.createDataSet( @@ -861,6 +864,7 @@ void createAndWriteDouble3DDataset( H5::H5File const& file, std::string const& datasetName, gsl::span buffer, hsize_t m, hsize_t n, hsize_t o ) { + Expects(buffer.size() == m * n * o); hsize_t const adims[]{m, n, o}; H5::DataSpace dataspace(3, adims); auto dataset = file.createDataSet(