CoastalME (Coastal Modelling Environment)
Simulates the long-term behaviour of complex coastlines
Loading...
Searching...
No Matches
nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType > Class Template Reference

#include <nanoflann.hpp>

Public Types

using ElementType = typename Distance::ElementType
 
using DistanceType = typename Distance::DistanceType
 
using Offset
 
using Size
 
using Dimension
 

Public Member Functions

const std::vector< index_container_t > & getAllIndices () const
 
 KDTreeSingleIndexDynamicAdaptor (const int dimensionality, const DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams &params=KDTreeSingleIndexAdaptorParams(), const size_t maximumPointCount=1000000000U)
 
 KDTreeSingleIndexDynamicAdaptor (const KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType > &)=delete
 
void addPoints (IndexType start, IndexType end)
 
void removePoint (size_t idx)
 
template<typename RESULTSET>
bool findNeighbors (RESULTSET &result, const ElementType *vec, const SearchParameters &searchParams={}) const
 

Data Fields

Distance distance_
 

Protected Types

using index_container_t
 

Protected Attributes

Size leaf_max_size_
 
Size treeCount_
 
Size pointCount_
 
const DatasetAdaptor & dataset_
 The source of our data.
 
std::vector< int > treeIndex_
 
std::unordered_set< int > removedPoints_
 
KDTreeSingleIndexAdaptorParams index_params_
 
Dimension dim_
 Dimensionality of each data point.
 
std::vector< index_container_tindex_
 

Private Member Functions

int First0Bit (IndexType num)
 
void init ()
 

Detailed Description

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
class nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >

kd-tree dynaimic index

class to create multiple static index and merge their results to behave as single dynamic index as proposed in Logarithmic Approach.

Example of usage: examples/dynamic_pointcloud_example.cpp

Template Parameters
DatasetAdaptorThe user-provided adaptor (see comments above).
DistanceThe distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc.
DIMDimensionality of data points (e.g. 3 for 3D points)
IndexTypeWill be typically size_t or int

Definition at line 2414 of file nanoflann.hpp.

Member Typedef Documentation

◆ Dimension

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
using nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::Dimension
Initial value:
Distance, DatasetAdaptor, DIM>::Dimension
typename KDTreeSingleIndexDynamicAdaptor_< Distance, DatasetAdaptor, DIM >::Dimension Dimension

Definition at line 2424 of file nanoflann.hpp.

◆ DistanceType

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
using nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::DistanceType = typename Distance::DistanceType

Definition at line 2418 of file nanoflann.hpp.

◆ ElementType

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
using nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::ElementType = typename Distance::ElementType

Definition at line 2417 of file nanoflann.hpp.

◆ index_container_t

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
using nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::index_container_t
protected
Initial value:
Distance, DatasetAdaptor, DIM, IndexType>

Definition at line 2446 of file nanoflann.hpp.

◆ Offset

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
using nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::Offset
Initial value:
Distance, DatasetAdaptor, DIM>::Offset
typename KDTreeSingleIndexDynamicAdaptor_< Distance, DatasetAdaptor, DIM >::Offset Offset

Definition at line 2420 of file nanoflann.hpp.

◆ Size

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
using nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::Size
Initial value:
Distance, DatasetAdaptor, DIM>::Size
typename KDTreeSingleIndexDynamicAdaptor_< Distance, DatasetAdaptor, DIM >::Size Size

Definition at line 2422 of file nanoflann.hpp.

Constructor & Destructor Documentation

◆ KDTreeSingleIndexDynamicAdaptor() [1/2]

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::KDTreeSingleIndexDynamicAdaptor ( const int dimensionality,
const DatasetAdaptor & inputData,
const KDTreeSingleIndexAdaptorParams & params = KDTreeSingleIndexAdaptorParams(),
const size_t maximumPointCount = 1000000000U )
inlineexplicit

KDTree constructor

Refer to docs in README.md or online in https://github.com/jlblancoc/nanoflann

The KD-Tree point dimension (the length of each point in the datase, e.g. 3 for 3D points) is determined by means of:

  • The DIM template parameter if >0 (highest priority)
  • Otherwise, the dimensionality parameter of this constructor.
Parameters
inputDataDataset with the input features. Its lifetime must be equal or longer than that of the instance of this class.
paramsBasically, the maximum leaf node size

Definition at line 2500 of file nanoflann.hpp.

Referenced by KDTreeSingleIndexDynamicAdaptor().

◆ KDTreeSingleIndexDynamicAdaptor() [2/2]

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::KDTreeSingleIndexDynamicAdaptor ( const KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType > & )
explicitdelete

Deleted copy constructor

Member Function Documentation

◆ addPoints()

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
void nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::addPoints ( IndexType start,
IndexType end )
inline

Add points to the set, Inserts all points from [start, end]

Definition at line 2524 of file nanoflann.hpp.

Referenced by KDTreeSingleIndexDynamicAdaptor().

◆ findNeighbors()

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
template<typename RESULTSET>
bool nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::findNeighbors ( RESULTSET & result,
const ElementType * vec,
const SearchParameters & searchParams = {} ) const
inline

Find set of nearest neighbors to vec[0:dim-1]. Their indices are stored inside the result object.

Params: result = the result object in which the indices of the nearest-neighbors are stored vec = the vector for which to search the nearest neighbors

Template Parameters
RESULTSETShould be any ResultSet<DistanceType>
Returns
True if the requested neighbors could be found.
See also
knnSearch, radiusSearch
Note
If L2 norms are used, all returned distances are actually squared distances.

Definition at line 2589 of file nanoflann.hpp.

◆ First0Bit()

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
int nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::First0Bit ( IndexType num)
inlineprivate

finds position of least significant unset bit

Definition at line 2460 of file nanoflann.hpp.

Referenced by addPoints().

◆ getAllIndices()

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
const std::vector< index_container_t > & nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::getAllIndices ( ) const
inline

Get a const ref to the internal list of indices; the number of indices is adapted dynamically as the dataset grows in size.

Definition at line 2453 of file nanoflann.hpp.

◆ init()

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
void nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::init ( )
inlineprivate

Creates multiple empty trees to handle dynamic support

Definition at line 2472 of file nanoflann.hpp.

Referenced by KDTreeSingleIndexDynamicAdaptor().

◆ removePoint()

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
void nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::removePoint ( size_t idx)
inline

Remove a point from the set (Lazy Deletion)

Definition at line 2565 of file nanoflann.hpp.

Field Documentation

◆ dataset_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
const DatasetAdaptor& nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::dataset_
protected

The source of our data.

The dataset used by this index

Definition at line 2435 of file nanoflann.hpp.

Referenced by init(), and KDTreeSingleIndexDynamicAdaptor().

◆ dim_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
Dimension nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::dim_
protected

Dimensionality of each data point.

Definition at line 2444 of file nanoflann.hpp.

Referenced by init(), and KDTreeSingleIndexDynamicAdaptor().

◆ distance_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
Distance nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::distance_

Definition at line 2483 of file nanoflann.hpp.

Referenced by KDTreeSingleIndexDynamicAdaptor().

◆ index_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
std::vector<index_container_t> nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::index_
protected

Definition at line 2448 of file nanoflann.hpp.

Referenced by addPoints(), getAllIndices(), and init().

◆ index_params_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
KDTreeSingleIndexAdaptorParams nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::index_params_
protected

Definition at line 2442 of file nanoflann.hpp.

Referenced by init(), and KDTreeSingleIndexDynamicAdaptor().

◆ leaf_max_size_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
Size nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::leaf_max_size_
protected

Definition at line 2428 of file nanoflann.hpp.

Referenced by KDTreeSingleIndexDynamicAdaptor().

◆ pointCount_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
Size nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::pointCount_
protected

Definition at line 2430 of file nanoflann.hpp.

Referenced by addPoints(), KDTreeSingleIndexDynamicAdaptor(), and removePoint().

◆ removedPoints_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
std::unordered_set<int> nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::removedPoints_
protected

Definition at line 2440 of file nanoflann.hpp.

Referenced by addPoints(), and removePoint().

◆ treeCount_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
Size nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::treeCount_
protected

Definition at line 2429 of file nanoflann.hpp.

Referenced by init(), and KDTreeSingleIndexDynamicAdaptor().

◆ treeIndex_

template<typename Distance, class DatasetAdaptor, int32_t DIM = -1, typename IndexType = uint32_t>
std::vector<int> nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::treeIndex_
protected

treeIndex[idx] is the index of tree in which point at idx is stored. treeIndex[idx]=-1 means that point has been removed.

Definition at line 2439 of file nanoflann.hpp.

Referenced by addPoints(), init(), KDTreeSingleIndexDynamicAdaptor(), and removePoint().


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