Mantid
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator > Class Template Reference

Class to create the box structure of MDWorkspace. More...

#include <MDEventTreeBuilder.h>

Classes

struct  Task
 Structure to store the subtask of creating subtree from the range of events. More...
 
struct  TreeWithIndexError
 

Public Types

using EventAccessType = DataObjects::EventAccessor
 
using IndexCoordinateSwitcher = typename MDEvent::template AccessFor< EventDistributor >
 
enum  WORKER_TYPE { MASTER , SLAVE }
 

Public Member Functions

TreeWithIndexError distribute (std::vector< MDEventType< ND > > &mdEvents)
 
 MDEventTreeBuilder (const int numWorkers, const size_t threshold, const API::BoxController_sptr &bc, const morton_index::MDSpaceBounds< ND > &space)
 

Private Types

using Box = DataObjects::MDBox< MDEvent, ND >
 
using BoxBase = DataObjects::MDBoxBase< MDEvent, ND >
 
using EventDistributor = MDEventTreeBuilder< ND, MDEventType, EventIterator >
 
using GridBox = DataObjects::MDGridBox< MDEvent, ND >
 
using IntT = typename MDEvent::IntT
 
using MDEvent = MDEventType< ND >
 
using MortonT = typename MDEvent::MortonT
 

Private Member Functions

morton_index::MDCoordinate< ND > convertToIndex (std::vector< MDEventType< ND > > &mdEvents, const morton_index::MDSpaceBounds< ND > &space)
 
void distributeEvents (Task &tsk, const WORKER_TYPE &wtp)
 Does actual work on creating tasks in MASTER mode and executing tasks in SLAVE mode. More...
 
BoxBasedoDistributeEvents (std::vector< MDEventType< ND > > &mdEvents)
 
std::unique_ptr< TaskpopTask ()
 
void pushTask (Task &&tsk)
 
void sortEvents (std::vector< MDEventType< ND > > &mdEvents)
 
void waitAndLaunchSlave ()
 

Private Attributes

const API::BoxController_sptrm_bc
 
const size_t m_eventsThreshold
 
std::vector< Mantid::Geometry::MDDimensionExtents< coord_t > > m_extents
 
std::atomic< bool > m_masterFinished
 
const MortonT m_mortonMax
 
const MortonT m_mortonMin
 
std::mutex m_mutex
 
const int m_numWorkers
 
const morton_index::MDSpaceBounds< ND > & m_space
 
std::queue< Taskm_tasks
 

Detailed Description

template<size_t ND, template< size_t > class MDEventType, typename EventIterator>
class Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >

Class to create the box structure of MDWorkspace.

The algorithm: The MASTER thread starting to build tree structure recursively, if it finds the subtask to distribute N events N < threshold, the it delegates this independent subtask to other tread, syncronisation is implemented with queue and mutex.

Template Parameters
ND:: number of Dimensions
MDEventType:: Type of created MDEvent [MDLeanEvent, MDEvent]
EventIterator:: Iterator of sorted collection storing the converted events

Definition at line 29 of file MDEventTreeBuilder.h.

Member Typedef Documentation

◆ Box

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::Box = DataObjects::MDBox<MDEvent, ND>
private

Definition at line 34 of file MDEventTreeBuilder.h.

◆ BoxBase

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::BoxBase = DataObjects::MDBoxBase<MDEvent, ND>
private

Definition at line 33 of file MDEventTreeBuilder.h.

◆ EventAccessType

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::EventAccessType = DataObjects::EventAccessor

Definition at line 39 of file MDEventTreeBuilder.h.

◆ EventDistributor

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::EventDistributor = MDEventTreeBuilder<ND, MDEventType, EventIterator>
private

Definition at line 36 of file MDEventTreeBuilder.h.

◆ GridBox

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::GridBox = DataObjects::MDGridBox<MDEvent, ND>
private

Definition at line 35 of file MDEventTreeBuilder.h.

◆ IndexCoordinateSwitcher

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::IndexCoordinateSwitcher = typename MDEvent::template AccessFor<EventDistributor>

Definition at line 40 of file MDEventTreeBuilder.h.

◆ IntT

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::IntT = typename MDEvent::IntT
private

Definition at line 31 of file MDEventTreeBuilder.h.

◆ MDEvent

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::MDEvent = MDEventType<ND>
private

Definition at line 30 of file MDEventTreeBuilder.h.

◆ MortonT

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
using Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::MortonT = typename MDEvent::MortonT
private

Definition at line 32 of file MDEventTreeBuilder.h.

Member Enumeration Documentation

◆ WORKER_TYPE

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
enum Mantid::MDAlgorithms::MDEventTreeBuilder::WORKER_TYPE
Enumerator
MASTER 
SLAVE 

Definition at line 41 of file MDEventTreeBuilder.h.

Constructor & Destructor Documentation

◆ MDEventTreeBuilder()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::MDEventTreeBuilder ( const int  numWorkers,
const size_t  threshold,
const API::BoxController_sptr bc,
const morton_index::MDSpaceBounds< ND > &  space 
)

Member Function Documentation

◆ convertToIndex()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
morton_index::MDCoordinate< ND > Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::convertToIndex ( std::vector< MDEventType< ND > > &  mdEvents,
const morton_index::MDSpaceBounds< ND > &  space 
)
private

Definition at line 147 of file MDEventTreeBuilder.h.

References Mantid::Geometry::d, and PARALLEL_THREAD_NUMBER.

◆ distribute()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
MDEventTreeBuilder< ND, MDEventType, EventIterator >::TreeWithIndexError Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::distribute ( std::vector< MDEventType< ND > > &  mdEvents)
Parameters
mdEvents:: events to distribute around the tree
Returns
:: pointer to the root node and error

Definition at line 110 of file MDEventTreeBuilder.h.

◆ distributeEvents()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
void Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::distributeEvents ( Task tsk,
const WORKER_TYPE wtp 
)
private

◆ doDistributeEvents()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
DataObjects::MDBoxBase< MDEventType< ND >, ND > * Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::doDistributeEvents ( std::vector< MDEventType< ND > > &  mdEvents)
private

◆ popTask()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
std::unique_ptr< typename MDEventTreeBuilder< ND, MDEventType, EventIterator >::Task > Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::popTask
private

Definition at line 188 of file MDEventTreeBuilder.h.

◆ pushTask()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
void Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::pushTask ( Task &&  tsk)
private

Definition at line 180 of file MDEventTreeBuilder.h.

◆ sortEvents()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
void Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::sortEvents ( std::vector< MDEventType< ND > > &  mdEvents)
private

Definition at line 169 of file MDEventTreeBuilder.h.

◆ waitAndLaunchSlave()

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
void Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::waitAndLaunchSlave
private

Member Data Documentation

◆ m_bc

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
const API::BoxController_sptr& Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_bc
private

Definition at line 89 of file MDEventTreeBuilder.h.

◆ m_eventsThreshold

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
const size_t Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_eventsThreshold
private

Definition at line 82 of file MDEventTreeBuilder.h.

◆ m_extents

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
std::vector<Mantid::Geometry::MDDimensionExtents<coord_t> > Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_extents
private

◆ m_masterFinished

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
std::atomic<bool> Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_masterFinished
private

Definition at line 85 of file MDEventTreeBuilder.h.

◆ m_mortonMax

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
const MortonT Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_mortonMax
private

Definition at line 92 of file MDEventTreeBuilder.h.

◆ m_mortonMin

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
const MortonT Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_mortonMin
private

Definition at line 91 of file MDEventTreeBuilder.h.

◆ m_mutex

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
std::mutex Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_mutex
private

Definition at line 84 of file MDEventTreeBuilder.h.

◆ m_numWorkers

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
const int Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_numWorkers
private

Definition at line 81 of file MDEventTreeBuilder.h.

◆ m_space

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
const morton_index::MDSpaceBounds<ND>& Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_space
private

Definition at line 87 of file MDEventTreeBuilder.h.

◆ m_tasks

template<size_t ND, template< size_t > class MDEventType, typename EventIterator >
std::queue<Task> Mantid::MDAlgorithms::MDEventTreeBuilder< ND, MDEventType, EventIterator >::m_tasks
private

Definition at line 83 of file MDEventTreeBuilder.h.


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