SPH
Classes | Enumerations | Functions | Variables
KdTree.inl.h File Reference
#include "objects/finders/KdTree.h"

Go to the source code of this file.

Classes

struct  ProcessedNode
 Object used during traversal. More...
 

Enumerations

enum class  KdChild { LEFT = 0 , RIGHT = 1 }
 

Functions

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

Variables

thread_local Array< ProcessedNodenodeStack
 Cached stack to avoid reallocation. More...
 

Enumeration Type Documentation

◆ KdChild

enum KdChild
strong
Enumerator
LEFT 
RIGHT 

Definition at line 5 of file KdTree.inl.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.

Variable Documentation

◆ nodeStack

thread_local Array<ProcessedNode> nodeStack
extern

Cached stack to avoid reallocation.

It is thread_local to allow using KdTree from multiple threads

Definition at line 5 of file KdTree.cpp.