4#ifndef OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED
5#define OPENVDB_TREE_LEAFNODE_HAS_BEEN_INCLUDED
30template<Index,
typename>
struct SameLeafConfig;
37template<
typename T, Index Log2Dim>
52 NUM_VALUES = 1 << 3 * Log2Dim,
53 NUM_VOXELS = NUM_VALUES,
59 template<
typename OtherValueType>
64 template<
typename OtherNodeType>
78 const ValueType& value = zeroVal<ValueType>(),
88 const ValueType& value = zeroVal<ValueType>(),
98 template<
typename OtherValueType>
102 template<
typename OtherValueType>
107 template<
typename OtherValueType>
151 bool isEmpty()
const {
return mValueMask.isOff(); }
153 bool isDense()
const {
return mValueMask.isOn(); }
155 bool isAllocated()
const {
return !mBuffer.isOutOfCore() && !mBuffer.empty(); }
161 Index64 memUsageIfLoaded()
const;
166 void evalActiveBoundingBox(
CoordBBox& bbox,
bool visitVoxels =
true)
const;
195 std::string str()
const;
199 template<
typename OtherType, Index OtherLog2Dim>
203 bool operator==(
const LeafNode& other)
const;
215 template<
typename MaskIterT,
typename NodeT,
typename ValueT,
typename TagT>
220 MaskIterT, ValueIter<MaskIterT, NodeT, ValueT, TagT>, NodeT, ValueT>
227 ValueT&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
228 ValueT&
getValue()
const {
return this->parent().getValue(this->pos()); }
233 this->parent().setValueOnly(pos, value);
238 this->parent().setValueOnly(this->pos(), value);
242 template<
typename ModifyOp>
243 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
245 template<
typename ModifyOp>
246 void modifyValue(
const ModifyOp& op)
const { this->parent().modifyValue(this->pos(), op); }
250 template<
typename MaskIterT,
typename NodeT,
typename TagT>
252 public SparseIteratorBase<MaskIterT, ChildIter<MaskIterT, NodeT, TagT>, NodeT, ValueType>
259 template<
typename NodeT,
typename ValueT,
typename TagT>
261 MaskDenseIterator, DenseIter<NodeT, ValueT, TagT>, NodeT, void, ValueT>
271 value = this->parent().getValue(pos);
282 this->parent().setValueOnly(pos, value);
357 void readTopology(std::istream& is,
bool fromHalf =
false);
361 void writeTopology(std::ostream& os,
bool toHalf =
false)
const;
366 void readBuffers(std::istream& is,
bool fromHalf =
false);
371 void readBuffers(std::istream& is,
const CoordBBox& bbox,
bool fromHalf =
false);
375 void writeBuffers(std::ostream& os,
bool toHalf =
false)
const;
400 void setActiveState(
const Coord& xyz,
bool on);
405 void setValueOnly(
const Coord& xyz,
const ValueType& val);
407 void setValueOnly(
Index offset,
const ValueType& val);
415 void setValueOff(
const Coord& xyz,
const ValueType& val);
417 void setValueOff(
Index offset,
const ValueType& val);
425 this->setValueOn(LeafNode::coordToOffset(xyz), val);
431 mBuffer.setValue(offset, val);
432 mValueMask.setOn(offset);
437 template<
typename ModifyOp>
440 mBuffer.loadValues();
441 if (!mBuffer.empty()) {
445 mValueMask.setOn(offset);
451 template<
typename ModifyOp>
454 this->modifyValue(this->coordToOffset(xyz), op);
458 template<
typename ModifyOp>
461 mBuffer.loadValues();
462 if (!mBuffer.empty()) {
463 const Index offset = this->coordToOffset(xyz);
464 bool state = mValueMask.isOn(offset);
468 mValueMask.set(offset, state);
490 void clip(
const CoordBBox&,
const ValueType& background);
493 void fill(
const CoordBBox& bbox,
const ValueType&,
bool active =
true);
497 this->fill(bbox, value, active);
501 void fill(
const ValueType& value);
503 void fill(
const ValueType& value,
bool active);
516 template<
typename DenseT>
517 void copyToDense(
const CoordBBox& bbox, DenseT& dense)
const;
535 template<
typename DenseT>
536 void copyFromDense(
const CoordBBox& bbox,
const DenseT& dense,
537 const ValueType& background,
const ValueType& tolerance);
541 template<
typename AccessorT>
544 return this->getValue(xyz);
549 template<
typename AccessorT>
554 template<
typename AccessorT>
557 this->setValueOn(xyz, val);
563 template<
typename AccessorT>
566 this->setValueOnly(xyz, val);
572 template<
typename ModifyOp,
typename AccessorT>
575 this->modifyValue(xyz, op);
580 template<
typename ModifyOp,
typename AccessorT>
583 this->modifyValueAndActiveState(xyz, op);
588 template<
typename AccessorT>
591 this->setValueOff(xyz, value);
597 template<
typename AccessorT>
600 this->setActiveState(xyz, on);
606 template<
typename AccessorT>
609 return this->probeValue(xyz, val);
615 template<
typename AccessorT>
618 const Index offset = this->coordToOffset(xyz);
619 state = mValueMask.isOn(offset);
621 return mBuffer[offset];
626 template<
typename AccessorT>
638 void resetBackground(
const ValueType& oldBackground,
const ValueType& newBackground);
646 template<MergePolicy Policy>
void merge(
const LeafNode&);
647 template<MergePolicy Policy>
void merge(
const ValueType& tileValue,
bool tileActive);
648 template<MergePolicy Policy>
649 void merge(
const LeafNode& other,
const ValueType& ,
const ValueType& );
657 template<
typename OtherType>
671 template<
typename OtherType>
685 template<
typename OtherType>
688 template<
typename CombineOp>
689 void combine(
const LeafNode& other, CombineOp& op);
690 template<
typename CombineOp>
691 void combine(
const ValueType& value,
bool valueIsActive, CombineOp& op);
693 template<
typename CombineOp,
typename OtherType >
694 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
695 template<
typename CombineOp,
typename OtherNodeT >
696 void combine2(
const ValueType&,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
697 template<
typename CombineOp,
typename OtherNodeT >
698 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
704 template<
typename AccessorT>
706 template<
typename NodeT>
708 template<
typename NodeT>
710 template<
typename NodeT>
712 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
716 void addTile(
Index level,
const Coord&,
const ValueType&,
bool);
717 void addTile(
Index offset,
const ValueType&,
bool);
718 template<
typename AccessorT>
719 void addTileAndCache(
Index,
const Coord&,
const ValueType&,
bool, AccessorT&);
724 template<
typename AccessorT>
726 template<
typename NodeT,
typename AccessorT>
730 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
731 return reinterpret_cast<NodeT*
>(
this);
735 template<
typename AccessorT>
741 template<
typename AccessorT>
743 template<
typename AccessorT>
746 template<
typename NodeT,
typename AccessorT>
750 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
751 return reinterpret_cast<const NodeT*
>(
this);
765 bool isConstant(ValueType& firstValue,
bool& state,
766 const ValueType& tolerance = zeroVal<ValueType>())
const;
779 bool isConstant(ValueType& minValue, ValueType& maxValue,
780 bool& state,
const ValueType& tolerance = zeroVal<ValueType>())
const;
797 ValueType medianAll(ValueType *tmp =
nullptr)
const;
813 Index medianOn(ValueType &value, ValueType *tmp =
nullptr)
const;
829 Index medianOff(ValueType &value, ValueType *tmp =
nullptr)
const;
858 friend class ::TestLeaf;
859 template<
typename>
friend class ::TestLeafIO;
896 inline void skipCompressedValues(
bool seekable, std::istream&,
bool fromHalf);
905 NodeMaskType mValueMask;
919template<Index Dim1,
typename NodeT2>
922template<Index Dim1,
typename T2>
930template<
typename T, Index Log2Dim>
939template<
typename T, Index Log2Dim>
944 mOrigin(xyz & (~(DIM - 1)))
949template<
typename T, Index Log2Dim>
954 mOrigin(xyz & (~(DIM - 1)))
959template<
typename T, Index Log2Dim>
962 : mBuffer(other.mBuffer)
963 , mValueMask(other.valueMask())
964 , mOrigin(other.mOrigin)
965 , mTransientData(other.mTransientData)
971template<
typename T, Index Log2Dim>
972template<
typename OtherValueType>
975 : mValueMask(other.valueMask())
976 , mOrigin(other.mOrigin)
977 , mTransientData(other.mTransientData)
981 static inline ValueType convertValue(
const OtherValueType& val) {
return ValueType(val); }
985 mBuffer[i] = Local::convertValue(other.mBuffer[i]);
990template<
typename T, Index Log2Dim>
991template<
typename OtherValueType>
995 : mBuffer(background)
996 , mValueMask(other.valueMask())
997 , mOrigin(other.mOrigin)
998 , mTransientData(other.mTransientData)
1003template<
typename T, Index Log2Dim>
1004template<
typename OtherValueType>
1008 : mValueMask(other.valueMask())
1009 , mOrigin(other.mOrigin)
1010 , mTransientData(other.mTransientData)
1013 mBuffer[i] = (mValueMask.
isOn(i) ? onValue : offValue);
1018template<
typename T, Index Log2Dim>
1025template<
typename T, Index Log2Dim>
1029 std::ostringstream ostr;
1030 ostr <<
"LeafNode @" << mOrigin <<
": " << mBuffer;
1038template<
typename T, Index Log2Dim>
1042 OPENVDB_ASSERT((xyz[0] & (DIM-1u)) < DIM && (xyz[1] & (DIM-1u)) < DIM && (xyz[2] & (DIM-1u)) < DIM);
1043 return ((xyz[0] & (DIM-1u)) << 2*Log2Dim)
1044 + ((xyz[1] & (DIM-1u)) << Log2Dim)
1045 + (xyz[2] & (DIM-1u));
1048template<
typename T, Index Log2Dim>
1054 xyz.
setX(n >> 2*Log2Dim);
1055 n &= ((1<<2*Log2Dim)-1);
1056 xyz.
setY(n >> Log2Dim);
1057 xyz.
setZ(n & ((1<<Log2Dim)-1));
1062template<
typename T, Index Log2Dim>
1066 return (this->offsetToLocalCoord(n) + this->origin());
1073template<
typename ValueT, Index Log2Dim>
1080template<
typename ValueT, Index Log2Dim>
1085 return mBuffer[offset];
1089template<
typename T, Index Log2Dim>
1096template<
typename T, Index Log2Dim>
1101 val = mBuffer[offset];
1102 return mValueMask.isOn(offset);
1106template<
typename T, Index Log2Dim>
1113template<
typename T, Index Log2Dim>
1118 mBuffer.setValue(offset, val);
1119 mValueMask.setOff(offset);
1123template<
typename T, Index Log2Dim>
1127 mValueMask.set(this->coordToOffset(xyz), on);
1131template<
typename T, Index Log2Dim>
1138template<
typename T, Index Log2Dim>
1149template<
typename T, Index Log2Dim>
1153 CoordBBox nodeBBox = this->getNodeBoundingBox();
1156 this->fill(background,
false);
1157 }
else if (clipBBox.
isInside(nodeBBox)) {
1169 int &x = xyz.
x(), &y = xyz.
y(), &z = xyz.
z();
1170 for (x = nodeBBox.
min().
x(); x <= nodeBBox.
max().
x(); ++x) {
1171 for (y = nodeBBox.
min().
y(); y <= nodeBBox.
max().
y(); ++y) {
1172 for (z = nodeBBox.
min().
z(); z <= nodeBBox.
max().
z(); ++z) {
1173 mask.
setOn(
static_cast<Index32>(this->coordToOffset(xyz)));
1181 this->setValueOff(maskIter.pos(), background);
1189template<
typename T, Index Log2Dim>
1195 auto clippedBBox = this->getNodeBoundingBox();
1196 clippedBBox.intersect(bbox);
1197 if (!clippedBBox)
return;
1199 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1200 const Index offsetX = (x & (DIM-1u)) << 2*Log2Dim;
1201 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1202 const Index offsetXY = offsetX + ((y & (DIM-1u)) << Log2Dim);
1203 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1204 const Index offset = offsetXY + (z & (DIM-1u));
1205 mBuffer[offset] = value;
1206 mValueMask.set(offset, active);
1212template<
typename T, Index Log2Dim>
1216 mBuffer.fill(value);
1219template<
typename T, Index Log2Dim>
1223 mBuffer.fill(value);
1224 mValueMask.set(active);
1231template<
typename T, Index Log2Dim>
1232template<
typename DenseT>
1236 mBuffer.loadValues();
1238 using DenseValueType =
typename DenseT::ValueType;
1240 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1241 const Coord& min = dense.bbox().min();
1242 DenseValueType* t0 = dense.data() + zStride * (bbox.
min()[2] - min[2]);
1243 const T* s0 = &mBuffer[bbox.
min()[2] & (DIM-1u)];
1244 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1245 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1246 const T* s1 = s0 + ((x & (DIM-1u)) << 2*Log2Dim);
1247 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1248 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1249 const T* s2 = s1 + ((y & (DIM-1u)) << Log2Dim);
1250 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2] + 1; z < ez; ++z, t2 += zStride) {
1251 *t2 = DenseValueType(*s2++);
1258template<
typename T, Index Log2Dim>
1259template<
typename DenseT>
1266 using DenseValueType =
typename DenseT::ValueType;
1268 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1269 const Coord& min = dense.bbox().min();
1271 const DenseValueType* s0 = dense.data() + zStride * (bbox.
min()[2] - min[2]);
1272 const Int32 n0 = bbox.
min()[2] & (DIM-1u);
1273 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0]+1; x < ex; ++x) {
1274 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1275 const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM);
1276 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1]+1; y < ey; ++y) {
1277 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1278 Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM);
1279 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1281 mValueMask.setOff(n2);
1282 mBuffer[n2] = background;
1284 mValueMask.setOn(n2);
1296template<
typename T, Index Log2Dim>
1300 mValueMask.load(is);
1304template<
typename T, Index Log2Dim>
1308 mValueMask.save(os);
1316template<
typename T, Index Log2Dim>
1323 is,
nullptr, SIZE, mValueMask, fromHalf);
1332template<
typename T, Index Log2Dim>
1340template<
typename T, Index Log2Dim>
1345 const bool seekable = meta && meta->seekable();
1347#ifdef OPENVDB_USE_DELAYED_LOADING
1348 std::streamoff maskpos = is.tellg();
1353 mValueMask.seek(is);
1356 mValueMask.load(is);
1359 int8_t numBuffers = 1;
1365 is.read(
reinterpret_cast<char*
>(&numBuffers),
sizeof(int8_t));
1368 CoordBBox nodeBBox = this->getNodeBoundingBox();
1371 skipCompressedValues(seekable, is, fromHalf);
1372 mValueMask.setOff();
1373 mBuffer.setOutOfCore(
false);
1375#ifdef OPENVDB_USE_DELAYED_LOADING
1380 io::MappedFile::Ptr mappedFile = io::getMappedFilePtr(is);
1381 const bool delayLoad = ((mappedFile.get() !=
nullptr) && clipBBox.
isInside(nodeBBox));
1384 mBuffer.setOutOfCore(
true);
1385 mBuffer.mFileInfo =
new typename Buffer::FileInfo;
1386 mBuffer.mFileInfo->meta = meta;
1387 mBuffer.mFileInfo->bufpos = is.tellg();
1388 mBuffer.mFileInfo->mapping = mappedFile;
1391 mBuffer.mFileInfo->maskpos = maskpos;
1393 skipCompressedValues(seekable, is, fromHalf);
1398 mBuffer.setOutOfCore(
false);
1403 background = *
static_cast<const T*
>(bgPtr);
1405 this->clip(clipBBox, background);
1406#ifdef OPENVDB_USE_DELAYED_LOADING
1411 if (numBuffers > 1) {
1416 for (
int i = 1; i < numBuffers; ++i) {
1426 if (meta) meta->setLeaf(meta->leaf() + 1);
1430template<
typename T, Index Log2Dim>
1435 mValueMask.save(os);
1437 mBuffer.loadValues();
1447template<
typename T, Index Log2Dim>
1451 return mOrigin == other.mOrigin &&
1453 mBuffer == other.mBuffer;
1457template<
typename T, Index Log2Dim>
1463 return sizeof(*this) + mBuffer.
memUsage() -
sizeof(mBuffer);
1467template<
typename T, Index Log2Dim>
1473 return sizeof(*this) + mBuffer.memUsageIfLoaded() -
sizeof(mBuffer);
1477template<
typename T, Index Log2Dim>
1481 CoordBBox this_bbox = this->getNodeBoundingBox();
1482 if (bbox.
isInside(this_bbox))
return;
1486 for(; iter; ++iter) this_bbox.
expand(this->offsetToLocalCoord(iter.pos()));
1494template<
typename T, Index Log2Dim>
1495template<
typename OtherType, Index OtherLog2Dim>
1500 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
1503template<
typename T, Index Log2Dim>
1509 if (!mValueMask.isConstant(state))
return false;
1510 firstValue = mBuffer[0];
1511 for (
Index i = 1; i < SIZE; ++i) {
1517template<
typename T, Index Log2Dim>
1524 if (!mValueMask.isConstant(state))
return false;
1525 minValue = maxValue = mBuffer[0];
1526 for (
Index i = 1; i < SIZE; ++i) {
1527 const T& v = mBuffer[i];
1529 if ((maxValue - v) > tolerance)
return false;
1531 }
else if (v > maxValue) {
1532 if ((v - minValue) > tolerance)
return false;
1539template<
typename T, Index Log2Dim>
1543 std::unique_ptr<T[]> data(
nullptr);
1544 if (tmp ==
nullptr) {
1545 data.reset(
new T[NUM_VALUES]);
1548 if (tmp != mBuffer.data()) {
1549 const T* src = mBuffer.data();
1550 for (T* dst = tmp; dst-tmp < NUM_VALUES;) *dst++ = *src++;
1552 static const size_t midpoint = (NUM_VALUES - 1) >> 1;
1553 std::nth_element(tmp, tmp + midpoint, tmp + NUM_VALUES);
1554 return tmp[midpoint];
1557template<
typename T, Index Log2Dim>
1561 const Index count = mValueMask.countOn();
1562 if (count == NUM_VALUES) {
1563 value = this->medianAll(tmp);
1565 }
else if (count == 0) {
1568 std::unique_ptr<T[]> data(
nullptr);
1569 if (tmp ==
nullptr) {
1570 data.reset(
new T[count]);
1573 for (
auto iter=this->cbeginValueOn(); iter; ++iter) *tmp++ = *iter;
1574 T *begin = tmp - count;
1575 const size_t midpoint = (count - 1) >> 1;
1576 std::nth_element(begin, begin + midpoint, tmp);
1577 value = begin[midpoint];
1581template<
typename T, Index Log2Dim>
1585 const Index count = mValueMask.countOff();
1586 if (count == NUM_VALUES) {
1587 value = this->medianAll(tmp);
1589 }
else if (count == 0) {
1592 std::unique_ptr<T[]> data(
nullptr);
1593 if (tmp ==
nullptr) {
1594 data.reset(
new T[count]);
1597 for (
auto iter=this->cbeginValueOff(); iter; ++iter) *tmp++ = *iter;
1598 T *begin = tmp - count;
1599 const size_t midpoint = (count - 1) >> 1;
1600 std::nth_element(begin, begin + midpoint, tmp);
1601 value = begin[midpoint];
1608template<
typename T, Index Log2Dim>
1612 this->addTile(this->coordToOffset(xyz), val, active);
1615template<
typename T, Index Log2Dim>
1620 setValueOnly(offset, val);
1621 setActiveState(offset, active);
1624template<
typename T, Index Log2Dim>
1625template<
typename AccessorT>
1628 const ValueType& val,
bool active, AccessorT&)
1630 this->addTile(level, xyz, val, active);
1637template<
typename T, Index Log2Dim>
1647 for (iter = this->mValueMask.beginOff(); iter; ++iter) {
1650 inactiveValue = newBackground;
1658template<
typename T, Index Log2Dim>
1659template<MergePolicy Policy>
1668 for (; iter; ++iter) {
1670 if (mValueMask.isOff(n)) {
1671 mBuffer[n] = other.mBuffer[n];
1672 mValueMask.setOn(n);
1678template<
typename T, Index Log2Dim>
1679template<MergePolicy Policy>
1684 this->
template merge<Policy>(other);
1687template<
typename T, Index Log2Dim>
1688template<MergePolicy Policy>
1696 if (!tileActive)
return;
1699 const Index n = iter.pos();
1700 mBuffer[n] = tileValue;
1701 mValueMask.setOn(n);
1707template<
typename T, Index Log2Dim>
1708template<
typename OtherType>
1715template<
typename T, Index Log2Dim>
1716template<
typename OtherType>
1724template<
typename T, Index Log2Dim>
1725template<
typename OtherType>
1733template<
typename T, Index Log2Dim>
1739 for (
Index i = 0; i < SIZE; ++i) {
1740 mBuffer[i] = -mBuffer[i];
1748template<
typename T, Index Log2Dim>
1749template<
typename CombineOp>
1756 for (
Index i = 0; i < SIZE; ++i) {
1767template<
typename T, Index Log2Dim>
1768template<
typename CombineOp>
1776 for (
Index i = 0; i < SIZE; ++i) {
1788template<
typename T, Index Log2Dim>
1789template<
typename CombineOp,
typename OtherType>
1792 bool valueIsActive, CombineOp& op)
1798 for (
Index i = 0; i < SIZE; ++i) {
1799 op(args.
setARef(other.mBuffer[i])
1807template<
typename T, Index Log2Dim>
1808template<
typename CombineOp,
typename OtherNodeT>
1811 bool valueIsActive, CombineOp& op)
1817 for (
Index i = 0; i < SIZE; ++i) {
1818 op(args.
setBRef(other.mBuffer[i])
1826template<
typename T, Index Log2Dim>
1827template<
typename CombineOp,
typename OtherNodeT>
1834 for (
Index i = 0; i < SIZE; ++i) {
1835 mValueMask.set(i, b0.
valueMask().
isOn(i) || b1.valueMask().isOn(i));
1836 op(args.
setARef(b0.mBuffer[i])
1849template<
typename T, Index Log2Dim>
1853 for (
Index32 i = 0, N = buf.
size(); i < N; ++i) os << buf.mData[i] <<
", ";
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition Types.h:569
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition Types.h:621
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition Types.h:637
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition Types.h:625
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition Types.h:623
bool resultIsActive() const
Definition Types.h:632
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition Types.h:635
Tag dispatch class that distinguishes constructors during file input.
Definition Types.h:689
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition Types.h:683
Axis-aligned bounding box of signed integer coordinates.
Definition Coord.h:252
void translate(const Coord &t)
Translate this bounding box by (tx, ty, tz).
Definition Coord.h:461
void expand(ValueType padding)
Pad this bounding box with the specified padding.
Definition Coord.h:421
const Coord & min() const
Definition Coord.h:324
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition Coord.h:415
const Coord & max() const
Definition Coord.h:325
static CoordBBox inf()
Return an "infinite" bounding box, as defined by the Coord value range.
Definition Coord.h:322
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition Coord.h:403
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition Coord.h:447
void reset()
Definition Coord.h:330
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:26
Int32 ValueType
Definition Coord.h:33
Int32 y() const
Definition Coord.h:132
Int32 x() const
Definition Coord.h:131
Coord & setZ(Int32 z)
Definition Coord.h:82
Coord & setY(Int32 y)
Definition Coord.h:81
Int32 z() const
Definition Coord.h:133
Coord & setX(Int32 x)
Definition Coord.h:80
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:320
static Index size()
Return the number of values contained in this buffer.
Definition LeafBuffer.h:112
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition LeafNode.h:39
void stealNodes(ArrayT &, const ValueType &, bool)
Definition LeafNode.h:713
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:607
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition LeafNode.h:480
static Index64 onTileCount()
Definition LeafNode.h:148
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Definition LeafNode.h:178
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0,...
Definition LeafNode.h:1050
ChildOnCIter cbeginChildOn() const
Definition LeafNode.h:322
SharedPtr< LeafNode > Ptr
Definition LeafNode.h:46
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node.
Definition LeafNode.h:170
NodeMaskType & getValueMask()
Definition LeafNode.h:885
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition LeafNode.h:422
bool isChildMaskOn(Index) const
Definition LeafNode.h:888
ChildOnCIter beginChildOn() const
Definition LeafNode.h:323
ChildOnIter beginChildOn()
Definition LeafNode.h:324
static Index64 nonLeafCount()
Return the non-leaf count for this node, which is zero.
Definition LeafNode.h:138
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:478
ValueOnIter endValueOn()
Definition LeafNode.h:312
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition LeafNode.h:1306
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:1234
bool isChildMaskOff() const
Definition LeafNode.h:890
ValueOffCIter cbeginValueOff() const
Definition LeafNode.h:303
Index32 transientData() const
Return the transient data value.
Definition LeafNode.h:190
static Index32 childCount()
Return the child count for this node, which is zero.
Definition LeafNode.h:140
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:428
static Index getChildDim()
Return the dimension of child nodes of this LeafNode, which is one for voxels.
Definition LeafNode.h:130
bool operator!=(const LeafNode &other) const
Definition LeafNode.h:204
static Index64 leafCount()
Return the leaf count for this node, which is one.
Definition LeafNode.h:132
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:1261
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition LeafNode.h:1075
void setValueMask(const NodeMaskType &mask)
Definition LeafNode.h:887
ChildOnIter endChildOn()
Definition LeafNode.h:334
ValueAllIter endValueAll()
Definition LeafNode.h:318
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition LeafNode.h:723
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:1133
LeafNode * probeLeaf(const Coord &)
Definition LeafNode.h:734
bool isValueMaskOff() const
Definition LeafNode.h:883
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition LeafNode.h:702
bool isValueMaskOn() const
Definition LeafNode.h:881
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:1727
void getNodes(ArrayT &) const
Definition LeafNode.h:712
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition LeafNode.h:475
ValueAllCIter endValueAll() const
Definition LeafNode.h:317
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition LeafNode.h:1583
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:424
Index64 onLeafVoxelCount() const
Definition LeafNode.h:146
ChildOffCIter endChildOff() const
Definition LeafNode.h:336
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition LeafNode.h:1541
bool getValueUnsafe(Index offset, ValueType &value) const
Return true if the voxel at the given offset is active and set value.
Definition LeafNode.h:843
~LeafNode()
Destructor.
Definition LeafNode.h:1020
ValueAllCIter cbeginValueAll() const
Definition LeafNode.h:306
NodeT * probeNode(const Coord &)
Definition LeafNode.h:709
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition LeafNode.h:1298
ValueOnCIter beginValueOn() const
Definition LeafNode.h:301
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition LeafNode.h:899
const Buffer & buffer() const
Definition LeafNode.h:348
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Definition LeafNode.h:736
void setValueMaskOn(Index n)
Definition LeafNode.h:893
void setValueOnlyUnsafe(Index offset, const ValueType &value)
Set the value of the voxel at the given coordinates but don't change its active state.
Definition LeafNode.h:847
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition LeafNode.h:1559
Index64 offLeafVoxelCount() const
Definition LeafNode.h:147
const LeafNode * probeLeaf(const Coord &) const
Definition LeafNode.h:745
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition LeafNode.h:1610
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition LeafNode.h:1639
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition LeafNode.h:173
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition LeafNode.h:176
static Index getValueLevel(const Coord &)
Return the level (i.e., 0) at which leaf node values reside.
Definition LeafNode.h:397
bool isInactive() const
Return true if all of this node's values are inactive.
Definition LeafNode.h:832
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition LeafNode.h:459
bool isValueMaskOff(Index n) const
Definition LeafNode.h:882
ValueOnCIter cendValueOn() const
Definition LeafNode.h:310
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition LeafNode.h:155
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition LeafNode.h:627
static Index numValues()
Return the total number of voxels represented by this LeafNode.
Definition LeafNode.h:124
const ValueType & getValueUnsafe(Index offset) const
Return the value of the voxel at the given offset.
Definition LeafNode.h:841
void setActiveStateUnsafe(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value.
Definition LeafNode.h:845
ValueOffCIter beginValueOff() const
Definition LeafNode.h:304
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:589
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:616
const ValueType & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition LeafNode.h:542
ChildAllCIter cbeginChildAll() const
Definition LeafNode.h:328
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:1718
ChildOffIter endChildOff()
Definition LeafNode.h:337
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition LeafNode.h:1151
ChildAllIter beginChildAll()
Definition LeafNode.h:330
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:430
static Index getLevel()
Return the level of this node, which by definition is zero for LeafNodes.
Definition LeafNode.h:126
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:550
void addLeaf(LeafNode *)
Definition LeafNode.h:703
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:1125
ValueOnIter beginValueOn()
Definition LeafNode.h:302
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:573
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:1710
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Definition LeafNode.h:727
const ValueType & getFirstValue() const
Return a const reference to the first value in the buffer.
Definition LeafNode.h:632
ChildOffCIter cbeginChildOff() const
Definition LeafNode.h:325
ChildOffIter beginChildOff()
Definition LeafNode.h:327
bool isChildMaskOff(Index) const
Definition LeafNode.h:889
Index64 onVoxelCount() const
Return the number of voxels marked On.
Definition LeafNode.h:143
ChildOffCIter beginChildOff() const
Definition LeafNode.h:326
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition LeafNode.h:1040
static Index64 offTileCount()
Definition LeafNode.h:149
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition LeafNode.h:410
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:1497
ValueOffIter endValueOff()
Definition LeafNode.h:315
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition LeafNode.h:412
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Definition LeafNode.h:742
ChildAllCIter endChildAll() const
Definition LeafNode.h:339
void nodeCount(std::vector< Index64 > &) const
no-op
Definition LeafNode.h:134
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Definition LeafNode.h:747
ValueOnCIter cbeginValueOn() const
Definition LeafNode.h:300
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition LeafNode.h:1432
static Index log2dim()
Return log2 of the dimension of this LeafNode, e.g. 3 if dimensions are 8^3.
Definition LeafNode.h:118
void combine(const LeafNode &other, CombineOp &op)
Definition LeafNode.h:1751
static void getNodeLog2Dims(std::vector< Index > &dims)
Append the Log2Dim of this LeafNode to the specified vector.
Definition LeafNode.h:128
ChildOnCIter endChildOn() const
Definition LeafNode.h:333
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition LeafNode.h:740
void setValueOnUnsafe(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition LeafNode.h:849
void setValueOnUnsafe(Index offset, const ValueType &value)
Set the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNode.h:851
ChildOnCIter cendChildOn() const
Definition LeafNode.h:332
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition LeafNode.h:487
ChildAllCIter cendChildAll() const
Definition LeafNode.h:338
Index64 memUsageIfLoaded() const
Definition LeafNode.h:1469
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition LeafNode.h:1791
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:1191
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:452
ChildAllIter endChildAll()
Definition LeafNode.h:340
size_t streamingSize(bool toHalf=false) const
void setValueMask(Index n, bool on)
Definition LeafNode.h:892
const NodeMaskType & valueMask() const
Definition LeafNode.h:886
Index64 offVoxelCount() const
Return the number of voxels marked Off.
Definition LeafNode.h:145
typename NodeMaskType::OffIterator MaskOffIterator
Definition LeafNode.h:208
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:347
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition LeafNode.h:1334
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition LeafNode.h:1505
T BuildType
Definition LeafNode.h:41
ValueAllCIter cendValueAll() const
Definition LeafNode.h:316
friend class LeafNode
Definition LeafNode.h:863
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:495
void negate()
Definition LeafNode.h:1735
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition LeafNode.h:1064
ChildAllCIter beginChildAll() const
Definition LeafNode.h:329
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Definition LeafNode.h:744
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:598
void getOrigin(Coord &origin) const
Definition LeafNode.h:177
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition LeafNode.h:473
void setTransientData(Index32 transientData)
Set the transient data value.
Definition LeafNode.h:192
static Index size()
Return the total number of voxels represented by this LeafNode.
Definition LeafNode.h:122
ChildOffCIter cendChildOff() const
Definition LeafNode.h:335
void skipCompressedValues(bool seekable, std::istream &, bool fromHalf)
Definition LeafNode.h:1318
typename NodeMaskType::OnIterator MaskOnIterator
Definition LeafNode.h:207
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition LeafNode.h:1449
static const Index SIZE
Definition LeafNode.h:54
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition LeafNode.h:1479
bool isEmpty() const
Return true if this node has no active voxels.
Definition LeafNode.h:151
void merge(const LeafNode &)
Definition LeafNode.h:1661
ValueOffIter beginValueOff()
Definition LeafNode.h:305
const NodeT * probeConstNode(const Coord &) const
Definition LeafNode.h:711
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition LeafNode.h:420
Buffer & buffer()
Definition LeafNode.h:349
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:564
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:402
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition LeafNode.h:157
const NodeMaskType & getValueMask() const
Definition LeafNode.h:884
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition LeafNode.h:1627
void addLeafAndCache(LeafNode *, AccessorT &)
Definition LeafNode.h:705
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:438
ValueOffCIter cendValueOff() const
Definition LeafNode.h:313
void setValueMaskOff(Index n)
Definition LeafNode.h:894
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition LeafNode.h:1459
bool isDense() const
Return true if this node contains only active voxels.
Definition LeafNode.h:153
ValueOffCIter endValueOff() const
Definition LeafNode.h:314
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:555
bool isValueOff(const Coord &xyz) const
Return true if the voxel at the given coordinates is inactive.
Definition LeafNode.h:482
std::string str() const
Return a string representation of this node.
Definition LeafNode.h:1027
NodeT * stealNode(const Coord &, const ValueType &, bool)
Definition LeafNode.h:707
void setValueOffUnsafe(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition LeafNode.h:853
T ValueType
Definition LeafNode.h:42
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:1091
ValueOnCIter endValueOn() const
Definition LeafNode.h:311
typename NodeMaskType::DenseIterator MaskDenseIterator
Definition LeafNode.h:209
void voxelizeActiveTiles(bool=true)
No-op.
Definition LeafNode.h:644
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition LeafNode.h:581
bool isValueOff(Index offset) const
Return true if the voxel at the given offset is inactive.
Definition LeafNode.h:484
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Definition LeafNode.h:725
const ValueType & getLastValue() const
Return a const reference to the last value in the buffer.
Definition LeafNode.h:634
ValueAllCIter beginValueAll() const
Definition LeafNode.h:307
static Index dim()
Return the number of voxels in each coordinate dimension.
Definition LeafNode.h:120
void setValueOffUnsafe(Index offset, const ValueType &value)
Set the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNode.h:855
bool isValueMaskOn(Index n) const
Definition LeafNode.h:880
ValueAllIter beginValueAll()
Definition LeafNode.h:308
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:646
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:55
void readCompressedValues(std::istream &is, ValueT *destBuf, Index destCount, const MaskT &valueMask, bool fromHalf)
Definition Compression.h:466
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,...
void readData(std::istream &is, T *data, Index count, uint32_t compression, DelayedLoadMetadata *metadata=nullptr, size_t metadataOffset=size_t(0))
Read data from a stream.
Definition Compression.h:248
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
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition Math.h:443
std::ostream & operator<<(std::ostream &os, const typename LeafNode< T, Log2Dim >::Buffer &buf)
Definition LeafNode.h:1851
Index32 Index
Definition Types.h:54
constexpr T zeroVal()
Return the value of type T that corresponds to zero.
Definition Math.h:70
uint32_t Index32
Definition Types.h:52
@ OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION
Definition version.h.in:262
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:508
@ MERGE_ACTIVE_STATES_AND_NODES
Definition Types.h:509
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:293
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:253
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNode.h:255
ChildIter()
Definition LeafNode.h:254
Definition LeafNode.h:213
Definition LeafNode.h:213
Definition LeafNode.h:262
DenseIter(const MaskDenseIterator &iter, NodeT *parent)
Definition LeafNode.h:267
void unsetItem(Index pos, const ValueT &value) const
Definition LeafNode.h:280
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition LeafNode.h:269
DenseIter()
Definition LeafNode.h:266
typename BaseT::NonConstValueType NonConstValueT
Definition LeafNode.h:264
SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a LeafNod...
Definition LeafNode.h:65
Definition LeafNode.h:212
ValueConverter<T>::Type is the type of a LeafNode having the same dimensions as this node but a diffe...
Definition LeafNode.h:60
Definition LeafNode.h:221
void setValue(const ValueT &value) const
Definition LeafNode.h:236
void modifyValue(const ModifyOp &op) const
Definition LeafNode.h:246
ValueT & getItem(Index pos) const
Definition LeafNode.h:227
void setItem(Index pos, const ValueT &value) const
Definition LeafNode.h:231
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNode.h:225
ValueT & getValue() const
Definition LeafNode.h:228
ValueIter()
Definition LeafNode.h:224
void modifyItem(Index n, const ModifyOp &op) const
Definition LeafNode.h:243
Definition LeafNode.h:212
Definition LeafNode.h:212
Definition LeafNode.h:920
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:218