A tree for doing quick searches in multidimensional space. A pointer to an array of objects type T is provided. If they are in a vector, vector.data() can be put in the constructor. The order of objects in the array is not changed. If Mypos is not specified the method D * T::x() must exist. It is this coordinate that is used for the object's position. Another definition for the position of and object can made by specifying Mypos.
More...
#include <simpleTreeVec.h>
|
| TreeSimpleVec (T *xpt, IndexType Npoints, int bucket=5, int dimensions=2, bool median=true, D *(*Mypos)(T &)=[](T &in){return in.x;}) |
|
void | PointsWithinCircle (D center[2], float radius, std::list< unsigned long > &neighborkist) |
| Finds the points within a circle around center and puts their index numbers in a list.
|
|
void | PointsWithinEllipse (D center[2], float a_max, float a_min, float posangle, std::list< unsigned long > &neighborkist) |
| Finds the points within an ellipse around center and puts their index numbers in a list.
|
|
void | NearestNeighbors (D *ray, int Nneighbors, std::vector< D > &radii, std::vector< IndexType > &neighbors) |
| Finds the nearest N neighbors and puts their index numbers in an array, also returns the distance to the Nth neighbor for calculating smoothing.
|
|
void | NearestNeighbor (D *ray, D &radius, IndexType &neighbor) |
| finds the nearest neighbors in whatever dimensions tree is defined in
|
|
void | pop (IndexType index_of_point) |
| pop this point out of the tree
|
|
std::vector< IndexType > | get_index () const |
| returns the index numbers of the remaining points which are less than the original if pop() was used.
|
|
void | print () |
|
|
void | BuildTree () |
|
void | _BuildTree (IndexType nparticles, IndexType *tmp_index) |
|
void | _PointsWithin (D *ray, float *rmax, std::list< unsigned long > &neighborkist) |
|
void | _NearestNeighbors (D *ray, int Nneighbors, unsigned long *neighbors, D *rneighbors) |
|
void | freeTree () |
| Free all the tree branches.
|
|
bool | isEmpty () |
|
bool | atTop () |
|
bool | noChild () |
|
bool | offEnd () |
|
void | getCurrent (IndexType *branch_index, IndexType *nparticles) |
|
unsigned long | getNbranches () |
|
void | moveTop () |
|
void | moveUp () |
|
void | moveToChild (int child) |
|
void | attachChildToCurrent (IndexType *branch_index, IndexType nparticles, D boundary_p1[], D boundary_p2[], int child) |
|
void | attachChildToCurrent (BranchV &data, int child) |
|
bool | TreeWalkStep (bool allowDescent) |
|
bool | atLeaf () |
|
bool | inbox (const D *center, D *p1, D *p2) |
|
int | cutbox (const D *center, D *p1, D *p2, float rmax) |
|
|
int | incell |
|
int | incell2 |
|
std::vector< IndexType > | index |
|
IndexType | Nparticles |
|
bool | median_cut |
|
int | Nbucket |
|
Point_nd< D > | realray |
|
T * | points |
|
D *(* | position )(T &) |
|
std::vector< D > | workspace |
|
std::shared_ptr< BranchV > | top_ptr |
|
std::shared_ptr< BranchV > | current |
|
unsigned long | Nbranches |
| number of branches in tree
|
|
short | Ndimensions |
| Dimension of tree, 2 or 3. This will dictate how the force is calculated.
|
|
template<typename T, typename D = PosType>
class TreeSimpleVec< T, D >
A tree for doing quick searches in multidimensional space. A pointer to an array of objects type T is provided. If they are in a vector, vector.data() can be put in the constructor. The order of objects in the array is not changed. If Mypos is not specified the method D * T::x() must exist. It is this coordinate that is used for the object's position. Another definition for the position of and object can made by specifying Mypos.
simpleTreeVec.h
Created on: Oct 14, 2011 Author: bmetcalf
◆ TreeSimpleVec()
template<typename T , typename D = PosType>
TreeSimpleVec< T, D >::TreeSimpleVec |
( |
T * | xpt, |
|
|
IndexType | Npoints, |
|
|
int | bucket = 5, |
|
|
int | dimensions = 2, |
|
|
bool | median = true, |
|
|
D *(* | Mypos )(T &) = [](T& in){return in.x;} ) |
|
inline |
- Parameters
-
xpt | array of object, xpt[i].x[0...dimensions-1] must exist or Mypos must be specified |
Npoints | number of object in array |
bucket | number of points in leaves of tree |
dimensions | dimension of space |
median | whether to use a median cut or a space cut in splitting branches |
Mypos | function that takes the object T and returns a pointer to its position, default is t.x[] |
◆ _NearestNeighbors()
template<typename T , typename D >
void TreeSimpleVec< T, D >::_NearestNeighbors |
( |
D * | ray, |
|
|
int | Nneighbors, |
|
|
unsigned long * | neighbors, |
|
|
D * | rneighbors ) |
|
protected |
if ray found in second child go back to first to search for neighbors
◆ _PointsWithin()
template<typename T , typename D >
void TreeSimpleVec< T, D >::_PointsWithin |
( |
D * | ray, |
|
|
float * | rmax, |
|
|
std::list< unsigned long > & | neighborlist ) |
|
protected |
Used in PointsWithinKist() to walk tree.
◆ NearestNeighbor()
template<typename T , typename D >
void TreeSimpleVec< T, D >::NearestNeighbor |
( |
D * | ray, |
|
|
D & | radius, |
|
|
IndexType & | neighbor ) |
finds the nearest neighbors in whatever dimensions tree is defined in
- Parameters
-
ray | position |
radius | distance of furthest neighbor found from ray[] |
neighbor | list of the indexes of the neighbors |
◆ NearestNeighbors()
template<typename T , typename D >
void TreeSimpleVec< T, D >::NearestNeighbors |
( |
D * | ray, |
|
|
int | Nneighbors, |
|
|
std::vector< D > & | radii, |
|
|
std::vector< IndexType > & | neighbors ) |
Finds the nearest N neighbors and puts their index numbers in an array, also returns the distance to the Nth neighbor for calculating smoothing.
finds the nearest neighbors in whatever dimensions tree is defined in
- Parameters
-
ray | position |
Nneighbors | number of neighbors to be found |
radii | distance to neighbors |
neighbors | list of the indexes of the neighbors |
The documentation for this class was generated from the following file: