Feel++ 0.111.0-preview.14
Finite Element Embedded Library in C++
Feel::KDTree Class Reference

KDTree class. More...

+ Collaboration diagram for Feel::KDTree:

Typedefs

typedef ublas::vector< double > node_type
 
typedef boost::tuple< node_type, size_type, uint16_type, size_type > index_node_type
 
typedef std::vector< index_node_type > points_type
 
typedef points_type::iterator points_iterator
 
typedef points_type::const_iterator points_const_iterator
 
typedef boost::tuple< node_type, size_type, uint16_type, size_type, double > index_node_search_type
 
typedef std::vector< index_node_search_type > points_search_type
 
typedef points_search_type::iterator points_search_iterator
 
typedef points_search_type::const_iterator points_search_const_iterator
 

Methods

void clear ()
 reset the tree, remove all points
 
void reserve (size_type n)
 reserve memory for the index/node pair
 
void nbNearNeighbor (size_type n)
 define the max number of point for the research( Default is 4 )
 
size_type addPoint (node_type const &n, size_type indice_global=0)
 insert a new point in the tree More...
 
void addPointWithId (const node_type &n, size_type i, uint16_type comp, size_type indice_global=0)
 insert a new point, with an associated number.
 
void pointsInBox (points_type &inpts, const node_type &min, const node_type &max)
 fills ipts with the indexes of points in the box [min,max]
 
void search (const node_type &node_)
 search the neighbors points of M_node_search in the kd-tree
 
void showResultSearch ()
 print the result of the research
 
void writeLatexData (std::string __nameFile="kdtreeData.tex")
 print in a file the scatterplot with the cuts of hyperplan (2d et 3d)
 

Constructors, destructor

 KDTree ()
 
 KDTree (KDTree const &tree)
 
 ~KDTree ()
 

Accessors

size_type nPoints () const
 get the number of points in the tree
 
const points_type & points () const
 get the points set
 
const points_search_type & pointsNearNeighbor () const
 get the points Near Neighbor set
 
size_type nPtMaxNearNeighbor ()
 

Detailed Description

KDTree class.

In computer science, a kd-tree (short for k-dimensional tree) is a space-partitioning data structure for organizing points in a k-dimensional space. kd-trees are a useful data structure for several applications, such as searches involving a multidimensional search key (e.g. range searches and nearest neighbor searches). kd-trees are a special case of BSP trees.

Author
Christophe Prud'homme
See also
RegionTree

Member Function Documentation

◆ addPoint()

size_type Feel::KDTree::addPoint ( node_type const &  n,
size_type  indice_global = 0 
)

insert a new point in the tree

Returns
the index of the point