Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
gts::OctRange< TIterType > Class Template Reference

An iteration range over a 3D data set. Splits divide each dimension in half for each dimension that is divisible. Successive splits result in a oct-tree where each leaf represents a unit of work. More...

#include <OctRange.h>

Public Types

using iter_type = TIterType
 
using range_type = Range1d< iter_type >
 
using split_result = SplitResult< OctRange, MAX_SPLITS, DIMENSIONALITY >
 
using size_type = typename range_type::size_type
 

Public Member Functions

 OctRange (OctRange const &)=default
 
GTS_INLINE OctRange (iter_type xBegin, iter_type xEnd, size_type xMinSize, iter_type yBegin, iter_type yEnd, size_type yMinSize, iter_type zBegin, iter_type zEnd, size_type zMinSize, size_type xSplitOnMultiplesOf=1, size_type ySplitOnMultiplesOf=1, size_type zSplitOnMultiplesOf=1)
 Constructs a OctRange. More...
 
GTS_INLINE range_type const & xRange () const
 
GTS_INLINE range_typexRange ()
 
GTS_INLINE range_type const & yRange () const
 
GTS_INLINE range_typeyRange ()
 
GTS_INLINE range_type const & zRange () const
 
GTS_INLINE range_typezRange ()
 
GTS_INLINE range_type const & subRange (SubRangeIndex::Type index) const
 
GTS_INLINE range_typesubRange (SubRangeIndex::Type index)
 
GTS_INLINE bool isDivisible () const
 
GTS_INLINE bool empty () const
 
GTS_INLINE size_t size () const
 
template<typename TSplitter >
GTS_INLINE void split (split_result &result, TSplitter const &)
 Splits the range into eight possible subranges. More...
 

Static Public Member Functions

static GTS_INLINE uint16_t adjustDivisor (uint16_t initialSplitDepth, bool)
 
static GTS_INLINE uint16_t splitInitialDepth (uint16_t initialSplitDepth, bool)
 
static GTS_INLINE uint16_t finalSplitDivisor (uint16_t initialSplitDepth, bool)
 

Static Public Attributes

static constexpr SubRangeIndex::Type X = SubRangeIndex::X
 
static constexpr SubRangeIndex::Type Y = SubRangeIndex::Y
 
static constexpr SubRangeIndex::Type Z = SubRangeIndex::Z
 
static constexpr size_t SPLIT_FACTOR = 8
 
static constexpr size_t MAX_SPLITS = SPLIT_FACTOR - 1
 
static constexpr size_t DIMENSIONALITY = 3
 

Detailed Description

template<typename TIterType>
class gts::OctRange< TIterType >

An iteration range over a 3D data set. Splits divide each dimension in half for each dimension that is divisible. Successive splits result in a oct-tree where each leaf represents a unit of work.

Todo:
Add get neighbor functions.

Constructor & Destructor Documentation

◆ OctRange()

template<typename TIterType >
GTS_INLINE gts::OctRange< TIterType >::OctRange ( iter_type  xBegin,
iter_type  xEnd,
size_type  xMinSize,
iter_type  yBegin,
iter_type  yEnd,
size_type  yMinSize,
iter_type  zBegin,
iter_type  zEnd,
size_type  zMinSize,
size_type  xSplitOnMultiplesOf = 1,
size_type  ySplitOnMultiplesOf = 1,
size_type  zSplitOnMultiplesOf = 1 
)
inline

Constructs a OctRange.

Parameters
xBeginAn iterator to the beginning of the x-dimension range.
xEndAn iterator to the end of the x-dimension range.
xMinSizeThe smallest sub-range the x-dimension can be divided into. Must be >= splitOnMultiplesOf.
yBeginAn iterator to the beginning of the y-dimension range.
yEndAn iterator to the end of the y-dimension range.
yMinSizeThe smallest sub-range the y-dimension can be divided into. Must be >= splitOnMultiplesOf.
zBeginAn iterator to the beginning of the z-dimension range.
zEndAn iterator to the end of the z-dimension range.
zMinSizeThe smallest sub-range the z-dimension can be divided into. Must be >= splitOnMultiplesOf.
xSplitOnMultiplesOfTries to ensure that each sub-range in the x-dimensions is a multiple of this value.
ySplitOnMultiplesOfTries to ensure that each sub-range in the y-dimensions is a multiple of this value.
zSplitOnMultiplesOfTries to ensure that each sub-range in the z-dimensions is a multiple of this value.

Member Function Documentation

◆ split()

template<typename TIterType >
template<typename TSplitter >
GTS_INLINE void gts::OctRange< TIterType >::split ( split_result result,
TSplitter const &   
)
inline

Splits the range into eight possible subranges.

Parameters
resultThe returned results from the split.