OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
NodeMask< 2 > Class Reference

Template specialization of NodeMask for Log2Dim=2, i.e. 4^3 nodes. More...

#include <openvdb/util/NodeMasks.h>

Public Types

using Word = Index64
 
using OnIterator = OnMaskIterator<NodeMask>
 
using OffIterator = OffMaskIterator<NodeMask>
 
using DenseIterator = DenseMaskIterator<NodeMask>
 
using Word
 
using OnIterator
 
using OffIterator
 
using DenseIterator
 

Public Member Functions

 NodeMask ()
 Default constructor sets all bits off.
 
 NodeMask (bool on)
 All bits are set to the specified state.
 
 NodeMask (const NodeMask &other)
 Copy constructor.
 
 ~NodeMask ()
 Destructor.
 
void operator= (const NodeMask &other)
 Assignment operator.
 
OnIterator beginOn () const
 
OnIterator endOn () const
 
OffIterator beginOff () const
 
OffIterator endOff () const
 
DenseIterator beginDense () const
 
DenseIterator endDense () const
 
bool operator== (const NodeMask &other) const
 
bool operator!= (const NodeMask &other) const
 
template<typename WordOp>
const NodeMaskforeach (const NodeMask &other, const WordOp &op)
 Apply a functor to the words of the this and the other mask.
 
template<typename WordOp>
const NodeMaskforeach (const NodeMask &other1, const NodeMask &other2, const WordOp &op)
 
template<typename WordOp>
const NodeMaskforeach (const NodeMask &other1, const NodeMask &other2, const NodeMask &other3, const WordOp &op)
 
const NodeMaskoperator&= (const NodeMask &other)
 Bitwise intersection.
 
const NodeMaskoperator|= (const NodeMask &other)
 Bitwise union.
 
const NodeMaskoperator-= (const NodeMask &other)
 Bitwise difference.
 
const NodeMaskoperator^= (const NodeMask &other)
 Bitwise XOR.
 
NodeMask operator! () const
 
NodeMask operator& (const NodeMask &other) const
 
NodeMask operator| (const NodeMask &other) const
 
NodeMask operator^ (const NodeMask &other) const
 
Index32 countOn () const
 Return the total number of on bits.
 
Index32 countOff () const
 Return the total number of on bits.
 
void setOn (Index32 n)
 Set the nth bit on.
 
void setOff (Index32 n)
 Set the nth bit off.
 
void set (Index32 n, bool On)
 Set the nth bit to the specified state.
 
void set (bool on)
 Set all bits to the specified state.
 
void setOn ()
 Set all bits on.
 
void setOff ()
 Set all bits off.
 
void toggle (Index32 n)
 Toggle the state of the nth bit.
 
void toggle ()
 Toggle the state of all bits in the mask.
 
void setFirstOn ()
 Set the first bit on.
 
void setLastOn ()
 Set the last bit on.
 
void setFirstOff ()
 Set the first bit off.
 
void setLastOff ()
 Set the last bit off.
 
bool isOn (Index32 n) const
 Return true if the nth bit is on.
 
bool isOff (Index32 n) const
 Return true if the nth bit is off.
 
bool isOn () const
 Return true if all the bits are on.
 
bool isOff () const
 Return true if all the bits are off.
 
bool isConstant (bool &isOn) const
 
Index32 findFirstOn () const
 
Index32 findFirstOff () const
 
template<typename WordT>
WordT getWord (Index n) const
 Return the nth word of the bit mask, for a word of arbitrary size.
 
template<typename WordT>
WordT & getWord (Index n)
 
void save (std::ostream &os) const
 
void load (std::istream &is)
 
void seek (std::istream &is) const
 
void printInfo (std::ostream &os=std::cout) const
 simple print method for debugging
 
void printBits (std::ostream &os=std::cout) const
 
void printAll (std::ostream &os=std::cout) const
 
Index32 findNextOn (Index32 start) const
 
Index32 findNextOff (Index32 start) const
 
 NodeMask ()
 Default constructor sets all bits off.
 
 NodeMask (bool on)
 All bits are set to the specified state.
 
 NodeMask (const NodeMask &other)
 Copy constructor.
 
 ~NodeMask ()
 Destructor.
 
NodeMaskoperator= (const NodeMask &other)
 Assignment operator.
 
OnIterator beginOn () const
 
OnIterator endOn () const
 
OffIterator beginOff () const
 
OffIterator endOff () const
 
DenseIterator beginDense () const
 
DenseIterator endDense () const
 
bool operator== (const NodeMask &other) const
 
bool operator!= (const NodeMask &other) const
 
const NodeMaskforeach (const NodeMask &other, const WordOp &op)
 Apply a functor to the words of the this and the other mask.
 
const NodeMaskforeach (const NodeMask &other1, const NodeMask &other2, const WordOp &op)
 
const NodeMaskforeach (const NodeMask &other1, const NodeMask &other2, const NodeMask &other3, const WordOp &op)
 
const NodeMaskoperator&= (const NodeMask &other)
 Bitwise intersection.
 
const NodeMaskoperator|= (const NodeMask &other)
 Bitwise union.
 
const NodeMaskoperator-= (const NodeMask &other)
 Bitwise difference.
 
const NodeMaskoperator^= (const NodeMask &other)
 Bitwise XOR.
 
NodeMask operator! () const
 
NodeMask operator& (const NodeMask &other) const
 
NodeMask operator| (const NodeMask &other) const
 
NodeMask operator^ (const NodeMask &other) const
 
Index32 countOn () const
 Return the total number of on bits.
 
Index32 countOff () const
 Return the total number of on bits.
 
void setOn (Index32 n)
 Set the nth bit on.
 
void setOn ()
 Set all bits on.
 
void setOff (Index32 n)
 Set the nth bit off.
 
void setOff ()
 Set all bits off.
 
void set (Index32 n, bool On)
 Set the nth bit to the specified state.
 
void set (bool on)
 Set all bits to the specified state.
 
void toggle (Index32 n)
 Toggle the state of the nth bit.
 
void toggle ()
 Toggle the state of all bits in the mask.
 
void setFirstOn ()
 Set the first bit on.
 
void setLastOn ()
 Set the last bit on.
 
void setFirstOff ()
 Set the first bit off.
 
void setLastOff ()
 Set the last bit off.
 
bool isOn (Index32 n) const
 Return true if the nth bit is on.
 
bool isOn () const
 Return true if all the bits are on.
 
bool isOff (Index32 n) const
 Return true if the nth bit is off.
 
bool isOff () const
 Return true if all the bits are off.
 
bool isConstant (bool &isOn) const
 
Index32 findFirstOn () const
 
Index32 findFirstOff () const
 
WordT getWord (Index n) const
 Return the nth word of the bit mask, for a word of arbitrary size.
 
WordT & getWord (Index n)
 
void save (std::ostream &os) const
 
void load (std::istream &is)
 
void seek (std::istream &is) const
 
void printInfo (std::ostream &os=std::cout) const
 simple print method for debugging
 
void printBits (std::ostream &os=std::cout, Index32 max_out=80u) const
 
void printAll (std::ostream &os=std::cout, Index32 max_out=80u) const
 
Index32 findNextOn (Index32 start) const
 
Index32 findNextOff (Index32 start) const
 

Static Public Member Functions

static Index32 memUsage ()
 Return the byte size of this NodeMask.
 
static Index32 memUsage ()
 Return the byte size of this NodeMask.
 

Static Public Attributes

static const Index32 LOG2DIM = 2
 
static const Index32 DIM = 4
 
static const Index32 SIZE = 64
 
static const Index32 WORD_COUNT = 1
 
static const Index32 LOG2DIM
 
static const Index32 DIM
 
static const Index32 SIZE
 
static const Index32 WORD_COUNT
 

Detailed Description

Template specialization of NodeMask for Log2Dim=2, i.e. 4^3 nodes.

Member Typedef Documentation

◆ DenseIterator [1/2]

◆ DenseIterator [2/2]

◆ OffIterator [1/2]

using OffIterator

◆ OffIterator [2/2]

◆ OnIterator [1/2]

using OnIterator

◆ OnIterator [2/2]

◆ Word [1/2]

using Word

◆ Word [2/2]

using Word = Index64

Constructor & Destructor Documentation

◆ NodeMask() [1/6]

NodeMask ( )
inline

Default constructor sets all bits off.

◆ NodeMask() [2/6]

NodeMask ( bool on)
inline

All bits are set to the specified state.

◆ NodeMask() [3/6]

NodeMask ( const NodeMask< 2 > & other)
inline

Copy constructor.

◆ ~NodeMask() [1/2]

~NodeMask ( )
inline

Destructor.

◆ NodeMask() [4/6]

NodeMask ( )
inline

Default constructor sets all bits off.

◆ NodeMask() [5/6]

NodeMask ( bool on)
inline

All bits are set to the specified state.

◆ NodeMask() [6/6]

NodeMask ( const NodeMask< 2 > & other)
inline

Copy constructor.

◆ ~NodeMask() [2/2]

~NodeMask ( )
inline

Destructor.

Member Function Documentation

◆ beginDense() [1/2]

DenseIterator beginDense ( ) const
inline

◆ beginDense() [2/2]

DenseIterator beginDense ( ) const
inline

◆ beginOff() [1/2]

OffIterator beginOff ( ) const
inline

◆ beginOff() [2/2]

OffIterator beginOff ( ) const
inline

◆ beginOn() [1/2]

OnIterator beginOn ( ) const
inline

◆ beginOn() [2/2]

OnIterator beginOn ( ) const
inline

◆ countOff() [1/2]

Index32 countOff ( ) const
inline

Return the total number of on bits.

◆ countOff() [2/2]

Index32 countOff ( ) const
inline

Return the total number of on bits.

◆ countOn() [1/2]

Index32 countOn ( ) const
inline

Return the total number of on bits.

◆ countOn() [2/2]

Index32 countOn ( ) const
inline

Return the total number of on bits.

◆ endDense() [1/2]

DenseIterator endDense ( ) const
inline

◆ endDense() [2/2]

DenseIterator endDense ( ) const
inline

◆ endOff() [1/2]

OffIterator endOff ( ) const
inline

◆ endOff() [2/2]

OffIterator endOff ( ) const
inline

◆ endOn() [1/2]

OnIterator endOn ( ) const
inline

◆ endOn() [2/2]

OnIterator endOn ( ) const
inline

◆ findFirstOff() [1/2]

Index32 findFirstOff ( ) const
inline

◆ findFirstOff() [2/2]

Index32 findFirstOff ( ) const
inline

◆ findFirstOn() [1/2]

Index32 findFirstOn ( ) const
inline

◆ findFirstOn() [2/2]

Index32 findFirstOn ( ) const
inline

◆ findNextOff() [1/2]

Index32 findNextOff ( Index32 start) const
inline

◆ findNextOff() [2/2]

Index32 findNextOff ( Index32 start) const
inline

◆ findNextOn() [1/2]

Index32 findNextOn ( Index32 start) const
inline

◆ findNextOn() [2/2]

Index32 findNextOn ( Index32 start) const
inline

◆ foreach() [1/6]

const NodeMask & foreach ( const NodeMask< 2 > & other,
const WordOp & op )
inline

Apply a functor to the words of the this and the other mask.

An example that implements the "operator&=" method:

struct Op { inline void operator()(W &w1, const W& w2) const { w1 &= w2; } };

◆ foreach() [2/6]

template<typename WordOp>
const NodeMask & foreach ( const NodeMask< 2 > & other,
const WordOp & op )
inline

Apply a functor to the words of the this and the other mask.

An example that implements the "operator&=" method:

struct Op { inline void operator()(Word &w1, const Word& w2) const { w1 &= w2; } };
Index64 Word
Definition NodeMasks.h:853

◆ foreach() [3/6]

const NodeMask & foreach ( const NodeMask< 2 > & other1,
const NodeMask< 2 > & other2,
const NodeMask< 2 > & other3,
const WordOp & op )
inline

◆ foreach() [4/6]

template<typename WordOp>
const NodeMask & foreach ( const NodeMask< 2 > & other1,
const NodeMask< 2 > & other2,
const NodeMask< 2 > & other3,
const WordOp & op )
inline

◆ foreach() [5/6]

const NodeMask & foreach ( const NodeMask< 2 > & other1,
const NodeMask< 2 > & other2,
const WordOp & op )
inline

◆ foreach() [6/6]

template<typename WordOp>
const NodeMask & foreach ( const NodeMask< 2 > & other1,
const NodeMask< 2 > & other2,
const WordOp & op )
inline

◆ getWord() [1/4]

WordT & getWord ( Index n)
inline

◆ getWord() [2/4]

template<typename WordT>
WordT & getWord ( Index n)
inline

◆ getWord() [3/4]

WordT getWord ( Index n) const
inline

Return the nth word of the bit mask, for a word of arbitrary size.

◆ getWord() [4/4]

template<typename WordT>
WordT getWord ( Index n) const
inline

Return the nth word of the bit mask, for a word of arbitrary size.

◆ isConstant() [1/2]

bool isConstant ( bool & isOn) const
inline

Return true if bits are either all off OR all on.

Parameters
isOnTakes on the values of all bits if the method returns true - else it is undefined.

◆ isConstant() [2/2]

bool isConstant ( bool & isOn) const
inline

Return true if bits are either all off OR all on.

Parameters
isOnTakes on the values of all bits if the method returns true - else it is undefined.

◆ isOff() [1/4]

bool isOff ( ) const
inline

Return true if all the bits are off.

◆ isOff() [2/4]

bool isOff ( ) const
inline

Return true if all the bits are off.

◆ isOff() [3/4]

bool isOff ( Index32 n) const
inline

Return true if the nth bit is off.

◆ isOff() [4/4]

bool isOff ( Index32 n) const
inline

Return true if the nth bit is off.

◆ isOn() [1/4]

bool isOn ( ) const
inline

Return true if all the bits are on.

◆ isOn() [2/4]

bool isOn ( ) const
inline

Return true if all the bits are on.

◆ isOn() [3/4]

bool isOn ( Index32 n) const
inline

Return true if the nth bit is on.

◆ isOn() [4/4]

bool isOn ( Index32 n) const
inline

Return true if the nth bit is on.

◆ load() [1/2]

void load ( std::istream & is)
inline

◆ load() [2/2]

void load ( std::istream & is)
inline

◆ memUsage() [1/2]

static Index32 memUsage ( )
inlinestatic

Return the byte size of this NodeMask.

◆ memUsage() [2/2]

static Index32 memUsage ( )
inlinestatic

Return the byte size of this NodeMask.

◆ operator!() [1/2]

NodeMask operator! ( ) const
inline

◆ operator!() [2/2]

NodeMask operator! ( ) const
inline

◆ operator!=() [1/2]

bool operator!= ( const NodeMask< 2 > & other) const
inline

◆ operator!=() [2/2]

bool operator!= ( const NodeMask< 2 > & other) const
inline

◆ operator&() [1/2]

NodeMask operator& ( const NodeMask< 2 > & other) const
inline

◆ operator&() [2/2]

NodeMask operator& ( const NodeMask< 2 > & other) const
inline

◆ operator&=() [1/2]

const NodeMask & operator&= ( const NodeMask< 2 > & other)
inline

Bitwise intersection.

◆ operator&=() [2/2]

const NodeMask & operator&= ( const NodeMask< 2 > & other)
inline

Bitwise intersection.

◆ operator-=() [1/2]

const NodeMask & operator-= ( const NodeMask< 2 > & other)
inline

Bitwise difference.

◆ operator-=() [2/2]

const NodeMask & operator-= ( const NodeMask< 2 > & other)
inline

Bitwise difference.

◆ operator=() [1/2]

NodeMask & operator= ( const NodeMask< 2 > & other)
inline

Assignment operator.

◆ operator=() [2/2]

void operator= ( const NodeMask< 2 > & other)
inline

Assignment operator.

◆ operator==() [1/2]

bool operator== ( const NodeMask< 2 > & other) const
inline

◆ operator==() [2/2]

bool operator== ( const NodeMask< 2 > & other) const
inline

◆ operator^() [1/2]

NodeMask operator^ ( const NodeMask< 2 > & other) const
inline

◆ operator^() [2/2]

NodeMask operator^ ( const NodeMask< 2 > & other) const
inline

◆ operator^=() [1/2]

const NodeMask & operator^= ( const NodeMask< 2 > & other)
inline

Bitwise XOR.

◆ operator^=() [2/2]

const NodeMask & operator^= ( const NodeMask< 2 > & other)
inline

Bitwise XOR.

◆ operator|() [1/2]

NodeMask operator| ( const NodeMask< 2 > & other) const
inline

◆ operator|() [2/2]

NodeMask operator| ( const NodeMask< 2 > & other) const
inline

◆ operator|=() [1/2]

const NodeMask & operator|= ( const NodeMask< 2 > & other)
inline

Bitwise union.

◆ operator|=() [2/2]

const NodeMask & operator|= ( const NodeMask< 2 > & other)
inline

Bitwise union.

◆ printAll() [1/2]

void printAll ( std::ostream & os = std::cout) const
inline

◆ printAll() [2/2]

void printAll ( std::ostream & os = std::cout,
Index32 max_out = 80u ) const
inline

◆ printBits() [1/2]

void printBits ( std::ostream & os = std::cout) const
inline

◆ printBits() [2/2]

void printBits ( std::ostream & os = std::cout,
Index32 max_out = 80u ) const
inline

◆ printInfo() [1/2]

void printInfo ( std::ostream & os = std::cout) const
inline

simple print method for debugging

◆ printInfo() [2/2]

void printInfo ( std::ostream & os = std::cout) const
inline

simple print method for debugging

◆ save() [1/2]

void save ( std::ostream & os) const
inline

◆ save() [2/2]

void save ( std::ostream & os) const
inline

◆ seek() [1/2]

void seek ( std::istream & is) const
inline

◆ seek() [2/2]

void seek ( std::istream & is) const
inline

◆ set() [1/4]

void set ( bool on)
inline

Set all bits to the specified state.

◆ set() [2/4]

void set ( bool on)
inline

Set all bits to the specified state.

◆ set() [3/4]

void set ( Index32 n,
bool On )
inline

Set the nth bit to the specified state.

◆ set() [4/4]

void set ( Index32 n,
bool On )
inline

Set the nth bit to the specified state.

◆ setFirstOff() [1/2]

void setFirstOff ( )
inline

Set the first bit off.

◆ setFirstOff() [2/2]

void setFirstOff ( )
inline

Set the first bit off.

◆ setFirstOn() [1/2]

void setFirstOn ( )
inline

Set the first bit on.

◆ setFirstOn() [2/2]

void setFirstOn ( )
inline

Set the first bit on.

◆ setLastOff() [1/2]

void setLastOff ( )
inline

Set the last bit off.

◆ setLastOff() [2/2]

void setLastOff ( )
inline

Set the last bit off.

◆ setLastOn() [1/2]

void setLastOn ( )
inline

Set the last bit on.

◆ setLastOn() [2/2]

void setLastOn ( )
inline

Set the last bit on.

◆ setOff() [1/4]

void setOff ( )
inline

Set all bits off.

◆ setOff() [2/4]

void setOff ( )
inline

Set all bits off.

◆ setOff() [3/4]

void setOff ( Index32 n)
inline

Set the nth bit off.

◆ setOff() [4/4]

void setOff ( Index32 n)
inline

Set the nth bit off.

◆ setOn() [1/4]

void setOn ( )
inline

Set all bits on.

◆ setOn() [2/4]

void setOn ( )
inline

Set all bits on.

◆ setOn() [3/4]

void setOn ( Index32 n)
inline

Set the nth bit on.

◆ setOn() [4/4]

void setOn ( Index32 n)
inline

Set the nth bit on.

◆ toggle() [1/4]

void toggle ( )
inline

Toggle the state of all bits in the mask.

◆ toggle() [2/4]

void toggle ( )
inline

Toggle the state of all bits in the mask.

◆ toggle() [3/4]

void toggle ( Index32 n)
inline

Toggle the state of the nth bit.

◆ toggle() [4/4]

void toggle ( Index32 n)
inline

Toggle the state of the nth bit.

Member Data Documentation

◆ DIM [1/2]

const Index32 DIM
static

◆ DIM [2/2]

const Index32 DIM = 4
static

◆ LOG2DIM [1/2]

const Index32 LOG2DIM
static

◆ LOG2DIM [2/2]

const Index32 LOG2DIM = 2
static

◆ SIZE [1/2]

const Index32 SIZE
static

◆ SIZE [2/2]

const Index32 SIZE = 64
static

◆ WORD_COUNT [1/2]

const Index32 WORD_COUNT
static

◆ WORD_COUNT [2/2]

const Index32 WORD_COUNT = 1
static