14 #ifndef NANOVDB_RANGE_H_HAS_BEEN_INCLUDED 15 #define NANOVDB_RANGE_H_HAS_BEEN_INCLUDED 19 #ifdef NANOVDB_USE_TBB 20 #include <tbb/blocked_range.h> 27 template <
int,
typename>
40 template<
int,
typename>
47 : mBegin(begin), mEnd(end), mGrainsize(grainsize)
52 Range(
Range &r,
Split) : mBegin(r.mBegin), mEnd(r.mEnd), mGrainsize(r.mGrainsize) {
53 assert(r.is_divisible());
54 r.mEnd = mBegin = this->middle();
56 #ifdef NANOVDB_USE_TBB 59 bool operator==(
const Range& rhs)
const {
return mBegin == rhs.mBegin && mEnd == rhs.mEnd && mGrainsize == rhs.mGrainsize; }
60 T
middle()
const {
return mBegin + (mEnd - mBegin) / T(2);}
62 bool empty()
const {
return !(mBegin < mEnd); }
78 :
Range(
Range<1,T>(beginRow, endRow, grainsizeRow),
Range<1,T>(beginCol, endCol, grainsizeCol) )
81 Range(T beginRow, T endRow, T beginCol, T endCol) :
Range(
Range<1,T>(beginRow, endRow),
Range<1,T>(beginCol, endCol) )
85 assert( r.is_divisible() );
86 if( mRange[0].size()*double(mRange[1].grainsize()) < mRange[1].size()*double(mRange[0].grainsize()) ) {
87 r.mRange[1].mEnd = mRange[1].mBegin = mRange[1].middle();
89 r.mRange[0].mEnd = mRange[0].mBegin = mRange[0].middle();
92 #ifdef NANOVDB_USE_TBB 95 bool operator==(
const Range& rhs)
const {
return mRange[0] == rhs[0] && mRange[1] == rhs[1]; }
96 bool empty()
const {
return mRange[0].empty() || mRange[1].empty(); }
97 bool is_divisible()
const {
return mRange[0].is_divisible() || mRange[1].is_divisible();}
102 template <
typename T>
112 :
Range(
Range<1,T>(beginX, endX, grainsizeX),
113 Range<1,T>(beginY, endY, grainsizeY),
114 Range<1,T>(beginZ, endZ, grainsizeZ) )
117 Range(T beginX, T endX, T beginY, T endY, T beginZ, T endZ)
123 assert( r.is_divisible() );
124 if ( mRange[2].size()*double(mRange[0].grainsize()) < mRange[0].size()*double(mRange[2].grainsize()) ) {
125 if ( mRange[0].size()*double(mRange[1].grainsize()) < mRange[1].size()*double(mRange[0].grainsize()) ) {
126 r.mRange[1].mEnd = mRange[1].mBegin = mRange[1].middle();
128 r.mRange[0].mEnd = mRange[0].mBegin = mRange[0].middle();
131 if ( mRange[2].size()*
double(mRange[1].grainsize()) < mRange[1].size()*
double(mRange[2].grainsize()) ) {
132 r.mRange[1].mEnd = mRange[1].mBegin = mRange[1].middle();
134 r.mRange[2].mEnd = mRange[2].mBegin = mRange[2].middle();
138 #ifdef NANOVDB_USE_TBB 141 bool operator==(
const Range& rhs)
const {
return mRange[0] == rhs[0] && mRange[1] == rhs[1] && mRange[2] == rhs[2]; }
142 bool empty()
const {
return mRange[0].empty() || mRange[1].empty() || mRange[2].empty(); }
143 bool is_divisible()
const {
return mRange[0].is_divisible() || mRange[1].is_divisible() || mRange[2].is_divisible();}
149 #endif // NANOVDB_RANGE_H_HAS_BEEN_INCLUDED const_iterator begin() const
Definition: Range.h:65
const Range< 1, T > & operator[](int i) const
Definition: Range.h:98
Range(const Range< 1, T > &rangeRow, const Range< 1, T > &rangeCol)
Definition: Range.h:76
typename Range< 1, T >::size_type size_type
Definition: Range.h:107
bool empty() const
Definition: Range.h:142
const Range< 1, T > & operator[](int i) const
Definition: Range.h:144
Range(Range &r, Split)
Definition: Range.h:121
const_iterator end() const
Definition: Range.h:66
size_t size_type
Definition: Range.h:44
bool is_divisible() const
Definition: Range.h:97
size_type size() const
Definition: Range.h:61
Definition: NanoVDB.h:184
bool empty() const
Definition: Range.h:62
Range(T beginX, T endX, size_type grainsizeX, T beginY, T endY, size_type grainsizeY, T beginZ, T endZ, size_type grainsizeZ)
Definition: Range.h:109
Range(Range &r, Split)
Definition: Range.h:84
Range(T beginX, T endX, T beginY, T endY, T beginZ, T endZ)
Definition: Range.h:117
T middle() const
Definition: Range.h:60
bool is_divisible() const
Definition: Range.h:143
bool operator==(const Range &rhs) const
Definition: Range.h:59
Range(T beginRow, T endRow, T beginCol, T endCol)
Definition: Range.h:81
Range(T begin, T end, size_type grainsize=size_type(1))
Definition: Range.h:46
size_type grainsize() const
Definition: Range.h:63
T const_iterator
Definition: Range.h:43
bool operator==(const Range &rhs) const
Definition: Range.h:141
bool empty() const
Definition: Range.h:96
Range(const Range< 1, T > &rangeX, const Range< 1, T > &rangeY, const Range< 1, T > &rangeZ)
Definition: Range.h:108
Range(Range &r, Split)
Split constructor: r[a,b[ -> r[a,b/2[ & this[b/2,b[.
Definition: Range.h:52
bool is_divisible() const
Definition: Range.h:64
typename Range< 1, T >::size_type size_type
Definition: Range.h:75
Range(T beginRow, T endRow, size_type grainsizeRow, T beginCol, T endCol, size_type grainsizeCol)
Definition: Range.h:77
bool operator==(const Range &rhs) const
Definition: Range.h:95