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

MDBoxIterator: iterate through MDBoxBase hierarchy down to a given maximum depth. More...

#include <MDBoxIterator.h>

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

Public Member Functions

std::vector< size_t > findNeighbourIndexes () const override
 Find neighbouring indexes vertex touching.
 
std::vector< size_t > findNeighbourIndexesFaceTouching () const override
 Find neighbouring indexes face touching.
 
MDBoxBase< MDE, nd > * getBox () const
 Return a pointer to the current box pointed to by the iterator.
 
Mantid::Kernel::VMD getCenter () const override
 Returns the position of the center of the box pointed to.
 
size_t getDataSize () const override
 ---------— IMDIterator Methods ---------------------------—
 
signal_t getError () const override
 Returns the error for this box.
 
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 goniometer 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
 Returns the error of a given event.
 
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.
 
size_t getPosition () const
 Getter for the position of the iterator.
 
signal_t getSignal () const override
 Returns the signal for this box.
 
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.
 
void init (std::vector< API::IMDNode * > &boxes, size_t begin, size_t end)
 Constructor helper function.
 
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.
 
 MDBoxIterator (API::IMDNode *topBox, size_t maxDepth, bool leafOnly, Mantid::Geometry::MDImplicitFunction *function=nullptr)
 Constructor.
 
 MDBoxIterator (API::IMDNode *topBox, size_t maxDepth, bool leafOnly, SkippingPolicy *skippingPolicy, Mantid::Geometry::MDImplicitFunction *function=nullptr)
 Constructor.
 
 MDBoxIterator (std::vector< API::IMDNode * > &boxes, size_t begin, size_t end)
 Constructor for parallelized iterators.
 
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
 
 ~MDBoxIterator () override
 Destructor.
 
- 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 commonConstruct (API::IMDNode *topBox, size_t maxDepth, bool leafOnly, Mantid::Geometry::MDImplicitFunction *function)
 Common code run my a few of the constructors.
 
void getEvents () const
 If needed, retrieve the events vector from the box.
 
void releaseEvents () const
 After you're done with a given box, release the events list (if it was retrieved)
 

Private Attributes

std::vector< API::IMDNode * > m_boxes
 Vector of all the boxes that will be iterated.
 
MDBoxBase< MDE, nd > * m_current
 Box currently pointed to.
 
MDBox< MDE, nd > * m_currentMDBox
 MDBox currently pointed to.
 
const std::vector< MDE > * m_events
 Pointer to the const events vector. Only initialized when needed.
 
size_t m_max
 Max pos = length of the boxes vector.
 
size_t m_pos
 Current position in the vector of boxes.
 
SkippingPolicy_scptr m_skippingPolicy
 

Additional Inherited Members

- Protected Attributes inherited from Mantid::API::IMDIterator
Mantid::API::MDNormalization m_normalization
 Normalization method for getNormalizedSignal()
 

Detailed Description

MDBoxIterator: iterate through MDBoxBase hierarchy down to a given maximum depth.

Author
Janik Zikovsky
Date
2011-06-03

Definition at line 28 of file MDBoxIterator.h.

Constructor & Destructor Documentation

◆ MDBoxIterator() [1/3]

Mantid::DataObjects::MDBoxIterator::MDBoxIterator ( API::IMDNode topBox,
size_t  maxDepth,
bool  leafOnly,
Mantid::Geometry::MDImplicitFunction function = nullptr 
)

Constructor.

Parameters
topBox:: top-level parent box.
maxDepth:: maximum depth to go to
leafOnly:: only report "leaf" nodes, e.g. boxes that are no longer split OR are at maxDepth.
function:: ImplicitFunction that limits iteration volume. NULL for don't limit this way. Note that the top level box is ALWAYS returned at least once, even if it is outside the implicit function

Definition at line 28 of file MDBoxIterator.hxx.

◆ MDBoxIterator() [2/3]

Mantid::DataObjects::MDBoxIterator::MDBoxIterator ( API::IMDNode topBox,
size_t  maxDepth,
bool  leafOnly,
SkippingPolicy skippingPolicy,
Mantid::Geometry::MDImplicitFunction function = nullptr 
)

Constructor.

Parameters
topBox:: top-level parent box.
maxDepth:: maximum depth to go to
leafOnly:: only report "leaf" nodes, e.g. boxes that are no longer split OR are at maxDepth.
skippingPolicy:: policy for skipping boxes upon next().
function:: ImplicitFunction that limits iteration volume. NULL for don't limit this way. Note that the top level box is ALWAYS returned at least once, even if it is outside the implicit function

Definition at line 49 of file MDBoxIterator.hxx.

◆ MDBoxIterator() [3/3]

Mantid::DataObjects::MDBoxIterator::MDBoxIterator ( std::vector< API::IMDNode * > &  boxes,
size_t  begin,
size_t  end 
)

Constructor for parallelized iterators.

Parameters
boxes:: ref to the list of ALL boxes in the workspace
begin:: start iterating at this point in the list
end:: stop iterating at this point in the list

Definition at line 98 of file MDBoxIterator.hxx.

◆ ~MDBoxIterator()

Mantid::DataObjects::MDBoxIterator::~MDBoxIterator ( )
override

Destructor.

Definition at line 134 of file MDBoxIterator.hxx.

Member Function Documentation

◆ commonConstruct()

void Mantid::DataObjects::MDBoxIterator::commonConstruct ( API::IMDNode topBox,
size_t  maxDepth,
bool  leafOnly,
Mantid::Geometry::MDImplicitFunction function 
)
private

Common code run my a few of the constructors.

Common construction code in the absense of constructor chaining.

Parameters
topBox:: top-level parent box.
maxDepth:: maximum depth to go to
leafOnly:: only report "leaf" nodes, e.g. boxes that are no longer split OR are at maxDepth.
function:: ImplicitFunction that limits iteration volume. NULL for don't limit this way. Note that the top level box is ALWAYS returned at least once, even if it is outside the implicit function

Definition at line 68 of file MDBoxIterator.hxx.

References m_max.

◆ findNeighbourIndexes()

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

Find neighbouring indexes vertex touching.

Implements Mantid::API::IMDIterator.

Definition at line 325 of file MDBoxIterator.hxx.

◆ findNeighbourIndexesFaceTouching()

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

Find neighbouring indexes face touching.

Implements Mantid::API::IMDIterator.

Definition at line 329 of file MDBoxIterator.hxx.

◆ getBox()

MDBoxBase< MDE, nd > * Mantid::DataObjects::MDBoxIterator::getBox ( ) const
inline

Return a pointer to the current box pointed to by the iterator.

Definition at line 39 of file MDBoxIterator.h.

Referenced by Mantid::MDAlgorithms::MinusMD::doMinus(), Mantid::MDAlgorithms::PlusMD::doPlus(), and Mantid::MDAlgorithms::IntegratePeaksMD2::findEllipsoid().

◆ getCenter()

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

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

Implements Mantid::API::IMDIterator.

Definition at line 264 of file MDBoxIterator.hxx.

◆ getDataSize()

size_t Mantid::DataObjects::MDBoxIterator::getDataSize ( ) const
overridevirtual

---------— IMDIterator Methods ---------------------------—

Returns the number of entries to be iterated against.

Implements Mantid::API::IMDIterator.

Definition at line 216 of file MDBoxIterator.hxx.

◆ getError()

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

Returns the error for this box.

Implements Mantid::API::IMDIterator.

Definition at line 251 of file MDBoxIterator.hxx.

◆ getEvents()

void Mantid::DataObjects::MDBoxIterator::getEvents ( ) const
private

If needed, retrieve the events vector from the box.

Does nothing if the events are already obtained.

Exceptions
ifthe box cannot have events.

Definition at line 189 of file MDBoxIterator.hxx.

References Mantid::DataObjects::MDBox::getConstEvents().

◆ getInnerDetectorID()

int32_t Mantid::DataObjects::MDBoxIterator::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 294 of file MDBoxIterator.hxx.

◆ getInnerError()

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

Returns the error of a given event.

Implements Mantid::API::IMDIterator.

Definition at line 312 of file MDBoxIterator.hxx.

◆ getInnerExpInfoIndex()

uint16_t Mantid::DataObjects::MDBoxIterator::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 282 of file MDBoxIterator.hxx.

◆ getInnerGoniometerIndex()

uint16_t Mantid::DataObjects::MDBoxIterator::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 288 of file MDBoxIterator.hxx.

◆ getInnerPosition()

coord_t Mantid::DataObjects::MDBoxIterator::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 300 of file MDBoxIterator.hxx.

◆ getInnerSignal()

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

Returns the signal of a given event.

Implements Mantid::API::IMDIterator.

Definition at line 306 of file MDBoxIterator.hxx.

◆ getIsMasked()

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

Returns the error of a given event.

Implements Mantid::API::IMDIterator.

Definition at line 318 of file MDBoxIterator.hxx.

◆ getLinearIndex()

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

Get the linear index.

Implements Mantid::API::IMDIterator.

Definition at line 333 of file MDBoxIterator.hxx.

◆ getNormalizedError()

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

Returns the normalized error for this box.

Implements Mantid::API::IMDIterator.

Definition at line 234 of file MDBoxIterator.hxx.

◆ getNormalizedSignal()

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

Returns the normalized signal for this box.

Implements Mantid::API::IMDIterator.

Definition at line 220 of file MDBoxIterator.hxx.

◆ getNumEvents()

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

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

Implements Mantid::API::IMDIterator.

Definition at line 272 of file MDBoxIterator.hxx.

◆ getPosition()

size_t Mantid::DataObjects::MDBoxIterator::getPosition ( ) const
inline

Getter for the position of the iterator.

Definition at line 84 of file MDBoxIterator.h.

◆ getSignal()

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

Returns the signal for this box.

Implements Mantid::API::IMDIterator.

Definition at line 248 of file MDBoxIterator.hxx.

◆ getVertexesArray() [1/2]

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

Return a list of vertexes defining the volume pointed to.

Implements Mantid::API::IMDIterator.

Definition at line 254 of file MDBoxIterator.hxx.

◆ getVertexesArray() [2/2]

std::unique_ptr< coord_t[]> Mantid::DataObjects::MDBoxIterator::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 258 of file MDBoxIterator.hxx.

◆ init()

void Mantid::DataObjects::MDBoxIterator::init ( std::vector< API::IMDNode * > &  boxes,
size_t  begin,
size_t  end 
)

Constructor helper function.

Parameters
boxes:: ref to the list of ALL boxes in the workspace
begin:: start iterating at this point in the list
end:: stop iterating at this point in the list

Definition at line 112 of file MDBoxIterator.hxx.

References m_max.

◆ isWithinBounds()

bool Mantid::DataObjects::MDBoxIterator::isWithinBounds ( size_t  index) const
overridevirtual

Is index reachable by the iterator.

Implements Mantid::API::IMDIterator.

Definition at line 337 of file MDBoxIterator.hxx.

◆ jumpTo()

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

Jump to the index^th cell.

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

Implements Mantid::API::IMDIterator.

Definition at line 141 of file MDBoxIterator.hxx.

References index, and m_max.

◆ next() [1/2]

bool Mantid::DataObjects::MDBoxIterator::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 158 of file MDBoxIterator.hxx.

Referenced by Mantid::MDAlgorithms::MinusMD::doMinus(), Mantid::MDAlgorithms::PlusMD::doPlus(), and Mantid::MDAlgorithms::IntegratePeaksMD2::findEllipsoid().

◆ next() [2/2]

bool Mantid::DataObjects::MDBoxIterator::next ( size_t  skip)
inlineoverridevirtual

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 172 of file MDBoxIterator.hxx.

References m_max.

◆ releaseEvents()

void Mantid::DataObjects::MDBoxIterator::releaseEvents ( ) const
private

After you're done with a given box, release the events list (if it was retrieved)

Definition at line 206 of file MDBoxIterator.hxx.

◆ valid()

bool Mantid::DataObjects::MDBoxIterator::valid ( ) const
overridevirtual
Returns
true if the iterator is currently valid

Implements Mantid::API::IMDIterator.

Definition at line 151 of file MDBoxIterator.hxx.

Member Data Documentation

◆ m_boxes

std::vector<API::IMDNode *> Mantid::DataObjects::MDBoxIterator::m_boxes
private

Vector of all the boxes that will be iterated.

Definition at line 110 of file MDBoxIterator.h.

◆ m_current

MDBoxBase<MDE, nd>* Mantid::DataObjects::MDBoxIterator::m_current
private

Box currently pointed to.

Definition at line 113 of file MDBoxIterator.h.

◆ m_currentMDBox

MDBox<MDE, nd>* Mantid::DataObjects::MDBoxIterator::m_currentMDBox
mutableprivate

MDBox currently pointed to.

Definition at line 116 of file MDBoxIterator.h.

◆ m_events

const std::vector<MDE>* Mantid::DataObjects::MDBoxIterator::m_events
mutableprivate

Pointer to the const events vector. Only initialized when needed.

Definition at line 119 of file MDBoxIterator.h.

◆ m_max

size_t Mantid::DataObjects::MDBoxIterator::m_max
private

Max pos = length of the boxes vector.

Definition at line 107 of file MDBoxIterator.h.

◆ m_pos

size_t Mantid::DataObjects::MDBoxIterator::m_pos
private

Current position in the vector of boxes.

Definition at line 104 of file MDBoxIterator.h.

◆ m_skippingPolicy

SkippingPolicy_scptr Mantid::DataObjects::MDBoxIterator::m_skippingPolicy
private

Definition at line 122 of file MDBoxIterator.h.


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