4#ifndef OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED
5#define OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED
29template<Index,
typename>
struct SameLeafConfig;
36template<
typename T, Index Log2Dim>
51 NUM_VALUES = 1 << 3 * Log2Dim,
52 NUM_VOXELS = NUM_VALUES,
58 template<
typename OtherValueType>
63 template<
typename OtherNodeType>
97 template<
typename OtherValueType>
101 template<
typename OtherValueType>
106 template<
typename OtherValueType>
148 bool isEmpty()
const {
return mValueMask.isOff(); }
150 bool isDense()
const {
return mValueMask.isOn(); }
152 bool isAllocated()
const {
return !mBuffer.isOutOfCore() && !mBuffer.empty(); }
158 Index64 memUsageIfLoaded()
const;
163 void evalActiveBoundingBox(
CoordBBox& bbox,
bool visitVoxels =
true)
const;
186#if OPENVDB_ABI_VERSION_NUMBER >= 9
194 std::string str()
const;
198 template<
typename OtherType, Index OtherLog2Dim>
202 bool operator==(
const LeafNode& other)
const;
214 template<
typename MaskIterT,
typename NodeT,
typename ValueT,
typename TagT>
219 MaskIterT, ValueIter<MaskIterT, NodeT, ValueT, TagT>, NodeT, ValueT>
226 ValueT&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
227 ValueT&
getValue()
const {
return this->parent().getValue(this->pos()); }
232 this->parent().setValueOnly(pos,
value);
237 this->parent().setValueOnly(this->pos(),
value);
241 template<
typename ModifyOp>
242 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
244 template<
typename ModifyOp>
245 void modifyValue(
const ModifyOp& op)
const { this->parent().modifyValue(this->pos(), op); }
249 template<
typename MaskIterT,
typename NodeT,
typename TagT>
251 public SparseIteratorBase<MaskIterT, ChildIter<MaskIterT, NodeT, TagT>, NodeT, ValueType>
258 template<
typename NodeT,
typename ValueT,
typename TagT>
260 MaskDenseIterator, DenseIter<NodeT, ValueT, TagT>, NodeT, void, ValueT>
270 value = this->parent().getValue(pos);
281 this->parent().setValueOnly(pos,
value);
356 void readTopology(std::istream& is,
bool fromHalf =
false);
360 void writeTopology(std::ostream& os,
bool toHalf =
false)
const;
365 void readBuffers(std::istream& is,
bool fromHalf =
false);
370 void readBuffers(std::istream& is,
const CoordBBox& bbox,
bool fromHalf =
false);
374 void writeBuffers(std::ostream& os,
bool toHalf =
false)
const;
399 void setActiveState(
const Coord& xyz,
bool on);
404 void setValueOnly(
const Coord& xyz,
const ValueType& val);
406 void setValueOnly(
Index offset,
const ValueType& val);
414 void setValueOff(
const Coord& xyz,
const ValueType& val);
416 void setValueOff(
Index offset,
const ValueType& val);
424 this->setValueOn(LeafNode::coordToOffset(xyz), val);
430 mBuffer.setValue(offset, val);
431 mValueMask.setOn(offset);
436 template<
typename ModifyOp>
439 mBuffer.loadValues();
440 if (!mBuffer.empty()) {
444 mValueMask.setOn(offset);
450 template<
typename ModifyOp>
453 this->modifyValue(this->coordToOffset(xyz), op);
457 template<
typename ModifyOp>
460 mBuffer.loadValues();
461 if (!mBuffer.empty()) {
462 const Index offset = this->coordToOffset(xyz);
463 bool state = mValueMask.isOn(offset);
467 mValueMask.set(offset, state);
485 void clip(
const CoordBBox&,
const ValueType& background);
488 void fill(
const CoordBBox& bbox,
const ValueType&,
bool active =
true);
492 this->fill(bbox,
value, active);
496 void fill(
const ValueType&
value);
498 void fill(
const ValueType&
value,
bool active);
511 template<
typename DenseT>
512 void copyToDense(
const CoordBBox& bbox, DenseT& dense)
const;
530 template<
typename DenseT>
531 void copyFromDense(
const CoordBBox& bbox,
const DenseT& dense,
532 const ValueType& background,
const ValueType& tolerance);
536 template<
typename AccessorT>
539 return this->getValue(xyz);
544 template<
typename AccessorT>
549 template<
typename AccessorT>
552 this->setValueOn(xyz, val);
558 template<
typename AccessorT>
561 this->setValueOnly(xyz, val);
567 template<
typename ModifyOp,
typename AccessorT>
570 this->modifyValue(xyz, op);
575 template<
typename ModifyOp,
typename AccessorT>
578 this->modifyValueAndActiveState(xyz, op);
583 template<
typename AccessorT>
586 this->setValueOff(xyz,
value);
592 template<
typename AccessorT>
595 this->setActiveState(xyz, on);
601 template<
typename AccessorT>
604 return this->probeValue(xyz, val);
610 template<
typename AccessorT>
613 const Index offset = this->coordToOffset(xyz);
614 state = mValueMask.isOn(offset);
616 return mBuffer[offset];
621 template<
typename AccessorT>
633 void resetBackground(
const ValueType& oldBackground,
const ValueType& newBackground);
641 template<MergePolicy Policy>
void merge(
const LeafNode&);
642 template<MergePolicy Policy>
void merge(
const ValueType& tileValue,
bool tileActive);
643 template<MergePolicy Policy>
644 void merge(
const LeafNode& other,
const ValueType& ,
const ValueType& );
652 template<
typename OtherType>
666 template<
typename OtherType>
680 template<
typename OtherType>
683 template<
typename CombineOp>
684 void combine(
const LeafNode& other, CombineOp& op);
685 template<
typename CombineOp>
686 void combine(
const ValueType&
value,
bool valueIsActive, CombineOp& op);
688 template<
typename CombineOp,
typename OtherType >
689 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
690 template<
typename CombineOp,
typename OtherNodeT >
691 void combine2(
const ValueType&,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
692 template<
typename CombineOp,
typename OtherNodeT >
693 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
699 template<
typename AccessorT>
701 template<
typename NodeT>
703 template<
typename NodeT>
705 template<
typename NodeT>
707 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
711 void addTile(
Index level,
const Coord&,
const ValueType&,
bool);
712 void addTile(
Index offset,
const ValueType&,
bool);
713 template<
typename AccessorT>
714 void addTileAndCache(
Index,
const Coord&,
const ValueType&,
bool, AccessorT&);
719 template<
typename AccessorT>
721 template<
typename NodeT,
typename AccessorT>
725 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
726 return reinterpret_cast<NodeT*
>(
this);
730 template<
typename AccessorT>
736 template<
typename AccessorT>
738 template<
typename AccessorT>
741 template<
typename NodeT,
typename AccessorT>
745 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
746 return reinterpret_cast<const NodeT*
>(
this);
760 bool isConstant(ValueType& firstValue,
bool& state,
761 const ValueType& tolerance = zeroVal<ValueType>())
const;
774 bool isConstant(ValueType& minValue, ValueType& maxValue,
775 bool& state,
const ValueType& tolerance = zeroVal<ValueType>())
const;
792 ValueType medianAll(ValueType *tmp =
nullptr)
const;
808 Index medianOn(ValueType &
value, ValueType *tmp =
nullptr)
const;
824 Index medianOff(ValueType &
value, ValueType *tmp =
nullptr)
const;
830 friend class ::TestLeaf;
831 template<
typename>
friend class ::TestLeafIO;
868 inline void skipCompressedValues(
bool seekable, std::istream&,
bool fromHalf);
877 NodeMaskType mValueMask;
880#if OPENVDB_ABI_VERSION_NUMBER >= 9
893template<Index Dim1,
typename NodeT2>
896template<Index Dim1,
typename T2>
904template<
typename T, Index Log2Dim>
913template<
typename T, Index Log2Dim>
918 mOrigin(xyz & (~(DIM - 1)))
923template<
typename T, Index Log2Dim>
928 mOrigin(xyz & (~(DIM - 1)))
933template<
typename T, Index Log2Dim>
936 : mBuffer(other.mBuffer)
937 , mValueMask(other.valueMask())
938 , mOrigin(other.mOrigin)
939#if OPENVDB_ABI_VERSION_NUMBER >= 9
940 , mTransientData(other.mTransientData)
947template<
typename T, Index Log2Dim>
948template<
typename OtherValueType>
951 : mValueMask(other.valueMask())
952 , mOrigin(other.mOrigin)
953#if OPENVDB_ABI_VERSION_NUMBER >= 9
954 , mTransientData(other.mTransientData)
959 static inline ValueType convertValue(
const OtherValueType& val) {
return ValueType(val); }
963 mBuffer[i] = Local::convertValue(other.mBuffer[i]);
968template<
typename T, Index Log2Dim>
969template<
typename OtherValueType>
973 : mBuffer(background)
974 , mValueMask(other.valueMask())
975 , mOrigin(other.mOrigin)
976#if OPENVDB_ABI_VERSION_NUMBER >= 9
977 , mTransientData(other.mTransientData)
983template<
typename T, Index Log2Dim>
984template<
typename OtherValueType>
988 : mValueMask(other.valueMask())
989 , mOrigin(other.mOrigin)
990#if OPENVDB_ABI_VERSION_NUMBER >= 9
991 , mTransientData(other.mTransientData)
995 mBuffer[i] = (mValueMask.
isOn(i) ? onValue : offValue);
1000template<
typename T, Index Log2Dim>
1007template<
typename T, Index Log2Dim>
1011 std::ostringstream ostr;
1012 ostr <<
"LeafNode @" << mOrigin <<
": " << mBuffer;
1020template<
typename T, Index Log2Dim>
1024 assert ((xyz[0] & (DIM-1u)) < DIM && (xyz[1] & (DIM-1u)) < DIM && (xyz[2] & (DIM-1u)) < DIM);
1025 return ((xyz[0] & (DIM-1u)) << 2*Log2Dim)
1026 + ((xyz[1] & (DIM-1u)) << Log2Dim)
1027 + (xyz[2] & (DIM-1u));
1030template<
typename T, Index Log2Dim>
1034 assert(n<(1<< 3*Log2Dim));
1036 xyz.
setX(n >> 2*Log2Dim);
1037 n &= ((1<<2*Log2Dim)-1);
1038 xyz.
setY(n >> Log2Dim);
1039 xyz.
setZ(n & ((1<<Log2Dim)-1));
1044template<
typename T, Index Log2Dim>
1048 return (this->offsetToLocalCoord(n) + this->origin());
1055template<
typename ValueT, Index Log2Dim>
1062template<
typename ValueT, Index Log2Dim>
1066 assert(offset < SIZE);
1067 return mBuffer[offset];
1071template<
typename T, Index Log2Dim>
1078template<
typename T, Index Log2Dim>
1082 assert(offset < SIZE);
1083 val = mBuffer[offset];
1084 return mValueMask.isOn(offset);
1088template<
typename T, Index Log2Dim>
1095template<
typename T, Index Log2Dim>
1099 assert(offset < SIZE);
1100 mBuffer.setValue(offset, val);
1101 mValueMask.setOff(offset);
1105template<
typename T, Index Log2Dim>
1109 mValueMask.set(this->coordToOffset(xyz), on);
1113template<
typename T, Index Log2Dim>
1120template<
typename T, Index Log2Dim>
1124 assert(offset<SIZE); mBuffer.setValue(offset, val);
1131template<
typename T, Index Log2Dim>
1135 CoordBBox nodeBBox = this->getNodeBoundingBox();
1138 this->fill(background,
false);
1139 }
else if (clipBBox.
isInside(nodeBBox)) {
1151 int &x = xyz.
x(), &y = xyz.
y(), &z = xyz.
z();
1152 for (x = nodeBBox.
min().
x(); x <= nodeBBox.
max().
x(); ++x) {
1153 for (y = nodeBBox.
min().
y(); y <= nodeBBox.
max().
y(); ++y) {
1154 for (z = nodeBBox.
min().
z(); z <= nodeBBox.
max().
z(); ++z) {
1155 mask.
setOn(
static_cast<Index32>(this->coordToOffset(xyz)));
1163 this->setValueOff(maskIter.pos(), background);
1171template<
typename T, Index Log2Dim>
1177 auto clippedBBox = this->getNodeBoundingBox();
1178 clippedBBox.intersect(bbox);
1179 if (!clippedBBox)
return;
1181 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1182 const Index offsetX = (x & (DIM-1u)) << 2*Log2Dim;
1183 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1184 const Index offsetXY = offsetX + ((y & (DIM-1u)) << Log2Dim);
1185 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1186 const Index offset = offsetXY + (z & (DIM-1u));
1187 mBuffer[offset] =
value;
1188 mValueMask.set(offset, active);
1194template<
typename T, Index Log2Dim>
1198 mBuffer.fill(
value);
1201template<
typename T, Index Log2Dim>
1205 mBuffer.fill(
value);
1206 mValueMask.set(active);
1213template<
typename T, Index Log2Dim>
1214template<
typename DenseT>
1218 mBuffer.loadValues();
1220 using DenseValueType =
typename DenseT::ValueType;
1222 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1223 const Coord& min = dense.bbox().min();
1224 DenseValueType* t0 = dense.data() + zStride * (bbox.
min()[2] - min[2]);
1225 const T* s0 = &mBuffer[bbox.
min()[2] & (DIM-1u)];
1226 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1227 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1228 const T* s1 = s0 + ((x & (DIM-1u)) << 2*Log2Dim);
1229 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1230 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1231 const T* s2 = s1 + ((y & (DIM-1u)) << Log2Dim);
1232 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2] + 1; z < ez; ++z, t2 += zStride) {
1233 *t2 = DenseValueType(*s2++);
1240template<
typename T, Index Log2Dim>
1241template<
typename DenseT>
1248 using DenseValueType =
typename DenseT::ValueType;
1250 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1251 const Coord& min = dense.bbox().min();
1253 const DenseValueType* s0 = dense.data() + zStride * (bbox.
min()[2] - min[2]);
1254 const Int32 n0 = bbox.
min()[2] & (DIM-1u);
1255 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0]+1; x < ex; ++x) {
1256 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1257 const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM);
1258 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1]+1; y < ey; ++y) {
1259 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1260 Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM);
1261 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1263 mValueMask.setOff(n2);
1264 mBuffer[n2] = background;
1266 mValueMask.setOn(n2);
1278template<
typename T, Index Log2Dim>
1282 mValueMask.load(is);
1286template<
typename T, Index Log2Dim>
1290 mValueMask.save(os);
1298template<
typename T, Index Log2Dim>
1304 io::readCompressedValues<ValueType, NodeMaskType>(
1305 is,
nullptr, SIZE, mValueMask, fromHalf);
1314template<
typename T, Index Log2Dim>
1322template<
typename T, Index Log2Dim>
1327 const bool seekable = meta && meta->seekable();
1329#ifdef OPENVDB_USE_DELAYED_LOADING
1330 std::streamoff maskpos = is.tellg();
1335 mValueMask.seek(is);
1338 mValueMask.load(is);
1341 int8_t numBuffers = 1;
1347 is.read(
reinterpret_cast<char*
>(&numBuffers),
sizeof(int8_t));
1350 CoordBBox nodeBBox = this->getNodeBoundingBox();
1353 skipCompressedValues(seekable, is, fromHalf);
1354 mValueMask.setOff();
1355 mBuffer.setOutOfCore(
false);
1357#ifdef OPENVDB_USE_DELAYED_LOADING
1362 io::MappedFile::Ptr mappedFile = io::getMappedFilePtr(is);
1363 const bool delayLoad = ((mappedFile.get() !=
nullptr) && clipBBox.
isInside(nodeBBox));
1366 mBuffer.setOutOfCore(
true);
1367 mBuffer.mFileInfo =
new typename Buffer::FileInfo;
1368 mBuffer.mFileInfo->meta = meta;
1369 mBuffer.mFileInfo->bufpos = is.tellg();
1370 mBuffer.mFileInfo->mapping = mappedFile;
1373 mBuffer.mFileInfo->maskpos = maskpos;
1375 skipCompressedValues(seekable, is, fromHalf);
1380 mBuffer.setOutOfCore(
false);
1383 T background = zeroVal<T>();
1385 background = *
static_cast<const T*
>(bgPtr);
1387 this->clip(clipBBox, background);
1388#ifdef OPENVDB_USE_DELAYED_LOADING
1393 if (numBuffers > 1) {
1398 for (
int i = 1; i < numBuffers; ++i) {
1402 io::readData<T>(is, temp.mData, SIZE, zipped);
1408 if (meta) meta->setLeaf(meta->leaf() + 1);
1412template<
typename T, Index Log2Dim>
1417 mValueMask.save(os);
1419 mBuffer.loadValues();
1429template<
typename T, Index Log2Dim>
1433 return mOrigin == other.mOrigin &&
1435 mBuffer == other.mBuffer;
1439template<
typename T, Index Log2Dim>
1445 return sizeof(*this) + mBuffer.
memUsage() -
sizeof(mBuffer);
1449template<
typename T, Index Log2Dim>
1455 return sizeof(*this) + mBuffer.memUsageIfLoaded() -
sizeof(mBuffer);
1459template<
typename T, Index Log2Dim>
1463 CoordBBox this_bbox = this->getNodeBoundingBox();
1464 if (bbox.
isInside(this_bbox))
return;
1468 for(; iter; ++iter) this_bbox.
expand(this->offsetToLocalCoord(iter.pos()));
1476template<
typename T, Index Log2Dim>
1477template<
typename OtherType, Index OtherLog2Dim>
1482 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
1485template<
typename T, Index Log2Dim>
1491 if (!mValueMask.isConstant(state))
return false;
1492 firstValue = mBuffer[0];
1493 for (
Index i = 1; i < SIZE; ++i) {
1499template<
typename T, Index Log2Dim>
1506 if (!mValueMask.isConstant(state))
return false;
1507 minValue = maxValue = mBuffer[0];
1508 for (
Index i = 1; i < SIZE; ++i) {
1509 const T& v = mBuffer[i];
1511 if ((maxValue - v) > tolerance)
return false;
1513 }
else if (v > maxValue) {
1514 if ((v - minValue) > tolerance)
return false;
1521template<
typename T, Index Log2Dim>
1525 std::unique_ptr<T[]> data(
nullptr);
1526 if (tmp ==
nullptr) {
1527 data.reset(
new T[NUM_VALUES]);
1530 if (tmp != mBuffer.data()) {
1531 const T* src = mBuffer.data();
1532 for (T* dst = tmp; dst-tmp < NUM_VALUES;) *dst++ = *src++;
1534 static const size_t midpoint = (NUM_VALUES - 1) >> 1;
1535 std::nth_element(tmp, tmp + midpoint, tmp + NUM_VALUES);
1536 return tmp[midpoint];
1539template<
typename T, Index Log2Dim>
1543 const Index count = mValueMask.countOn();
1544 if (count == NUM_VALUES) {
1545 value = this->medianAll(tmp);
1547 }
else if (count == 0) {
1550 std::unique_ptr<T[]> data(
nullptr);
1551 if (tmp ==
nullptr) {
1552 data.reset(
new T[count]);
1555 for (
auto iter=this->cbeginValueOn(); iter; ++iter) *tmp++ = *iter;
1556 T *begin = tmp - count;
1557 const size_t midpoint = (count - 1) >> 1;
1558 std::nth_element(begin, begin + midpoint, tmp);
1559 value = begin[midpoint];
1563template<
typename T, Index Log2Dim>
1567 const Index count = mValueMask.countOff();
1568 if (count == NUM_VALUES) {
1569 value = this->medianAll(tmp);
1571 }
else if (count == 0) {
1574 std::unique_ptr<T[]> data(
nullptr);
1575 if (tmp ==
nullptr) {
1576 data.reset(
new T[count]);
1579 for (
auto iter=this->cbeginValueOff(); iter; ++iter) *tmp++ = *iter;
1580 T *begin = tmp - count;
1581 const size_t midpoint = (count - 1) >> 1;
1582 std::nth_element(begin, begin + midpoint, tmp);
1583 value = begin[midpoint];
1590template<
typename T, Index Log2Dim>
1594 this->addTile(this->coordToOffset(xyz), val, active);
1597template<
typename T, Index Log2Dim>
1601 assert(offset < SIZE);
1602 setValueOnly(offset, val);
1603 setActiveState(offset, active);
1606template<
typename T, Index Log2Dim>
1607template<
typename AccessorT>
1610 const ValueType& val,
bool active, AccessorT&)
1612 this->addTile(level, xyz, val, active);
1619template<
typename T, Index Log2Dim>
1628 for (iter = this->mValueMask.beginOff(); iter; ++iter) {
1631 inactiveValue = newBackground;
1639template<
typename T, Index Log2Dim>
1640template<MergePolicy Policy>
1649 for (; iter; ++iter) {
1651 if (mValueMask.isOff(n)) {
1652 mBuffer[n] = other.mBuffer[n];
1653 mValueMask.setOn(n);
1659template<
typename T, Index Log2Dim>
1660template<MergePolicy Policy>
1665 this->
template merge<Policy>(other);
1668template<
typename T, Index Log2Dim>
1669template<MergePolicy Policy>
1677 if (!tileActive)
return;
1680 const Index n = iter.pos();
1681 mBuffer[n] = tileValue;
1682 mValueMask.setOn(n);
1688template<
typename T, Index Log2Dim>
1689template<
typename OtherType>
1696template<
typename T, Index Log2Dim>
1697template<
typename OtherType>
1705template<
typename T, Index Log2Dim>
1706template<
typename OtherType>
1714template<
typename T, Index Log2Dim>
1720 for (
Index i = 0; i < SIZE; ++i) {
1721 mBuffer[i] = -mBuffer[i];
1729template<
typename T, Index Log2Dim>
1730template<
typename CombineOp>
1737 for (
Index i = 0; i < SIZE; ++i) {
1748template<
typename T, Index Log2Dim>
1749template<
typename CombineOp>
1757 for (
Index i = 0; i < SIZE; ++i) {
1769template<
typename T, Index Log2Dim>
1770template<
typename CombineOp,
typename OtherType>
1773 bool valueIsActive, CombineOp& op)
1779 for (
Index i = 0; i < SIZE; ++i) {
1780 op(args.
setARef(other.mBuffer[i])
1788template<
typename T, Index Log2Dim>
1789template<
typename CombineOp,
typename OtherNodeT>
1792 bool valueIsActive, CombineOp& op)
1798 for (
Index i = 0; i < SIZE; ++i) {
1799 op(args.
setBRef(other.mBuffer[i])
1807template<
typename T, Index Log2Dim>
1808template<
typename CombineOp,
typename OtherNodeT>
1815 for (
Index i = 0; i < SIZE; ++i) {
1816 mValueMask.set(i, b0.
valueMask().
isOn(i) || b1.valueMask().isOn(i));
1817 op(args.
setARef(b0.mBuffer[i])
1830template<
typename T, Index Log2Dim>
1834 for (
Index32 i = 0, N = buf.
size(); i < N; ++i) os << buf.mData[i] <<
", ";
ValueT value
Definition GridBuilder.h:1290
ChildT * child
Definition GridBuilder.h:1289
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition Types.h:530
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition Types.h:582
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition Types.h:598
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition Types.h:586
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition Types.h:584
bool resultIsActive() const
Definition Types.h:593
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition Types.h:596
Tag dispatch class that distinguishes constructors during file input.
Definition Types.h:650
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition Types.h:644
Axis-aligned bounding box of signed integer coordinates.
Definition Coord.h:249
void translate(const Coord &t)
Translate this bounding box by (tx, ty, tz).
Definition Coord.h:458
void expand(ValueType padding)
Pad this bounding box with the specified padding.
Definition Coord.h:418
const Coord & min() const
Definition Coord.h:321
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition Coord.h:412
const Coord & max() const
Definition Coord.h:322
static CoordBBox inf()
Return an "infinite" bounding box, as defined by the Coord value range.
Definition Coord.h:319
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition Coord.h:400
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition Coord.h:444
void reset()
Definition Coord.h:327
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:25
Int32 ValueType
Definition Coord.h:32
Int32 y() const
Definition Coord.h:131
Int32 x() const
Definition Coord.h:130
Coord & setZ(Int32 z)
Definition Coord.h:81
Coord & setY(Int32 y)
Definition Coord.h:80
Int32 z() const
Definition Coord.h:132
Coord & setX(Int32 x)
Definition Coord.h:79
Base class for iterators over internal and leaf nodes.
Definition Iterator.h:30
Index memUsage() const
Return the memory footprint of this buffer in bytes.
Definition LeafBuffer.h:325
static Index size()
Return the number of values contained in this buffer.
Definition LeafBuffer.h:111
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition LeafNode.h:38
void stealNodes(ArrayT &, const ValueType &, bool)
Definition LeafNode.h:708
LeafNode & operator=(const LeafNode &)=default
Deep assignment operator.
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.
Definition LeafNode.h:602
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition LeafNode.h:479
static Index64 onTileCount()
Definition LeafNode.h:145
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Definition LeafNode.h:175
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0,...
Definition LeafNode.h:1032
ChildOnCIter cbeginChildOn() const
Definition LeafNode.h:321
SharedPtr< LeafNode > Ptr
Definition LeafNode.h:45
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node.
Definition LeafNode.h:167
NodeMaskType & getValueMask()
Definition LeafNode.h:857
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition LeafNode.h:421
bool isChildMaskOn(Index) const
Definition LeafNode.h:860
ChildOnCIter beginChildOn() const
Definition LeafNode.h:322
ChildOnIter beginChildOn()
Definition LeafNode.h:323
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:477
ValueOnIter endValueOn()
Definition LeafNode.h:311
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition LeafNode.h:1288
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.
Definition LeafNode.h:1216
bool isChildMaskOff() const
Definition LeafNode.h:862
ValueOffCIter cbeginValueOff() const
Definition LeafNode.h:302
Index32 transientData() const
Return the transient data value.
Definition LeafNode.h:188
static Index32 childCount()
Return the child count for this node, which is zero.
Definition LeafNode.h:137
void setValue(const Coord &xyz, const ValueType &val)
Set the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNode.h:427
static Index getChildDim()
Return the dimension of child nodes of this LeafNode, which is one for voxels.
Definition LeafNode.h:129
bool operator!=(const LeafNode &other) const
Definition LeafNode.h:203
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.
Definition LeafNode.h:1243
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition LeafNode.h:1057
void setValueMask(const NodeMaskType &mask)
Definition LeafNode.h:859
ChildOnIter endChildOn()
Definition LeafNode.h:333
ValueAllIter endValueAll()
Definition LeafNode.h:317
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition LeafNode.h:718
void setValueOnly(const Coord &xyz, const ValueType &val)
Set the value of the voxel at the given coordinates but don't change its active state.
Definition LeafNode.h:1115
LeafNode * probeLeaf(const Coord &)
Definition LeafNode.h:729
bool isValueMaskOff() const
Definition LeafNode.h:855
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition LeafNode.h:697
bool isValueMaskOn() const
Definition LeafNode.h:853
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,...
Definition LeafNode.h:1708
void getNodes(ArrayT &) const
Definition LeafNode.h:707
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition LeafNode.h:474
ValueAllCIter endValueAll() const
Definition LeafNode.h:316
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition LeafNode.h:1565
void setValueOn(const Coord &xyz, const ValueType &val)
Set the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNode.h:423
Index64 onLeafVoxelCount() const
Definition LeafNode.h:143
ChildOffCIter endChildOff() const
Definition LeafNode.h:335
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition LeafNode.h:1523
~LeafNode()
Destructor.
Definition LeafNode.h:1002
ValueAllCIter cbeginValueAll() const
Definition LeafNode.h:305
NodeT * probeNode(const Coord &)
Definition LeafNode.h:704
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition LeafNode.h:1280
ValueOnCIter beginValueOn() const
Definition LeafNode.h:300
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition LeafNode.h:871
const Buffer & buffer() const
Definition LeafNode.h:347
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Definition LeafNode.h:731
void setValueMaskOn(Index n)
Definition LeafNode.h:865
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition LeafNode.h:1541
Index64 offLeafVoxelCount() const
Definition LeafNode.h:144
const LeafNode * probeLeaf(const Coord &) const
Definition LeafNode.h:740
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition LeafNode.h:1592
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition LeafNode.h:1621
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition LeafNode.h:170
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition LeafNode.h:173
static Index getValueLevel(const Coord &)
Return the level (i.e., 0) at which leaf node values reside.
Definition LeafNode.h:396
bool isInactive() const
Return true if all of this node's values are inactive.
Definition LeafNode.h:827
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition LeafNode.h:458
bool isValueMaskOff(Index n) const
Definition LeafNode.h:854
ValueOnCIter cendValueOn() const
Definition LeafNode.h:309
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition LeafNode.h:152
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition LeafNode.h:622
static Index numValues()
Return the total number of voxels represented by this LeafNode.
Definition LeafNode.h:123
ValueOffCIter beginValueOff() const
Definition LeafNode.h:303
void setValueOffAndCache(const Coord &xyz, const ValueType &value, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as inactive.
Definition LeafNode.h:584
const ValueType & getValue(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....
Definition LeafNode.h:611
const ValueType & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition LeafNode.h:537
ChildAllCIter cbeginChildAll() const
Definition LeafNode.h:327
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,...
Definition LeafNode.h:1699
ChildOffIter endChildOff()
Definition LeafNode.h:336
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition LeafNode.h:1133
ChildAllIter beginChildAll()
Definition LeafNode.h:329
void setValueOn(Index offset, const ValueType &val)
Set the value of the voxel at the given offset and mark the voxel as active.
Definition LeafNode.h:429
static Index getLevel()
Return the level of this node, which by definition is zero for LeafNodes.
Definition LeafNode.h:125
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:545
void addLeaf(LeafNode *)
Definition LeafNode.h:698
void setActiveState(const Coord &xyz, bool on)
Set the active state of the voxel at the given coordinates but don't change its value.
Definition LeafNode.h:1107
ValueOnIter beginValueOn()
Definition LeafNode.h:301
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.
Definition LeafNode.h:568
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 ...
Definition LeafNode.h:1691
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Definition LeafNode.h:722
const ValueType & getFirstValue() const
Return a const reference to the first value in the buffer.
Definition LeafNode.h:627
ChildOffCIter cbeginChildOff() const
Definition LeafNode.h:324
ChildOffIter beginChildOff()
Definition LeafNode.h:326
bool isChildMaskOff(Index) const
Definition LeafNode.h:861
Index64 onVoxelCount() const
Return the number of voxels marked On.
Definition LeafNode.h:140
ChildOffCIter beginChildOff() const
Definition LeafNode.h:325
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition LeafNode.h:1022
static Index64 offTileCount()
Definition LeafNode.h:146
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition LeafNode.h:409
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 acti...
Definition LeafNode.h:1479
ValueOffIter endValueOff()
Definition LeafNode.h:314
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition LeafNode.h:411
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Definition LeafNode.h:737
ChildAllCIter endChildAll() const
Definition LeafNode.h:338
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Definition LeafNode.h:742
ValueOnCIter cbeginValueOn() const
Definition LeafNode.h:299
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition LeafNode.h:1414
static Index log2dim()
Return log2 of the dimension of this LeafNode, e.g. 3 if dimensions are 8^3.
Definition LeafNode.h:117
void combine(const LeafNode &other, CombineOp &op)
Definition LeafNode.h:1732
static void getNodeLog2Dims(std::vector< Index > &dims)
Append the Log2Dim of this LeafNode to the specified vector.
Definition LeafNode.h:127
ChildOnCIter endChildOn() const
Definition LeafNode.h:332
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition LeafNode.h:735
static Index32 nonLeafCount()
Return the non-leaf count for this node, which is zero.
Definition LeafNode.h:135
ChildOnCIter cendChildOn() const
Definition LeafNode.h:331
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition LeafNode.h:482
ChildAllCIter cendChildAll() const
Definition LeafNode.h:337
Index64 memUsageIfLoaded() const
Definition LeafNode.h:1451
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition LeafNode.h:1772
void fill(const CoordBBox &bbox, const ValueType &, bool active=true)
Set all voxels within an axis-aligned box to the specified value and active state.
Definition LeafNode.h:1173
void modifyValue(const Coord &xyz, const ModifyOp &op)
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNode.h:451
ChildAllIter endChildAll()
Definition LeafNode.h:339
size_t streamingSize(bool toHalf=false) const
void setValueMask(Index n, bool on)
Definition LeafNode.h:864
const NodeMaskType & valueMask() const
Definition LeafNode.h:858
Index64 offVoxelCount() const
Return the number of voxels marked Off.
Definition LeafNode.h:142
typename NodeMaskType::OffIterator MaskOffIterator
Definition LeafNode.h:207
void swap(Buffer &other)
Exchange this node's data buffer with the given data buffer without changing the active states of the...
Definition LeafNode.h:346
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition LeafNode.h:1316
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition LeafNode.h:1487
T BuildType
Definition LeafNode.h:40
ValueAllCIter cendValueAll() const
Definition LeafNode.h:315
friend class LeafNode
Definition LeafNode.h:835
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.
Definition LeafNode.h:490
void negate()
Definition LeafNode.h:1716
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition LeafNode.h:1046
ChildAllCIter beginChildAll() const
Definition LeafNode.h:328
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Definition LeafNode.h:739
void setActiveStateAndCache(const Coord &xyz, bool on, AccessorT &)
Set the active state of the voxel at the given coordinates without changing its value.
Definition LeafNode.h:593
void getOrigin(Coord &origin) const
Definition LeafNode.h:174
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition LeafNode.h:472
void setTransientData(Index32 transientData)
Set the transient data value.
Definition LeafNode.h:190
void nodeCount(std::vector< Index32 > &) const
no-op
Definition LeafNode.h:133
static Index size()
Return the total number of voxels represented by this LeafNode.
Definition LeafNode.h:121
ChildOffCIter cendChildOff() const
Definition LeafNode.h:334
void skipCompressedValues(bool seekable, std::istream &, bool fromHalf)
Definition LeafNode.h:1300
typename NodeMaskType::OnIterator MaskOnIterator
Definition LeafNode.h:206
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition LeafNode.h:1431
static const Index SIZE
Definition LeafNode.h:53
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition LeafNode.h:1461
bool isEmpty() const
Return true if this node has no active voxels.
Definition LeafNode.h:148
void merge(const LeafNode &)
Definition LeafNode.h:1642
ValueOffIter beginValueOff()
Definition LeafNode.h:304
const NodeT * probeConstNode(const Coord &) const
Definition LeafNode.h:706
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition LeafNode.h:419
Buffer & buffer()
Definition LeafNode.h:348
void setValueOnlyAndCache(const Coord &xyz, const ValueType &val, AccessorT &)
Change the value of the voxel at the given coordinates but preserve its state.
Definition LeafNode.h:559
void setActiveState(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value.
Definition LeafNode.h:401
static Index32 leafCount()
Return the leaf count for this node, which is one.
Definition LeafNode.h:131
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition LeafNode.h:154
const NodeMaskType & getValueMask() const
Definition LeafNode.h:856
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition LeafNode.h:1609
void addLeafAndCache(LeafNode *, AccessorT &)
Definition LeafNode.h:700
void modifyValue(Index offset, const ModifyOp &op)
Apply a functor to the value of the voxel at the given offset and mark the voxel as active.
Definition LeafNode.h:437
ValueOffCIter cendValueOff() const
Definition LeafNode.h:312
void setValueMaskOff(Index n)
Definition LeafNode.h:866
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition LeafNode.h:1441
bool isDense() const
Return true if this node contains only active voxels.
Definition LeafNode.h:150
ValueOffCIter endValueOff() const
Definition LeafNode.h:313
void setValueAndCache(const Coord &xyz, const ValueType &val, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as active.
Definition LeafNode.h:550
std::string str() const
Return a string representation of this node.
Definition LeafNode.h:1009
NodeT * stealNode(const Coord &, const ValueType &, bool)
Definition LeafNode.h:702
T ValueType
Definition LeafNode.h:41
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:1073
ValueOnCIter endValueOn() const
Definition LeafNode.h:310
typename NodeMaskType::DenseIterator MaskDenseIterator
Definition LeafNode.h:208
void voxelizeActiveTiles(bool=true)
No-op.
Definition LeafNode.h:639
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition LeafNode.h:576
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Definition LeafNode.h:720
const ValueType & getLastValue() const
Return a const reference to the last value in the buffer.
Definition LeafNode.h:629
ValueAllCIter beginValueAll() const
Definition LeafNode.h:306
static Index dim()
Return the number of voxels in each coordinate dimension.
Definition LeafNode.h:119
bool isValueMaskOn(Index n) const
Definition LeafNode.h:852
ValueAllIter beginValueAll()
Definition LeafNode.h:307
Index32 pos() const
Definition NodeMasks.h:200
Definition NodeMasks.h:271
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation.
Definition NodeMasks.h:308
OnIterator beginOn() const
Definition NodeMasks.h:352
OffIterator beginOff() const
Definition NodeMasks.h:354
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition NodeMasks.h:502
void setOn(Index32 n)
Set the nth bit on.
Definition NodeMasks.h:452
Definition NodeMasks.h:240
Definition NodeMasks.h:209
OPENVDB_API uint32_t getDataCompression(std::ios_base &)
Return a bitwise OR of compression option flags (COMPRESS_ZIP, COMPRESS_ACTIVE_MASK,...
void writeCompressedValues(std::ostream &os, ValueT *srcBuf, Index srcCount, const MaskT &valueMask, const MaskT &childMask, bool toHalf)
Definition Compression.h:645
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
@ COMPRESS_ZIP
Definition Compression.h:54
void readCompressedValues(std::istream &is, ValueT *destBuf, Index destCount, const MaskT &valueMask, bool fromHalf)
Definition Compression.h:465
OPENVDB_API const void * getGridBackgroundValuePtr(std::ios_base &)
Return a pointer to the background value of the grid currently being read from or written to the give...
OPENVDB_API SharedPtr< StreamMetadata > getStreamMetadataPtr(std::ios_base &)
Return a shared pointer to an object that stores metadata (file format, compression scheme,...
bool isApproxEqual(const Type &a, const Type &b, const Type &tolerance)
Return true if a is equal to b to within the given tolerance.
Definition Math.h:406
T negative(const T &val)
Return the unary negation of the given value.
Definition Math.h:128
std::ostream & operator<<(std::ostream &os, const typename LeafNode< T, Log2Dim >::Buffer &buf)
Definition LeafNode.h:1832
Index32 Index
Definition Types.h:54
uint32_t Index32
Definition Types.h:52
@ OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION
Definition version.h.in:256
int32_t Int32
Definition Types.h:56
uint64_t Index64
Definition Types.h:53
std::shared_ptr< T > SharedPtr
Definition Types.h:114
@ MERGE_NODES
Definition Types.h:469
@ MERGE_ACTIVE_STATES_AND_NODES
Definition Types.h:470
Definition Exceptions.h:13
static pnanovdb_uint32_t allocate(pnanovdb_uint32_t *poffset, pnanovdb_uint32_t size, pnanovdb_uint32_t alignment)
Definition pnanovdb_validate_strides.h:20
Definition Compression.h:292
Base class for dense iterators over internal and leaf nodes.
Definition Iterator.h:179
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition Iterator.h:184
Leaf nodes have no children, so their child iterators have no get/set accessors.
Definition LeafNode.h:252
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNode.h:254
ChildIter()
Definition LeafNode.h:253
Definition LeafNode.h:212
Definition LeafNode.h:212
Definition LeafNode.h:261
DenseIter(const MaskDenseIterator &iter, NodeT *parent)
Definition LeafNode.h:266
void unsetItem(Index pos, const ValueT &value) const
Definition LeafNode.h:279
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition LeafNode.h:268
DenseIter()
Definition LeafNode.h:265
typename BaseT::NonConstValueType NonConstValueT
Definition LeafNode.h:263
SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a LeafNod...
Definition LeafNode.h:64
Definition LeafNode.h:211
ValueConverter<T>::Type is the type of a LeafNode having the same dimensions as this node but a diffe...
Definition LeafNode.h:59
Definition LeafNode.h:220
void setValue(const ValueT &value) const
Definition LeafNode.h:235
void modifyValue(const ModifyOp &op) const
Definition LeafNode.h:245
ValueT & getItem(Index pos) const
Definition LeafNode.h:226
void setItem(Index pos, const ValueT &value) const
Definition LeafNode.h:230
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNode.h:224
ValueT & getValue() const
Definition LeafNode.h:227
ValueIter()
Definition LeafNode.h:223
void modifyItem(Index n, const ModifyOp &op) const
Definition LeafNode.h:242
Definition LeafNode.h:211
Definition LeafNode.h:211
Definition LeafNode.h:894
Base class for sparse iterators over internal and leaf nodes.
Definition Iterator.h:115
ValueType ValueType
Definition Iterator.h:117
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212