OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
nanoflann::KNNResultSet< DistanceType, IndexType, CountType > Class Template Reference

#include <nanoflann.hpp>

+ Collaboration diagram for nanoflann::KNNResultSet< DistanceType, IndexType, CountType >:

Public Member Functions

 KNNResultSet (CountType capacity_)
 
void init (IndexType *indices_, DistanceType *dists_)
 
CountType size () const
 
bool full () const
 
void addPoint (DistanceType dist, IndexType index)
 
DistanceType worstDist () const
 

Detailed Description

template<typename DistanceType, typename IndexType = size_t, typename CountType = size_t>
class nanoflann::KNNResultSet< DistanceType, IndexType, CountType >

Definition at line 64 of file nanoflann.hpp.

Constructor & Destructor Documentation

◆ KNNResultSet()

template<typename DistanceType , typename IndexType = size_t, typename CountType = size_t>
nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::KNNResultSet ( CountType capacity_)
inline

Definition at line 71 of file nanoflann.hpp.

72 : indices(0),
73 dists(0),
74 capacity(capacity_),
75 count(0) {
76 }

Member Function Documentation

◆ addPoint()

template<typename DistanceType , typename IndexType = size_t, typename CountType = size_t>
void nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::addPoint ( DistanceType dist,
IndexType index )
inline

Definition at line 93 of file nanoflann.hpp.

93 {
94 CountType i;
95 for (i = count; i > 0; --i) {
96#ifdef NANOFLANN_FIRST_MATCH // If defined and two poins have the same distance, the one with the lowest-index will be returned first.
97 if ( (dists[i-1]>dist) || ((dist==dists[i-1])&&(indices[i-1]>index)) ) {
98#else
99 if (dists[i - 1] > dist) {
100#endif
101 if (i < capacity) {
102 dists[i] = dists[i - 1];
103 indices[i] = indices[i - 1];
104 }
105 } else
106 break;
107 }
108 if (i < capacity) {
109 dists[i] = dist;
110 indices[i] = index;
111 }
112 if (count < capacity)
113 count++;
114 }

◆ full()

template<typename DistanceType , typename IndexType = size_t, typename CountType = size_t>
bool nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::full ( ) const
inline

Definition at line 89 of file nanoflann.hpp.

89 {
90 return count == capacity;
91 }

◆ init()

template<typename DistanceType , typename IndexType = size_t, typename CountType = size_t>
void nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init ( IndexType * indices_,
DistanceType * dists_ )
inline

Definition at line 78 of file nanoflann.hpp.

78 {
79 indices = indices_;
80 dists = dists_;
81 count = 0;
82 dists[capacity - 1] = (std::numeric_limits<DistanceType>::max)();
83 }
+ Here is the caller graph for this function:

◆ size()

template<typename DistanceType , typename IndexType = size_t, typename CountType = size_t>
CountType nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::size ( ) const
inline

Definition at line 85 of file nanoflann.hpp.

85 {
86 return count;
87 }
+ Here is the caller graph for this function:

◆ worstDist()

template<typename DistanceType , typename IndexType = size_t, typename CountType = size_t>
DistanceType nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::worstDist ( ) const
inline

Definition at line 116 of file nanoflann.hpp.

116 {
117 return dists[capacity - 1];
118 }

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