35 #ifndef OPENVDB_UTIL_NODEMASKS_HAS_BEEN_INCLUDED
36 #define OPENVDB_UTIL_NODEMASKS_HAS_BEEN_INCLUDED
41 #include <openvdb/Types.h>
55 static const Byte numBits[256] = {
56 # define B2(n) n, n+1, n+1, n+2
57 # define B4(n) B2(n), B2(n+1), B2(n+1), B2(n+2)
58 # define B6(n) B4(n), B4(n+1), B4(n+1), B4(n+2)
78 v = v - ((v >> 1) & 0x55555555U);
79 v = (v & 0x33333333U) + ((v >> 2) & 0x33333333U);
80 return (((v + (v >> 4)) & 0xF0F0F0FU) * 0x1010101U) >> 24;
90 v = v - ((v >> 1) & UINT64_C(0x5555555555555555));
91 v = (v & UINT64_C(0x3333333333333333)) + ((v >> 2) & UINT64_C(0x3333333333333333));
92 return (((v + (v >> 4)) & UINT64_C(0xF0F0F0F0F0F0F0F)) * UINT64_C(0x101010101010101)) >> 56;
103 static const Byte DeBruijn[8] = {0, 1, 6, 2, 7, 5, 4, 3};
104 return DeBruijn[
Byte((v & -v) * 0x1DU) >> 5];
113 static const Byte DeBruijn[32] = {
114 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
115 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
117 return DeBruijn[
Index32((v & -v) * 0x077CB531U) >> 27];
126 static const Byte DeBruijn[64] = {
127 0, 1, 2, 53, 3, 7, 54, 27, 4, 38, 41, 8, 34, 55, 48, 28,
128 62, 5, 39, 46, 44, 42, 22, 9, 24, 35, 59, 56, 49, 18, 29, 11,
129 63, 52, 6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10,
130 51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12,
132 return DeBruijn[
Index64((v & -v) * UINT64_C(0x022FDD63CC95386D)) >> 58];
139 static const Byte DeBruijn[32] = {
140 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
141 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31
148 return DeBruijn[
Index32(v * 0x07C4ACDDU) >> 27];
156 template <
typename NodeMask>
166 assert( (parent==NULL && pos==0 ) || (parent!=NULL && pos<=NodeMask::SIZE) );
173 mPos = iter.
mPos; mParent = iter.
mParent;
return *
this;
179 assert(mPos <= NodeMask::SIZE);
180 return (mPos != NodeMask::SIZE);
182 operator bool()
const {
return this->test();}
187 template <
typename NodeMask>
192 using BaseType::mPos;
193 using BaseType::mParent;
199 assert(mParent != NULL);
200 mPos = mParent->findNextOn(mPos+1);
201 assert(mPos <= NodeMask::SIZE);
218 template <
typename NodeMask>
223 using BaseType::mPos;
224 using BaseType::mParent;
230 assert(mParent != NULL);
231 mPos=mParent->findNextOff(mPos+1);
232 assert(mPos <= NodeMask::SIZE);
249 template <
typename NodeMask>
254 using BaseType::mPos;
255 using BaseType::mParent;
262 assert(mParent != NULL);
264 assert(mPos<= NodeMask::SIZE);
286 template<Index Log2Dim>
290 BOOST_STATIC_ASSERT( Log2Dim>2 );
308 Word mWords[WORD_COUNT];
323 const Word* w2 = other.mWords;
324 for (
Word* w1 = mWords; n--; ++w1, ++w2) *w1 = *w2;
342 for (
const Word *w1=mWords, *w2=other.mWords; n-- && *w1++ == *w2++;) ;
355 const Word* w2 = other.mWords;
356 for (
Word* w1 = mWords; n--; ++w1, ++w2) *w1 &= *w2;
362 const Word* w2 = other.mWords;
363 for (
Word* w1 = mWords; n--; ++w1, ++w2) *w1 |= *w2;
369 const Word* w2 = other.mWords;
370 for (
Word* w1 = mWords; n--; ++w1, ++w2) *w1 ^= *w2;
381 Index32 sum = 0, n = WORD_COUNT;
382 for (
const Word* w = mWords; n--; ++w) sum +=
CountOn(*w);
389 assert( (n >> 6) < WORD_COUNT );
390 mWords[n >> 6] |=
Word(1) << (n & 63);
394 assert( (n >> 6) < WORD_COUNT );
395 mWords[n >> 6] &= ~(
Word(1) << (n & 63));
398 void set(
Index32 n,
bool On) { On ? this->setOn(n) : this->setOff(n); }
404 for (
Word* w = mWords; n--; ++w) *w = state;
410 for (
Word* w = mWords; n--; ++w) *w = ~
Word(0);
416 for (
Word* w = mWords; n--; ++w) *w =
Word(0);
420 assert( (n >> 6) < WORD_COUNT );
421 mWords[n >> 6] ^= 1 << (n & 63);
427 for (
Word* w = mWords; n--; ++w) *w = ~*w;
440 assert( (n >> 6) < WORD_COUNT );
441 return 0 != (mWords[n >> 6] & (
Word(1) << (n & 63)));
449 for (
const Word *w = mWords; n-- && *w++ == ~
Word(0);) ;
456 for (
const Word *w = mWords; n-- && *w++ ==
Word(0);) ;
462 const Word* w = mWords;
463 for (; n<WORD_COUNT && !*w; ++w, ++n) ;
464 return n==WORD_COUNT ? SIZE : (n << 6) +
FindLowestOn(*w);
469 const Word* w = mWords;
470 for (; n<WORD_COUNT && !~*w; ++w, ++n) ;
471 return n==WORD_COUNT ? SIZE : (n << 6) +
FindLowestOn(~*w);
475 template<
typename WordT>
479 assert(n*8*
sizeof(WordT) < SIZE);
480 return reinterpret_cast<const WordT*
>(mWords)[n];
482 template<
typename WordT>
485 assert(n*8*
sizeof(WordT) < SIZE);
486 return reinterpret_cast<WordT*
>(mWords)[n];
490 void save(std::ostream& os)
const
492 os.write(reinterpret_cast<const char*>(mWords), this->memUsage());
495 is.read(reinterpret_cast<char*>(mWords), this->memUsage());
500 os <<
"NodeMask: Dim=" << DIM <<
" Log2Dim=" << Log2Dim
501 <<
" Bit count=" << SIZE <<
" word count=" << WORD_COUNT << std::endl;
505 const Index32 n=(SIZE>max_out ? max_out : SIZE);
506 for (
Index32 i=0; i < n; ++i) {
513 os <<
"|" << std::endl;
518 this->printBits(os, max_out);
524 if (n >= WORD_COUNT)
return SIZE;
527 if (b & (
Word(1) << m))
return start;
529 while(!b && ++n<WORD_COUNT) b = mWords[n];
536 if (n >= WORD_COUNT)
return SIZE;
539 if (b & (
Word(1) << m))
return start;
541 while(!b && ++n<WORD_COUNT) b = ~mWords[n];
573 void operator = (
const NodeMask &other) { mByte = other.mByte; }
596 mByte &= other.mByte;
601 mByte |= other.mByte;
606 mByte ^= other.mByte;
621 mByte |= 0x01U << (n & 7);
626 mByte &= ~(0x01U << (n & 7));
629 void set(
Index32 n,
bool On) { On ? this->setOn(n) : this->setOff(n); }
631 void set(
bool on) { mByte = on ? 0xFFU : 0x00U; }
639 mByte ^= 0x01U << (n & 7);
655 return mByte & (0x01U << (n & 7));
660 bool isOn()
const {
return mByte == 0xFFU; }
662 bool isOff()
const {
return mByte == 0; }
666 const Byte b = ~mByte;
689 void save(std::ostream& os)
const
691 os.write(reinterpret_cast<const char*>(&mByte), 1);
693 void load(std::istream& is) { is.read(reinterpret_cast<char*>(&mByte), 1); }
697 os <<
"NodeMask: Dim=2, Log2Dim=1, Bit count=8, Word count=1"<<std::endl;
702 for (
Index32 i=0; i < 8; ++i) os << this->isOn(i);
703 os <<
"||" << std::endl;
713 if (start>=8)
return 8;
714 const Byte b = mByte & (0xFFU << start);
720 if (start>=8)
return 8;
721 const Byte b = ~mByte & (0xFFU << start);
748 NodeMask(
bool on) : mWord(on ? UINT64_C(0xFFFFFFFFFFFFFFFF) : UINT64_C(0x00)) {}
754 void operator = (
const NodeMask &other) { mWord = other.mWord; }
777 mWord &= other.mWord;
782 mWord |= other.mWord;
787 mWord ^= other.mWord;
802 mWord |= UINT64_C(0x01) << (n & 63);
807 mWord &= ~(UINT64_C(0x01) << (n & 63));
810 void set(
Index32 n,
bool On) { On ? this->setOn(n) : this->setOff(n); }
812 void set(
bool on) { mWord = on ? UINT64_C(0xFFFFFFFFFFFFFFFF) : UINT64_C(0x00); }
814 void setOn() { mWord = UINT64_C(0xFFFFFFFFFFFFFFFF); }
816 void setOff() { mWord = UINT64_C(0x00); }
820 mWord ^= UINT64_C(0x01) << (n & 63);
836 return 0 != (mWord & (UINT64_C(0x01) << (n & 63)));
841 bool isOn()
const {
return mWord == UINT64_C(0xFFFFFFFFFFFFFFFF); }
843 bool isOff()
const {
return mWord == 0; }
847 const Word w = ~mWord;
851 template<
typename WordT>
855 assert(n*8*
sizeof(WordT) < SIZE);
856 return reinterpret_cast<const WordT*
>(&mWord)[n];
858 template<
typename WordT>
861 assert(n*8*
sizeof(WordT) < SIZE);
862 return reinterpret_cast<WordT*
>(mWord)[n];
865 void save(std::ostream& os)
const
867 os.write(reinterpret_cast<const char*>(&mWord), 8);
869 void load(std::istream& is) { is.read(reinterpret_cast<char*>(&mWord), 8); }
873 os <<
"NodeMask: Dim=4, Log2Dim=2, Bit count=64, Word count=1"<<std::endl;
878 for (
Index32 i=0; i < 64; ++i) {
879 if ( !(i%8) ) os <<
"|";
882 os <<
"||" << std::endl;
892 if (start>=64)
return 64;
893 const Word w = mWord & (UINT64_C(0xFFFFFFFFFFFFFFFF) << start);
899 if (start>=64)
return 64;
900 const Word w = ~mWord & (UINT64_C(0xFFFFFFFFFFFFFFFF) << start);
920 mBitSize(bit_size), mIntSize(((bit_size-1)>>5)+1), mBits(new
Index32[mIntSize])
922 for (
Index32 i=0; i<mIntSize; ++i) mBits[i]=0x00000000;
925 mBitSize(B.mBitSize), mIntSize(B.mIntSize), mBits(new
Index32[mIntSize])
933 mIntSize =((bit_size-1)>>5)+1;
936 for (
Index32 i=0; i<mIntSize; ++i) mBits[i]=0x00000000;
963 : mPos(pos), mBitSize(parent->getBitSize()), mParent(parent) {
964 assert( pos<=mBitSize );
981 assert(mPos <= mBitSize);
982 return (mPos != mBitSize);
985 operator bool()
const {
return this->test();}
992 using BaseIterator::mPos;
993 using BaseIterator::mBitSize;
994 using BaseIterator::mParent;
999 assert(mParent!=NULL);
1000 mPos=mParent->findNextOn(mPos+1);
1001 assert(mPos <= mBitSize);
1004 for (
Index i=0; i<n && this->next(); ++i) {}
1008 return this->test();
1020 using BaseIterator::mPos;
1021 using BaseIterator::mBitSize;
1022 using BaseIterator::mParent;
1027 assert(mParent!=NULL);
1028 mPos=mParent->findNextOff(mPos+1);
1029 assert(mPos <= mBitSize);
1032 for (
Index i=0; i<n && this->next(); ++i) {}
1036 return this->test();
1048 using BaseIterator::mPos;
1049 using BaseIterator::mBitSize;
1050 using BaseIterator::mParent;
1055 assert(mParent!=NULL);
1057 assert(mPos<= mBitSize);
1060 for (
Index i=0; i<n && this->next(); ++i) {}
1064 return this->test();
1081 if (mBitSize != B.
mBitSize)
return false;
1082 for (
Index32 i=0; i<mIntSize; ++i)
if (mBits[i] != B.
mBits[i])
return false;
1087 if (mBitSize != B.
mBitSize)
return true;
1088 for (
Index32 i=0; i<mIntSize; ++i)
if (mBits[i] != B.
mBits[i])
return true;
1097 assert(mIntSize == other.
mIntSize);
1099 mBits[i] &= other.
mBits[i];
1101 for (
Index32 i = other.
mIntSize; i < mIntSize; ++i) mBits[i] = 0x00000000;
1105 assert(mIntSize == other.
mIntSize);
1107 mBits[i] |= other.
mBits[i];
1112 assert(mIntSize == other.
mIntSize);
1114 mBits[i] ^= other.
mBits[i];
1142 assert( (i>>5) < mIntSize);
1143 mBits[i>>5] |= 1<<(i&31);
1148 assert( (i>>5) < mIntSize);
1149 mBits[i>>5] &= ~(1<<(i&31));
1152 void set(
Index32 i,
bool On) { On ? this->setOn(i) : this->setOff(i); }
1156 for (
Index32 i=0; i<mIntSize; ++i) mBits[i]=0xFFFFFFFF;
1160 for (
Index32 i=0; i<mIntSize; ++i) mBits[i]=0x00000000;
1164 assert( (i>>5) < mIntSize);
1165 mBits[i>>5] ^= 1<<(i&31);
1169 for (
Index32 i=0; i<mIntSize; ++i) mBits[i]=~mBits[i];
1177 assert( (i>>5) < mIntSize);
1178 return ( mBits[i >> 5] & (1<<(i&31)) );
1182 assert( (i>>5) < mIntSize);
1183 return ( ~mBits[i >> 5] & (1<<(i&31)) );
1187 if (!mBits)
return false;
1188 for (
Index32 i=0; i<mIntSize; ++i)
if (mBits[i] != 0xFFFFFFFF)
return false;
1193 if (!mBits)
return true;
1194 for (
Index32 i=0; i<mIntSize; ++i)
if (mBits[i] != 0)
return false;
1201 while(!mBits[i])
if (++i == mIntSize)
return mBitSize;
1208 while(!(~mBits[i]))
if (++i == mIntSize)
return mBitSize;
1212 void save(std::ostream& os)
const {
1214 os.write((
const char *)mBits,mIntSize*
sizeof(
Index32));
1218 is.read((
char *)mBits,mIntSize*
sizeof(
Index32));
1222 os <<
"RootNodeMask: Bit-size="<<mBitSize<<
" Int-size="<<mIntSize<<std::endl;
1226 const Index32 n=(mBitSize>max_out?max_out:mBitSize);
1227 for (
Index32 i=0; i < n; ++i) {
1232 os << this->isOn(i);
1234 os <<
"|" << std::endl;
1238 this->printInfo(os);
1239 this->printBits(os,max_out);
1244 Index32 n = start >> 5, m = start & 31;
1245 if (n>=mIntSize)
return mBitSize;
1247 if (b & (1<<m))
return start;
1248 b &= 0xFFFFFFFF << m;
1249 while(!b && ++n<mIntSize) b = mBits[n];
1255 Index32 n = start >> 5, m = start & 31;
1256 if (n>=mIntSize)
return mBitSize;
1258 if (b & (1<<m))
return start;
1260 while(!b && ++n<mIntSize) b = ~mBits[n];
1274 #endif // OPENVDB_UTIL_NODEMASKS_HAS_BEEN_INCLUDED
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:386
OPENVDB_API Hermite min(const Hermite &, const Hermite &)
min and max operations done directly on the compressed data.
bool operator*() const
Definition: NodeMasks.h:209
NodeMask operator|(const NodeMask &other) const
Definition: NodeMasks.h:791
void init(Index32 bit_size)
Definition: NodeMasks.h:931
void setOff(Index32 i)
Definition: NodeMasks.h:1146
Index32 countOff() const
Definition: NodeMasks.h:1138
Index32 findNextOn(Index32 start) const
Definition: NodeMasks.h:1242
bool operator!=(const BaseMaskIterator &iter) const
Definition: NodeMasks.h:169
Index32 CountOn(Index64 v)
Return the number of on bits in the given 64-bit value.
Definition: NodeMasks.h:88
bool isOn() const
Return true if all the bits are on.
Definition: NodeMasks.h:446
Index32 findFirstOff() const
Definition: NodeMasks.h:466
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:839
Index32 memUsage() const
Definition: NodeMasks.h:1264
Index32 findFirstOn() const
Definition: NodeMasks.h:459
WordT getWord(Index n) const
Return the nth word of the bit mask, for a word of arbitrary size.
Definition: NodeMasks.h:477
BaseMaskIterator(Index32 pos, const NodeMask *parent)
Definition: NodeMasks.h:164
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:617
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:393
void printBits(std::ostream &os=std::cout) const
Definition: NodeMasks.h:875
DenseIterator endDense() const
Definition: NodeMasks.h:584
Definition: NodeMasks.h:954
void printBits(std::ostream &os=std::cout, Index32 max_out=80u) const
Definition: NodeMasks.h:503
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:652
NodeMask operator|(const NodeMask &other) const
Definition: NodeMasks.h:610
BaseMaskIterator()
Definition: NodeMasks.h:163
OffIterator endOff() const
Definition: NodeMasks.h:335
DenseIterator endDense() const
Definition: NodeMasks.h:765
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:833
void setOn()
Set all bits on.
Definition: NodeMasks.h:814
void setLastOff()
Set the last bit off.
Definition: NodeMasks.h:650
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:800
NodeMask()
Default constructor sets all bits off.
Definition: NodeMasks.h:312
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:658
OnIterator beginOn() const
Definition: NodeMasks.h:1073
Byte Word
Definition: NodeMasks.h:557
void increment(Index n)
Definition: NodeMasks.h:1031
void setOn()
Set all bits on.
Definition: NodeMasks.h:633
void setLastOn()
Definition: NodeMasks.h:1172
OnIterator beginOn() const
Definition: NodeMasks.h:332
void setLastOff()
Set the last bit off.
Definition: NodeMasks.h:831
NodeMask(bool on)
All bits are set to the specified state.
Definition: NodeMasks.h:567
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:619
Index getIntSize() const
Definition: NodeMasks.h:941
void setOn()
Definition: NodeMasks.h:1154
Index32 findNextOff(Index32 start) const
Definition: NodeMasks.h:1253
NodeMask(bool on)
All bits are set to the specified state.
Definition: NodeMasks.h:748
Index32 Index
Definition: Types.h:57
NodeMask operator^(const NodeMask &other) const
Definition: NodeMasks.h:792
RootNodeMask()
Definition: NodeMasks.h:918
DenseMaskIterator(Index32 pos, const NodeMask *parent)
Definition: NodeMasks.h:259
bool operator*() const
Definition: NodeMasks.h:1066
Index32 findFirstOn() const
Definition: NodeMasks.h:1198
~NodeMask()
Destructor.
Definition: NodeMasks.h:571
void increment()
Definition: NodeMasks.h:228
Index32 FindLowestOn(Index64 v)
Return the least significant on bit of the given 64-bit value.
Definition: NodeMasks.h:122
NodeMask operator^(const NodeMask &other) const
Definition: NodeMasks.h:611
void setLastOff()
Definition: NodeMasks.h:1174
WordT & getWord(Index n)
Return the nth word of the bit mask, for a word of arbitrary size.
Definition: NodeMasks.h:483
OnIterator endOn() const
Definition: NodeMasks.h:1074
OnIterator()
Definition: NodeMasks.h:996
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:379
void save(std::ostream &os) const
Definition: NodeMasks.h:1212
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:446
NodeMask(const NodeMask &other)
Copy constructor.
Definition: NodeMasks.h:316
Index32 pos() const
Definition: NodeMasks.h:176
bool next()
Definition: NodeMasks.h:1006
void load(std::istream &is)
Definition: NodeMasks.h:494
void toggle(Index32 i)
Definition: NodeMasks.h:1162
OffIterator endOff() const
Definition: NodeMasks.h:1076
void save(std::ostream &os) const
Definition: NodeMasks.h:689
void toggle(Index32 n)
Toggle the state of the nth bit.
Definition: NodeMasks.h:818
Index32 * mBits
Definition: NodeMasks.h:915
Index32 findFirstOff() const
Definition: NodeMasks.h:1205
const RootNodeMask & operator^=(const RootNodeMask &other)
Definition: NodeMasks.h:1111
Definition: NodeMasks.h:188
const NodeMask & operator^=(const NodeMask &other)
Definition: NodeMasks.h:366
void printInfo(std::ostream &os=std::cout) const
simple print method for debugging
Definition: NodeMasks.h:871
~NodeMask()
Destructor.
Definition: NodeMasks.h:752
void toggle(Index32 n)
Toggle the state of the nth bit.
Definition: NodeMasks.h:637
const NodeMask & operator|=(const NodeMask &other)
Definition: NodeMasks.h:599
OnMaskIterator< NodeMask > OnIterator
Definition: NodeMasks.h:328
void printInfo(std::ostream &os=std::cout) const
simple print method for debugging
Definition: NodeMasks.h:695
Index32 findNextOn(Index32 start) const
Definition: NodeMasks.h:711
void setLastOn()
Set the last bit on.
Definition: NodeMasks.h:827
Index64 Word
Definition: NodeMasks.h:738
void save(std::ostream &os) const
Definition: NodeMasks.h:865
Index32 findNextOff(Index32 start) const
Definition: NodeMasks.h:897
Index32 findNextOn(Index32 start) const
Definition: NodeMasks.h:890
~NodeMask()
Destructor.
Definition: NodeMasks.h:318
Definition: NodeMasks.h:1045
void setOn()
Set all bits on.
Definition: NodeMasks.h:407
BaseMaskIterator & operator=(const BaseMaskIterator &iter)
Definition: NodeMasks.h:171
~RootNodeMask()
Definition: NodeMasks.h:929
bool isOff(Index32 i) const
Definition: NodeMasks.h:1180
DenseIterator beginDense() const
Definition: NodeMasks.h:764
Definition: NodeMasks.h:1017
void setFirstOn()
Set the first bit on.
Definition: NodeMasks.h:825
OnMaskIterator & operator++()
Definition: NodeMasks.h:210
void increment(Index n)
Definition: NodeMasks.h:1003
Index32 offset() const
Definition: NodeMasks.h:175
bool operator*() const
Definition: NodeMasks.h:240
Index32 findNextOff(Index32 start) const
Definition: NodeMasks.h:718
const NodeMask & operator&=(const NodeMask &other)
Definition: NodeMasks.h:352
Base class for the bit mask iterators.
Definition: NodeMasks.h:157
NodeMask operator|(const NodeMask &other) const
Definition: NodeMasks.h:374
DenseIterator beginDense() const
Definition: NodeMasks.h:583
const NodeMask & operator|=(const NodeMask &other)
Definition: NodeMasks.h:780
bool next()
Definition: NodeMasks.h:235
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:287
void setFirstOn()
Set the first bit on.
Definition: NodeMasks.h:644
void toggle()
Toggle the state of all bits in the mask.
Definition: NodeMasks.h:424
NodeMask()
Default constructor sets all bits off.
Definition: NodeMasks.h:746
void setLastOn()
Set the last bit on.
Definition: NodeMasks.h:646
OnIterator beginOn() const
Definition: NodeMasks.h:760
DenseIterator & operator++()
Definition: NodeMasks.h:1067
void setOff()
Definition: NodeMasks.h:1158
Definition: NodeMasks.h:219
bool isOff() const
Return true if all the bits are off.
Definition: NodeMasks.h:843
void setFirstOn()
Definition: NodeMasks.h:1171
const NodeMask & operator|=(const NodeMask &other)
Definition: NodeMasks.h:359
OnIterator beginOn() const
Definition: NodeMasks.h:579
void toggle(Index32 n)
Toggle the state of the nth bit.
Definition: NodeMasks.h:419
bool isOff() const
Return true if all the bits are off.
Definition: NodeMasks.h:662
Index32 CountOff(Index64 v)
Return the number of off bits in the given 64-bit value.
Definition: NodeMasks.h:96
RootNodeMask operator!() const
Definition: NodeMasks.h:1095
OnIterator & operator++()
Definition: NodeMasks.h:1011
bool test() const
Definition: NodeMasks.h:980
Index32 offset() const
Definition: NodeMasks.h:976
NodeMask(const NodeMask &other)
Copy constructor.
Definition: NodeMasks.h:750
bool test() const
Definition: NodeMasks.h:177
void increment()
Definition: NodeMasks.h:1026
const NodeMask & operator&=(const NodeMask &other)
Definition: NodeMasks.h:594
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:444
NodeMask()
Default constructor sets all bits off.
Definition: NodeMasks.h:565
uint64_t Index64
Definition: Types.h:56
#define OPENVDB_VERSION_NAME
Definition: version.h:45
void increment()
Definition: NodeMasks.h:197
OffIterator()
Definition: NodeMasks.h:1024
void set(bool on)
Set all bits to the specified state.
Definition: NodeMasks.h:400
OffIterator beginOff() const
Definition: NodeMasks.h:581
NodeMask(const NodeMask &other)
Copy constructor.
Definition: NodeMasks.h:569
bool next()
Definition: NodeMasks.h:204
const NodeMask & operator&=(const NodeMask &other)
Definition: NodeMasks.h:775
bool operator==(const BaseMaskIterator &iter) const
Definition: NodeMasks.h:168
Index32 mPos
Definition: NodeMasks.h:957
DenseIterator beginDense() const
Definition: NodeMasks.h:1077
RootNodeMask & operator=(const RootNodeMask &B)
Definition: NodeMasks.h:943
bool next()
Definition: NodeMasks.h:1062
void load(std::istream &is)
Definition: NodeMasks.h:1216
NodeMask & operator=(const NodeMask &other)
Assignment operator.
Definition: NodeMasks.h:320
bool operator*() const
Definition: NodeMasks.h:1010
Index32 FindHighestOn(Index32 v)
Return the most significant on bit of the given 32-bit value.
Definition: NodeMasks.h:137
NodeMask operator&(const NodeMask &other) const
Definition: NodeMasks.h:609
void load(std::istream &is)
Definition: NodeMasks.h:693
bool operator*() const
Definition: NodeMasks.h:1038
OffIterator beginOff() const
Definition: NodeMasks.h:762
OnIterator endOn() const
Definition: NodeMasks.h:333
void increment()
Definition: NodeMasks.h:260
BaseIterator & operator=(const BaseIterator &iter)
Definition: NodeMasks.h:969
static Index32 memUsage()
Return the byte size of this NodeMask.
Definition: NodeMasks.h:377
NodeMask operator!() const
Definition: NodeMasks.h:774
OnMaskIterator< NodeMask > OnIterator
Definition: NodeMasks.h:575
OffIterator beginOff() const
Definition: NodeMasks.h:1075
bool isOn() const
Definition: NodeMasks.h:1186
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:438
const NodeMask * mParent
Definition: NodeMasks.h:161
void increment()
Definition: NodeMasks.h:1054
bool operator*() const
Definition: NodeMasks.h:272
Index getBitSize() const
Definition: NodeMasks.h:939
NodeMask operator!() const
Definition: NodeMasks.h:593
OnMaskIterator< NodeMask > OnIterator
Definition: NodeMasks.h:756
WordT & getWord(Index n)
Return the nth word of the bit mask, for a word of arbitrary size.
Definition: NodeMasks.h:859
Index32 pos() const
Definition: NodeMasks.h:978
bool operator<(const Tuple< SIZE, T0 > &t0, const Tuple< SIZE, T1 > &t1)
Definition: Tuple.h:158
DenseMaskIterator< NodeMask > DenseIterator
Definition: NodeMasks.h:330
OffIterator & operator++()
Definition: NodeMasks.h:1039
void setOff()
Set all bits off.
Definition: NodeMasks.h:635
unsigned char Byte
Definition: Types.h:62
DenseMaskIterator & operator++()
Definition: NodeMasks.h:273
OnMaskIterator()
Definition: NodeMasks.h:195
NodeMask operator&(const NodeMask &other) const
Definition: NodeMasks.h:790
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:388
DenseMaskIterator()
Definition: NodeMasks.h:258
void increment(Index n)
Definition: NodeMasks.h:234
bool next()
Definition: NodeMasks.h:267
RootNodeMask operator|(const RootNodeMask &other) const
Definition: NodeMasks.h:1121
NodeMask operator^(const NodeMask &other) const
Definition: NodeMasks.h:375
void load(std::istream &is)
Definition: NodeMasks.h:869
void toggle()
Definition: NodeMasks.h:1167
OffMaskIterator< NodeMask > OffIterator
Definition: NodeMasks.h:576
const RootNodeMask & operator|=(const RootNodeMask &other)
Definition: NodeMasks.h:1104
void increment(Index n)
Definition: NodeMasks.h:1059
Index32 mBitSize
Definition: NodeMasks.h:914
DenseIterator endDense() const
Definition: NodeMasks.h:337
uint32_t Index32
Definition: Types.h:55
void setFirstOff()
Set the first bit off.
Definition: NodeMasks.h:648
OffMaskIterator< NodeMask > OffIterator
Definition: NodeMasks.h:757
Index32 getMemUsage() const
Definition: NodeMasks.h:1129
Index32 mBitSize
Definition: NodeMasks.h:958
OnMaskIterator(Index32 pos, const NodeMask *parent)
Definition: NodeMasks.h:196
bool isOff() const
Definition: NodeMasks.h:1192
OffIterator beginOff() const
Definition: NodeMasks.h:334
void set(bool on)
Set all bits to the specified state.
Definition: NodeMasks.h:631
bool operator==(const BaseIterator &iter) const
Definition: NodeMasks.h:966
DenseIterator(Index32 pos, const RootNodeMask *parent)
Definition: NodeMasks.h:1053
void setOff()
Set all bits off.
Definition: NodeMasks.h:816
DenseIterator endDense() const
Definition: NodeMasks.h:1078
bool isOn(Index32 i) const
Definition: NodeMasks.h:1175
bool isOn() const
Return true if all the bits are on.
Definition: NodeMasks.h:660
OnIterator(Index32 pos, const RootNodeMask *parent)
Definition: NodeMasks.h:997
void setFirstOn()
Set the first bit on.
Definition: NodeMasks.h:430
Index32 countOn() const
Definition: NodeMasks.h:1131
Index32 findFirstOff() const
Definition: NodeMasks.h:664
void setFirstOff()
Set the first bit off.
Definition: NodeMasks.h:829
bool operator!=(const BaseIterator &iter) const
Definition: NodeMasks.h:967
void toggle()
Toggle the state of all bits in the mask.
Definition: NodeMasks.h:823
Index32 findFirstOff() const
Definition: NodeMasks.h:845
void printAll(std::ostream &os=std::cout) const
Definition: NodeMasks.h:705
const RootNodeMask * mParent
Definition: NodeMasks.h:959
Definition: NodeMasks.h:989
void set(bool on)
Set all bits to the specified state.
Definition: NodeMasks.h:812
const RootNodeMask & operator&=(const RootNodeMask &other)
Definition: NodeMasks.h:1096
Definition: NodeMasks.h:911
RootNodeMask(Index32 bit_size)
Definition: NodeMasks.h:919
void increment(Index n)
Definition: NodeMasks.h:266
void toggle()
Toggle the state of all bits in the mask.
Definition: NodeMasks.h:642
void printAll(std::ostream &os=std::cout) const
Definition: NodeMasks.h:884
bool isOn() const
Return true if all the bits are on.
Definition: NodeMasks.h:841
void setLastOn()
Set the last bit on.
Definition: NodeMasks.h:432
void increment()
Definition: NodeMasks.h:998
NodeMask operator!() const
Definition: NodeMasks.h:351
NodeMask(bool on)
All bits are set to the specified state.
Definition: NodeMasks.h:314
OffMaskIterator & operator++()
Definition: NodeMasks.h:241
OffIterator endOff() const
Definition: NodeMasks.h:582
Index64 Word
Definition: NodeMasks.h:296
const NodeMask & operator^=(const NodeMask &other)
Definition: NodeMasks.h:785
RootNodeMask(const RootNodeMask &B)
Definition: NodeMasks.h:924
NodeMask operator&(const NodeMask &other) const
Definition: NodeMasks.h:373
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:454
void setOn(Index32 i)
Definition: NodeMasks.h:1140
const NodeMask & operator^=(const NodeMask &other)
Definition: NodeMasks.h:604
void setFirstOff()
Definition: NodeMasks.h:1173
bool next()
Definition: NodeMasks.h:1034
BaseIterator(Index32 pos, const RootNodeMask *parent)
Definition: NodeMasks.h:962
void printAll(std::ostream &os=std::cout, Index32 max_out=80u) const
Definition: NodeMasks.h:515
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:629
void increment(Index n)
Definition: NodeMasks.h:203
DenseIterator()
Definition: NodeMasks.h:1052
OnIterator endOn() const
Definition: NodeMasks.h:761
DenseIterator beginDense() const
Definition: NodeMasks.h:336
DenseMaskIterator< NodeMask > DenseIterator
Definition: NodeMasks.h:577
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:810
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:398
static Index32 memUsage()
Return the byte size of this NodeMask.
Definition: NodeMasks.h:613
OffIterator endOff() const
Definition: NodeMasks.h:763
Definition: NodeMasks.h:250
void printAll(std::ostream &os=std::cout, Index32 max_out=80u) const
Definition: NodeMasks.h:1237
OffIterator(Index32 pos, const RootNodeMask *parent)
Definition: NodeMasks.h:1025
OnIterator endOn() const
Definition: NodeMasks.h:580
DenseMaskIterator< NodeMask > DenseIterator
Definition: NodeMasks.h:758
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:67
Index32 findFirstOn() const
Definition: NodeMasks.h:844
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:624
OffMaskIterator()
Definition: NodeMasks.h:226
Index32 findNextOff(Index32 start) const
Definition: NodeMasks.h:533
Index32 findFirstOn() const
Definition: NodeMasks.h:663
Index32 findNextOn(Index32 start) const
Definition: NodeMasks.h:521
static Index32 memUsage()
Return the byte size of this NodeMask.
Definition: NodeMasks.h:794
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:796
void set(Index32 i, bool On)
Definition: NodeMasks.h:1152
RootNodeMask operator^(const RootNodeMask &other) const
Definition: NodeMasks.h:1124
WordT getWord(Index n) const
Return the nth word of the bit mask, for a word of arbitrary size.
Definition: NodeMasks.h:853
void setOff()
Set all bits off.
Definition: NodeMasks.h:413
void printInfo(std::ostream &os=std::cout) const
simple print method for debugging
Definition: NodeMasks.h:498
bool isOff() const
Return true if all the bits are off.
Definition: NodeMasks.h:453
Index32 mPos
Definition: NodeMasks.h:160
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:615
void printBits(std::ostream &os=std::cout, Index32 max_out=80u) const
Definition: NodeMasks.h:1225
OffMaskIterator< NodeMask > OffIterator
Definition: NodeMasks.h:329
OffMaskIterator(Index32 pos, const NodeMask *parent)
Definition: NodeMasks.h:227
void save(std::ostream &os) const
Definition: NodeMasks.h:490
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:805
Index32 mIntSize
Definition: NodeMasks.h:914
BaseIterator()
Definition: NodeMasks.h:961
void printInfo(std::ostream &os=std::cout) const
simple print method for debugging
Definition: NodeMasks.h:1221
RootNodeMask operator&(const RootNodeMask &other) const
Definition: NodeMasks.h:1118
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:798
void setLastOff()
Set the last bit off.
Definition: NodeMasks.h:436
void printBits(std::ostream &os=std::cout) const
Definition: NodeMasks.h:699
void setFirstOff()
Set the first bit off.
Definition: NodeMasks.h:434