Belle II Software development
LinearDivision< ABox, divisions > Class Template Reference

Factory object that constructs sub boxes from a given box with optional overlaps. More...

#include <LinearDivision.h>

Public Member Functions

 LinearDivision (const typename ABox::Delta &overlaps=typename ABox::Delta())
 Initialise the sub box factory with specific overlaps.
 
std::array< ABox, s_nSubBoxesoperator() (const ABox &box)
 Factory method to construct the subboxes with overlap from the given box.
 
template<std::size_t... Is>
std::array< ABox, s_nSubBoxesmakeSubBoxes (const ABox &box, std::index_sequence< Is... >)
 Make all subboxs with overlap of the given box.
 
template<std::size_t... Is>
ABox makeSubBox (const ABox &box, std::size_t globalISubBox, std::index_sequence< Is... >)
 Make the subbox with overlaps of the given box at global index.
 

Static Public Attributes

static const std::size_t s_nSubBoxes = Product<divisions...>::value
 Number of sub boxes produced by this factory facility.
 

Private Attributes

ABox::Delta m_overlaps
 Custom overlaps of the bounds at each division for each dimension.
 

Static Private Attributes

static constexpr std::size_t s_divisions [sizeof...(divisions)] = {divisions...}
 Array of the number of divisions for each dimension.
 

Detailed Description

template<class ABox, std::size_t... divisions>
class Belle2::TrackFindingCDC::LinearDivision< ABox, divisions >

Factory object that constructs sub boxes from a given box with optional overlaps.

The number of divisions in each dimension are given as template parameters such that the total number is know at compile time.

Definition at line 31 of file LinearDivision.h.

Constructor & Destructor Documentation

◆ LinearDivision()

LinearDivision ( const typename ABox::Delta &  overlaps = typename ABox::Delta())
inlineexplicit

Initialise the sub box factory with specific overlaps.

Definition at line 43 of file LinearDivision.h.

44 : m_overlaps(overlaps)
45 {}
ABox::Delta m_overlaps
Custom overlaps of the bounds at each division for each dimension.

Member Function Documentation

◆ makeSubBox()

ABox makeSubBox ( const ABox &  box,
std::size_t  globalISubBox,
std::index_sequence< Is... >   
)
inline

Make the subbox with overlaps of the given box at global index.

Definition at line 67 of file LinearDivision.h.

70 {
71 std::array<std::size_t, sizeof...(divisions)> indices;
72 for (size_t c_Index = 0 ; c_Index < sizeof...(divisions); ++c_Index) {
73 indices[c_Index] = globalISubBox % s_divisions[c_Index];
74 globalISubBox /= s_divisions[c_Index];
75 }
76 assert(globalISubBox == 0);
77 return ABox(box.template getDivisionBoundsWithOverlap<Is>(std::get<Is>(m_overlaps),
78 s_divisions[Is],
79 indices[Is]) ...);
80 }
static constexpr std::size_t s_divisions[sizeof...(divisions)]
Array of the number of divisions for each dimension.

◆ makeSubBoxes()

std::array< ABox, s_nSubBoxes > makeSubBoxes ( const ABox &  box,
std::index_sequence< Is... >   
)
inline

Make all subboxs with overlap of the given box.

Definition at line 58 of file LinearDivision.h.

59 {
60 return {{ makeSubBox(box, Is, std::make_index_sequence<sizeof...(divisions)>())... }};
61 }
ABox makeSubBox(const ABox &box, std::size_t globalISubBox, std::index_sequence< Is... >)
Make the subbox with overlaps of the given box at global index.

◆ operator()()

std::array< ABox, s_nSubBoxes > operator() ( const ABox &  box)
inline

Factory method to construct the subboxes with overlap from the given box.

Definition at line 49 of file LinearDivision.h.

50 {
51 return makeSubBoxes(box, std::make_index_sequence<s_nSubBoxes>());
52 }
std::array< ABox, s_nSubBoxes > makeSubBoxes(const ABox &box, std::index_sequence< Is... >)
Make all subboxs with overlap of the given box.

Member Data Documentation

◆ m_overlaps

ABox::Delta m_overlaps
private

Custom overlaps of the bounds at each division for each dimension.

Definition at line 84 of file LinearDivision.h.

◆ s_divisions

constexpr std::size_t s_divisions = {divisions...}
staticconstexprprivate

Array of the number of divisions for each dimension.

Definition at line 39 of file LinearDivision.h.

◆ s_nSubBoxes

const std::size_t s_nSubBoxes = Product<divisions...>::value
static

Number of sub boxes produced by this factory facility.

Definition at line 35 of file LinearDivision.h.


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