13namespace DataObjects {
30 : m_pos(0), m_current(nullptr), m_currentMDBox(nullptr), m_events(nullptr),
32 commonConstruct(topBox, maxDepth, leafOnly, function);
51 : m_pos(0), m_current(nullptr), m_currentMDBox(nullptr), m_events(nullptr), m_skippingPolicy(skippingPolicy) {
52 commonConstruct(topBox, maxDepth, leafOnly, function);
71 throw std::invalid_argument(
"MDBoxIterator::ctor(): NULL top-level box given.");
73 if (topBox->getDepth() > maxDepth)
74 throw std::invalid_argument(
"MDBoxIterator::ctor(): The maxDepth parameter "
75 "must be >= the depth of the topBox.");
80 topBox->getBoxes(m_boxes, maxDepth, leafOnly, function);
82 topBox->getBoxes(m_boxes, maxDepth, leafOnly);
85 m_max = m_boxes.size();
99 : m_pos(0), m_current(nullptr), m_currentMDBox(nullptr), m_events(nullptr),
103 this->init(boxes, begin, end);
113 if (begin >= boxes.size())
114 throw std::runtime_error(
"MDBoxIterator::ctor(): invalid beginning position.");
117 throw std::runtime_error(
"MDBoxIterator::ctor(): end position is before the position.");
118 if (theEnd > boxes.size())
119 theEnd = boxes.size();
123 m_boxes.insert(m_boxes.begin(), boxes.begin() + begin, boxes.begin() + theEnd);
125 m_max = m_boxes.size();
159 bool result = this->next(1);
160 while (m_skippingPolicy->keepGoing()) {
161 result = this->next(1);
193 if (m_currentMDBox) {
197 throw std::runtime_error(
"MDBoxIterator: requested the event list from a "
198 "box that is not a MDBox!");
208 m_currentMDBox->releaseEvents();
210 m_currentMDBox =
nullptr;
222 switch (m_normalization) {
223 case API::NoNormalization:
224 return m_current->getSignal();
225 case API::VolumeNormalization:
226 return m_current->getSignal() * m_current->getInverseVolume();
227 case API::NumEventsNormalization:
228 return m_current->getSignal() / double(m_current->getNPoints());
230 return std::numeric_limits<signal_t>::quiet_NaN();
236 switch (m_normalization) {
237 case API::NoNormalization:
238 return m_current->getError();
239 case API::VolumeNormalization:
240 return m_current->getError() * m_current->getInverseVolume();
241 case API::NumEventsNormalization:
242 return m_current->getError() / double(m_current->getNPoints());
244 return std::numeric_limits<signal_t>::quiet_NaN();
255 return m_current->getVertexesArray(numVertices);
259 const bool *maskDim) const {
260 return m_current->getVertexesArray(numVertices, outDimensions, maskDim);
266 m_current->getCenter(center);
274 m_currentMDBox = dynamic_cast<
MDBox<MDE, nd> *>(m_current);
276 return m_current->getNPoints();
284 return (*m_events)[
index].getExpInfoIndex();
290 return (*m_events)[
index].getGoniometerIndex();
296 return (*m_events)[
index].getDetectorID();
302 return (*m_events)[
index].getCenter(dimension);
308 return (*m_events)[
index].getSignal();
314 return (*m_events)[
index].getError();
320 return m_current->getIsMasked();
326 throw
std::runtime_error(
"MDBoxIterator does not implement findNeighbourIndex");
330 throw
std::runtime_error(
"MDBoxIterator does not implement findNeighbourIndexesFaceTouching");
334 throw
std::runtime_error(
"MDBoxIterator does not implement getLinearIndex");
338 throw
std::runtime_error(
"MDBoxIterator does not implement isWithinBounds");
std::map< DeltaEMode::Type, std::string > index
#define TMDE(decl)
Macro TMDE to make declaring template functions faster.
Templated super-class of a multi-dimensional event "box".
MDBoxIterator: iterate through MDBoxBase hierarchy down to a given maximum depth.
Templated class for a multi-dimensional event "box".
const std::vector< MDE > & getConstEvents() const
Get vector of constant events to use.
Policy that indicates skipping of masked bins.
SkippingPolicy : Policy types for skipping in MDiterators.
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
VMDBase< VMD_t > VMD
Define the VMD as using the double or float data type.
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,...
double signal_t
Typedef for the signal recorded in a MDBox, etc.