CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
KDTreeNodes< DATA, DIM > Struct Template Reference

#include <KDTreeLinkerAlgo.h>

Public Member Functions

void build (int sizeData)
 
void clear ()
 
bool empty () const
 
int getNextNode ()
 
constexpr bool isLeaf (int right) const
 
bool isLeafIndex (int index) const
 
constexpr KDTreeNodes ()
 
int size () const
 

Public Attributes

std::vector< DATA > data
 
std::array< std::vector< float >, DIMdims
 
int poolPos
 
int poolSize
 
std::vector< int > right
 

Detailed Description

template<typename DATA, unsigned DIM = 2>
struct KDTreeNodes< DATA, DIM >

Definition at line 50 of file KDTreeLinkerAlgo.h.

Constructor & Destructor Documentation

◆ KDTreeNodes()

template<typename DATA, unsigned DIM = 2>
constexpr KDTreeNodes< DATA, DIM >::KDTreeNodes ( )
inline

Definition at line 58 of file KDTreeLinkerAlgo.h.

58 : poolSize(-1), poolPos(-1) {}

Member Function Documentation

◆ build()

template<typename DATA, unsigned DIM = 2>
void KDTreeNodes< DATA, DIM >::build ( int  sizeData)
inline

Definition at line 78 of file KDTreeLinkerAlgo.h.

Referenced by psClasses.BuildThread::run().

78  {
79  poolSize = sizeData * 2 - 1;
80  for (auto &dim : dims) {
81  dim.resize(poolSize);
82  }
83  right.resize(poolSize);
84  data.resize(poolSize);
85  };
std::array< std::vector< float >, DIM > dims
std::vector< DATA > data
std::vector< int > right

◆ clear()

template<typename DATA, unsigned DIM = 2>
void KDTreeNodes< DATA, DIM >::clear ( void  )
inline

Definition at line 63 of file KDTreeLinkerAlgo.h.

Referenced by BeautifulSoup.Tag::setString().

63  {
64  for (auto &dim : dims) {
65  dim.clear();
66  }
67  right.clear();
68  data.clear();
69  poolSize = -1;
70  poolPos = -1;
71  }
std::array< std::vector< float >, DIM > dims
std::vector< DATA > data
std::vector< int > right

◆ empty()

template<typename DATA, unsigned DIM = 2>
bool KDTreeNodes< DATA, DIM >::empty ( ) const
inline

Definition at line 60 of file KDTreeLinkerAlgo.h.

60 { return poolPos == -1; }

◆ getNextNode()

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::getNextNode ( )
inline

Definition at line 73 of file KDTreeLinkerAlgo.h.

73  {
74  ++poolPos;
75  return poolPos;
76  }

◆ isLeaf()

template<typename DATA, unsigned DIM = 2>
constexpr bool KDTreeNodes< DATA, DIM >::isLeaf ( int  right) const
inline

Definition at line 87 of file KDTreeLinkerAlgo.h.

Referenced by KDTreeNodes< reco::PFRecHit const *, 2 >::isLeafIndex().

87  {
88  // Valid values of right are always >= 2
89  // index 0 is the root, and 1 is the first left node
90  // Exploit index values 0 and 1 to mark which of dim1/dim2 is the
91  // current one in recSearch() at the depth of the leaf.
92  return right < 2;
93  }
std::vector< int > right

◆ isLeafIndex()

template<typename DATA, unsigned DIM = 2>
bool KDTreeNodes< DATA, DIM >::isLeafIndex ( int  index) const
inline

Definition at line 95 of file KDTreeLinkerAlgo.h.

95 { return isLeaf(right[index]); }
constexpr bool isLeaf(int right) const
std::vector< int > right

◆ size()

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::size ( void  ) const
inline

Member Data Documentation

◆ data

template<typename DATA, unsigned DIM = 2>
std::vector<DATA> KDTreeNodes< DATA, DIM >::data

◆ dims

template<typename DATA, unsigned DIM = 2>
std::array<std::vector<float>, DIM> KDTreeNodes< DATA, DIM >::dims

◆ poolPos

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::poolPos

◆ poolSize

template<typename DATA, unsigned DIM = 2>
int KDTreeNodes< DATA, DIM >::poolSize

◆ right

template<typename DATA, unsigned DIM = 2>
std::vector<int> KDTreeNodes< DATA, DIM >::right