|
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. | |
| std::vector< size_t > | findNeighbourIndexesFaceTouching () const override |
| Find neighbour indexes face touching. | |
| Mantid::Kernel::VMD | getCenter () const override |
| Returns the position of the center of the box pointed to. | |
| size_t | getDataSize () const override |
| signal_t | getError () const override |
| Returns the error for this box, same as innerError. | |
| int32_t | getInnerDetectorID (size_t index) const override |
| For a given event/point in this box, return the detector ID. | |
| signal_t | getInnerError (size_t index) const override |
| Returns the error of a given event. | |
| uint16_t | getInnerExpInfoIndex (size_t index) const override |
| For a given event/point in this box, return the associated experiment-info index. | |
| uint16_t | getInnerGoniometerIndex (size_t index) const override |
| For a given event/point in this box, return the associated experiment-info index. | |
| coord_t | getInnerPosition (size_t index, size_t dimension) const override |
| Returns the position of a given event for a given dimension. | |
| signal_t | getInnerSignal (size_t index) const override |
| Returns the signal of a given event. | |
| bool | getIsMasked () const override |
| Getter for the masked state of the workspace. | |
| size_t | getLinearIndex () const override |
| Get the linear index. | |
| signal_t | getNormalizedError () const override |
| Returns the normalized error for this box. | |
| signal_t | getNormalizedSignal () const override |
| Returns the normalized signal for this box. | |
| size_t | getNumEvents () const override |
| Returns the number of events/points contained in this box. | |
| signal_t | getSignal () const override |
| Returns the signal for this box, same as innerSignal. | |
| std::unique_ptr< coord_t[]> | getVertexesArray (size_t &numVertices) const override |
| Return a list of vertexes defining the volume pointed to. | |
| 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. | |
| bool | isWithinBounds (size_t index) const override |
| Is index reachable by the iterator. | |
| void | jumpTo (size_t index) override |
| Jump to the index^th cell. | |
| MatrixWorkspaceMDIterator (const MatrixWorkspace *workspace, Mantid::Geometry::MDImplicitFunction *function, size_t beginWI=0, size_t endWI=size_t(-1)) | |
| Constructor. | |
| bool | next () override |
| Advance to the next cell. | |
| bool | next (size_t skip) override |
| Advance, skipping a certain number of cells. | |
| bool | valid () const override |
Public Member Functions inherited from Mantid::API::IMDIterator | |
| Mantid::API::MDNormalization | getNormalization () const |
| IMDIterator () | |
| Default constructor. | |
| void | setNormalization (Mantid::API::MDNormalization normalization) |
| Set how the signal will be normalized when calling getNormalizedSignal() | |
| virtual | ~IMDIterator ()=default |
Private Member Functions | |
| void | calcWorkspacePos (size_t newWI) |
| Calculate the workspace index/x index for this iterator position. | |
Private Attributes | |
| size_t | m_beginWI |
| Workspace index at which the iterator begins. | |
| Mantid::Kernel::VMD | m_center |
| Coordinates of the center at the current iterator pos. | |
| Mantid::Geometry::IMDDimension_const_sptr | m_dimY |
| The Y (vertical, e.g. spectra) dimension. | |
| MantidVec | m_E |
| size_t | m_endWI |
| Workspace index at which the iterator ends. | |
| bool | m_errorIsCached |
| Error vector has been cached? | |
| Mantid::Geometry::MDImplicitFunction * | m_function |
| Implicit function to limit volume searched. | |
| bool | m_isBinnedData |
| Is the matrix workspace binned (true) e.g. Y vector is 1 shorter than X. | |
| uint64_t | m_max |
| The maximum linear index in the workspace. | |
| uint64_t | m_pos |
| The linear position/index into the MDHistoWorkspace. | |
| const SpectrumInfo & | m_spectrumInfo |
| SpectrumInfo object, used for masking information. | |
| std::vector< size_t > | m_startIndices |
| vector of starting index of the unraveled data array | |
| double | m_verticalBinSize |
| For numeric axes, this is the size of the bin in the vertical direction. | |
| size_t | m_workspaceIndex |
| Workspace index of the spectrum we are looking at. | |
| const MatrixWorkspace * | m_ws |
| Workspace being iterated. | |
| MantidVec | m_X |
| Cached copies of X,Y,E at current workspace index. | |
| size_t | m_xIndex |
| x-index, index into the Y[] data array of the spectrum. | |
| MantidVec | m_Y |
Additional Inherited Members | |
Protected Attributes inherited from Mantid::API::IMDIterator | |
| Mantid::API::MDNormalization | m_normalization |
| Normalization method for getNormalizedSignal() | |
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(), next(), and valid().
|
private |
|
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().