dongli / fortran-kdtree

A Fortran implementation of KD-Tree searching

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

KD-Tree is a standard data structure for indexing data, especially in 3D space. It is an extension of Binary-Space Partition (BSP) to more than one dimension. For more information on KD-Tree, please refer Wiki.

This repository is a Fortran implementation of KD-Tree. We need KD-Tree in scientific HPC scenarios, so Fortran is still the right language, and also we need more modern library interfaces.

Usage

  use kdtree

  real(8), allocatable :: x(:,:)       ! num_dim, num_point
  integer, allocatable :: ngb_idx(:,:) ! num_ngb, num_point
  type(kdtree_type) kdtree
  integer i

  ! Allocate x and ngb_idx, and set x accordingly.

  call kdtree%build(x)
  do i = 1, size(x, 2)
    call kdtree%search(x(:,i), ngb_idx(:,i))
  end do

  ! Other works ...

Contributors

About

A Fortran implementation of KD-Tree searching

License:MIT License


Languages

Language:Fortran 91.1%Language:NCL 5.6%Language:CMake 3.3%