Mantid
|
IMDIterator-compatible implementation of an iterator through a MatrixWorkspace. More...
#include <MatrixWorkspaceMDIterator.h>
Public Member Functions | |
std::vector< size_t > | findNeighbourIndexes () const override |
Find neighbour indexes. More... | |
std::vector< size_t > | findNeighbourIndexesFaceTouching () const override |
Find neighbour indexes face touching. More... | |
Mantid::Kernel::VMD | getCenter () const override |
Returns the position of the center of the box pointed to. More... | |
size_t | getDataSize () const override |
signal_t | getError () const override |
Returns the error for this box, same as innerError. More... | |
int32_t | getInnerDetectorID (size_t index) const override |
For a given event/point in this box, return the detector ID. More... | |
signal_t | getInnerError (size_t index) const override |
Returns the error of a given event. More... | |
uint16_t | getInnerExpInfoIndex (size_t index) const override |
For a given event/point in this box, return the associated experiment-info index. More... | |
uint16_t | getInnerGoniometerIndex (size_t index) const override |
For a given event/point in this box, return the associated experiment-info index. More... | |
coord_t | getInnerPosition (size_t index, size_t dimension) const override |
Returns the position of a given event for a given dimension. More... | |
signal_t | getInnerSignal (size_t index) const override |
Returns the signal of a given event. More... | |
bool | getIsMasked () const override |
Getter for the masked state of the workspace. More... | |
size_t | getLinearIndex () const override |
Get the linear index. More... | |
signal_t | getNormalizedError () const override |
Returns the normalized error for this box. More... | |
signal_t | getNormalizedSignal () const override |
Returns the normalized signal for this box. More... | |
size_t | getNumEvents () const override |
Returns the number of events/points contained in this box. More... | |
signal_t | getSignal () const override |
Returns the signal for this box, same as innerSignal. More... | |
std::unique_ptr< coord_t[]> | getVertexesArray (size_t &numVertices) const override |
Return a list of vertexes defining the volume pointed to. More... | |
std::unique_ptr< coord_t[]> | getVertexesArray (size_t &numVertices, const size_t outDimensions, const bool *maskDim) const override |
Return a list of vertexes defining the volume pointed to, enable masking of dimensions. More... | |
bool | isWithinBounds (size_t index) const override |
Is index reachable by the iterator. More... | |
void | jumpTo (size_t index) override |
Jump to the index^th cell. More... | |
MatrixWorkspaceMDIterator (const MatrixWorkspace *workspace, Mantid::Geometry::MDImplicitFunction *function, size_t beginWI=0, size_t endWI=size_t(-1)) | |
Constructor. More... | |
bool | next () override |
Advance to the next cell. More... | |
bool | next (size_t skip) override |
Advance, skipping a certain number of cells. More... | |
bool | valid () const override |
Public Member Functions inherited from Mantid::API::IMDIterator | |
virtual std::vector< size_t > | findNeighbourIndexes () const =0 |
Find neighbouring indexes vertex touching. More... | |
virtual std::vector< size_t > | findNeighbourIndexesFaceTouching () const =0 |
Find neighbouring indexes face touching. More... | |
virtual Mantid::Kernel::VMD | getCenter () const =0 |
Returns the position of the center of the box pointed to. More... | |
virtual size_t | getDataSize () const =0 |
Get the size of the data (number of entries that will be iterated through) More... | |
virtual signal_t | getError () const =0 |
Returns the total error for this box. More... | |
virtual int32_t | getInnerDetectorID (size_t index) const =0 |
For a given event/point in this box, return the detector ID. More... | |
virtual signal_t | getInnerError (size_t index) const =0 |
Returns the error of a given event. More... | |
virtual uint16_t | getInnerExpInfoIndex (size_t index) const =0 |
For a given event/point in this box, return the associated experiment-info index. More... | |
virtual uint16_t | getInnerGoniometerIndex (size_t index) const =0 |
For a given event/point in this box, return the goniometer index. More... | |
virtual coord_t | getInnerPosition (size_t index, size_t dimension) const =0 |
Returns the position of a given event for a given dimension. More... | |
virtual signal_t | getInnerSignal (size_t index) const =0 |
Returns the signal of a given event. More... | |
virtual bool | getIsMasked () const =0 |
Returns true if masking is used. More... | |
virtual size_t | getLinearIndex () const =0 |
Get the linear index. More... | |
Mantid::API::MDNormalization | getNormalization () const |
virtual signal_t | getNormalizedError () const =0 |
Returns the normalized error for this box. More... | |
virtual signal_t | getNormalizedSignal () const =0 |
Returns the normalized signal for this box. More... | |
virtual size_t | getNumEvents () const =0 |
Returns the number of events/points contained in this box. More... | |
virtual signal_t | getSignal () const =0 |
Returns the total signal for this box. More... | |
virtual std::unique_ptr< coord_t[]> | getVertexesArray (size_t &numVertices) const =0 |
Return a list of vertexes defining the volume pointed to. More... | |
virtual std::unique_ptr< coord_t[]> | getVertexesArray (size_t &numVertices, const size_t outDimensions, const bool *maskDim) const =0 |
Return a list of vertexes defining the volume pointed to, enable masking of dimensions. More... | |
IMDIterator () | |
Default constructor. More... | |
virtual bool | isWithinBounds (size_t index) const =0 |
Is index reachable by the iterator. More... | |
virtual void | jumpTo (size_t index)=0 |
Jump to the index^th cell. More... | |
virtual bool | next ()=0 |
Advance to the next cell. More... | |
virtual bool | next (size_t skip)=0 |
Advance, skipping a certain number of cells. More... | |
void | setNormalization (Mantid::API::MDNormalization normalization) |
Set how the signal will be normalized when calling getNormalizedSignal() More... | |
virtual bool | valid () const =0 |
Is the current position of the iterator valid? More... | |
virtual | ~IMDIterator ()=default |
Private Member Functions | |
void | calcWorkspacePos (size_t newWI) |
Calculate the workspace index/x index for this iterator position. More... | |
Private Attributes | |
size_t | m_beginWI |
Workspace index at which the iterator begins. More... | |
Mantid::Kernel::VMD | m_center |
Coordinates of the center at the current iterator pos. More... | |
Mantid::Geometry::IMDDimension_const_sptr | m_dimY |
The Y (vertical, e.g. spectra) dimension. More... | |
MantidVec | m_E |
size_t | m_endWI |
Workspace index at which the iterator ends. More... | |
bool | m_errorIsCached |
Error vector has been cached? More... | |
Mantid::Geometry::MDImplicitFunction * | m_function |
Implicit function to limit volume searched. More... | |
bool | m_isBinnedData |
Is the matrix workspace binned (true) e.g. Y vector is 1 shorter than X. More... | |
uint64_t | m_max |
The maximum linear index in the workspace. More... | |
uint64_t | m_pos |
The linear position/index into the MDHistoWorkspace. More... | |
const SpectrumInfo & | m_spectrumInfo |
SpectrumInfo object, used for masking information. More... | |
std::vector< size_t > | m_startIndices |
vector of starting index of the unraveled data array More... | |
double | m_verticalBinSize |
For numeric axes, this is the size of the bin in the vertical direction. More... | |
size_t | m_workspaceIndex |
Workspace index of the spectrum we are looking at. More... | |
const MatrixWorkspace * | m_ws |
Workspace being iterated. More... | |
MantidVec | m_X |
Cached copies of X,Y,E at current workspace index. More... | |
size_t | m_xIndex |
x-index, index into the Y[] data array of the spectrum. More... | |
MantidVec | m_Y |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::API::IMDIterator | |
Mantid::API::MDNormalization | m_normalization |
Normalization method for getNormalizedSignal() More... | |
IMDIterator-compatible implementation of an iterator through a MatrixWorkspace.
Definition at line 24 of file MatrixWorkspaceMDIterator.h.
Mantid::API::MatrixWorkspaceMDIterator::MatrixWorkspaceMDIterator | ( | const MatrixWorkspace * | workspace, |
Mantid::Geometry::MDImplicitFunction * | function, | ||
size_t | beginWI = 0 , |
||
size_t | endWI = size_t(-1) |
||
) |
Constructor.
workspace | :: iterate through this workspace |
function | :: limiting implicit function |
beginWI | :: first workspace index to iterate |
endWI | :: end when you reach this workspace index |
Definition at line 29 of file MatrixWorkspaceMDIterator.cpp.
References calcWorkspacePos(), Mantid::API::MatrixWorkspace::getDimension(), Mantid::API::MatrixWorkspace::getNumberHistograms(), Mantid::API::MatrixWorkspace::isHistogramData(), m_beginWI, m_center, m_dimY, m_endWI, m_isBinnedData, m_max, m_startIndices, m_workspaceIndex, m_ws, m_xIndex, and Mantid::API::MatrixWorkspace::readY().
|
inlineprivate |
Calculate the workspace index/x index for this iterator position.
Definition at line 86 of file MatrixWorkspaceMDIterator.cpp.
References Mantid::API::MatrixWorkspace::getAxis(), Mantid::API::NumericAxis::getValues(), m_center, m_dimY, m_endWI, m_errorIsCached, m_verticalBinSize, m_workspaceIndex, m_ws, m_X, m_Y, Mantid::API::MatrixWorkspace::readX(), and Mantid::API::MatrixWorkspace::readY().
Referenced by jumpTo(), MatrixWorkspaceMDIterator(), and next().
|
overridevirtual |
Find neighbour indexes.
Implements Mantid::API::IMDIterator.
Definition at line 267 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Find neighbour indexes face touching.
Implements Mantid::API::IMDIterator.
Definition at line 275 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Returns the position of the center of the box pointed to.
Implements Mantid::API::IMDIterator.
Definition at line 216 of file MatrixWorkspaceMDIterator.cpp.
References m_center, m_isBinnedData, m_X, and m_xIndex.
Referenced by getInnerPosition(), and next().
|
overridevirtual |
Implements Mantid::API::IMDIterator.
Definition at line 68 of file MatrixWorkspaceMDIterator.cpp.
References m_max.
|
overridevirtual |
Returns the error for this box, same as innerError.
Implements Mantid::API::IMDIterator.
Definition at line 193 of file MatrixWorkspaceMDIterator.cpp.
References m_E, m_errorIsCached, m_workspaceIndex, m_ws, m_xIndex, and Mantid::API::MatrixWorkspace::readE().
Referenced by getInnerError(), and getNormalizedError().
|
overridevirtual |
For a given event/point in this box, return the detector ID.
Implements Mantid::API::IMDIterator.
Definition at line 238 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Returns the error of a given event.
Implements Mantid::API::IMDIterator.
Definition at line 249 of file MatrixWorkspaceMDIterator.cpp.
References getError().
|
overridevirtual |
For a given event/point in this box, return the associated experiment-info index.
Implements Mantid::API::IMDIterator.
Definition at line 232 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
For a given event/point in this box, return the associated experiment-info index.
Implements Mantid::API::IMDIterator.
Definition at line 235 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Returns the position of a given event for a given dimension.
Implements Mantid::API::IMDIterator.
Definition at line 241 of file MatrixWorkspaceMDIterator.cpp.
References getCenter().
|
overridevirtual |
Returns the signal of a given event.
Implements Mantid::API::IMDIterator.
Definition at line 246 of file MatrixWorkspaceMDIterator.cpp.
References getSignal().
|
overridevirtual |
Getter for the masked state of the workspace.
Implements Mantid::API::IMDIterator.
Definition at line 256 of file MatrixWorkspaceMDIterator.cpp.
References Mantid::API::SpectrumInfo::hasDetectors(), Mantid::API::SpectrumInfo::isMasked(), m_spectrumInfo, and m_workspaceIndex.
|
overridevirtual |
Get the linear index.
Implements Mantid::API::IMDIterator.
Definition at line 280 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Returns the normalized error for this box.
Implements Mantid::API::IMDIterator.
Definition at line 176 of file MatrixWorkspaceMDIterator.cpp.
References getError(), Mantid::API::IMDIterator::m_normalization, m_verticalBinSize, m_X, m_xIndex, Mantid::API::NoNormalization, Mantid::API::NumEventsNormalization, and Mantid::API::VolumeNormalization.
|
overridevirtual |
Returns the normalized signal for this box.
Implements Mantid::API::IMDIterator.
Definition at line 161 of file MatrixWorkspaceMDIterator.cpp.
References Mantid::API::IMDIterator::m_normalization, m_verticalBinSize, m_X, m_xIndex, m_Y, Mantid::API::NoNormalization, Mantid::API::NumEventsNormalization, and Mantid::API::VolumeNormalization.
|
overridevirtual |
Returns the number of events/points contained in this box.
Implements Mantid::API::IMDIterator.
Definition at line 228 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Returns the signal for this box, same as innerSignal.
Implements Mantid::API::IMDIterator.
Definition at line 190 of file MatrixWorkspaceMDIterator.cpp.
Referenced by getInnerSignal().
|
overridevirtual |
Return a list of vertexes defining the volume pointed to.
Implements Mantid::API::IMDIterator.
Definition at line 204 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Return a list of vertexes defining the volume pointed to, enable masking of dimensions.
Implements Mantid::API::IMDIterator.
Definition at line 208 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Is index reachable by the iterator.
Implements Mantid::API::IMDIterator.
Definition at line 284 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Jump to the index^th cell.
No range checking is performed, for performance reasons!
index | :: point to jump to. Must be 0 <= index < getDataSize(). |
Implements Mantid::API::IMDIterator.
Definition at line 76 of file MatrixWorkspaceMDIterator.cpp.
References calcWorkspacePos(), index, lower, m_beginWI, m_pos, m_startIndices, and m_xIndex.
Referenced by next().
|
overridevirtual |
Advance to the next cell.
If the current cell is the last one in the workspace do nothing and return false.
Implements Mantid::API::IMDIterator.
Definition at line 125 of file MatrixWorkspaceMDIterator.cpp.
References calcWorkspacePos(), getCenter(), Mantid::Geometry::MDImplicitFunction::isPointContained(), m_center, m_function, m_max, m_pos, m_workspaceIndex, m_xIndex, and m_Y.
|
overridevirtual |
Advance, skipping a certain number of cells.
skip | :: how many to increase. If 1, then every point will be sampled. |
Implements Mantid::API::IMDIterator.
Definition at line 154 of file MatrixWorkspaceMDIterator.cpp.
|
overridevirtual |
Implements Mantid::API::IMDIterator.
Definition at line 118 of file MatrixWorkspaceMDIterator.cpp.
|
private |
Workspace index at which the iterator begins.
Definition at line 119 of file MatrixWorkspaceMDIterator.h.
Referenced by jumpTo(), and MatrixWorkspaceMDIterator().
|
mutableprivate |
Coordinates of the center at the current iterator pos.
Definition at line 99 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), getCenter(), MatrixWorkspaceMDIterator(), and next().
|
private |
The Y (vertical, e.g. spectra) dimension.
Definition at line 113 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), and MatrixWorkspaceMDIterator().
|
mutableprivate |
Definition at line 104 of file MatrixWorkspaceMDIterator.h.
Referenced by getError().
|
private |
Workspace index at which the iterator ends.
Definition at line 122 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), and MatrixWorkspaceMDIterator().
|
mutableprivate |
Error vector has been cached?
Definition at line 107 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), and getError().
|
private |
Implicit function to limit volume searched.
Definition at line 90 of file MatrixWorkspaceMDIterator.h.
Referenced by next().
|
private |
Is the matrix workspace binned (true) e.g. Y vector is 1 shorter than X.
Definition at line 110 of file MatrixWorkspaceMDIterator.h.
Referenced by getCenter(), and MatrixWorkspaceMDIterator().
|
private |
The maximum linear index in the workspace.
Definition at line 87 of file MatrixWorkspaceMDIterator.h.
Referenced by getDataSize(), MatrixWorkspaceMDIterator(), next(), and valid().
|
private |
The linear position/index into the MDHistoWorkspace.
Definition at line 84 of file MatrixWorkspaceMDIterator.h.
|
private |
SpectrumInfo object, used for masking information.
Definition at line 129 of file MatrixWorkspaceMDIterator.h.
Referenced by getIsMasked().
|
private |
vector of starting index of the unraveled data array
Definition at line 116 of file MatrixWorkspaceMDIterator.h.
Referenced by jumpTo(), and MatrixWorkspaceMDIterator().
|
private |
For numeric axes, this is the size of the bin in the vertical direction.
It is 1.0 for spectrum axes
Definition at line 126 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), getNormalizedError(), and getNormalizedSignal().
|
private |
Workspace index of the spectrum we are looking at.
Definition at line 93 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), getError(), getIsMasked(), MatrixWorkspaceMDIterator(), and next().
|
private |
Workspace being iterated.
Definition at line 81 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), getError(), and MatrixWorkspaceMDIterator().
|
private |
Cached copies of X,Y,E at current workspace index.
Definition at line 102 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), getCenter(), getNormalizedError(), and getNormalizedSignal().
|
private |
x-index, index into the Y[] data array of the spectrum.
Definition at line 96 of file MatrixWorkspaceMDIterator.h.
Referenced by getCenter(), getError(), getNormalizedError(), getNormalizedSignal(), getSignal(), jumpTo(), MatrixWorkspaceMDIterator(), and next().
|
private |
Definition at line 103 of file MatrixWorkspaceMDIterator.h.
Referenced by calcWorkspacePos(), getNormalizedSignal(), getSignal(), and next().