Mantid
Loading...
Searching...
No Matches
MDEventWSWrapper.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2011 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
11#include "MantidMDAlgorithms/DllConfig.h"
13
14namespace Mantid {
15namespace MDAlgorithms {
27using Strings = std::vector<std::string>;
28
31// NOTICE: There is need to work with bare class-function pointers here, as
32// Boost function pointers with multiple arguments
33// appear not portable to all architectures supported (Fail on MAC)
35using fpVoidMethod = void (MDEventWSWrapper::*)();
38using fpAddData = void (MDEventWSWrapper::*)(const float *, const uint16_t *, const uint16_t *, const uint32_t *,
39 const coord_t *, size_t) const;
41using fpCreateWS = void (MDEventWSWrapper::*)(const MDWSDescription &);
42
43class MANTID_MDALGORITHMS_DLL MDEventWSWrapper {
44public:
46 virtual ~MDEventWSWrapper() = default;
49 static size_t getMaxNDim() { return MAX_N_DIM; }
50
53 size_t nDimensions() const;
56 API::IMDEventWorkspace_sptr createEmptyMDWS(const MDWSDescription &WSD);
59 void addMDData(std::vector<float> &sigErr, std::vector<uint16_t> &expInfoIndex,
60 std::vector<uint16_t> &goniometerIndex, std::vector<uint32_t> &detId, std::vector<coord_t> &Coord,
61 size_t dataSize) const;
64 void releaseWorkspace();
66 API::IMDEventWorkspace_sptr pWorkspace() { return m_Workspace; }
67 // should it be moved to the IDataObjects?
68 // void refreshCentroid(){ (this->*(mdCalCentroid[m_NDimensions]))(); };
70 void setMDWS(API::IMDEventWorkspace_sptr spWS);
71
74 bool ifNeedsSplitting() const { return m_needSplitting; }
76 void splitList(Kernel::ThreadScheduler *) { (this->*(mdBoxListSplitter[m_NDimensions]))(); }
77
78private:
80 enum { MAX_N_DIM = 8 };
86
90 std::vector<fpCreateWS> wsCreator;
93 std::vector<fpAddData> mdEvAddAndForget;
96 std::vector<fpVoidMethod> mdCalCentroid;
99 std::vector<fpVoidMethod> mdBoxListSplitter;
100
101 // helper class to generate methaloop on MD workspaces dimensions:
102 template <size_t i> friend class LOOP;
103
104 // internal function tempates to generate as function of dimensions and
105 // assign to function pointers
106 template <size_t nd>
107 void addMDDataND(const float *sigErr, const uint16_t *expInfoIndex, const uint16_t *goniometerIndex,
108 const uint32_t *detId, const coord_t *Coord, size_t dataSize) const;
109 template <size_t nd>
110 void addAndTraceMDDataND(float *sig_err, uint16_t *expInfoIndex, uint16_t *goniometerIndex, uint32_t *det_id,
111 coord_t *Coord, size_t data_size) const;
112
113 template <size_t nd> void calcCentroidND();
114
115 template <size_t nd> void createEmptyEventWS(const MDWSDescription &description);
116
117 template <size_t nd> void splitBoxList(); // for the time being
118 // void splitBoxList(Kernel::ThreadScheduler * ts);
119
120 // the variable, which informs the user of MD Event WS wrapper that there are
121 // boxes to split; Very simple for the time being
122 mutable bool m_needSplitting;
123};
124
125} // namespace MDAlgorithms
126} // namespace Mantid
MDEventFactory : collection of methods to create MDLeanEvent* instances, by specifying the number of ...
The ThreadScheduler object defines how tasks are allocated to threads and in what order.
std::vector< fpCreateWS > wsCreator
VECTORS OF FUNCTION POINTERS to different number of dimensions methdods vector holding function point...
size_t m_NDimensions
actual number of dimensions, initiated in current MD workspace; 0 if not initated;
bool ifNeedsSplitting() const
the accessor verify if there are boxes in box-splitter cash which need splitting;
void splitList(Kernel::ThreadScheduler *)
method splits list of boxes not yet uses thread sheduler but may be later
API::IMDEventWorkspace_sptr m_Workspace
pointer to taret MD workspace:
std::vector< fpVoidMethod > mdBoxListSplitter
vector holding function pointers to the code, which split list of boxes need splitting
static size_t getMaxNDim()
get maximal number of dimensions, allowed for the algorithm and embedded in algorithm during compilat...
void addAndTraceMDDataND(float *sig_err, uint16_t *expInfoIndex, uint16_t *goniometerIndex, uint32_t *det_id, coord_t *Coord, size_t data_size) const
std::vector< fpVoidMethod > mdCalCentroid
vector holding function pointers to the code, which refreshes centroid (could it be moved to IMD?...
std::vector< fpAddData > mdEvAddAndForget
vector holding function pointers to the code, which adds diffrent dimension number events to the work...
API::IMDEventWorkspace_sptr pWorkspace()
get access to the internal workspace
helper class describes the properties of target MD workspace, which should be obtained as the result ...
std::shared_ptr< IMDEventWorkspace > IMDEventWorkspace_sptr
Shared pointer to Mantid::API::IMDEventWorkspace.
Holds support functions for strings.
Definition: RegexStrings.h:16
void(MDEventWSWrapper::*)(const float *, const uint16_t *, const uint16_t *, const uint32_t *, const coord_t *, size_t) const fpAddData
signature for the internal templated function pointer to add data to an existing workspace
void(MDEventWSWrapper::*)(const MDWSDescription &) fpCreateWS
signature for the internal templated function pointer to create workspace
void(MDEventWSWrapper::*)() fpVoidMethod
signature to void templated function
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,...
Definition: MDTypes.h:27