SPH
Classes | Enumerations | Functions
KdTree.h File Reference

K-d tree for efficient search of neighbouring particles. More...

#include "io/Logger.h"
#include "objects/finders/NeighbourFinder.h"
#include "objects/geometry/Box.h"
#include "objects/utility/IteratorAdapters.h"
#include "objects/wrappers/Finally.h"
#include "objects/wrappers/Function.h"
#include "objects/wrappers/Outcome.h"
#include "thread/ThreadLocal.h"
#include <set>
#include <shared_mutex>
#include "objects/finders/KdTree.inl.h"

Go to the source code of this file.

Classes

struct  KdNode
 Base class for nodes of K-d tree. More...
 
struct  InnerNode< TBase >
 Inner node of K-d tree. More...
 
struct  LeafNode< TBase >
 Leaf (bucket) node of K-d tree. More...
 
class  LeafIndexIterator
 Index iterator with given mapping (index permutation). More...
 
class  LeafIndexSequence
 Helper index sequence to iterate over particle indices of a leaf node. More...
 
struct  EuclideanMetric
 
class  KdTree< TNode, TMetric >
 K-d tree, used for hierarchical clustering of particles and accelerated Kn queries. More...
 

Enumerations

enum class  IterateDirection { TOP_DOWN , BOTTOM_UP }
 

Functions

template<IterateDirection Dir, typename TNode , typename TMetric , typename TFunctor >
void iterateTree (KdTree< TNode, TMetric > &tree, IScheduler &scheduler, const TFunctor &functor, const Size nodeIdx=0, const Size depthLimit=Size(-1))
 Calls a functor for every node of a K-d tree tree in specified direction. More...
 
template<IterateDirection Dir, typename TNode , typename TMetric , typename TFunctor >
void iterateTree (const KdTree< TNode, TMetric > &tree, IScheduler &scheduler, const TFunctor &functor, const Size nodeIdx=0, const Size depthLimit=Size(-1))
 

Detailed Description

K-d tree for efficient search of neighbouring particles.

Author
Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz))
Date
2016-2021

Definition in file KdTree.h.

Enumeration Type Documentation

◆ IterateDirection

enum IterateDirection
strong
Enumerator
TOP_DOWN 

From root to leaves.

BOTTOM_UP 

From leaves to root.

Definition at line 216 of file KdTree.h.

Function Documentation

◆ iterateTree() [1/2]

template<IterateDirection Dir, typename TNode , typename TMetric , typename TFunctor >
void iterateTree ( const KdTree< TNode, TMetric > &  tree,
IScheduler scheduler,
const TFunctor &  functor,
const Size  nodeIdx,
const Size  depthLimit 
)

Definition at line 511 of file KdTree.inl.h.

◆ iterateTree() [2/2]

template<IterateDirection Dir, typename TNode , typename TMetric , typename TFunctor >
void iterateTree ( KdTree< TNode, TMetric > &  tree,
IScheduler scheduler,
const TFunctor &  functor,
const Size  nodeIdx = 0,
const Size  depthLimit = Size(-1) 
)

Calls a functor for every node of a K-d tree tree in specified direction.

The functor is called with the node as a parameter. For top-down direction, functor may return false to skip all children nodes from processing, otherwise the iteration proceedes through the tree into leaf nodes.

Parameters
treeKdTree to iterate.
schedulerScheduler used for sequential or parallelized task execution
functorFunctor executed for every node
nodeIdxIndex of the first processed node; use 0 for root node
depthLimitMaximal depth processed in parallel.

Definition at line 465 of file KdTree.inl.h.