VAPOR3 3.9.4
Classes | Public Member Functions | List of all members
VAPoR::KDTreeRG Class Reference

This class implements a k-d space partitioning tree. More...

#include <KDTreeRG.h>

Public Member Functions

 KDTreeRG (const Grid &xg, const Grid &yg)
 
virtual ~KDTreeRG ()
 
void Nearest (const std::vector< float > &coordu, std::vector< size_t > &index) const
 
void Nearest (const std::vector< double > &coordu, std::vector< size_t > &index) const
 
std::vector< size_t > GetDimensions () const
 

Detailed Description

This class implements a k-d space partitioning tree.

This class provides an object-oriented interface to kdtree.c, which implements a k-d space partitioning tree.

See also
https://en.wikipedia.org/wiki/K-d_tree

Definition at line 22 of file KDTreeRG.h.

Constructor & Destructor Documentation

◆ KDTreeRG()

VAPoR::KDTreeRG::KDTreeRG ( const Grid xg,
const Grid yg 
)

Construct a 2D k-d tree for a structured grid

Creates a 2D k-d space partitioning tree for a structured grid defined by a pair of Grid instances. The data values of the xg and yg Grid instances provide the coordinates of all of the points to be inserted into the k-d tree.

Parameters
[in]xgA Grid instance giving the X user coordinates for each point in the k-d tree.
[in]ygA Grid instance giving the Y user coordinates for each point in the k-d tree. The xg and yg Grid instances must have identical configurations, differing only in their data values.
See also
Grid()

◆ ~KDTreeRG()

virtual VAPoR::KDTreeRG::~KDTreeRG ( )
virtual

Construct a 3D k-d tree for a structured grid

Creates a 3D k-d space partitioning tree for a structured grid

Parameters
[in]xgA Grid instance giving the X user coordinates for each point in the k-d tree.
[in]ygA Grid instance giving the Y user coordinates for each point in the k-d tree.
[in]zgA Grid instance giving the Z user coordinates for each point in the k-d tree. The xg, yg, and yg Grid instances must have identical configurations, differing only in their data values.
See also
KDTreeRG(const Grid, const Grid)

Member Function Documentation

◆ GetDimensions()

std::vector< size_t > VAPoR::KDTreeRG::GetDimensions ( ) const
inline

Returns the dimesionality of the structured grids passed to the constructor.

This method returns a two or three element vector containing the dimensions of the Grid class instances passed to the constructor.

Return values
vector

Definition at line 92 of file KDTreeRG.h.

◆ Nearest() [1/2]

void VAPoR::KDTreeRG::Nearest ( const std::vector< double > &  coordu,
std::vector< size_t > &  index 
) const
inline

Definition at line 77 of file KDTreeRG.h.

◆ Nearest() [2/2]

void VAPoR::KDTreeRG::Nearest ( const std::vector< float > &  coordu,
std::vector< size_t > &  index 
) const

Return indecies of nearest point

This method returns the ijk indeces of the grid vertex nearest, by measure of Cartesian distance, a specified point. The returned indeces may be used to access the xg, yg, and zg Grid instances passed into the constructor.

Parameters
[in]coorduA 2D or 3D vector of user coordinates specifying the location of a point in space.
[out]indexThe ijk indecies of the grid vertex nearest coordu.

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