Mantid
Loading...
Searching...
No Matches
MatrixWorkspaceMDIterator.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
13#include "MantidKernel/System.h"
15
16namespace Mantid {
17namespace API {
18
24class MANTID_API_DLL MatrixWorkspaceMDIterator : public IMDIterator {
25public:
27 size_t beginWI = 0, size_t endWI = size_t(-1));
28 size_t getDataSize() const override;
29
30 bool valid() const override;
31
32 bool next() override;
33
34 bool next(size_t skip) override;
35
36 void jumpTo(size_t index) override;
37
38 signal_t getNormalizedSignal() const override;
39
40 signal_t getNormalizedError() const override;
41
42 signal_t getSignal() const override;
43
44 signal_t getError() const override;
45
46 std::unique_ptr<coord_t[]> getVertexesArray(size_t &numVertices) const override;
47
48 std::unique_ptr<coord_t[]> getVertexesArray(size_t &numVertices, const size_t outDimensions,
49 const bool *maskDim) const override;
50
51 Mantid::Kernel::VMD getCenter() const override;
52
53 size_t getNumEvents() const override;
54
55 uint16_t getInnerExpInfoIndex(size_t index) const override;
56
57 uint16_t getInnerGoniometerIndex(size_t index) const override;
58
59 int32_t getInnerDetectorID(size_t index) const override;
60
61 coord_t getInnerPosition(size_t index, size_t dimension) const override;
62
63 signal_t getInnerSignal(size_t index) const override;
64
65 signal_t getInnerError(size_t index) const override;
66
67 bool getIsMasked() const override;
68
69 std::vector<size_t> findNeighbourIndexes() const override;
70
71 std::vector<size_t> findNeighbourIndexesFaceTouching() const override;
72
73 size_t getLinearIndex() const override;
74
75 bool isWithinBounds(size_t index) const override;
76
77private:
78 void calcWorkspacePos(size_t newWI);
79
82
84 uint64_t m_pos;
85
87 uint64_t m_max;
88
91
94
96 size_t m_xIndex;
97
100
104 mutable MantidVec m_E;
105
107 mutable bool m_errorIsCached;
108
111
114
116 std::vector<size_t> m_startIndices;
117
119 size_t m_beginWI;
120
122 size_t m_endWI;
123
127
130};
131
132} // namespace API
133} // namespace Mantid
IPeaksWorkspace_sptr workspace
Definition: IndexPeaks.cpp:114
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
This is an interface to an iterator of an IMDWorkspace.
Definition: IMDIterator.h:39
IMDIterator-compatible implementation of an iterator through a MatrixWorkspace.
Mantid::Kernel::VMD m_center
Coordinates of the center at the current iterator pos.
Mantid::Geometry::MDImplicitFunction * m_function
Implicit function to limit volume searched.
uint64_t m_max
The maximum linear index in the workspace.
bool m_isBinnedData
Is the matrix workspace binned (true) e.g. Y vector is 1 shorter than X.
double m_verticalBinSize
For numeric axes, this is the size of the bin in the vertical direction.
MantidVec m_X
Cached copies of X,Y,E at current workspace index.
bool m_errorIsCached
Error vector has been cached?
Mantid::Geometry::IMDDimension_const_sptr m_dimY
The Y (vertical, e.g. spectra) dimension.
size_t m_workspaceIndex
Workspace index of the spectrum we are looking at.
uint64_t m_pos
The linear position/index into the MDHistoWorkspace.
const SpectrumInfo & m_spectrumInfo
SpectrumInfo object, used for masking information.
size_t m_endWI
Workspace index at which the iterator ends.
size_t m_xIndex
x-index, index into the Y[] data array of the spectrum.
const MatrixWorkspace * m_ws
Workspace being iterated.
size_t m_beginWI
Workspace index at which the iterator begins.
std::vector< size_t > m_startIndices
vector of starting index of the unraveled data array
Base MatrixWorkspace Abstract Class.
API::SpectrumInfo is an intermediate step towards a SpectrumInfo that is part of Instrument-2....
Definition: SpectrumInfo.h:53
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
std::shared_ptr< const IMDDimension > IMDDimension_const_sptr
Shared Pointer to const IMDDimension.
Definition: IMDDimension.h:101
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition: MDTypes.h:27
double signal_t
Typedef for the signal recorded in a MDBox, etc.
Definition: MDTypes.h:36
std::vector< double > MantidVec
typedef for the data storage used in Mantid matrix workspaces
Definition: cow_ptr.h:172