10#include "MantidDataHandling/DllConfig.h"
13namespace DataHandling {
21 specnum_t getMinSpectrumID()
const override;
22 void setMinSpectrumID(
specnum_t)
override;
24 specnum_t getMaxSpectrumID()
const override;
25 void setMaxSpectrumID(
specnum_t)
override;
27 size_t getNumberOfSpectra()
const override;
28 size_t getNumberOfChannels()
const override;
29 int getNumberOfPeriods()
const override;
31 std::unique_ptr<DataBlockGenerator> getGenerator()
const override;
36 void addDataBlock(
const DataBlock &dataBlock);
37 std::vector<DataBlock> getDataBlocks();
41 std::vector<specnum_t> getAllSpectrumNumbers();
63 int64_t nArray,
int numberOfPeriods,
size_t numberOfChannels,
64 std::vector<specnum_t> monitorSpectra) {
66 return std::find(std::begin(monitorSpectra), std::end(monitorSpectra),
index) != std::end(monitorSpectra);
74 struct HandleWhenElementIsMonitor {
77 if (previousValue - startValue > 0) {
78 auto numberOfSpectra = previousValue - startValue;
80 DataBlock dataBlock(numberOfPeriods, numberOfSpectra, numberOfChannels);
87 DataBlock dataBlock(numberOfPeriods, 1, numberOfChannels);
97 struct HandleWhenElementMadeAJump {
100 auto numberOfSpectra = previousValue - startValue + 1;
101 DataBlock dataBlock(numberOfPeriods, numberOfSpectra, numberOfChannels);
108 HandleWhenElementIsMonitor handleWhenElementIsMonitor;
109 HandleWhenElementMadeAJump handleWhenElementMadeAJump;
111 auto startValue = indexContainer[0];
112 auto previousValue = startValue;
113 for (int64_t arrayIndex = 1; arrayIndex < nArray; ++arrayIndex) {
118 if (isMonitor(previousValue)) {
119 handleWhenElementIsMonitor(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
120 startValue = indexContainer[arrayIndex];
121 }
else if ((indexContainer[arrayIndex] - previousValue) != 1) {
124 handleWhenElementMadeAJump(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
125 startValue = indexContainer[arrayIndex];
129 previousValue = indexContainer[arrayIndex];
133 if (isMonitor(previousValue)) {
134 handleWhenElementIsMonitor(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
136 handleWhenElementMadeAJump(dataBlockComposite, numberOfPeriods, numberOfChannels, previousValue, startValue);
std::map< DeltaEMode::Type, std::string > index
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
DataBlockComposite: The DataBlockComposite handles a collection of DataBlocks.
std::vector< DataBlock > m_dataBlocks
void addDataBlock(const DataBlock &dataBlock)
DataBlock: The DataBlock class holds information about a contiguous block of spectrum numbers.
virtual void setMaxSpectrumID(specnum_t minSpecID)
virtual void setMinSpectrumID(specnum_t minSpecID)
MatrixWorkspace_sptr MANTID_API_DLL operator+(const MatrixWorkspace_sptr &lhs, const MatrixWorkspace_sptr &rhs)
Adds two workspaces.
void DLLExport populateDataBlockCompositeWithContainer(DataBlockComposite &dataBlockComposite, T &indexContainer, int64_t nArray, int numberOfPeriods, size_t numberOfChannels, std::vector< specnum_t > monitorSpectra)
Populates a DataBlockComposite with DataBlocks which are extracted from a indexable collection (array...
Helper class which provides the Collimation Length for SANS instruments.
int32_t specnum_t
Typedef for a spectrum Number.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)