19namespace DataObjects {
21#ifndef __INTEL_COMPILER
73 void setFileBacked(
const uint64_t ,
const size_t ,
const bool )
override;
74 void setFileBacked()
override;
75 void clearFileBacked(
bool loadDiskBackedData)
override;
80 void reserveMemoryForLoad(uint64_t )
override;
82 void clearDataFromMemory()
override;
84 void clear()
override;
86 uint64_t getNPoints()
const override;
90 size_t getNumDims()
const override;
91 size_t getNumMDBoxes()
const override;
97 bool isBox()
const override {
return true; }
103 void setChildren(
const std::vector<API::IMDNode *> & ,
const size_t ,
104 const size_t )
override {
105 throw std::runtime_error(
"MDBox cannot have children.");
110 bool isDataAdded()
const;
118 std::vector<MDE> &getEvents();
125 const std::vector<MDE> &getConstEvents()
const;
127 const std::vector<MDE> &getEvents()
const;
128 void releaseEvents();
130 std::vector<MDE> *getEventsCopy()
override;
132 void getEventsData(std::vector<coord_t> &coordTable,
size_t &nColumns)
const override;
133 void setEventsData(
const std::vector<coord_t> &coordTable)
override;
135 size_t addEvent(
const MDE &Evnt)
override;
136 size_t addEventUnsafe(
const MDE &Evnt)
override;
139 size_t addEvents(
const std::vector<MDE> &events)
override;
141 size_t addEventsUnsafe(
const std::vector<MDE> &events)
override;
145 void buildAndAddEvent(
const signal_t Signal,
const signal_t errorSq,
const std::vector<coord_t> &point,
146 uint16_t expInfoIndex, uint16_t goniometerIndex, uint32_t detectorId)
override;
147 void buildAndAddEventUnsafe(
const signal_t Signal,
const signal_t errorSq,
const std::vector<coord_t> &point,
148 uint16_t expInfoIndex, uint16_t goniometernIndex, uint32_t detectorId)
override;
149 size_t buildAndAddEvents(
const std::vector<signal_t> &sigErrSq,
const std::vector<coord_t> &Coord,
150 const std::vector<uint16_t> &expInfoIndex,
const std::vector<uint16_t> &goniometernIndex,
151 const std::vector<uint32_t> &detectorId)
override;
154 void centerpointBin(
MDBin<MDE, nd> &bin,
bool *fullyContained)
const override;
163 void calculateCentroid(
coord_t *centroid)
const override;
164 void calculateCentroid(
coord_t *centroid,
const int expInfoIndex)
const override;
165 coord_t *getCentroid()
const override;
169 const bool useOnePercentBackgroundCorrection =
true)
const override;
173 signal_t &signal,
signal_t &errorSquared, std::vector<signal_t> &signal_fit)
const override;
177 void getBoxes(std::vector<API::IMDNode *> &boxes,
size_t ,
bool )
override;
179 void getBoxes(std::vector<
MDBoxBase<MDE, nd> *> &boxes,
size_t maxDepth,
bool leafOnly,
181 void getBoxes(std::vector<API::IMDNode *> &boxes,
size_t maxDepth,
bool leafOnly,
184 void getBoxes(std::vector<API::IMDNode *> &outBoxes,
const std::function<
bool(
API::IMDNode *)> &cond)
final override;
186 void transformDimensions(std::vector<double> &scaling, std::vector<double> &offset)
override;
192 void mask()
override;
194 void unmask()
override;
211 void initMDBox(
const size_t nBoxEvents);
217 using sptr = std::shared_ptr<MDBox<MDE, nd>>;
223#ifndef __INTEL_COMPILER
230template <
typename MDE,
size_t nd>
struct IF {
234 static inline void EXEC(std::vector<MDE> &data,
const std::vector<signal_t> &sigErrSq,
235 const std::vector<coord_t> &Coord,
const std::vector<uint16_t> &expInfoIndex,
236 const std::vector<uint16_t> &goniometerIndex,
const std::vector<uint32_t> &detectorId,
238 for (
size_t i = 0; i < nEvents; i++) {
239 data.emplace_back(sigErrSq[2 * i], sigErrSq[2 * i + 1], expInfoIndex[i], goniometerIndex[i], detectorId[i],
245 const uint16_t expInfoIndex,
const uint16_t goniometerIndex,
246 const uint32_t detectorId) {
247 return MDE(Signal, Error, expInfoIndex, goniometerIndex, detectorId, Coord);
255 const std::vector<coord_t> &Coord,
const std::vector<uint16_t> & ,
256 const std::vector<uint16_t> & ,
257 const std::vector<uint32_t> & ,
size_t nEvents) {
258 for (
size_t i = 0; i < nEvents; i++) {
259 data.emplace_back(sigErrSq[2 * i], sigErrSq[2 * i + 1], &Coord[i * nd]);
264 const uint16_t ,
const uint16_t ,
#define TMDE_CLASS
Macro to make declaring template classes faster.
This class is used by MDBox and MDGridBox in order to intelligently determine optimal behavior.
The header describes interface to IO Operations perfomed by the box controller May be replaced by a b...
MDBin : Class describing a single bin in a dense, Multidimensional histogram.
Templated super-class of a multi-dimensional event "box".
Templated class for a multi-dimensional event "box".
std::vector< MDE > vec_t
Typedef for a vector of the conatined events.
bool getIsMasked() const override
bool m_bIsMasked
Flag indicating that masking has been applied.
size_t getNumChildren() const override
Get the # of children MDBoxBase'es (non-recursive)
API::IMDNode * getChild(size_t) override
Return the indexth child MDBoxBase.
bool isBox() const override
void splitAllIfNeeded(Mantid::Kernel::ThreadScheduler *=nullptr) override
std::unique_ptr< Kernel::ISaveable > m_Saveable
uint64_t getTotalDataSize() const override
std::shared_ptr< MDBox< MDE, nd > > sptr
Typedef for a shared pointer to a MDBox.
std::vector< coord_t > m_tableData
member to avoid reallocation
void setChildren(const std::vector< API::IMDNode * > &, const size_t, const size_t) override
Sets the children from a vector of children.
std::vector< MDE > data
Vector of MDEvent's, in no particular order.
typename std::vector< MDE >::const_iterator EventIterator
size_t getDataInMemorySize() const override
MDBox(const MDBox &)
private default copy constructor as the only correct constructor is the one with the boxController;
A simple class holding some statistics on the distribution of events in a particular dimension.
Templated class holding data about a neutron detection event in N-dimensions (for example,...
Simple class that holds the extents (min/max) of a given dimension in a MD workspace or MDBox.
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
An interface for objects that can be cached or saved to disk.
The ThreadScheduler object defines how tasks are allocated to threads and in what order.
std::shared_ptr< BoxController > BoxController_sptr
Shared ptr to BoxController.
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.
static MDLeanEvent< nd > BUILD_EVENT(const signal_t Signal, const signal_t Error, const coord_t *Coord, const uint16_t, const uint16_t, const uint32_t)
static void EXEC(std::vector< MDLeanEvent< nd > > &data, const std::vector< signal_t > &sigErrSq, const std::vector< coord_t > &Coord, const std::vector< uint16_t > &, const std::vector< uint16_t > &, const std::vector< uint32_t > &, size_t nEvents)
static MDE BUILD_EVENT(const signal_t Signal, const signal_t Error, const coord_t *Coord, const uint16_t expInfoIndex, const uint16_t goniometerIndex, const uint32_t detectorId)
static void EXEC(std::vector< MDE > &data, const std::vector< signal_t > &sigErrSq, const std::vector< coord_t > &Coord, const std::vector< uint16_t > &expInfoIndex, const std::vector< uint16_t > &goniometerIndex, const std::vector< uint32_t > &detectorId, size_t nEvents)