From f228fde6f77aeda2408393d8547d0c673abf75d8 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Mon, 7 Feb 2022 14:01:19 +0100 Subject: [PATCH] including stride and block for selecting hyperslab --- slsReceiverSoftware/src/DataProcessor.cpp | 5 ++-- slsReceiverSoftware/src/HDF5VirtualFile.cpp | 26 +++++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index b97da54df..6f817e974 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -213,8 +213,9 @@ void DataProcessor::CreateVirtualFile( if (virtualFile_) { delete virtualFile_; } - gotthard25um = ((detectorType_ == GOTTHARD || detectorType_ == GOTTHARD2) && - (numModX * numModY) == 2); + bool gotthard25um = + ((detectorType_ == GOTTHARD || detectorType_ == GOTTHARD2) && + (numModX * numModY) == 2); virtualFile_ = new HDF5VirtualFile(hdf5Lib, gotthard25um); uint64_t numImagesProcessed = GetProcessedIndex() + 1; diff --git a/slsReceiverSoftware/src/HDF5VirtualFile.cpp b/slsReceiverSoftware/src/HDF5VirtualFile.cpp index 8349291b9..3b15831c4 100644 --- a/slsReceiverSoftware/src/HDF5VirtualFile.cpp +++ b/slsReceiverSoftware/src/HDF5VirtualFile.cpp @@ -103,19 +103,35 @@ void HDF5VirtualFile::CreateVirtualFile( ((numImagesCaught - framesSaved) > maxFramesPerFile) ? maxFramesPerFile : (numImagesCaught - framesSaved); + // starting location hsize_t start[3] = {framesSaved, 0, 0}; - hsize_t count[3] = {nDimx, nDimy, nDimz}; + // number of elements separating each block + hsize_t stride[3] = {1, 1, 1}; + // number of blocks + hsize_t count[3] = {1, 1, 1}; + // block size + hsize_t block[3] = {nDimx, nDimy, nDimz}; + + // starting location hsize_t startPara[2] = {framesSaved, 0}; - hsize_t countPara[2] = {nDimx, 1}; - // loop through readouts + // number of elements separating each block + hsize_t stridePara[3] = {1, 1}; + // number of blocks + hsize_t countPara[2] = {1, 1}; + // block size + hsize_t blockPara[3] = {nDimx, 1}; + + // loop through readouts (image) for (unsigned int i = 0; i < numModY * numModZ; ++i) { // setect data hyperslabs - vdsDataSpace.selectHyperslab(H5S_SELECT_SET, count, start); + vdsDataSpace.selectHyperslab(H5S_SELECT_SET, count, start, + stride, block); // select parameter hyperslabs vdsDataSpacePara.selectHyperslab(H5S_SELECT_SET, countPara, - startPara); + startPara, stridePara, + blockPara); // source file name std::ostringstream os;