PetscKDTreeCreate#

create a PetscKDTree

Synopsis#

PetscErrorCode PetscKDTreeCreate(PetscCount num_coords, PetscInt dim, const PetscReal coords[], PetscCopyMode copy_mode, PetscInt max_bucket_size, PetscKDTree *new_tree)

Not Collective, No Fortran Support

Input Parameters#

  • num_coords - number of coordinate points to build the PetscKDTree

  • dim - the dimension of the coordinates

  • coords - array of the coordinates, in point-major order

  • copy_mode - behavior handling coords, PETSC_COPY_VALUES generally more performant

  • max_bucket_size - maximum number of points stored at each leaf

Output Parameter#

Note#

When copy_mode == PETSC_COPY_VALUES, the coordinates are copied and organized to optimize vectorization and cache-coherency. It is recommended to run this way if the extra memory use is not a concern and it has very little impact on the PetscKDTree creation time.

Developer Note#

Building algorithm detailed in ‘Building a Balanced k-d Tree in O(kn log n) Time’ Brown, 2015

See Also#

PetscKDTree, PetscKDTreeDestroy(), PetscKDTreeQueryPointsNearestNeighbor()

Level#

advanced

Location#

src/vec/is/utils/kdtree.c


Index of all IS routines
Table of Contents for all manual pages
Index of all manual pages