OpenVDB  9.0.1
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
PointDataLeafNode< T, Log2Dim > Class Template Reference

#include <openvdb/points/PointDataGrid.h>

Inherits LeafNode< T, Log2Dim >, and MultiPass.

Public Types

using LeafNodeType = PointDataLeafNode< T, Log2Dim >
 
using Ptr = std::shared_ptr< PointDataLeafNode >
 
using ValueType = T
 
using ValueTypePair = std::pair< ValueType, ValueType >
 
using IndexArray = std::vector< ValueType >
 
using Descriptor = AttributeSet::Descriptor
 
using BaseLeaf = tree::LeafNode< T, Log2Dim >
 
using NodeMaskType = util::NodeMask< Log2Dim >
 
using ValueOn = typename BaseLeaf::ValueOn
 
using ValueOff = typename BaseLeaf::ValueOff
 
using ValueAll = typename BaseLeaf::ValueAll
 
using ValueOnIter = typename BaseLeaf::template ValueIter< MaskOnIterator, PointDataLeafNode, const ValueType, ValueOn >
 
using ValueOnCIter = typename BaseLeaf::template ValueIter< MaskOnIterator, const PointDataLeafNode, const ValueType, ValueOn >
 
using ValueOffIter = typename BaseLeaf::template ValueIter< MaskOffIterator, PointDataLeafNode, const ValueType, ValueOff >
 
using ValueOffCIter = typename BaseLeaf::template ValueIter< MaskOffIterator, const PointDataLeafNode, const ValueType, ValueOff >
 
using ValueAllIter = typename BaseLeaf::template ValueIter< MaskDenseIterator, PointDataLeafNode, const ValueType, ValueAll >
 
using ValueAllCIter = typename BaseLeaf::template ValueIter< MaskDenseIterator, const PointDataLeafNode, const ValueType, ValueAll >
 
using ChildOnIter = typename BaseLeaf::template ChildIter< MaskOnIterator, PointDataLeafNode, ChildOn >
 
using ChildOnCIter = typename BaseLeaf::template ChildIter< MaskOnIterator, const PointDataLeafNode, ChildOn >
 
using ChildOffIter = typename BaseLeaf::template ChildIter< MaskOffIterator, PointDataLeafNode, ChildOff >
 
using ChildOffCIter = typename BaseLeaf::template ChildIter< MaskOffIterator, const PointDataLeafNode, ChildOff >
 
using ChildAllIter = typename BaseLeaf::template DenseIter< PointDataLeafNode, ValueType, ChildAll >
 
using ChildAllCIter = typename BaseLeaf::template DenseIter< const PointDataLeafNode, const ValueType, ChildAll >
 
using IndexVoxelIter = IndexIter< ValueVoxelCIter, NullFilter >
 
using IndexAllIter = IndexIter< ValueAllCIter, NullFilter >
 
using IndexOnIter = IndexIter< ValueOnCIter, NullFilter >
 
using IndexOffIter = IndexIter< ValueOffCIter, NullFilter >
 
using BuildType = T
 
using Buffer = LeafBuffer< ValueType, Log2Dim >
 

Public Member Functions

 PointDataLeafNode ()
 Default constructor. More...
 
 ~PointDataLeafNode ()=default
 
 PointDataLeafNode (const PointDataLeafNode &other)
 Construct using deep copy of other PointDataLeafNode. More...
 
 PointDataLeafNode (const Coord &coords, const T &value=zeroVal< T >(), bool active=false)
 Construct using supplied origin, value and active status. More...
 
 PointDataLeafNode (const PointDataLeafNode &other, const Coord &coords, const T &value=zeroVal< T >(), bool active=false)
 
template<typename OtherValueType >
 PointDataLeafNode (const tools::PointIndexLeafNode< OtherValueType, Log2Dim > &other)
 
template<typename ValueType >
 PointDataLeafNode (const tree::LeafNode< ValueType, Log2Dim > &other, const T &value, TopologyCopy)
 
template<typename ValueType >
 PointDataLeafNode (const tree::LeafNode< ValueType, Log2Dim > &other, const T &, const T &, TopologyCopy)
 
 PointDataLeafNode (PartialCreate, const Coord &coords, const T &value=zeroVal< T >(), bool active=false)
 
const AttributeSetattributeSet () const
 Retrieve the attribute set. More...
 
AttributeSet::UniquePtr stealAttributeSet ()
 Steal the attribute set, a new, empty attribute set is inserted in it's place. More...
 
void initializeAttributes (const Descriptor::Ptr &descriptor, const Index arrayLength, const AttributeArray::ScopedRegistryLock *lock=nullptr)
 Create a new attribute set. Existing attributes will be removed. More...
 
void clearAttributes (const bool updateValueMask=true, const AttributeArray::ScopedRegistryLock *lock=nullptr)
 Clear the attribute set. More...
 
bool hasAttribute (const size_t pos) const
 Returns true if an attribute with this index exists. More...
 
bool hasAttribute (const Name &attributeName) const
 Returns true if an attribute with this name exists. More...
 
AttributeArray::Ptr appendAttribute (const Descriptor &expected, Descriptor::Ptr &replacement, const size_t pos, const Index strideOrTotalSize=1, const bool constantStride=true, const Metadata *metadata=nullptr, const AttributeArray::ScopedRegistryLock *lock=nullptr)
 Append an attribute to the leaf. More...
 
void dropAttributes (const std::vector< size_t > &pos, const Descriptor &expected, Descriptor::Ptr &replacement)
 Drop list of attributes. More...
 
void reorderAttributes (const Descriptor::Ptr &replacement)
 Reorder attribute set. More...
 
void renameAttributes (const Descriptor &expected, Descriptor::Ptr &replacement)
 Rename attributes in attribute set (order must remain the same). More...
 
void compactAttributes ()
 Compact all attributes in attribute set. More...
 
void replaceAttributeSet (AttributeSet *attributeSet, bool allowMismatchingDescriptors=false)
 Replace the underlying attribute set with the given attributeSet. More...
 
void resetDescriptor (const Descriptor::Ptr &replacement)
 Replace the descriptor with a new one The new Descriptor must exactly match the old one. More...
 
void setOffsets (const std::vector< ValueType > &offsets, const bool updateValueMask=true)
 Sets all of the voxel offset values on this leaf, from the given vector of offsets. If updateValueMask is true, then the active value mask will be updated so voxels with points are active and empty voxels are inactive. More...
 
void validateOffsets () const
 Throws an error if the voxel values on this leaf are not monotonically increasing or within the bounds of the attribute arrays. More...
 
AttributeArrayattributeArray (const size_t pos)
 Read-write attribute array reference from index. More...
 
const AttributeArrayattributeArray (const size_t pos) const
 
const AttributeArrayconstAttributeArray (const size_t pos) const
 
AttributeArrayattributeArray (const Name &attributeName)
 Read-write attribute array reference from name. More...
 
const AttributeArrayattributeArray (const Name &attributeName) const
 
const AttributeArrayconstAttributeArray (const Name &attributeName) const
 
GroupHandle groupHandle (const AttributeSet::Descriptor::GroupIndex &index) const
 } More...
 
GroupHandle groupHandle (const Name &group) const
 Read-only group handle from group name. More...
 
GroupWriteHandle groupWriteHandle (const AttributeSet::Descriptor::GroupIndex &index)
 Read-write group handle from group index. More...
 
GroupWriteHandle groupWriteHandle (const Name &name)
 Read-write group handle from group name. More...
 
Index64 pointCount () const
 Compute the total point count for the leaf. More...
 
Index64 onPointCount () const
 Compute the total active (on) point count for the leaf. More...
 
Index64 offPointCount () const
 Compute the total inactive (off) point count for the leaf. More...
 
Index64 groupPointCount (const Name &groupName) const
 Compute the point count in a specific group for the leaf. More...
 
void updateValueMask ()
 Activate voxels with non-zero points, deactivate voxels with zero points. More...
 
void setOffsetOn (Index offset, const ValueType &val)
 
void setOffsetOnly (Index offset, const ValueType &val)
 
template<typename OtherType , Index OtherLog2Dim>
bool hasSameTopology (const PointDataLeafNode< OtherType, OtherLog2Dim > *other) const
 Return true if the given node (which may have a different ValueType than this node) has the same active value topology as this node. More...
 
bool operator== (const PointDataLeafNode &other) const
 
bool operator!= (const PointDataLeafNode &other) const
 
void addLeaf (PointDataLeafNode *)
 
template<typename AccessorT >
void addLeafAndCache (PointDataLeafNode *, AccessorT &)
 
void readTopology (std::istream &is, bool fromHalf=false)
 
void writeTopology (std::ostream &os, bool toHalf=false) const
 
Index buffers () const
 
void readBuffers (std::istream &is, bool fromHalf=false)
 
void readBuffers (std::istream &is, const CoordBBox &, bool fromHalf=false)
 
void writeBuffers (std::ostream &os, bool toHalf=false) const
 
Index64 memUsage () const
 
void evalActiveBoundingBox (CoordBBox &bbox, bool visitVoxels=true) const
 
CoordBBox getNodeBoundingBox () const
 Return the bounding box of this node, i.e., the full index space spanned by this leaf node. More...
 
void assertNonmodifiable ()
 
void assertNonModifiableUnlessZero (const ValueType &value)
 
void setActiveState (const Coord &xyz, bool on)
 
void setActiveState (Index offset, bool on)
 
void setValueOnly (const Coord &, const ValueType &)
 
void setValueOnly (Index, const ValueType &)
 
void setValueOff (const Coord &xyz)
 
void setValueOff (Index offset)
 
void setValueOff (const Coord &, const ValueType &)
 
void setValueOff (Index, const ValueType &)
 
void setValueOn (const Coord &xyz)
 
void setValueOn (Index offset)
 
void setValueOn (const Coord &, const ValueType &)
 
void setValueOn (Index, const ValueType &)
 
void setValue (const Coord &, const ValueType &)
 
void setValuesOn ()
 
void setValuesOff ()
 
template<typename ModifyOp >
void modifyValue (Index, const ModifyOp &)
 
template<typename ModifyOp >
void modifyValue (const Coord &, const ModifyOp &)
 
template<typename ModifyOp >
void modifyValueAndActiveState (const Coord &, const ModifyOp &)
 
void clip (const CoordBBox &, const ValueType &value)
 
void fill (const CoordBBox &, const ValueType &, bool)
 
void fill (const ValueType &value)
 
void fill (const ValueType &, bool)
 
template<typename AccessorT >
void setValueOnlyAndCache (const Coord &, const ValueType &, AccessorT &)
 
template<typename ModifyOp , typename AccessorT >
void modifyValueAndActiveStateAndCache (const Coord &, const ModifyOp &, AccessorT &)
 
template<typename AccessorT >
void setValueOffAndCache (const Coord &, const ValueType &, AccessorT &)
 
template<typename AccessorT >
void setActiveStateAndCache (const Coord &xyz, bool on, AccessorT &parent)
 
void resetBackground (const ValueType &, const ValueType &newBackground)
 
void signedFloodFill (const ValueType &)
 
void signedFloodFill (const ValueType &, const ValueType &)
 
void negate ()
 
ValueVoxelCIter beginValueVoxel (const Coord &ijk) const
 Leaf value voxel iterator. More...
 
IndexAllIter beginIndexAll () const
 Leaf index iterator. More...
 
IndexOnIter beginIndexOn () const
 
IndexOffIter beginIndexOff () const
 
template<typename IterT , typename FilterT >
IndexIter< IterT, FilterT > beginIndex (const FilterT &filter) const
 
template<typename FilterT >
IndexIter< ValueAllCIter, FilterT > beginIndexAll (const FilterT &filter) const
 Filtered leaf index iterator. More...
 
template<typename FilterT >
IndexIter< ValueOnCIter, FilterT > beginIndexOn (const FilterT &filter) const
 
template<typename FilterT >
IndexIter< ValueOffCIter, FilterT > beginIndexOff (const FilterT &filter) const
 
IndexVoxelIter beginIndexVoxel (const Coord &ijk) const
 Leaf index iterator from voxel. More...
 
template<typename FilterT >
IndexIter< ValueVoxelCIter, FilterT > beginIndexVoxel (const Coord &ijk, const FilterT &filter) const
 Filtered leaf index iterator from voxel. More...
 
ValueOnCIter cbeginValueOn () const
 
ValueOnCIter beginValueOn () const
 
ValueOnIter beginValueOn ()
 
ValueOffCIter cbeginValueOff () const
 
ValueOffCIter beginValueOff () const
 
ValueOffIter beginValueOff ()
 
ValueAllCIter cbeginValueAll () const
 
ValueAllCIter beginValueAll () const
 
ValueAllIter beginValueAll ()
 
ValueOnCIter cendValueOn () const
 
ValueOnCIter endValueOn () const
 
ValueOnIter endValueOn ()
 
ValueOffCIter cendValueOff () const
 
ValueOffCIter endValueOff () const
 
ValueOffIter endValueOff ()
 
ValueAllCIter cendValueAll () const
 
ValueAllCIter endValueAll () const
 
ValueAllIter endValueAll ()
 
ChildOnCIter cbeginChildOn () const
 
ChildOnCIter beginChildOn () const
 
ChildOnIter beginChildOn ()
 
ChildOffCIter cbeginChildOff () const
 
ChildOffCIter beginChildOff () const
 
ChildOffIter beginChildOff ()
 
ChildAllCIter cbeginChildAll () const
 
ChildAllCIter beginChildAll () const
 
ChildAllIter beginChildAll ()
 
ChildOnCIter cendChildOn () const
 
ChildOnCIter endChildOn () const
 
ChildOnIter endChildOn ()
 
ChildOffCIter cendChildOff () const
 
ChildOffCIter endChildOff () const
 
ChildOffIter endChildOff ()
 
ChildAllCIter cendChildAll () const
 
ChildAllCIter endChildAll () const
 
ChildAllIter endChildAll ()
 
template<typename ValueIterT , typename FilterT >
IndexIter< ValueIterT, FilterT > beginIndex (const FilterT &filter) const
 
void nodeCount (std::vector< Index32 > &) const
 no-op More...
 
Index64 onVoxelCount () const
 Return the number of voxels marked On. More...
 
Index64 offVoxelCount () const
 Return the number of voxels marked Off. More...
 
Index64 onLeafVoxelCount () const
 
Index64 offLeafVoxelCount () const
 
bool isEmpty () const
 Return true if this node has no active voxels. More...
 
bool isDense () const
 Return true if this node contains only active voxels. More...
 
bool isAllocated () const
 Return true if memory for this node's buffer has been allocated. More...
 
bool allocate ()
 Allocate memory for this node's buffer if it has not already been allocated. More...
 
void setOrigin (const Coord &origin)
 Set the grid index coordinates of this node's local origin. More...
 
Coord offsetToGlobalCoord (Index n) const
 Return the global coordinates for a linear table offset. More...
 
Index32 transientData () const
 Return the transient data value. More...
 
void setTransientData (Index32 transientData)
 Set the transient data value. More...
 
std::string str () const
 Return a string representation of this node. More...
 
template<typename OtherType , Index OtherLog2Dim>
bool hasSameTopology (const LeafNode< OtherType, OtherLog2Dim > *other) const
 Return true if the given node (which may have a different ValueType than this node) has the same active value topology as this node. More...
 
bool operator== (const LeafNode &other) const
 Check for buffer, state and origin equivalence. More...
 
bool operator!= (const LeafNode &other) const
 
void swap (Buffer &other)
 Exchange this node's data buffer with the given data buffer without changing the active states of the values. More...
 
const Bufferbuffer () const
 
Bufferbuffer ()
 
size_t streamingSize (bool toHalf=false) const
 
const ValueTypegetValue (const Coord &xyz) const
 Return the value of the voxel at the given coordinates. More...
 
const ValueTypegetValue (Index offset) const
 Return the value of the voxel at the given linear offset. More...
 
template<typename AccessorT >
const ValueTypegetValue (const Coord &xyz, bool &state, int &level, AccessorT &) const
 Return the value of the voxel at the given coordinates and return its active state and level (i.e., 0) in state and level. More...
 
bool probeValue (const Coord &xyz, ValueType &val) const
 Return true if the voxel at the given coordinates is active. More...
 
bool probeValue (Index offset, ValueType &val) const
 Return true if the voxel at the given offset is active. More...
 
bool isValueOn (const Coord &xyz) const
 Return true if the voxel at the given coordinates is active. More...
 
bool isValueOn (Index offset) const
 Return true if the voxel at the given offset is active. More...
 
void denseFill (const CoordBBox &bbox, const ValueType &value, bool active=true)
 Set all voxels within an axis-aligned box to the specified value and active state. More...
 
template<typename DenseT >
void copyToDense (const CoordBBox &bbox, DenseT &dense) const
 Copy into a dense grid the values of the voxels that lie within a given bounding box. More...
 
template<typename DenseT >
void copyFromDense (const CoordBBox &bbox, const DenseT &dense, const ValueType &background, const ValueType &tolerance)
 Copy from a dense grid into this node the values of the voxels that lie within a given bounding box. More...
 
template<typename AccessorT >
const ValueTypegetValueAndCache (const Coord &xyz, AccessorT &) const
 Return the value of the voxel at the given coordinates. More...
 
template<typename AccessorT >
bool isValueOnAndCache (const Coord &xyz, AccessorT &) const
 Return true if the voxel at the given coordinates is active. More...
 
template<typename AccessorT >
void setValueAndCache (const Coord &xyz, const ValueType &val, AccessorT &)
 Change the value of the voxel at the given coordinates and mark it as active. More...
 
template<typename ModifyOp , typename AccessorT >
void modifyValueAndCache (const Coord &xyz, const ModifyOp &op, AccessorT &)
 Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active. More...
 
template<typename AccessorT >
bool probeValueAndCache (const Coord &xyz, ValueType &val, AccessorT &) const
 Return true if the voxel at the given coordinates is active and return the voxel value in val. More...
 
const ValueTypegetFirstValue () const
 Return a const reference to the first value in the buffer. More...
 
const ValueTypegetLastValue () const
 Return a const reference to the last value in the buffer. More...
 
void voxelizeActiveTiles (bool=true)
 No-op. More...
 
template<MergePolicy Policy>
void merge (const LeafNode &)
 
template<MergePolicy Policy>
void merge (const ValueType &tileValue, bool tileActive)
 
template<MergePolicy Policy>
void merge (const LeafNode &other, const ValueType &, const ValueType &)
 
template<typename OtherType >
void topologyUnion (const LeafNode< OtherType, Log2Dim > &other, const bool preserveTiles=false)
 Union this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active if either of the original voxels were active. More...
 
template<typename OtherType >
void topologyIntersection (const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
 Intersect this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active only if both of the original voxels were active. More...
 
template<typename OtherType >
void topologyDifference (const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
 Difference this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this LeafNode and inactive in the other LeafNode. More...
 
template<typename CombineOp >
void combine (const LeafNode &other, CombineOp &op)
 
template<typename CombineOp >
void combine (const ValueType &value, bool valueIsActive, CombineOp &op)
 
template<typename CombineOp , typename OtherType >
void combine2 (const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
 
template<typename CombineOp , typename OtherNodeT >
void combine2 (const ValueType &, const OtherNodeT &other, bool valueIsActive, CombineOp &)
 
template<typename CombineOp , typename OtherNodeT >
void combine2 (const LeafNode &b0, const OtherNodeT &b1, CombineOp &)
 
template<typename BBoxOp >
void visitActiveBBox (BBoxOp &) const
 Calls the templated functor BBoxOp with bounding box information. An additional level argument is provided to the callback. More...
 
template<typename VisitorOp >
void visit (VisitorOp &)
 
template<typename VisitorOp >
void visit (VisitorOp &) const
 
template<typename OtherLeafNodeType , typename VisitorOp >
void visit2Node (OtherLeafNodeType &other, VisitorOp &)
 
template<typename OtherLeafNodeType , typename VisitorOp >
void visit2Node (OtherLeafNodeType &other, VisitorOp &) const
 
template<typename IterT , typename VisitorOp >
void visit2 (IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
 
template<typename IterT , typename VisitorOp >
void visit2 (IterT &otherIter, VisitorOp &, bool otherIsLHS=false) const
 
void addTile (Index level, const Coord &, const ValueType &, bool)
 
void addTile (Index offset, const ValueType &, bool)
 
template<typename AccessorT >
void addTileAndCache (Index, const Coord &, const ValueType &, bool, AccessorT &)
 
bool isConstant (ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
 
bool isConstant (ValueType &minValue, ValueType &maxValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
 
ValueType medianAll (ValueType *tmp=nullptr) const
 Computes the median value of all the active AND inactive voxels in this node. More...
 
Index medianOn (ValueType &value, ValueType *tmp=nullptr) const
 Computes the median value of all the active voxels in this node. More...
 
Index medianOff (ValueType &value, ValueType *tmp=nullptr) const
 Computes the median value of all the inactive voxels in this node. More...
 
bool isInactive () const
 Return true if all of this node's values are inactive. More...
 
bool isValueMaskOn (Index n) const
 
bool isValueMaskOn () const
 
bool isValueMaskOff (Index n) const
 
bool isValueMaskOff () const
 
const NodeMaskTypegetValueMask () const
 
NodeMaskTypegetValueMask ()
 
const NodeMaskTypevalueMask () const
 
void setValueMask (const NodeMaskType &mask)
 
bool isChildMaskOn (Index) const
 
bool isChildMaskOff (Index) const
 
bool isChildMaskOff () const
 
PointDataLeafNodetouchLeaf (const Coord &)
 Return a pointer to this node. More...
 
template<typename AccessorT >
PointDataLeafNodetouchLeafAndCache (const Coord &, AccessorT &)
 Return a pointer to this node. More...
 
template<typename NodeT , typename AccessorT >
NodeT * probeNodeAndCache (const Coord &, AccessorT &)
 Return a pointer to this node. More...
 
PointDataLeafNodeprobeLeaf (const Coord &)
 Return a pointer to this node. More...
 
template<typename AccessorT >
PointDataLeafNodeprobeLeafAndCache (const Coord &, AccessorT &)
 Return a pointer to this node. More...
 
const PointDataLeafNodeprobeConstLeaf (const Coord &) const
 Return a const pointer to this node. More...
 
template<typename AccessorT >
const PointDataLeafNodeprobeConstLeafAndCache (const Coord &, AccessorT &) const
 Return a const pointer to this node. More...
 
template<typename AccessorT >
const PointDataLeafNodeprobeLeafAndCache (const Coord &, AccessorT &) const
 Return a const pointer to this node. More...
 
const PointDataLeafNodeprobeLeaf (const Coord &) const
 Return a const pointer to this node. More...
 
template<typename NodeT , typename AccessorT >
const NodeT * probeConstNodeAndCache (const Coord &, AccessorT &) const
 Return a const pointer to this node. More...
 
const Coord & origin () const
 Return the grid index coordinates of this node's local origin. More...
 
void getOrigin (Coord &origin) const
 Return the grid index coordinates of this node's local origin. More...
 
void getOrigin (Int32 &x, Int32 &y, Int32 &z) const
 Return the grid index coordinates of this node's local origin. More...
 
void prune (const ValueType &=zeroVal< ValueType >())
 This function exists only to enable template instantiation. More...
 
void addLeaf (LeafNode *)
 This function exists only to enable template instantiation. More...
 
template<typename AccessorT >
void addLeafAndCache (LeafNode *, AccessorT &)
 This function exists only to enable template instantiation. More...
 
template<typename NodeT >
NodeT * stealNode (const Coord &, const ValueType &, bool)
 This function exists only to enable template instantiation. More...
 
template<typename NodeT >
NodeT * probeNode (const Coord &)
 This function exists only to enable template instantiation. More...
 
template<typename NodeT >
const NodeT * probeConstNode (const Coord &) const
 This function exists only to enable template instantiation. More...
 
template<typename ArrayT >
void getNodes (ArrayT &) const
 This function exists only to enable template instantiation. More...
 
template<typename ArrayT >
void stealNodes (ArrayT &, const ValueType &, bool)
 This function exists only to enable template instantiation. More...
 

Static Public Member Functions

static Index log2dim ()
 Return log2 of the dimension of this LeafNode, e.g. 3 if dimensions are 8^3. More...
 
static Index dim ()
 Return the number of voxels in each coordinate dimension. More...
 
static Index size ()
 Return the total number of voxels represented by this LeafNode. More...
 
static Index numValues ()
 Return the total number of voxels represented by this LeafNode. More...
 
static Index getLevel ()
 Return the level of this node, which by definition is zero for LeafNodes. More...
 
static void getNodeLog2Dims (std::vector< Index > &dims)
 Append the Log2Dim of this LeafNode to the specified vector. More...
 
static Index getChildDim ()
 Return the dimension of child nodes of this LeafNode, which is one for voxels. More...
 
static Index32 leafCount ()
 Return the leaf count for this node, which is one. More...
 
static Index32 nonLeafCount ()
 Return the non-leaf count for this node, which is zero. More...
 
static Index32 childCount ()
 Return the child count for this node, which is zero. More...
 
static Index64 onTileCount ()
 
static Index64 offTileCount ()
 
static Index coordToOffset (const Coord &xyz)
 Return the linear table offset of the given global or local coordinates. More...
 
static Coord offsetToLocalCoord (Index n)
 Return the local coordinates for a linear table offset, where offset 0 has coordinates (0, 0, 0). More...
 
static Index getValueLevel (const Coord &)
 Return the level (i.e., 0) at which leaf node values reside. More...
 
static bool hasActiveTiles ()
 Return false since leaf nodes never contain tiles. More...
 
template<typename AccessorT >
static Index getValueLevelAndCache (const Coord &, AccessorT &)
 Return the LEVEL (=0) at which leaf node values reside. More...
 

Static Public Attributes

static const Index LOG2DIM = Log2Dim
 
static const Index TOTAL = Log2Dim
 
static const Index DIM = 1 << TOTAL
 
static const Index NUM_VALUES = 1 << 3 * Log2Dim
 
static const Index NUM_VOXELS = NUM_VALUES
 
static const Index SIZE = NUM_VALUES
 
static const Index LEVEL = 0
 

Protected Types

using ChildOn = typename BaseLeaf::ChildOn
 
using ChildOff = typename BaseLeaf::ChildOff
 
using ChildAll = typename BaseLeaf::ChildAll
 
using MaskOnIterator = typename NodeMaskType::OnIterator
 
using MaskOffIterator = typename NodeMaskType::OffIterator
 
using MaskDenseIterator = typename NodeMaskType::DenseIterator
 

Protected Member Functions

void setValueMask (Index n, bool on)
 
void setValueMaskOn (Index n)
 
void setValueMaskOff (Index n)
 
void skipCompressedValues (bool seekable, std::istream &, bool fromHalf)
 

Static Protected Member Functions

static void evalNodeOrigin (Coord &xyz)
 Compute the origin of the leaf node that contains the voxel with the given coordinates. More...
 
template<typename NodeT , typename VisitorOp , typename ChildAllIterT >
static void doVisit (NodeT &, VisitorOp &)
 
template<typename NodeT , typename OtherNodeT , typename VisitorOp , typename ChildAllIterT , typename OtherChildAllIterT >
static void doVisit2Node (NodeT &self, OtherNodeT &other, VisitorOp &)
 
template<typename NodeT , typename VisitorOp , typename ChildAllIterT , typename OtherChildAllIterT >
static void doVisit2 (NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
 

Friends

class ::TestPointDataLeaf
 
template<typename , Index >
class PointDataLeafNode
 
class tree::IteratorBase< MaskOnIterator, PointDataLeafNode >
 
class tree::IteratorBase< MaskOffIterator, PointDataLeafNode >
 
class tree::IteratorBase< MaskDenseIterator, PointDataLeafNode >
 

Member Typedef Documentation

using BaseLeaf = tree::LeafNode<T, Log2Dim>
using Buffer = LeafBuffer<ValueType, Log2Dim>
inherited
using BuildType = T
inherited
using ChildAll = typename BaseLeaf::ChildAll
protected
using ChildAllCIter = typename BaseLeaf::template DenseIter< const PointDataLeafNode, const ValueType, ChildAll>
using ChildAllIter = typename BaseLeaf::template DenseIter< PointDataLeafNode, ValueType, ChildAll>
using ChildOff = typename BaseLeaf::ChildOff
protected
using ChildOffCIter = typename BaseLeaf::template ChildIter< MaskOffIterator, const PointDataLeafNode, ChildOff>
using ChildOffIter = typename BaseLeaf::template ChildIter< MaskOffIterator, PointDataLeafNode, ChildOff>
using ChildOn = typename BaseLeaf::ChildOn
protected
using ChildOnCIter = typename BaseLeaf::template ChildIter< MaskOnIterator, const PointDataLeafNode, ChildOn>
using ChildOnIter = typename BaseLeaf::template ChildIter< MaskOnIterator, PointDataLeafNode, ChildOn>
using Descriptor = AttributeSet::Descriptor
using IndexArray = std::vector<ValueType>
using LeafNodeType = PointDataLeafNode<T, Log2Dim>
using MaskDenseIterator = typename NodeMaskType::DenseIterator
protected
using MaskOffIterator = typename NodeMaskType::OffIterator
protected
using MaskOnIterator = typename NodeMaskType::OnIterator
protected
using NodeMaskType = util::NodeMask<Log2Dim>
using Ptr = std::shared_ptr<PointDataLeafNode>
using ValueAll = typename BaseLeaf::ValueAll
using ValueAllCIter = typename BaseLeaf::template ValueIter< MaskDenseIterator,const PointDataLeafNode,const ValueType,ValueAll>
using ValueAllIter = typename BaseLeaf::template ValueIter< MaskDenseIterator, PointDataLeafNode, const ValueType, ValueAll>
using ValueOff = typename BaseLeaf::ValueOff
using ValueOffCIter = typename BaseLeaf::template ValueIter< MaskOffIterator,const PointDataLeafNode,const ValueType,ValueOff>
using ValueOffIter = typename BaseLeaf::template ValueIter< MaskOffIterator, PointDataLeafNode, const ValueType, ValueOff>
using ValueOn = typename BaseLeaf::ValueOn
using ValueOnCIter = typename BaseLeaf::template ValueIter< MaskOnIterator, const PointDataLeafNode, const ValueType, ValueOn>
using ValueOnIter = typename BaseLeaf::template ValueIter< MaskOnIterator, PointDataLeafNode, const ValueType, ValueOn>
using ValueType = T
using ValueTypePair = std::pair<ValueType, ValueType>

Constructor & Destructor Documentation

PointDataLeafNode ( )
inline

Default constructor.

~PointDataLeafNode ( )
default
PointDataLeafNode ( const PointDataLeafNode< T, Log2Dim > &  other)
inlineexplicit

Construct using deep copy of other PointDataLeafNode.

PointDataLeafNode ( const Coord &  coords,
const T &  value = zeroVal<T>(),
bool  active = false 
)
inlineexplicit

Construct using supplied origin, value and active status.

PointDataLeafNode ( const PointDataLeafNode< T, Log2Dim > &  other,
const Coord &  coords,
const T &  value = zeroVal<T>(),
bool  active = false 
)
inline

Construct using supplied origin, value and active status use attribute map from another PointDataLeafNode

PointDataLeafNode ( const tools::PointIndexLeafNode< OtherValueType, Log2Dim > &  other)
inline
PointDataLeafNode ( const tree::LeafNode< ValueType, Log2Dim > &  other,
const T &  value,
TopologyCopy   
)
inline
PointDataLeafNode ( const tree::LeafNode< ValueType, Log2Dim > &  other,
const T &  ,
const T &  ,
TopologyCopy   
)
inline
PointDataLeafNode ( PartialCreate  ,
const Coord &  coords,
const T &  value = zeroVal<T>(),
bool  active = false 
)
inline

Member Function Documentation

void addLeaf ( PointDataLeafNode< T, Log2Dim > *  )
inline
void addLeaf ( LeafNode< T, Log2Dim > *  )
inlineinherited

This function exists only to enable template instantiation.

void addLeafAndCache ( PointDataLeafNode< T, Log2Dim > *  ,
AccessorT &   
)
inline
void addLeafAndCache ( LeafNode< T, Log2Dim > *  ,
AccessorT &   
)
inlineinherited

This function exists only to enable template instantiation.

void addTile ( Index  level,
const Coord &  xyz,
const ValueType val,
bool  active 
)
inlineinherited
void addTile ( Index  offset,
const ValueType val,
bool  active 
)
inlineinherited
void addTileAndCache ( Index  level,
const Coord &  xyz,
const ValueType val,
bool  active,
AccessorT &   
)
inlineinherited
bool allocate ( )
inlineinherited

Allocate memory for this node's buffer if it has not already been allocated.

AttributeArray::Ptr appendAttribute ( const Descriptor expected,
Descriptor::Ptr &  replacement,
const size_t  pos,
const Index  strideOrTotalSize = 1,
const bool  constantStride = true,
const Metadata metadata = nullptr,
const AttributeArray::ScopedRegistryLock lock = nullptr 
)
inline

Append an attribute to the leaf.

Parameters
expectedExisting descriptor is expected to match this parameter.
replacementNew descriptor to replace the existing one.
posIndex of the new attribute in the descriptor replacement.
strideOrTotalSizeStride of the attribute array (if constantStride), total size otherwise
constantStrideif false, stride is interpreted as total size of the array
metadataoptional default value metadata
lockan optional scoped registry lock to avoid contention
void assertNonmodifiable ( )
inline
void assertNonModifiableUnlessZero ( const ValueType value)
inline
AttributeArray & attributeArray ( const size_t  pos)
inline

Read-write attribute array reference from index.

Attribute arrays can be shared across leaf nodes, so non-const access will deep-copy the array to make it unique. Always prefer accessing const arrays where possible to eliminate this copying. {

const AttributeArray & attributeArray ( const size_t  pos) const
inline
AttributeArray & attributeArray ( const Name attributeName)
inline

Read-write attribute array reference from name.

}

Attribute arrays can be shared across leaf nodes, so non-const access will deep-copy the array to make it unique. Always prefer accessing const arrays where possible to eliminate this copying. {

const AttributeArray & attributeArray ( const Name attributeName) const
inline
const AttributeSet& attributeSet ( ) const
inline

Retrieve the attribute set.

ChildAllCIter beginChildAll ( ) const
inline
ChildAllIter beginChildAll ( )
inline
ChildOffCIter beginChildOff ( ) const
inline
ChildOffIter beginChildOff ( )
inline
ChildOnCIter beginChildOn ( ) const
inline
ChildOnIter beginChildOn ( )
inline
IndexIter<IterT, FilterT> beginIndex ( const FilterT &  filter) const
IndexIter<ValueIterT, FilterT> beginIndex ( const FilterT &  filter) const
inline
IndexAllIter beginIndexAll ( ) const
inline

Leaf index iterator.

IndexIter<ValueAllCIter, FilterT> beginIndexAll ( const FilterT &  filter) const
inline

Filtered leaf index iterator.

IndexOffIter beginIndexOff ( ) const
inline
IndexIter<ValueOffCIter, FilterT> beginIndexOff ( const FilterT &  filter) const
inline
IndexOnIter beginIndexOn ( ) const
inline
IndexIter<ValueOnCIter, FilterT> beginIndexOn ( const FilterT &  filter) const
inline
PointDataLeafNode< T, Log2Dim >::IndexVoxelIter beginIndexVoxel ( const Coord &  ijk) const
inline

Leaf index iterator from voxel.

IndexIter< ValueVoxelCIter, FilterT > beginIndexVoxel ( const Coord &  ijk,
const FilterT &  filter 
) const
inline

Filtered leaf index iterator from voxel.

ValueAllCIter beginValueAll ( ) const
inline
ValueAllIter beginValueAll ( )
inline
ValueOffCIter beginValueOff ( ) const
inline
ValueOffIter beginValueOff ( )
inline
ValueOnCIter beginValueOn ( ) const
inline
ValueOnIter beginValueOn ( )
inline
ValueVoxelCIter beginValueVoxel ( const Coord &  ijk) const
inline

Leaf value voxel iterator.

const Buffer& buffer ( ) const
inlineinherited
Buffer& buffer ( )
inlineinherited
Index buffers ( ) const
inline
ChildAllCIter cbeginChildAll ( ) const
inline
ChildOffCIter cbeginChildOff ( ) const
inline
ChildOnCIter cbeginChildOn ( ) const
inline
ValueAllCIter cbeginValueAll ( ) const
inline
ValueOffCIter cbeginValueOff ( ) const
inline
ValueOnCIter cbeginValueOn ( ) const
inline
ChildAllCIter cendChildAll ( ) const
inline
ChildOffCIter cendChildOff ( ) const
inline
ChildOnCIter cendChildOn ( ) const
inline
ValueAllCIter cendValueAll ( ) const
inline
ValueOffCIter cendValueOff ( ) const
inline
ValueOnCIter cendValueOn ( ) const
inline
static Index32 childCount ( )
inlinestaticinherited

Return the child count for this node, which is zero.

void clearAttributes ( const bool  updateValueMask = true,
const AttributeArray::ScopedRegistryLock lock = nullptr 
)
inline

Clear the attribute set.

void clip ( const CoordBBox &  ,
const ValueType value 
)
inline
void combine ( const LeafNode< T, Log2Dim > &  other,
CombineOp &  op 
)
inlineinherited
void combine ( const ValueType value,
bool  valueIsActive,
CombineOp &  op 
)
inlineinherited
void combine2 ( const LeafNode< T, Log2Dim > &  other,
const OtherType &  value,
bool  valueIsActive,
CombineOp &  op 
)
inlineinherited
void combine2 ( const ValueType value,
const OtherNodeT &  other,
bool  valueIsActive,
CombineOp &  op 
)
inlineinherited
void combine2 ( const LeafNode< T, Log2Dim > &  b0,
const OtherNodeT &  b1,
CombineOp &  op 
)
inlineinherited
void compactAttributes ( )
inline

Compact all attributes in attribute set.

const AttributeArray & constAttributeArray ( const size_t  pos) const
inline
const AttributeArray & constAttributeArray ( const Name attributeName) const
inline
Index coordToOffset ( const Coord &  xyz)
inlinestaticinherited

Return the linear table offset of the given global or local coordinates.

void copyFromDense ( const CoordBBox &  bbox,
const DenseT &  dense,
const ValueType background,
const ValueType tolerance 
)
inlineinherited

Copy from a dense grid into this node the values of the voxels that lie within a given bounding box.

Only values that are different (by more than the given tolerance) from the background value will be active. Other values are inactive and truncated to the background value.

Parameters
bboxinclusive bounding box of the voxels to be copied into this node
densedense grid with a stride in z of one (see tools::Dense in tools/Dense.h for the required API)
backgroundbackground value of the tree that this node belongs to
tolerancetolerance within which a value equals the background value
Note
bbox is assumed to be identical to or contained in the coordinate domains of both the dense grid and this node, i.e., no bounds checking is performed.
Consider using tools::CopyFromDense in tools/Dense.h instead of calling this method directly.
void copyToDense ( const CoordBBox &  bbox,
DenseT &  dense 
) const
inlineinherited

Copy into a dense grid the values of the voxels that lie within a given bounding box.

Parameters
bboxinclusive bounding box of the voxels to be copied into the dense grid
densedense grid with a stride in z of one (see tools::Dense in tools/Dense.h for the required API)
Note
bbox is assumed to be identical to or contained in the coordinate domains of both the dense grid and this node, i.e., no bounds checking is performed.
Consider using tools::CopyToDense in tools/Dense.h instead of calling this method directly.
void denseFill ( const CoordBBox &  bbox,
const ValueType value,
bool  active = true 
)
inlineinherited

Set all voxels within an axis-aligned box to the specified value and active state.

static Index dim ( )
inlinestaticinherited

Return the number of voxels in each coordinate dimension.

void doVisit ( NodeT &  self,
VisitorOp &  op 
)
inlinestaticprotectedinherited
void doVisit2 ( NodeT &  self,
OtherChildAllIterT &  otherIter,
VisitorOp &  op,
bool  otherIsLHS 
)
inlinestaticprotectedinherited
void doVisit2Node ( NodeT &  self,
OtherNodeT &  other,
VisitorOp &  op 
)
inlinestaticprotectedinherited
void dropAttributes ( const std::vector< size_t > &  pos,
const Descriptor expected,
Descriptor::Ptr &  replacement 
)
inline

Drop list of attributes.

Parameters
posvector of attribute indices to drop
expectedExisting descriptor is expected to match this parameter.
replacementNew descriptor to replace the existing one.
ChildAllCIter endChildAll ( ) const
inline
ChildAllIter endChildAll ( )
inline
ChildOffCIter endChildOff ( ) const
inline
ChildOffIter endChildOff ( )
inline
ChildOnCIter endChildOn ( ) const
inline
ChildOnIter endChildOn ( )
inline
ValueAllCIter endValueAll ( ) const
inline
ValueAllIter endValueAll ( )
inline
ValueOffCIter endValueOff ( ) const
inline
ValueOffIter endValueOff ( )
inline
ValueOnCIter endValueOn ( ) const
inline
ValueOnIter endValueOn ( )
inline
void evalActiveBoundingBox ( CoordBBox &  bbox,
bool  visitVoxels = true 
) const
inline
static void evalNodeOrigin ( Coord &  xyz)
inlinestaticprotectedinherited

Compute the origin of the leaf node that contains the voxel with the given coordinates.

void fill ( const CoordBBox &  bbox,
const ValueType value,
bool  active 
)
inline
void fill ( const ValueType value)
inline
void fill ( const ValueType value,
bool  active 
)
inline
static Index getChildDim ( )
inlinestaticinherited

Return the dimension of child nodes of this LeafNode, which is one for voxels.

const ValueType& getFirstValue ( ) const
inlineinherited

Return a const reference to the first value in the buffer.

Note
Though it is potentially risky you can convert this to a non-const pointer by means of const_case<ValueType*>&.
const ValueType& getLastValue ( ) const
inlineinherited

Return a const reference to the last value in the buffer.

static Index getLevel ( )
inlinestaticinherited

Return the level of this node, which by definition is zero for LeafNodes.

CoordBBox getNodeBoundingBox ( ) const
inline

Return the bounding box of this node, i.e., the full index space spanned by this leaf node.

static void getNodeLog2Dims ( std::vector< Index > &  dims)
inlinestaticinherited

Append the Log2Dim of this LeafNode to the specified vector.

void getNodes ( ArrayT &  ) const
inlineinherited

This function exists only to enable template instantiation.

void getOrigin ( Coord &  origin) const
inlineinherited

Return the grid index coordinates of this node's local origin.

void getOrigin ( Int32 x,
Int32 y,
Int32 z 
) const
inlineinherited

Return the grid index coordinates of this node's local origin.

const ValueT & getValue ( const Coord &  xyz) const
inlineinherited

Return the value of the voxel at the given coordinates.

const ValueT & getValue ( Index  offset) const
inlineinherited

Return the value of the voxel at the given linear offset.

const ValueType& getValue ( const Coord &  xyz,
bool &  state,
int &  level,
AccessorT &   
) const
inlineinherited

Return the value of the voxel at the given coordinates and return its active state and level (i.e., 0) in state and level.

Note
Used internally by ValueAccessor.
const ValueType& getValueAndCache ( const Coord &  xyz,
AccessorT &   
) const
inlineinherited

Return the value of the voxel at the given coordinates.

Note
Used internally by ValueAccessor.
static Index getValueLevel ( const Coord &  )
inlinestaticinherited

Return the level (i.e., 0) at which leaf node values reside.

static Index getValueLevelAndCache ( const Coord &  ,
AccessorT &   
)
inlinestaticinherited

Return the LEVEL (=0) at which leaf node values reside.

Note
Used internally by ValueAccessor (note last argument is a dummy).
const NodeMaskType& getValueMask ( ) const
inlineinherited
NodeMaskType& getValueMask ( )
inlineinherited
GroupHandle groupHandle ( const AttributeSet::Descriptor::GroupIndex &  index) const
inline

}

Read-only group handle from group index

GroupHandle groupHandle ( const Name group) const
inline

Read-only group handle from group name.

Index64 groupPointCount ( const Name groupName) const
inline

Compute the point count in a specific group for the leaf.

GroupWriteHandle groupWriteHandle ( const AttributeSet::Descriptor::GroupIndex &  index)
inline

Read-write group handle from group index.

GroupWriteHandle groupWriteHandle ( const Name name)
inline

Read-write group handle from group name.

static bool hasActiveTiles ( )
inlinestaticinherited

Return false since leaf nodes never contain tiles.

bool hasAttribute ( const size_t  pos) const
inline

Returns true if an attribute with this index exists.

Parameters
posIndex of the attribute
bool hasAttribute ( const Name attributeName) const
inline

Returns true if an attribute with this name exists.

Parameters
attributeNameName of the attribute
bool hasSameTopology ( const LeafNode< OtherType, OtherLog2Dim > *  other) const
inlineinherited

Return true if the given node (which may have a different ValueType than this node) has the same active value topology as this node.

bool hasSameTopology ( const PointDataLeafNode< OtherType, OtherLog2Dim > *  other) const
inline

Return true if the given node (which may have a different ValueType than this node) has the same active value topology as this node.

void initializeAttributes ( const Descriptor::Ptr &  descriptor,
const Index  arrayLength,
const AttributeArray::ScopedRegistryLock lock = nullptr 
)
inline

Create a new attribute set. Existing attributes will be removed.

bool isAllocated ( ) const
inlineinherited

Return true if memory for this node's buffer has been allocated.

bool isChildMaskOff ( Index  ) const
inlineinherited
bool isChildMaskOff ( ) const
inlineinherited
bool isChildMaskOn ( Index  ) const
inlineinherited
bool isConstant ( ValueType firstValue,
bool &  state,
const ValueType tolerance = zeroVal<ValueType>() 
) const
inlineinherited

Return true if all of this node's values have the same active state and are in the range this->getFirstValue() +/- tolerance.

Parameters
firstValueIs updated with the first value of this leaf node.
stateIs updated with the state of all values IF method returns true. Else the value is undefined!
toleranceThe tolerance used to determine if values are approximately equal to the for value.
bool isConstant ( ValueType minValue,
ValueType maxValue,
bool &  state,
const ValueType tolerance = zeroVal<ValueType>() 
) const
inlineinherited

Return true if all of this node's values have the same active state and the range (maxValue - minValue) < tolerance.

Parameters
minValueIs updated with the minimum of all values IF method returns true. Else the value is undefined!
maxValueIs updated with the maximum of all values IF method returns true. Else the value is undefined!
stateIs updated with the state of all values IF method returns true. Else the value is undefined!
toleranceThe tolerance used to determine if values are approximately constant.
bool isDense ( ) const
inlineinherited

Return true if this node contains only active voxels.

bool isEmpty ( ) const
inlineinherited

Return true if this node has no active voxels.

bool isInactive ( ) const
inlineinherited

Return true if all of this node's values are inactive.

bool isValueMaskOff ( Index  n) const
inlineinherited
bool isValueMaskOff ( ) const
inlineinherited
bool isValueMaskOn ( Index  n) const
inlineinherited
bool isValueMaskOn ( ) const
inlineinherited
bool isValueOn ( const Coord &  xyz) const
inlineinherited

Return true if the voxel at the given coordinates is active.

bool isValueOn ( Index  offset) const
inlineinherited

Return true if the voxel at the given offset is active.

bool isValueOnAndCache ( const Coord &  xyz,
AccessorT &   
) const
inlineinherited

Return true if the voxel at the given coordinates is active.

Note
Used internally by ValueAccessor.
static Index32 leafCount ( )
inlinestaticinherited

Return the leaf count for this node, which is one.

static Index log2dim ( )
inlinestaticinherited

Return log2 of the dimension of this LeafNode, e.g. 3 if dimensions are 8^3.

T medianAll ( ValueType tmp = nullptr) const
inlineinherited

Computes the median value of all the active AND inactive voxels in this node.

Returns
The median value of all values in this node.
Parameters
tmpOptional temporary storage that can hold at least NUM_VALUES values Use of this temporary storage can improve performance when this method is called multiple times.
Note
If tmp = this->buffer().data() then the median value is computed very efficiently (in place) but the voxel values in this node are re-shuffled!
Warning
If tmp != nullptr then it is the responsibility of the client code that it points to enough memory to hold NUM_VALUES elements of type ValueType.
Index medianOff ( ValueType value,
ValueType tmp = nullptr 
) const
inlineinherited

Computes the median value of all the inactive voxels in this node.

Returns
The number of inactive voxels.
Parameters
valueIf the return value is non zero value is updated with the median value.
tmpOptional temporary storage that can hold at least as many values as there are inactive voxels in this node. Use of this temporary storage can improve performance when this method is called multiple times.
Warning
If tmp != nullptr then it is the responsibility of the client code that it points to enough memory to hold the number of inactive voxels of type ValueType.
Index medianOn ( ValueType value,
ValueType tmp = nullptr 
) const
inlineinherited

Computes the median value of all the active voxels in this node.

Returns
The number of active voxels.
Parameters
valueIf the return value is non zero value is updated with the median value.
tmpOptional temporary storage that can hold at least as many values as there are active voxels in this node. Use of this temporary storage can improve performance when this method is called multiple times.
Warning
If tmp != nullptr then it is the responsibility of the client code that it points to enough memory to hold the number of active voxels of type ValueType.
Index64 memUsage ( ) const
inline
void merge ( const LeafNode< T, Log2Dim > &  other)
inlineinherited
void merge ( const ValueType tileValue,
bool  tileActive 
)
inlineinherited
void merge ( const LeafNode< T, Log2Dim > &  other,
const ValueType ,
const ValueType  
)
inlineinherited
void modifyValue ( Index  ,
const ModifyOp &   
)
inline
void modifyValue ( const Coord &  ,
const ModifyOp &   
)
inline
void modifyValueAndActiveState ( const Coord &  ,
const ModifyOp &   
)
inline
void modifyValueAndActiveStateAndCache ( const Coord &  ,
const ModifyOp &  ,
AccessorT &   
)
inline
void modifyValueAndCache ( const Coord &  xyz,
const ModifyOp &  op,
AccessorT &   
)
inlineinherited

Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.

Note
Used internally by ValueAccessor.
void negate ( )
inline
void nodeCount ( std::vector< Index32 > &  ) const
inlineinherited

no-op

static Index32 nonLeafCount ( )
inlinestaticinherited

Return the non-leaf count for this node, which is zero.

static Index numValues ( )
inlinestaticinherited

Return the total number of voxels represented by this LeafNode.

Index64 offLeafVoxelCount ( ) const
inlineinherited
Index64 offPointCount ( ) const
inline

Compute the total inactive (off) point count for the leaf.

Coord offsetToGlobalCoord ( Index  n) const
inlineinherited

Return the global coordinates for a linear table offset.

Coord offsetToLocalCoord ( Index  n)
inlinestaticinherited

Return the local coordinates for a linear table offset, where offset 0 has coordinates (0, 0, 0).

static Index64 offTileCount ( )
inlinestaticinherited
Index64 offVoxelCount ( ) const
inlineinherited

Return the number of voxels marked Off.

Index64 onLeafVoxelCount ( ) const
inlineinherited
Index64 onPointCount ( ) const
inline

Compute the total active (on) point count for the leaf.

static Index64 onTileCount ( )
inlinestaticinherited
Index64 onVoxelCount ( ) const
inlineinherited

Return the number of voxels marked On.

bool operator!= ( const LeafNode< T, Log2Dim > &  other) const
inlineinherited
bool operator!= ( const PointDataLeafNode< T, Log2Dim > &  other) const
inline
bool operator== ( const LeafNode< T, Log2Dim > &  other) const
inlineinherited

Check for buffer, state and origin equivalence.

bool operator== ( const PointDataLeafNode< T, Log2Dim > &  other) const
inline

Check for buffer, state and origin equivalence first. If this returns true, do a deeper comparison on the attribute set to check

const Coord& origin ( ) const
inlineinherited

Return the grid index coordinates of this node's local origin.

Index64 pointCount ( ) const
inline

Compute the total point count for the leaf.

const PointDataLeafNode* probeConstLeaf ( const Coord &  ) const
inline

Return a const pointer to this node.

const PointDataLeafNode* probeConstLeafAndCache ( const Coord &  ,
AccessorT &   
) const
inline

Return a const pointer to this node.

const NodeT* probeConstNode ( const Coord &  ) const
inlineinherited

This function exists only to enable template instantiation.

const NodeT* probeConstNodeAndCache ( const Coord &  ,
AccessorT &   
) const
inline

Return a const pointer to this node.

PointDataLeafNode* probeLeaf ( const Coord &  )
inline

Return a pointer to this node.

const PointDataLeafNode* probeLeaf ( const Coord &  ) const
inline

Return a const pointer to this node.

PointDataLeafNode* probeLeafAndCache ( const Coord &  ,
AccessorT &   
)
inline

Return a pointer to this node.

const PointDataLeafNode* probeLeafAndCache ( const Coord &  ,
AccessorT &   
) const
inline

Return a const pointer to this node.

NodeT* probeNode ( const Coord &  )
inlineinherited

This function exists only to enable template instantiation.

NodeT* probeNodeAndCache ( const Coord &  ,
AccessorT &   
)
inline

Return a pointer to this node.

bool probeValue ( const Coord &  xyz,
ValueType val 
) const
inlineinherited

Return true if the voxel at the given coordinates is active.

Parameters
xyzthe coordinates of the voxel to be probed
[out]valthe value of the voxel at the given coordinates
bool probeValue ( Index  offset,
ValueType val 
) const
inlineinherited

Return true if the voxel at the given offset is active.

Parameters
offsetthe linear offset of the voxel to be probed
[out]valthe value of the voxel at the given coordinates
bool probeValueAndCache ( const Coord &  xyz,
ValueType val,
AccessorT &   
) const
inlineinherited

Return true if the voxel at the given coordinates is active and return the voxel value in val.

Note
Used internally by ValueAccessor.
void prune ( const ValueType = zeroVal<ValueType>())
inlineinherited

This function exists only to enable template instantiation.

void readBuffers ( std::istream &  is,
bool  fromHalf = false 
)
inline
void readBuffers ( std::istream &  is,
const CoordBBox &  ,
bool  fromHalf = false 
)
inline
void readTopology ( std::istream &  is,
bool  fromHalf = false 
)
inline
void renameAttributes ( const Descriptor expected,
Descriptor::Ptr &  replacement 
)
inline

Rename attributes in attribute set (order must remain the same).

Parameters
expectedExisting descriptor is expected to match this parameter.
replacementNew descriptor to replace the existing one.
void reorderAttributes ( const Descriptor::Ptr &  replacement)
inline

Reorder attribute set.

Parameters
replacementNew descriptor to replace the existing one.
void replaceAttributeSet ( AttributeSet attributeSet,
bool  allowMismatchingDescriptors = false 
)
inline

Replace the underlying attribute set with the given attributeSet.

This leaf will assume ownership of the given attribute set. The descriptors must match and the voxel offsets values will need updating if the point order is different.

Exceptions
ValueErrorif allowMismatchingDescriptors is false and the descriptors do not match
void resetBackground ( const ValueType ,
const ValueType newBackground 
)
inline
void resetDescriptor ( const Descriptor::Ptr &  replacement)
inline

Replace the descriptor with a new one The new Descriptor must exactly match the old one.

void setActiveState ( const Coord &  xyz,
bool  on 
)
inline
void setActiveState ( Index  offset,
bool  on 
)
inline
void setActiveStateAndCache ( const Coord &  xyz,
bool  on,
AccessorT &  parent 
)
inline
void setOffsetOn ( Index  offset,
const ValueType val 
)
inline
void setOffsetOnly ( Index  offset,
const ValueType val 
)
inline
void setOffsets ( const std::vector< ValueType > &  offsets,
const bool  updateValueMask = true 
)
inline

Sets all of the voxel offset values on this leaf, from the given vector of offsets. If updateValueMask is true, then the active value mask will be updated so voxels with points are active and empty voxels are inactive.

void setOrigin ( const Coord &  origin)
inlineinherited

Set the grid index coordinates of this node's local origin.

void setTransientData ( Index32  transientData)
inlineinherited

Set the transient data value.

void setValue ( const Coord &  ,
const ValueType  
)
inline
void setValueAndCache ( const Coord &  xyz,
const ValueType val,
AccessorT &   
)
inlineinherited

Change the value of the voxel at the given coordinates and mark it as active.

Note
Used internally by ValueAccessor.
void setValueMask ( const NodeMaskType mask)
inlineinherited
void setValueMask ( Index  n,
bool  on 
)
inlineprotectedinherited
void setValueMaskOff ( Index  n)
inlineprotectedinherited
void setValueMaskOn ( Index  n)
inlineprotectedinherited
void setValueOff ( const Coord &  xyz)
inline
void setValueOff ( Index  offset)
inline
void setValueOff ( const Coord &  ,
const ValueType  
)
inline
void setValueOff ( Index  ,
const ValueType  
)
inline
void setValueOffAndCache ( const Coord &  ,
const ValueType ,
AccessorT &   
)
inline
void setValueOn ( const Coord &  xyz)
inline
void setValueOn ( Index  offset)
inline
void setValueOn ( const Coord &  ,
const ValueType  
)
inline
void setValueOn ( Index  ,
const ValueType  
)
inline
void setValueOnly ( const Coord &  ,
const ValueType  
)
inline
void setValueOnly ( Index  ,
const ValueType  
)
inline
void setValueOnlyAndCache ( const Coord &  ,
const ValueType ,
AccessorT &   
)
inline
void setValuesOff ( )
inline
void setValuesOn ( )
inline
void signedFloodFill ( const ValueType )
inline
void signedFloodFill ( const ValueType ,
const ValueType  
)
inline
static Index size ( )
inlinestaticinherited

Return the total number of voxels represented by this LeafNode.

void skipCompressedValues ( bool  seekable,
std::istream &  is,
bool  fromHalf 
)
inlineprotectedinherited
AttributeSet::UniquePtr stealAttributeSet ( )
inline

Steal the attribute set, a new, empty attribute set is inserted in it's place.

NodeT* stealNode ( const Coord &  ,
const ValueType ,
bool   
)
inlineinherited

This function exists only to enable template instantiation.

void stealNodes ( ArrayT &  ,
const ValueType ,
bool   
)
inlineinherited

This function exists only to enable template instantiation.

std::string str ( ) const
inlineinherited

Return a string representation of this node.

size_t streamingSize ( bool  toHalf = false) const
inherited
void swap ( Buffer other)
inlineinherited

Exchange this node's data buffer with the given data buffer without changing the active states of the values.

void topologyDifference ( const LeafNode< OtherType, Log2Dim > &  other,
const ValueType  
)
inlineinherited

Difference this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this LeafNode and inactive in the other LeafNode.

The last dummy argument is required to match the signature for InternalNode::topologyDifference.

Note
This operation modifies only active states, not values. Also, because it can deactivate all of this node's voxels, consider subsequently calling prune.
void topologyIntersection ( const LeafNode< OtherType, Log2Dim > &  other,
const ValueType  
)
inlineinherited

Intersect this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active only if both of the original voxels were active.

The last dummy argument is required to match the signature for InternalNode::topologyIntersection.

Note
This operation modifies only active states, not values. Also note that this operation can result in all voxels being inactive so consider subsequently calling prune.
void topologyUnion ( const LeafNode< OtherType, Log2Dim > &  other,
const bool  preserveTiles = false 
)
inlineinherited

Union this node's set of active values with the active values of the other node, whose ValueType may be different. So a resulting voxel will be active if either of the original voxels were active.

Note
This operation modifies only active states, not values.
PointDataLeafNode* touchLeaf ( const Coord &  )
inline

Return a pointer to this node.

PointDataLeafNode* touchLeafAndCache ( const Coord &  ,
AccessorT &   
)
inline

Return a pointer to this node.

Index32 transientData ( ) const
inlineinherited

Return the transient data value.

void updateValueMask ( )
inline

Activate voxels with non-zero points, deactivate voxels with zero points.

void validateOffsets ( ) const
inline

Throws an error if the voxel values on this leaf are not monotonically increasing or within the bounds of the attribute arrays.

const NodeMaskType& valueMask ( ) const
inlineinherited
void visit ( VisitorOp &  op)
inlineinherited
void visit ( VisitorOp &  op) const
inlineinherited
void visit2 ( IterT &  otherIter,
VisitorOp &  op,
bool  otherIsLHS = false 
)
inlineinherited
void visit2 ( IterT &  otherIter,
VisitorOp &  op,
bool  otherIsLHS = false 
) const
inlineinherited
void visit2Node ( OtherLeafNodeType &  other,
VisitorOp &  op 
)
inlineinherited
void visit2Node ( OtherLeafNodeType &  other,
VisitorOp &  op 
) const
inlineinherited
void visitActiveBBox ( BBoxOp &  op) const
inlineinherited

Calls the templated functor BBoxOp with bounding box information. An additional level argument is provided to the callback.

Note
The bounding boxes are guaranteed to be non-overlapping.
void voxelizeActiveTiles ( bool  = true)
inlineinherited

No-op.

This function exists only to enable template instantiation.

void writeBuffers ( std::ostream &  os,
bool  toHalf = false 
) const
inline
void writeTopology ( std::ostream &  os,
bool  toHalf = false 
) const
inline

Friends And Related Function Documentation

friend class ::TestPointDataLeaf
friend
friend class PointDataLeafNode
friend

Member Data Documentation

const Index DIM = 1 << TOTAL
staticinherited
const Index LEVEL = 0
staticinherited
const Index LOG2DIM = Log2Dim
staticinherited
const Index NUM_VALUES = 1 << 3 * Log2Dim
staticinherited
const Index NUM_VOXELS = NUM_VALUES
staticinherited
const Index SIZE = NUM_VALUES
staticinherited
const Index TOTAL = Log2Dim
staticinherited