Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
Mantid::MDAlgorithms::MDEventWSWrapper Class Reference

#include <MDEventWSWrapper.h>

Public Member Functions

void addMDData (std::vector< float > &sigErr, std::vector< uint16_t > &expInfoIndex, std::vector< uint16_t > &goniometerIndex, std::vector< uint32_t > &detId, std::vector< coord_t > &Coord, size_t dataSize) const
 add the data to the internal workspace. More...
 
API::IMDEventWorkspace_sptr createEmptyMDWS (const MDWSDescription &WSD)
 function creates empty MD event workspace with given parameters (workspace factory) and stores internal pointer to this workspace for further usage More...
 
bool ifNeedsSplitting () const
 the accessor verify if there are boxes in box-splitter cash which need splitting; More...
 
 MDEventWSWrapper ()
 constructor More...
 
size_t nDimensions () const
 get number of dimensions, for the workspace, currently accessed by the algorithm. More...
 
API::IMDEventWorkspace_sptr pWorkspace ()
 get access to the internal workspace More...
 
void releaseWorkspace ()
 releases the shared pointer to the MD workspace, stored by the class and makes the class instance undefined; More...
 
void setMDWS (API::IMDEventWorkspace_sptr spWS)
 initiate the class with pointer to existing MD workspace More...
 
void splitList (Kernel::ThreadScheduler *)
 method splits list of boxes not yet uses thread sheduler but may be later More...
 
virtual ~MDEventWSWrapper ()=default
 

Static Public Member Functions

static size_t getMaxNDim ()
 get maximal number of dimensions, allowed for the algorithm and embedded in algorithm during compilation time. More...
 

Private Types

enum  { MAX_N_DIM = 8 }
 maximal nuber of dimensions, currently supported by the class; More...
 

Private Member Functions

template<size_t nd>
void addAndTraceMDDataND (float *sig_err, uint16_t *expInfoIndex, uint16_t *goniometerIndex, uint32_t *det_id, coord_t *Coord, size_t data_size) const
 
template<>
void addMDDataND (const float *, const uint16_t *, const uint16_t *, const uint32_t *, const coord_t *, size_t) const
 the function used in template metaloop termination on 0 dimensions and to throw the error in attempt to add data to 0-dimension workspace More...
 
template<size_t nd>
void addMDDataND (const float *sigErr, const uint16_t *expInfoIndex, const uint16_t *goniometerIndex, const uint32_t *detId, const coord_t *Coord, size_t dataSize) const
 templated by number of dimensions function to add multidimensional data to the workspace it is expected that all MD coordinates are within the ranges of MD defined workspace, so no checks are performed More...
 
template<size_t nd>
void calcCentroidND ()
 helper function to refresh centroid on MDEventWorkspace with nd dimensions More...
 
template<>
void calcCentroidND ()
 the function used in template metaloop termination on 0 dimensions and as the function which will throw the error on undefined MDWorkspaceWrapper More...
 
template<>
void createEmptyEventWS (const MDWSDescription &)
 terminator for attempting initiate 0 dimensions workspace, will throw. More...
 
template<size_t nd>
void createEmptyEventWS (const MDWSDescription &description)
 internal helper function to create empty MDEventWorkspace with nd dimensions and set up internal pointer to this workspace template parameter: nd – number of dimensions More...
 
template<size_t nd>
void splitBoxList ()
 
template<>
void splitBoxList ()
 

Private Attributes

size_t m_NDimensions
 actual number of dimensions, initiated in current MD workspace; 0 if not initated; More...
 
bool m_needSplitting
 
API::IMDEventWorkspace_sptr m_Workspace
 pointer to taret MD workspace: More...
 
std::vector< fpVoidMethodmdBoxListSplitter
 vector holding function pointers to the code, which split list of boxes need splitting More...
 
std::vector< fpVoidMethodmdCalCentroid
 vector holding function pointers to the code, which refreshes centroid (could it be moved to IMD?) More...
 
std::vector< fpAddDatamdEvAddAndForget
 vector holding function pointers to the code, which adds diffrent dimension number events to the workspace More...
 
std::vector< fpCreateWSwsCreator
 VECTORS OF FUNCTION POINTERS to different number of dimensions methdods vector holding function pointers to the code, creating different number of dimension worspace as function of dimensions number. More...
 

Friends

template<size_t i>
class LOOP
 

Detailed Description

Definition at line 43 of file MDEventWSWrapper.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

maximal nuber of dimensions, currently supported by the class;

Enumerator
MAX_N_DIM 

Definition at line 80 of file MDEventWSWrapper.h.

Constructor & Destructor Documentation

◆ MDEventWSWrapper()

Mantid::MDAlgorithms::MDEventWSWrapper::MDEventWSWrapper ( )

◆ ~MDEventWSWrapper()

virtual Mantid::MDAlgorithms::MDEventWSWrapper::~MDEventWSWrapper ( )
virtualdefault

Member Function Documentation

◆ addAndTraceMDDataND()

template<size_t nd>
void Mantid::MDAlgorithms::MDEventWSWrapper::addAndTraceMDDataND ( float *  sig_err,
uint16_t *  expInfoIndex,
uint16_t *  goniometerIndex,
uint32_t *  det_id,
coord_t Coord,
size_t  data_size 
) const
private

◆ addMDData()

void Mantid::MDAlgorithms::MDEventWSWrapper::addMDData ( std::vector< float > &  sigErr,
std::vector< uint16_t > &  expInfoIndex,
std::vector< uint16_t > &  goniometerIndex,
std::vector< uint32_t > &  detId,
std::vector< coord_t > &  Coord,
size_t  dataSize 
) const

add the data to the internal workspace.

method adds the data to the workspace which was initiated before;

The workspace has to exist and be initiated

Parameters
sigErr: pointer to the beginning of 2*data_size array containing signal and squared error
expInfoIndex: pointer to the beginnign of data_size containing associated experiment-info index
goniometerIndex: 0-based index determines the goniometer settings when this event occurred
detId: pointer to the beginning of dataSize array containing detector id-s
Coord: pointer to the beginning of dataSize*nd array containig the coordinates od nd-dimensional events
dataSize– the length of the vector of MD events

Definition at line 204 of file MDEventWSWrapper.cpp.

References m_NDimensions, and mdEvAddAndForget.

◆ addMDDataND() [1/2]

template<>
void Mantid::MDAlgorithms::MDEventWSWrapper::addMDDataND ( const float *  ,
const uint16_t *  ,
const uint16_t *  ,
const uint32_t *  ,
const coord_t ,
size_t   
) const
private

the function used in template metaloop termination on 0 dimensions and to throw the error in attempt to add data to 0-dimension workspace

Definition at line 112 of file MDEventWSWrapper.cpp.

◆ addMDDataND() [2/2]

template<size_t nd>
void Mantid::MDAlgorithms::MDEventWSWrapper::addMDDataND ( const float *  sigErr,
const uint16_t *  expInfoIndex,
const uint16_t *  goniometerIndex,
const uint32_t *  detId,
const coord_t Coord,
size_t  dataSize 
) const
private

templated by number of dimensions function to add multidimensional data to the workspace it is expected that all MD coordinates are within the ranges of MD defined workspace, so no checks are performed

tempate parameter: nd – number of dimensions

Parameters
sigErr– pointer to the beginning of 2*data_size array containing signal and squared error
expInfoIndex– pointer to the beginning of data_size containing associated experiment-info index
goniometerIndex– 0-based index determines the goniometer settings when this event occurred
detId– pointer to the beginning of dataSize array containing detector id-s
Coord– pointer to the beginning of dataSize*nd array containing the coordinates of nd-dimensional events
dataSize– the length of the vector of MD events

Definition at line 85 of file MDEventWSWrapper.cpp.

References Mantid::DataObjects::MDEventWorkspace::addEvent(), and m_Workspace.

◆ calcCentroidND() [1/2]

template<size_t nd>
void Mantid::MDAlgorithms::MDEventWSWrapper::calcCentroidND
private

helper function to refresh centroid on MDEventWorkspace with nd dimensions

Definition at line 133 of file MDEventWSWrapper.cpp.

References m_Workspace.

◆ calcCentroidND() [2/2]

template<>
void Mantid::MDAlgorithms::MDEventWSWrapper::calcCentroidND ( )
private

the function used in template metaloop termination on 0 dimensions and as the function which will throw the error on undefined MDWorkspaceWrapper

Definition at line 144 of file MDEventWSWrapper.cpp.

◆ createEmptyEventWS() [1/2]

template<>
void Mantid::MDAlgorithms::MDEventWSWrapper::createEmptyEventWS ( const MDWSDescription )
private

terminator for attempting initiate 0 dimensions workspace, will throw.

Definition at line 59 of file MDEventWSWrapper.cpp.

◆ createEmptyEventWS() [2/2]

template<size_t nd>
void Mantid::MDAlgorithms::MDEventWSWrapper::createEmptyEventWS ( const MDWSDescription description)
private

◆ createEmptyMDWS()

API::IMDEventWorkspace_sptr Mantid::MDAlgorithms::MDEventWSWrapper::createEmptyMDWS ( const MDWSDescription WSD)

function creates empty MD event workspace with given parameters (workspace factory) and stores internal pointer to this workspace for further usage

function creates empty MD event workspace with given parameters (workspace factory) and stores internal pointer to this workspace for further usage.

IT ASLO SETS UP W-TRANSFORMATON. TODO: reconcile w-transformation with MD geometry.

Parameters
WSDthe class which describes an MD workspace
Returns
shared pointer to the created workspace

Definition at line 165 of file MDEventWSWrapper.cpp.

References m_NDimensions, m_Workspace, Mantid::MDAlgorithms::MDWSDescription::m_Wtransf, MAX_N_DIM, Mantid::MDAlgorithms::MDWSDescription::nDimensions(), std::to_string(), and wsCreator.

◆ getMaxNDim()

static size_t Mantid::MDAlgorithms::MDEventWSWrapper::getMaxNDim ( )
inlinestatic

get maximal number of dimensions, allowed for the algorithm and embedded in algorithm during compilation time.

Definition at line 49 of file MDEventWSWrapper.h.

◆ ifNeedsSplitting()

bool Mantid::MDAlgorithms::MDEventWSWrapper::ifNeedsSplitting ( ) const
inline

the accessor verify if there are boxes in box-splitter cash which need splitting;

Definition at line 74 of file MDEventWSWrapper.h.

◆ nDimensions()

size_t Mantid::MDAlgorithms::MDEventWSWrapper::nDimensions ( ) const

get number of dimensions, for the workspace, currently accessed by the algorithm.

function returns the number of dimensions in current MDEvent workspace or throws if the workspace has not been defined

Definition at line 150 of file MDEventWSWrapper.cpp.

References m_NDimensions.

◆ pWorkspace()

API::IMDEventWorkspace_sptr Mantid::MDAlgorithms::MDEventWSWrapper::pWorkspace ( )
inline

get access to the internal workspace

Definition at line 66 of file MDEventWSWrapper.h.

◆ releaseWorkspace()

void Mantid::MDAlgorithms::MDEventWSWrapper::releaseWorkspace ( )

releases the shared pointer to the MD workspace, stored by the class and makes the class instance undefined;

method should be called at the end of the algorithm, to let the workspace manager know that it has whole responsibility for the workspace (As the algorithm is static, it will hold the pointer to the workspace otherwise, not allowing the WS manager to delete WS on request or when it finds this usefull)

Definition at line 220 of file MDEventWSWrapper.cpp.

References m_NDimensions, and m_Workspace.

◆ setMDWS()

void Mantid::MDAlgorithms::MDEventWSWrapper::setMDWS ( API::IMDEventWorkspace_sptr  spWS)

initiate the class with pointer to existing MD workspace

set up existing workspace pointer as internal pointer for the class to perform proper MD operations on this workspace

Definition at line 187 of file MDEventWSWrapper.cpp.

References m_NDimensions, and m_Workspace.

◆ splitBoxList() [1/2]

template<size_t nd>
void Mantid::MDAlgorithms::MDEventWSWrapper::splitBoxList
private

Definition at line 119 of file MDEventWSWrapper.cpp.

References m_needSplitting, and m_Workspace.

◆ splitBoxList() [2/2]

template<>
void Mantid::MDAlgorithms::MDEventWSWrapper::splitBoxList ( )
private

Definition at line 127 of file MDEventWSWrapper.cpp.

◆ splitList()

void Mantid::MDAlgorithms::MDEventWSWrapper::splitList ( Kernel::ThreadScheduler )
inline

method splits list of boxes not yet uses thread sheduler but may be later

Definition at line 76 of file MDEventWSWrapper.h.

Friends And Related Function Documentation

◆ LOOP

template<size_t i>
friend class LOOP
friend

Definition at line 102 of file MDEventWSWrapper.h.

Member Data Documentation

◆ m_NDimensions

size_t Mantid::MDAlgorithms::MDEventWSWrapper::m_NDimensions
private

actual number of dimensions, initiated in current MD workspace; 0 if not initated;

Definition at line 83 of file MDEventWSWrapper.h.

Referenced by addMDData(), createEmptyMDWS(), nDimensions(), releaseWorkspace(), and setMDWS().

◆ m_needSplitting

bool Mantid::MDAlgorithms::MDEventWSWrapper::m_needSplitting
mutableprivate

Definition at line 122 of file MDEventWSWrapper.h.

Referenced by splitBoxList().

◆ m_Workspace

API::IMDEventWorkspace_sptr Mantid::MDAlgorithms::MDEventWSWrapper::m_Workspace
private

pointer to taret MD workspace:

Definition at line 85 of file MDEventWSWrapper.h.

Referenced by addMDDataND(), calcCentroidND(), createEmptyEventWS(), createEmptyMDWS(), releaseWorkspace(), setMDWS(), and splitBoxList().

◆ mdBoxListSplitter

std::vector<fpVoidMethod> Mantid::MDAlgorithms::MDEventWSWrapper::mdBoxListSplitter
private

vector holding function pointers to the code, which split list of boxes need splitting

Definition at line 99 of file MDEventWSWrapper.h.

Referenced by Mantid::MDAlgorithms::LOOP< i >::EXEC(), Mantid::MDAlgorithms::LOOP< 0 >::EXEC(), and MDEventWSWrapper().

◆ mdCalCentroid

std::vector<fpVoidMethod> Mantid::MDAlgorithms::MDEventWSWrapper::mdCalCentroid
private

vector holding function pointers to the code, which refreshes centroid (could it be moved to IMD?)

Definition at line 96 of file MDEventWSWrapper.h.

Referenced by Mantid::MDAlgorithms::LOOP< i >::EXEC(), Mantid::MDAlgorithms::LOOP< 0 >::EXEC(), and MDEventWSWrapper().

◆ mdEvAddAndForget

std::vector<fpAddData> Mantid::MDAlgorithms::MDEventWSWrapper::mdEvAddAndForget
private

vector holding function pointers to the code, which adds diffrent dimension number events to the workspace

Definition at line 93 of file MDEventWSWrapper.h.

Referenced by addMDData(), Mantid::MDAlgorithms::LOOP< i >::EXEC(), Mantid::MDAlgorithms::LOOP< 0 >::EXEC(), and MDEventWSWrapper().

◆ wsCreator

std::vector<fpCreateWS> Mantid::MDAlgorithms::MDEventWSWrapper::wsCreator
private

VECTORS OF FUNCTION POINTERS to different number of dimensions methdods vector holding function pointers to the code, creating different number of dimension worspace as function of dimensions number.

Definition at line 90 of file MDEventWSWrapper.h.

Referenced by createEmptyMDWS(), Mantid::MDAlgorithms::LOOP< i >::EXEC(), Mantid::MDAlgorithms::LOOP< 0 >::EXEC(), and MDEventWSWrapper().


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