Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mantid::DataObjects::MDHistoWorkspaceIterator Class Reference

An implementation of IMDIterator that iterates through a MDHistoWorkspace. More...

#include <MDHistoWorkspaceIterator.h>

Inheritance diagram for Mantid::DataObjects::MDHistoWorkspaceIterator:
Mantid::API::IMDIterator

Public Member Functions

std::vector< size_t > findNeighbourIndexes () const override
 Gets indexes of bins/pixels/boxes neighbouring the present iterator location. More...
 
std::vector< size_t > findNeighbourIndexesByWidth (const int &width) const
 Find vertex-touching neighbours. More...
 
std::vector< size_t > findNeighbourIndexesByWidth (const std::vector< int > &widths) const
 Find vertex-touching neighbours. More...
 
std::pair< std::vector< size_t >, std::vector< bool > > findNeighbourIndexesByWidth1D (const int &width, const int &width_dimension) const
 Find vertex-touching neighbours. More...
 
std::vector< size_t > findNeighbourIndexesFaceTouching () const override
 Find neighbor indexes, but only return those that are face-touching. More...
 
VecMDExtents getBoxExtents () const
 Get the extents in n-dimensions corresponding to the position of the box of the current iterator. 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 goniometer 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
 Returns true if masking is used. More...
 
size_t getLinearIndex () const override
 Getter for 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...
 
virtual signal_t getNumEventsFraction () const
 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...
 
void init (const MDHistoWorkspace *workspace, Mantid::Geometry::MDImplicitFunction *function, size_t beginPos=0, size_t endPos=size_t(-1))
 Constructor helper. More...
 
bool isWithinBounds (size_t index) const override
 
void jumpTo (size_t index) override
 Jump to the index^th cell. More...
 
virtual coord_t jumpToNearest (const Mantid::Kernel::VMD &fromLocation)
 Jump the iterator to the nearest valid position correspoinding to the centre current position of the desired iterator position. More...
 
 MDHistoWorkspaceIterator (const MDHistoWorkspace *workspace, Mantid::Geometry::MDImplicitFunction *function=nullptr, size_t beginPos=0, size_t endPos=size_t(-1))
 Constructor. More...
 
 MDHistoWorkspaceIterator (const MDHistoWorkspace *workspace, SkippingPolicy *skippingPolicy, Mantid::Geometry::MDImplicitFunction *function=nullptr, size_t beginPos=0, size_t endPos=size_t(-1))
 Constructor. More...
 
 MDHistoWorkspaceIterator (const MDHistoWorkspace_const_sptr &workspace, Mantid::Geometry::MDImplicitFunction *function=nullptr, size_t beginPos=0, size_t endPos=size_t(-1))
 Constructor. More...
 
 MDHistoWorkspaceIterator (const MDHistoWorkspace_const_sptr &workspace, SkippingPolicy *skippingPolicy, Mantid::Geometry::MDImplicitFunction *function=nullptr, size_t beginPos=0, size_t endPos=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...
 
size_t permutationCacheSize () const
 
bool valid () const override
 
 ~MDHistoWorkspaceIterator () override
 Destructor. More...
 
- 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
 

Protected Member Functions

std::vector< int64_t > createPermutations (const std::vector< int > &widths) const
 Create or fetch permutations relating to a given neighbour width. More...
 

Protected Attributes

uint64_t m_begin
 The beginning linear index in the workspace. More...
 
coord_tm_binWidth
 Width of each bin in each dimension. More...
 
coord_tm_center
 Center of the current box. Not set until getCenter() is called. More...
 
std::unique_ptr< Mantid::Geometry::MDImplicitFunctionm_function
 Implicit function to limit volume searched. More...
 
size_t * m_index
 Index into each dimension. More...
 
size_t * m_indexMaker
 Array to find indices from linear indices. More...
 
size_t * m_indexMax
 Index into each dimension. More...
 
uint64_t m_max
 The maximum linear index in the workspace. More...
 
size_t m_nd
 Number of dimensions. More...
 
coord_tm_origin
 Origin (index 0,0,0) in the space = the minimum of each dimension. More...
 
std::vector< int64_t > m_permutationsFaceTouching
 Neigbour finding permutations for face touching neighbours (3 by 3 width). More...
 
PermutationsMap m_permutationsVertexTouchingMap
 Neighbour finding permutations map for vertex touching. More...
 
uint64_t m_pos
 The linear position/index into the MDHistoWorkspace. More...
 
SkippingPolicy_scptr m_skippingPolicy
 Skipping policy. More...
 
const MDHistoWorkspacem_ws
 The MDHistoWorkspace being iterated. More...
 
- Protected Attributes inherited from Mantid::API::IMDIterator
Mantid::API::MDNormalization m_normalization
 Normalization method for getNormalizedSignal() More...
 

Detailed Description

An implementation of IMDIterator that iterates through a MDHistoWorkspace.

It treats the bin in the workspace as a box containing a single "event", at the center of each bin and with the proper signal/error.

Author
Janik Zikovsky
Date
2011-10-06

Definition at line 36 of file MDHistoWorkspaceIterator.h.

Constructor & Destructor Documentation

◆ MDHistoWorkspaceIterator() [1/4]

Mantid::DataObjects::MDHistoWorkspaceIterator::MDHistoWorkspaceIterator ( const MDHistoWorkspace_const_sptr workspace,
SkippingPolicy skippingPolicy,
Mantid::Geometry::MDImplicitFunction function = nullptr,
size_t  beginPos = 0,
size_t  endPos = size_t(-1) 
)

Constructor.

Parameters
workspace:: MDHistoWorkspace_sptr being iterated
skippingPolicy:: The skipping policy to use.
function:: The implicit function to use. Becomes owned by this object.
beginPos:: Start position
endPos:: End position

Definition at line 121 of file MDHistoWorkspaceIterator.cpp.

References init(), and workspace.

◆ MDHistoWorkspaceIterator() [2/4]

Mantid::DataObjects::MDHistoWorkspaceIterator::MDHistoWorkspaceIterator ( const MDHistoWorkspace workspace,
SkippingPolicy skippingPolicy,
Mantid::Geometry::MDImplicitFunction function = nullptr,
size_t  beginPos = 0,
size_t  endPos = size_t(-1) 
)

Constructor.

Parameters
workspace:: MDHistoWorkspace_sptr being iterated
function:: The implicit function to use. Becomes owned by this object.
skippingPolicy:: The skipping policy to use
beginPos:: Start position
endPos:: End position
Returns

Definition at line 140 of file MDHistoWorkspaceIterator.cpp.

References init(), and workspace.

◆ MDHistoWorkspaceIterator() [3/4]

Mantid::DataObjects::MDHistoWorkspaceIterator::MDHistoWorkspaceIterator ( const MDHistoWorkspace_const_sptr workspace,
Mantid::Geometry::MDImplicitFunction function = nullptr,
size_t  beginPos = 0,
size_t  endPos = size_t(-1) 
)

Constructor.

Parameters
workspace:: MDHistoWorkspace_sptr being iterated
function:: The implicit function to use. Becomes owned by this object.
Returns
Constructor
Parameters
workspace:: MDHistoWorkspace_sptr being iterated
function:: The implicit function to use. Becomes owned by this object.
beginPos:: start position
endPos:: end position

Definition at line 90 of file MDHistoWorkspaceIterator.cpp.

References init(), and workspace.

◆ MDHistoWorkspaceIterator() [4/4]

Mantid::DataObjects::MDHistoWorkspaceIterator::MDHistoWorkspaceIterator ( const MDHistoWorkspace workspace,
Mantid::Geometry::MDImplicitFunction function = nullptr,
size_t  beginPos = 0,
size_t  endPos = size_t(-1) 
)

Constructor.

Parameters
workspace:: MDHistoWorkspace_sptr being iterated
function:: The implicit function to use. Becomes owned by this object.
beginPos
endPos

Definition at line 105 of file MDHistoWorkspaceIterator.cpp.

References init(), and workspace.

◆ ~MDHistoWorkspaceIterator()

Mantid::DataObjects::MDHistoWorkspaceIterator::~MDHistoWorkspaceIterator ( )
override

Destructor.

Definition at line 234 of file MDHistoWorkspaceIterator.cpp.

References m_binWidth, m_center, m_index, m_indexMaker, m_indexMax, and m_origin.

Member Function Documentation

◆ createPermutations()

std::vector< int64_t > Mantid::DataObjects::MDHistoWorkspaceIterator::createPermutations ( const std::vector< int > &  widths) const
protected

Create or fetch permutations relating to a given neighbour width.

This is to create the permutations needed to operate find neighbours in the vertex-touching schenarios Rather than having to fabricate what the possible permutations are each time the iterator is moved and the method is called, we can cache the results, and re-use them as the only factors are the and the dimensionality, the width (n-neighbours).

Parameters
widths: vector of integer widths.
Returns
index permutations

Definition at line 529 of file MDHistoWorkspaceIterator.cpp.

References Mantid::API::MDGeometry::getDimension(), Mantid::Geometry::m, m_nd, m_permutationsVertexTouchingMap, and m_ws.

Referenced by findNeighbourIndexesByWidth(), and findNeighbourIndexesByWidth1D().

◆ findNeighbourIndexes()

std::vector< size_t > Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexes ( ) const
overridevirtual

Gets indexes of bins/pixels/boxes neighbouring the present iterator location.

Return all vertex touching neighbours. The number of neighbour indexes returned will depend upon the dimensionality of the workspace as well as the presence of boundaries and edges.

FindNeighbours will return the indexes of neighbours even if they are unreachable from the current iterator. To verify that the indexes are reachable from the current iterator, run isWithinBounds. Note that this is only a concern where the workspace iteration is portioned up amongst >1 iterators.

Returns
vector of linear indexes to neighbour locations.

Implements Mantid::API::IMDIterator.

Definition at line 478 of file MDHistoWorkspaceIterator.cpp.

References findNeighbourIndexesByWidth().

◆ findNeighbourIndexesByWidth() [1/2]

std::vector< size_t > Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexesByWidth ( const int &  width) const

Find vertex-touching neighbours.

Expands out the width to make a n-dimensional vector filled with the requested width.

Parameters
width: Odd number of pixels for all dimensions.
Returns
collection of indexes.

Definition at line 592 of file MDHistoWorkspaceIterator.cpp.

References findNeighbourIndexesByWidth(), and m_nd.

Referenced by findNeighbourIndexes(), and findNeighbourIndexesByWidth().

◆ findNeighbourIndexesByWidth() [2/2]

std::vector< size_t > Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexesByWidth ( const std::vector< int > &  widths) const

Find vertex-touching neighbours.

Parameters
widths: Vector containing odd number of pixels per dimension. Entries match dimensions of iterator.
Returns
collection of indexes.

Definition at line 603 of file MDHistoWorkspaceIterator.cpp.

References createPermutations(), Mantid::Kernel::Utils::NestedForLoop::GetIndicesFromLinearIndex(), Mantid::Kernel::Utils::isNeighbourOfSubject(), m_index, m_indexMaker, m_indexMax, m_nd, and m_pos.

◆ findNeighbourIndexesByWidth1D()

std::pair< std::vector< size_t >, std::vector< bool > > Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexesByWidth1D ( const int &  width,
const int &  width_dimension 
) const

Find vertex-touching neighbours.

This function always returns a vector of indexes which has a size equal to the product of the widths. This is because it also returns a vector of bools (of the same size) which records the validity of each index, rather than removing invalid indexes from the list. This function only allows a width vector to have one non-singleton dimension. NB, the index of the central pixel is included in the output array.

Parameters
width: Width in the non-singleton dimension
width_dimension: The non-singleton dimension of the widths vector
Returns
collection of indexes.

Definition at line 646 of file MDHistoWorkspaceIterator.cpp.

References createPermutations(), Mantid::Kernel::Utils::NestedForLoop::GetIndicesFromLinearIndex(), Mantid::Kernel::Utils::isNeighbourOfSubject(), m_index, m_indexMaker, m_indexMax, m_nd, and m_pos.

◆ findNeighbourIndexesFaceTouching()

std::vector< size_t > Mantid::DataObjects::MDHistoWorkspaceIterator::findNeighbourIndexesFaceTouching ( ) const
overridevirtual

Find neighbor indexes, but only return those that are face-touching.

Will return the indexes of neighbours even if they are unreachable from the current iterator. To verify that the indexes are reachable from the current iterator, run isWithinBounds. Note that this is only a concern where the workspace iteration is portioned up amongst >1 iterators.

Returns

Implements Mantid::API::IMDIterator.

Definition at line 493 of file MDHistoWorkspaceIterator.cpp.

References Mantid::Kernel::Utils::NestedForLoop::GetIndicesFromLinearIndex(), Mantid::Kernel::Utils::isNeighbourOfSubject(), m_index, m_indexMaker, m_indexMax, m_nd, m_permutationsFaceTouching, and m_pos.

◆ getBoxExtents()

VecMDExtents Mantid::DataObjects::MDHistoWorkspaceIterator::getBoxExtents ( ) const

Get the extents in n-dimensions corresponding to the position of the box of the current iterator.

Returns
pairs of min/max extents.

Definition at line 397 of file MDHistoWorkspaceIterator.cpp.

References Mantid::Geometry::d, Mantid::Kernel::Utils::NestedForLoop::GetIndicesFromLinearIndex(), m_binWidth, m_index, m_indexMaker, m_indexMax, m_nd, m_origin, and m_pos.

Referenced by performWeightedSum().

◆ getCenter()

Mantid::Kernel::VMD Mantid::DataObjects::MDHistoWorkspaceIterator::getCenter ( ) const
overridevirtual

Returns the position of the center of the box pointed to.

Implements Mantid::API::IMDIterator.

Definition at line 382 of file MDHistoWorkspaceIterator.cpp.

References Mantid::Geometry::d, Mantid::Kernel::Utils::NestedForLoop::GetIndicesFromLinearIndex(), m_binWidth, m_center, m_index, m_indexMaker, m_indexMax, m_nd, m_origin, and m_pos.

◆ getDataSize()

size_t Mantid::DataObjects::MDHistoWorkspaceIterator::getDataSize ( ) const
overridevirtual
Returns
the number of points to be iterated on

Implements Mantid::API::IMDIterator.

Definition at line 244 of file MDHistoWorkspaceIterator.cpp.

References m_begin, and m_max.

◆ getError()

signal_t Mantid::DataObjects::MDHistoWorkspaceIterator::getError ( ) const
overridevirtual

Returns the error for this box, same as innerError.

Implements Mantid::API::IMDIterator.

Definition at line 363 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getErrorAt(), m_pos, and m_ws.

Referenced by performWeightedSum().

◆ getInnerDetectorID()

int32_t Mantid::DataObjects::MDHistoWorkspaceIterator::getInnerDetectorID ( size_t  index) const
overridevirtual

For a given event/point in this box, return the detector ID.

Implements Mantid::API::IMDIterator.

Definition at line 438 of file MDHistoWorkspaceIterator.cpp.

◆ getInnerError()

signal_t Mantid::DataObjects::MDHistoWorkspaceIterator::getInnerError ( size_t  index) const
overridevirtual

Returns the error of a given event.

Implements Mantid::API::IMDIterator.

Definition at line 453 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getErrorAt(), m_pos, and m_ws.

◆ getInnerExpInfoIndex()

uint16_t Mantid::DataObjects::MDHistoWorkspaceIterator::getInnerExpInfoIndex ( size_t  index) const
overridevirtual

For a given event/point in this box, return the associated experiment-info index.

Implements Mantid::API::IMDIterator.

Definition at line 424 of file MDHistoWorkspaceIterator.cpp.

◆ getInnerGoniometerIndex()

uint16_t Mantid::DataObjects::MDHistoWorkspaceIterator::getInnerGoniometerIndex ( size_t  index) const
overridevirtual

For a given event/point in this box, return the goniometer index.

Implements Mantid::API::IMDIterator.

Definition at line 431 of file MDHistoWorkspaceIterator.cpp.

◆ getInnerPosition()

coord_t Mantid::DataObjects::MDHistoWorkspaceIterator::getInnerPosition ( size_t  index,
size_t  dimension 
) const
overridevirtual

Returns the position of a given event for a given dimension.

Implements Mantid::API::IMDIterator.

Definition at line 445 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getCenter(), m_pos, and m_ws.

◆ getInnerSignal()

signal_t Mantid::DataObjects::MDHistoWorkspaceIterator::getInnerSignal ( size_t  index) const
overridevirtual

Returns the signal of a given event.

Implements Mantid::API::IMDIterator.

Definition at line 450 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getSignalAt(), m_pos, and m_ws.

◆ getIsMasked()

bool Mantid::DataObjects::MDHistoWorkspaceIterator::getIsMasked ( ) const
overridevirtual

Returns true if masking is used.

Implements Mantid::API::IMDIterator.

Definition at line 455 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getIsMaskedAt(), m_pos, and m_ws.

Referenced by performWeightedSum().

◆ getLinearIndex()

size_t Mantid::DataObjects::MDHistoWorkspaceIterator::getLinearIndex ( ) const
overridevirtual

Getter for the linear index.

Returns
the linear index.

Implements Mantid::API::IMDIterator.

Definition at line 461 of file MDHistoWorkspaceIterator.cpp.

References m_pos.

Referenced by Mantid::MDAlgorithms::ReplicateMD::exec().

◆ getNormalizedError()

signal_t Mantid::DataObjects::MDHistoWorkspaceIterator::getNormalizedError ( ) const
overridevirtual

◆ getNormalizedSignal()

signal_t Mantid::DataObjects::MDHistoWorkspaceIterator::getNormalizedSignal ( ) const
overridevirtual

◆ getNumEvents()

size_t Mantid::DataObjects::MDHistoWorkspaceIterator::getNumEvents ( ) const
overridevirtual

Returns the number of events/points contained in this box.

Returns
truncated number of events

Implements Mantid::API::IMDIterator.

Definition at line 415 of file MDHistoWorkspaceIterator.cpp.

References getNumEventsFraction().

◆ getNumEventsFraction()

signal_t Mantid::DataObjects::MDHistoWorkspaceIterator::getNumEventsFraction ( ) const
virtual

Returns the number of events/points contained in this box.

Returns
eact number of events (weights may be applied)

Definition at line 420 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getNumEventsAt(), m_pos, and m_ws.

Referenced by getNumEvents(), and performWeightedSum().

◆ getSignal()

signal_t Mantid::DataObjects::MDHistoWorkspaceIterator::getSignal ( ) const
overridevirtual

Returns the signal for this box, same as innerSignal.

Implements Mantid::API::IMDIterator.

Definition at line 360 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getSignalAt(), m_pos, and m_ws.

Referenced by performWeightedSum().

◆ getVertexesArray() [1/2]

std::unique_ptr< coord_t[]> Mantid::DataObjects::MDHistoWorkspaceIterator::getVertexesArray ( size_t &  numVertices) const
overridevirtual

Return a list of vertexes defining the volume pointed to.

Implements Mantid::API::IMDIterator.

Definition at line 366 of file MDHistoWorkspaceIterator.cpp.

References Mantid::DataObjects::MDHistoWorkspace::getVertexesArray(), m_pos, and m_ws.

◆ getVertexesArray() [2/2]

std::unique_ptr< coord_t[]> Mantid::DataObjects::MDHistoWorkspaceIterator::getVertexesArray ( size_t &  numVertices,
const size_t  outDimensions,
const bool *  maskDim 
) const
overridevirtual

Return a list of vertexes defining the volume pointed to, enable masking of dimensions.

Implements Mantid::API::IMDIterator.

Definition at line 371 of file MDHistoWorkspaceIterator.cpp.

References UNUSED_ARG.

◆ init()

void Mantid::DataObjects::MDHistoWorkspaceIterator::init ( const MDHistoWorkspace workspace,
Mantid::Geometry::MDImplicitFunction function,
size_t  beginPos = 0,
size_t  endPos = size_t(-1) 
)

◆ isWithinBounds()

bool Mantid::DataObjects::MDHistoWorkspaceIterator::isWithinBounds ( size_t  index) const
overridevirtual
Parameters
index: linear index to inspect against iterator
Returns
True only if the index is between the min and max bounds of the iterator.

Implements Mantid::API::IMDIterator.

Definition at line 517 of file MDHistoWorkspaceIterator.cpp.

References index, m_begin, and m_max.

◆ jumpTo()

void Mantid::DataObjects::MDHistoWorkspaceIterator::jumpTo ( size_t  index)
overridevirtual

Jump to the index^th cell.

No range checking is performed, for performance reasons!

Parameters
index:: point to jump to. Must be 0 <= index < getDataSize().

Implements Mantid::API::IMDIterator.

Definition at line 252 of file MDHistoWorkspaceIterator.cpp.

References index, m_begin, and m_pos.

Referenced by jumpToNearest().

◆ jumpToNearest()

Mantid::coord_t Mantid::DataObjects::MDHistoWorkspaceIterator::jumpToNearest ( const Mantid::Kernel::VMD fromLocation)
virtual

Jump the iterator to the nearest valid position correspoinding to the centre current position of the desired iterator position.

Parameters
fromLocation: destination or nearest to.
Returns
absolute distance of end position from requested position.

Definition at line 260 of file MDHistoWorkspaceIterator.cpp.

References Mantid::Geometry::d, Mantid::Kernel::Utils::NestedForLoop::GetLinearIndex(), jumpTo(), m_binWidth, m_indexMaker, m_indexMax, m_nd, and m_origin.

◆ next() [1/2]

bool Mantid::DataObjects::MDHistoWorkspaceIterator::next ( )
overridevirtual

Advance to the next cell.

If the current cell is the last one in the workspace do nothing and return false.

Returns
true if you can continue iterating

Implements Mantid::API::IMDIterator.

Definition at line 290 of file MDHistoWorkspaceIterator.cpp.

References Mantid::Geometry::d, Mantid::Kernel::Utils::NestedForLoop::Increment(), m_binWidth, m_center, m_function, m_index, m_indexMax, m_max, m_nd, m_origin, m_pos, and m_skippingPolicy.

Referenced by init().

◆ next() [2/2]

bool Mantid::DataObjects::MDHistoWorkspaceIterator::next ( size_t  skip)
overridevirtual

Advance, skipping a certain number of cells.

Parameters
skip:: how many to increase. If 1, then every point will be sampled.

Implements Mantid::API::IMDIterator.

Definition at line 320 of file MDHistoWorkspaceIterator.cpp.

References m_max, and m_pos.

◆ permutationCacheSize()

size_t Mantid::DataObjects::MDHistoWorkspaceIterator::permutationCacheSize ( ) const
Returns
The size of the permutation cache.

Definition at line 686 of file MDHistoWorkspaceIterator.cpp.

References m_permutationsVertexTouchingMap.

◆ valid()

bool Mantid::DataObjects::MDHistoWorkspaceIterator::valid ( ) const
overridevirtual
Returns
true if the iterator is valid. Check this at the start of an iteration, in case the very first point is not valid.

Implements Mantid::API::IMDIterator.

Definition at line 283 of file MDHistoWorkspaceIterator.cpp.

References m_max, and m_pos.

Referenced by init().

Member Data Documentation

◆ m_begin

uint64_t Mantid::DataObjects::MDHistoWorkspaceIterator::m_begin
protected

The beginning linear index in the workspace.

Definition at line 126 of file MDHistoWorkspaceIterator.h.

Referenced by getDataSize(), init(), isWithinBounds(), and jumpTo().

◆ m_binWidth

coord_t* Mantid::DataObjects::MDHistoWorkspaceIterator::m_binWidth
protected

Width of each bin in each dimension.

Definition at line 144 of file MDHistoWorkspaceIterator.h.

Referenced by getBoxExtents(), getCenter(), init(), jumpToNearest(), next(), and ~MDHistoWorkspaceIterator().

◆ m_center

coord_t* Mantid::DataObjects::MDHistoWorkspaceIterator::m_center
protected

Center of the current box. Not set until getCenter() is called.

Definition at line 138 of file MDHistoWorkspaceIterator.h.

Referenced by getCenter(), init(), next(), and ~MDHistoWorkspaceIterator().

◆ m_function

std::unique_ptr<Mantid::Geometry::MDImplicitFunction> Mantid::DataObjects::MDHistoWorkspaceIterator::m_function
protected

Implicit function to limit volume searched.

Definition at line 132 of file MDHistoWorkspaceIterator.h.

Referenced by init(), and next().

◆ m_index

size_t* Mantid::DataObjects::MDHistoWorkspaceIterator::m_index
protected

◆ m_indexMaker

size_t* Mantid::DataObjects::MDHistoWorkspaceIterator::m_indexMaker
protected

◆ m_indexMax

size_t* Mantid::DataObjects::MDHistoWorkspaceIterator::m_indexMax
protected

◆ m_max

uint64_t Mantid::DataObjects::MDHistoWorkspaceIterator::m_max
protected

The maximum linear index in the workspace.

Definition at line 129 of file MDHistoWorkspaceIterator.h.

Referenced by getDataSize(), init(), isWithinBounds(), next(), and valid().

◆ m_nd

size_t Mantid::DataObjects::MDHistoWorkspaceIterator::m_nd
protected

◆ m_origin

coord_t* Mantid::DataObjects::MDHistoWorkspaceIterator::m_origin
protected

Origin (index 0,0,0) in the space = the minimum of each dimension.

Definition at line 141 of file MDHistoWorkspaceIterator.h.

Referenced by getBoxExtents(), getCenter(), init(), jumpToNearest(), next(), and ~MDHistoWorkspaceIterator().

◆ m_permutationsFaceTouching

std::vector<int64_t> Mantid::DataObjects::MDHistoWorkspaceIterator::m_permutationsFaceTouching
mutableprotected

Neigbour finding permutations for face touching neighbours (3 by 3 width).

Definition at line 156 of file MDHistoWorkspaceIterator.h.

Referenced by findNeighbourIndexesFaceTouching(), and init().

◆ m_permutationsVertexTouchingMap

PermutationsMap Mantid::DataObjects::MDHistoWorkspaceIterator::m_permutationsVertexTouchingMap
mutableprotected

Neighbour finding permutations map for vertex touching.

Keyed via the width (n-pixels) of neighbours required.

Definition at line 160 of file MDHistoWorkspaceIterator.h.

Referenced by createPermutations(), and permutationCacheSize().

◆ m_pos

uint64_t Mantid::DataObjects::MDHistoWorkspaceIterator::m_pos
protected

◆ m_skippingPolicy

SkippingPolicy_scptr Mantid::DataObjects::MDHistoWorkspaceIterator::m_skippingPolicy
protected

Skipping policy.

Definition at line 163 of file MDHistoWorkspaceIterator.h.

Referenced by next().

◆ m_ws

const MDHistoWorkspace* Mantid::DataObjects::MDHistoWorkspaceIterator::m_ws
protected

The documentation for this class was generated from the following files: