OpenVDB  7.1.0
PointDataGrid.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
11 
12 #ifndef OPENVDB_POINTS_POINT_DATA_GRID_HAS_BEEN_INCLUDED
13 #define OPENVDB_POINTS_POINT_DATA_GRID_HAS_BEEN_INCLUDED
14 
15 #include <openvdb/version.h>
16 #include <openvdb/Grid.h>
17 #include <openvdb/tree/Tree.h>
18 #include <openvdb/tree/LeafNode.h>
20 #include "AttributeArray.h"
21 #include "AttributeArrayString.h"
22 #include "AttributeGroup.h"
23 #include "AttributeSet.h"
24 #include "StreamCompression.h"
25 #include <cstring> // std::memcpy
26 #include <iostream>
27 #include <limits>
28 #include <memory>
29 #include <type_traits> // std::is_same
30 #include <utility> // std::pair, std::make_pair
31 #include <vector>
32 
33 class TestPointDataLeaf;
34 
35 namespace openvdb {
37 namespace OPENVDB_VERSION_NAME {
38 
39 namespace io
40 {
41 
44 template<>
45 inline void
46 readCompressedValues( std::istream& is, PointDataIndex32* destBuf, Index destCount,
47  const util::NodeMask<3>& /*valueMask*/, bool /*fromHalf*/)
48 {
50 
51  const bool seek = destBuf == nullptr;
52 
53  const size_t destBytes = destCount*sizeof(PointDataIndex32);
54  const size_t maximumBytes = std::numeric_limits<uint16_t>::max();
55  if (destBytes >= maximumBytes) {
56  OPENVDB_THROW(openvdb::IoError, "Cannot read more than " <<
57  maximumBytes << " bytes in voxel values.")
58  }
59 
60  uint16_t bytes16;
61 
63 
64  if (seek && meta) {
65  // buffer size temporarily stored in the StreamMetadata pass
66  // to avoid having to perform an expensive disk read for 2-bytes
67  bytes16 = static_cast<uint16_t>(meta->pass());
68  // seek over size of the compressed buffer
69  is.seekg(sizeof(uint16_t), std::ios_base::cur);
70  }
71  else {
72  // otherwise read from disk
73  is.read(reinterpret_cast<char*>(&bytes16), sizeof(uint16_t));
74  }
75 
76  if (bytes16 == std::numeric_limits<uint16_t>::max()) {
77  // read or seek uncompressed data
78  if (seek) {
79  is.seekg(destBytes, std::ios_base::cur);
80  }
81  else {
82  is.read(reinterpret_cast<char*>(destBuf), destBytes);
83  }
84  }
85  else {
86  // read or seek uncompressed data
87  if (seek) {
88  is.seekg(int(bytes16), std::ios_base::cur);
89  }
90  else {
91  // decompress into the destination buffer
92  std::unique_ptr<char[]> bloscBuffer(new char[int(bytes16)]);
93  is.read(bloscBuffer.get(), bytes16);
94  std::unique_ptr<char[]> buffer = bloscDecompress( bloscBuffer.get(),
95  destBytes,
96  /*resize=*/false);
97  std::memcpy(destBuf, buffer.get(), destBytes);
98  }
99  }
100 }
101 
104 template<>
105 inline void
106 writeCompressedValues( std::ostream& os, PointDataIndex32* srcBuf, Index srcCount,
107  const util::NodeMask<3>& /*valueMask*/,
108  const util::NodeMask<3>& /*childMask*/, bool /*toHalf*/)
109 {
111 
112  const size_t srcBytes = srcCount*sizeof(PointDataIndex32);
113  const size_t maximumBytes = std::numeric_limits<uint16_t>::max();
114  if (srcBytes >= maximumBytes) {
115  OPENVDB_THROW(openvdb::IoError, "Cannot write more than " <<
116  maximumBytes << " bytes in voxel values.")
117  }
118 
119  const char* charBuffer = reinterpret_cast<const char*>(srcBuf);
120 
121  size_t compressedBytes;
122  std::unique_ptr<char[]> buffer = bloscCompress( charBuffer, srcBytes,
123  compressedBytes, /*resize=*/false);
124 
125  if (compressedBytes > 0) {
126  auto bytes16 = static_cast<uint16_t>(compressedBytes); // clamp to 16-bit unsigned integer
127  os.write(reinterpret_cast<const char*>(&bytes16), sizeof(uint16_t));
128  os.write(reinterpret_cast<const char*>(buffer.get()), compressedBytes);
129  }
130  else {
131  auto bytes16 = static_cast<uint16_t>(maximumBytes); // max value indicates uncompressed
132  os.write(reinterpret_cast<const char*>(&bytes16), sizeof(uint16_t));
133  os.write(reinterpret_cast<const char*>(srcBuf), srcBytes);
134  }
135 }
136 
137 template <typename T>
138 inline void
139 writeCompressedValuesSize(std::ostream& os, const T* srcBuf, Index srcCount)
140 {
142 
143  const size_t srcBytes = srcCount*sizeof(T);
144  const size_t maximumBytes = std::numeric_limits<uint16_t>::max();
145  if (srcBytes >= maximumBytes) {
146  OPENVDB_THROW(openvdb::IoError, "Cannot write more than " <<
147  maximumBytes << " bytes in voxel values.")
148  }
149 
150  const char* charBuffer = reinterpret_cast<const char*>(srcBuf);
151 
152  // calculate voxel buffer size after compression
153  size_t compressedBytes = bloscCompressedSize(charBuffer, srcBytes);
154 
155  if (compressedBytes > 0) {
156  auto bytes16 = static_cast<uint16_t>(compressedBytes); // clamp to 16-bit unsigned integer
157  os.write(reinterpret_cast<const char*>(&bytes16), sizeof(uint16_t));
158  }
159  else {
160  auto bytes16 = static_cast<uint16_t>(maximumBytes); // max value indicates uncompressed
161  os.write(reinterpret_cast<const char*>(&bytes16), sizeof(uint16_t));
162  }
163 }
164 
165 } // namespace io
166 
167 
168 // forward declaration
169 namespace tree {
170  template<Index, typename> struct SameLeafConfig;
171 }
172 
173 
175 
176 
177 namespace points {
178 
179 
180 // forward declaration
181 template<typename T, Index Log2Dim> class PointDataLeafNode;
182 
186 
187 
190 
191 
199 template <typename PointDataTreeT>
200 inline AttributeSet::Descriptor::Ptr
201 makeDescriptorUnique(PointDataTreeT& tree);
202 
203 
213 template <typename PointDataTreeT>
214 inline void
215 setStreamingMode(PointDataTreeT& tree, bool on = true);
216 
217 
224 template <typename PointDataTreeT>
225 inline void
226 prefetch(PointDataTreeT& tree, bool position = true, bool otherAttributes = true);
227 
228 
230 
231 
232 template <typename T, Index Log2Dim>
233 class PointDataLeafNode : public tree::LeafNode<T, Log2Dim>, io::MultiPass {
234 
235 public:
237  using Ptr = std::shared_ptr<PointDataLeafNode>;
238 
239  using ValueType = T;
240  using ValueTypePair = std::pair<ValueType, ValueType>;
241  using IndexArray = std::vector<ValueType>;
242 
243  using Descriptor = AttributeSet::Descriptor;
244 
246 
247  // The following methods had to be copied from the LeafNode class
248  // to make the derived PointDataLeafNode class compatible with the tree structure.
249 
252 
253  using BaseLeaf::LOG2DIM;
254  using BaseLeaf::TOTAL;
255  using BaseLeaf::DIM;
256  using BaseLeaf::NUM_VALUES;
257  using BaseLeaf::NUM_VOXELS;
258  using BaseLeaf::SIZE;
259  using BaseLeaf::LEVEL;
260 
263  : mAttributeSet(new AttributeSet) { }
264 
265  ~PointDataLeafNode() = default;
266 
268  explicit PointDataLeafNode(const PointDataLeafNode& other)
269  : BaseLeaf(other)
270  , mAttributeSet(new AttributeSet(*other.mAttributeSet)) { }
271 
273  explicit
274  PointDataLeafNode(const Coord& coords, const T& value = zeroVal<T>(), bool active = false)
275  : BaseLeaf(coords, zeroVal<T>(), active)
276  , mAttributeSet(new AttributeSet) { assertNonModifiableUnlessZero(value); }
277 
280  PointDataLeafNode(const PointDataLeafNode& other, const Coord& coords,
281  const T& value = zeroVal<T>(), bool active = false)
282  : BaseLeaf(coords, zeroVal<T>(), active)
283  , mAttributeSet(new AttributeSet(*other.mAttributeSet))
284  {
285  assertNonModifiableUnlessZero(value);
286  }
287 
288  // Copy-construct from a PointIndexLeafNode with the same configuration but a different ValueType.
289  template<typename OtherValueType>
291  : BaseLeaf(other)
292  , mAttributeSet(new AttributeSet) { }
293 
294  // Copy-construct from a LeafNode with the same configuration but a different ValueType.
295  // Used for topology copies - explicitly sets the value (background) to zeroVal
296  template <typename ValueType>
298  : BaseLeaf(other, zeroVal<T>(), TopologyCopy())
299  , mAttributeSet(new AttributeSet) { assertNonModifiableUnlessZero(value); }
300 
301  // Copy-construct from a LeafNode with the same configuration but a different ValueType.
302  // Used for topology copies - explicitly sets the on and off value (background) to zeroVal
303  template <typename ValueType>
304  PointDataLeafNode(const tree::LeafNode<ValueType, Log2Dim>& other, const T& /*offValue*/, const T& /*onValue*/, TopologyCopy)
305  : BaseLeaf(other, zeroVal<T>(), zeroVal<T>(), TopologyCopy())
306  , mAttributeSet(new AttributeSet) { }
307 
309  const T& value = zeroVal<T>(), bool active = false)
310  : BaseLeaf(PartialCreate(), coords, value, active)
311  , mAttributeSet(new AttributeSet) { assertNonModifiableUnlessZero(value); }
312 
313 public:
314 
316  const AttributeSet& attributeSet() const { return *mAttributeSet; }
317 
319  AttributeSet::UniquePtr stealAttributeSet();
320 
322  void initializeAttributes(const Descriptor::Ptr& descriptor, const Index arrayLength,
323  const AttributeArray::ScopedRegistryLock* lock = nullptr);
325  void clearAttributes(const bool updateValueMask = true,
326  const AttributeArray::ScopedRegistryLock* lock = nullptr);
327 
330  bool hasAttribute(const size_t pos) const;
333  bool hasAttribute(const Name& attributeName) const;
334 
343  AttributeArray::Ptr appendAttribute(const Descriptor& expected, Descriptor::Ptr& replacement,
344  const size_t pos, const Index strideOrTotalSize = 1,
345  const bool constantStride = true,
346  const Metadata* metadata = nullptr,
347  const AttributeArray::ScopedRegistryLock* lock = nullptr);
348 
350  AttributeArray::Ptr appendAttribute(const Descriptor& expected, Descriptor::Ptr& replacement,
351  const size_t pos, const Index strideOrTotalSize,
352  const bool constantStride,
354 
359  void dropAttributes(const std::vector<size_t>& pos,
360  const Descriptor& expected, Descriptor::Ptr& replacement);
363  void reorderAttributes(const Descriptor::Ptr& replacement);
367  void renameAttributes(const Descriptor& expected, Descriptor::Ptr& replacement);
369  void compactAttributes();
370 
376  void replaceAttributeSet(AttributeSet* attributeSet, bool allowMismatchingDescriptors = false);
377 
380  void resetDescriptor(const Descriptor::Ptr& replacement);
381 
385  void setOffsets(const std::vector<ValueType>& offsets, const bool updateValueMask = true);
386 
389  void validateOffsets() const;
390 
396  AttributeArray& attributeArray(const size_t pos);
397  const AttributeArray& attributeArray(const size_t pos) const;
398  const AttributeArray& constAttributeArray(const size_t pos) const;
405  AttributeArray& attributeArray(const Name& attributeName);
406  const AttributeArray& attributeArray(const Name& attributeName) const;
407  const AttributeArray& constAttributeArray(const Name& attributeName) const;
409 
411  GroupHandle groupHandle(const AttributeSet::Descriptor::GroupIndex& index) const;
413  GroupHandle groupHandle(const Name& group) const;
415  GroupWriteHandle groupWriteHandle(const AttributeSet::Descriptor::GroupIndex& index);
417  GroupWriteHandle groupWriteHandle(const Name& name);
418 
420  Index64 pointCount() const;
422  Index64 onPointCount() const;
424  Index64 offPointCount() const;
426  Index64 groupPointCount(const Name& groupName) const;
427 
429  void updateValueMask();
430 
432 
433  void setOffsetOn(Index offset, const ValueType& val);
434  void setOffsetOnly(Index offset, const ValueType& val);
435 
438  template<typename OtherType, Index OtherLog2Dim>
440  return BaseLeaf::hasSameTopology(other);
441  }
442 
445  bool operator==(const PointDataLeafNode& other) const {
446  if(BaseLeaf::operator==(other) != true) return false;
447  return (*this->mAttributeSet == *other.mAttributeSet);
448  }
449 
450  bool operator!=(const PointDataLeafNode& other) const { return !(other == *this); }
451 
453  template<typename AccessorT>
454  void addLeafAndCache(PointDataLeafNode*, AccessorT&) {}
455 
457  PointDataLeafNode* touchLeaf(const Coord&) { return this; }
459  template<typename AccessorT>
460  PointDataLeafNode* touchLeafAndCache(const Coord&, AccessorT&) { return this; }
461 
462  template<typename NodeT, typename AccessorT>
463  NodeT* probeNodeAndCache(const Coord&, AccessorT&)
464  {
466  if (!(std::is_same<NodeT,PointDataLeafNode>::value)) return nullptr;
467  return reinterpret_cast<NodeT*>(this);
469  }
470  PointDataLeafNode* probeLeaf(const Coord&) { return this; }
471  template<typename AccessorT>
472  PointDataLeafNode* probeLeafAndCache(const Coord&, AccessorT&) { return this; }
474 
476  const PointDataLeafNode* probeConstLeaf(const Coord&) const { return this; }
478  template<typename AccessorT>
479  const PointDataLeafNode* probeConstLeafAndCache(const Coord&, AccessorT&) const { return this; }
480  template<typename AccessorT>
481  const PointDataLeafNode* probeLeafAndCache(const Coord&, AccessorT&) const { return this; }
482  const PointDataLeafNode* probeLeaf(const Coord&) const { return this; }
483  template<typename NodeT, typename AccessorT>
484  const NodeT* probeConstNodeAndCache(const Coord&, AccessorT&) const
485  {
487  if (!(std::is_same<NodeT,PointDataLeafNode>::value)) return nullptr;
488  return reinterpret_cast<const NodeT*>(this);
490  }
492 
493  // I/O methods
494 
495  void readTopology(std::istream& is, bool fromHalf = false);
496  void writeTopology(std::ostream& os, bool toHalf = false) const;
497 
498  Index buffers() const;
499 
500  void readBuffers(std::istream& is, bool fromHalf = false);
501  void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false);
502  void writeBuffers(std::ostream& os, bool toHalf = false) const;
503 
504 
505  Index64 memUsage() const;
506 
507  void evalActiveBoundingBox(CoordBBox& bbox, bool visitVoxels = true) const;
508 
511  CoordBBox getNodeBoundingBox() const;
512 
514 
515  // Disable all write methods to avoid unintentional changes
516  // to the point-array offsets.
517 
519  assert(false && "Cannot modify voxel values in a PointDataTree.");
520  }
521 
522  // some methods silently ignore attempts to modify the
523  // point-array offsets if a zero value is used
524 
526  if (value != zeroVal<T>()) this->assertNonmodifiable();
527  }
528 
529  void setActiveState(const Coord& xyz, bool on) { BaseLeaf::setActiveState(xyz, on); }
530  void setActiveState(Index offset, bool on) { BaseLeaf::setActiveState(offset, on); }
531 
532  void setValueOnly(const Coord&, const ValueType&) { assertNonmodifiable(); }
533  void setValueOnly(Index, const ValueType&) { assertNonmodifiable(); }
534 
535  void setValueOff(const Coord& xyz) { BaseLeaf::setValueOff(xyz); }
536  void setValueOff(Index offset) { BaseLeaf::setValueOff(offset); }
537 
538  void setValueOff(const Coord&, const ValueType&) { assertNonmodifiable(); }
539  void setValueOff(Index, const ValueType&) { assertNonmodifiable(); }
540 
541  void setValueOn(const Coord& xyz) { BaseLeaf::setValueOn(xyz); }
542  void setValueOn(Index offset) { BaseLeaf::setValueOn(offset); }
543 
544  void setValueOn(const Coord&, const ValueType&) { assertNonmodifiable(); }
545  void setValueOn(Index, const ValueType&) { assertNonmodifiable(); }
546 
547  void setValue(const Coord&, const ValueType&) { assertNonmodifiable(); }
548 
549  void setValuesOn() { BaseLeaf::setValuesOn(); }
550  void setValuesOff() { BaseLeaf::setValuesOff(); }
551 
552  template<typename ModifyOp>
553  void modifyValue(Index, const ModifyOp&) { assertNonmodifiable(); }
554 
555  template<typename ModifyOp>
556  void modifyValue(const Coord&, const ModifyOp&) { assertNonmodifiable(); }
557 
558  template<typename ModifyOp>
559  void modifyValueAndActiveState(const Coord&, const ModifyOp&) { assertNonmodifiable(); }
560 
561  // clipping is not yet supported
562  void clip(const CoordBBox&, const ValueType& value) { assertNonModifiableUnlessZero(value); }
563 
564  void fill(const CoordBBox&, const ValueType&, bool);
565  void fill(const ValueType& value) { assertNonModifiableUnlessZero(value); }
566  void fill(const ValueType&, bool);
567 
568  template<typename AccessorT>
569  void setValueOnlyAndCache(const Coord&, const ValueType&, AccessorT&) {assertNonmodifiable();}
570 
571  template<typename ModifyOp, typename AccessorT>
572  void modifyValueAndActiveStateAndCache(const Coord&, const ModifyOp&, AccessorT&) {
573  assertNonmodifiable();
574  }
575 
576  template<typename AccessorT>
577  void setValueOffAndCache(const Coord&, const ValueType&, AccessorT&) { assertNonmodifiable(); }
578 
579  template<typename AccessorT>
580  void setActiveStateAndCache(const Coord& xyz, bool on, AccessorT& parent) {
581  BaseLeaf::setActiveStateAndCache(xyz, on, parent);
582  }
583 
584  void resetBackground(const ValueType&, const ValueType& newBackground) {
585  assertNonModifiableUnlessZero(newBackground);
586  }
587 
588  void signedFloodFill(const ValueType&) { assertNonmodifiable(); }
589  void signedFloodFill(const ValueType&, const ValueType&) { assertNonmodifiable(); }
590 
591  void negate() { assertNonmodifiable(); }
592 
593  friend class ::TestPointDataLeaf;
594 
595  using ValueOn = typename BaseLeaf::ValueOn;
596  using ValueOff = typename BaseLeaf::ValueOff;
597  using ValueAll = typename BaseLeaf::ValueAll;
598 
599 private:
600  AttributeSet::UniquePtr mAttributeSet;
601  uint16_t mVoxelBufferSize = 0;
602 
603 protected:
604  using ChildOn = typename BaseLeaf::ChildOn;
605  using ChildOff = typename BaseLeaf::ChildOff;
606  using ChildAll = typename BaseLeaf::ChildAll;
607 
611 
612  // During topology-only construction, access is needed
613  // to protected/private members of other template instances.
614  template<typename, Index> friend class PointDataLeafNode;
615 
619 
620 public:
622  ValueVoxelCIter beginValueVoxel(const Coord& ijk) const;
623 
624 public:
625 
626  using ValueOnIter = typename BaseLeaf::template ValueIter<
628  using ValueOnCIter = typename BaseLeaf::template ValueIter<
630  using ValueOffIter = typename BaseLeaf::template ValueIter<
632  using ValueOffCIter = typename BaseLeaf::template ValueIter<
634  using ValueAllIter = typename BaseLeaf::template ValueIter<
636  using ValueAllCIter = typename BaseLeaf::template ValueIter<
638  using ChildOnIter = typename BaseLeaf::template ChildIter<
640  using ChildOnCIter = typename BaseLeaf::template ChildIter<
642  using ChildOffIter = typename BaseLeaf::template ChildIter<
644  using ChildOffCIter = typename BaseLeaf::template ChildIter<
646  using ChildAllIter = typename BaseLeaf::template DenseIter<
648  using ChildAllCIter = typename BaseLeaf::template DenseIter<
649  const PointDataLeafNode, const ValueType, ChildAll>;
650 
655 
658  {
659  NullFilter filter;
660  return this->beginIndex<ValueAllCIter, NullFilter>(filter);
661  }
663  {
664  NullFilter filter;
665  return this->beginIndex<ValueOnCIter, NullFilter>(filter);
666  }
668  {
669  NullFilter filter;
670  return this->beginIndex<ValueOffCIter, NullFilter>(filter);
671  }
672 
673  template<typename IterT, typename FilterT>
674  IndexIter<IterT, FilterT> beginIndex(const FilterT& filter) const;
675 
677  template<typename FilterT>
679  {
680  return this->beginIndex<ValueAllCIter, FilterT>(filter);
681  }
682  template<typename FilterT>
683  IndexIter<ValueOnCIter, FilterT> beginIndexOn(const FilterT& filter) const
684  {
685  return this->beginIndex<ValueOnCIter, FilterT>(filter);
686  }
687  template<typename FilterT>
689  {
690  return this->beginIndex<ValueOffCIter, FilterT>(filter);
691  }
692 
694  IndexVoxelIter beginIndexVoxel(const Coord& ijk) const;
695 
697  template<typename FilterT>
698  IndexIter<ValueVoxelCIter, FilterT> beginIndexVoxel(const Coord& ijk, const FilterT& filter) const;
699 
700 #define VMASK_ this->getValueMask()
701  ValueOnCIter cbeginValueOn() const { return ValueOnCIter(VMASK_.beginOn(), this); }
702  ValueOnCIter beginValueOn() const { return ValueOnCIter(VMASK_.beginOn(), this); }
703  ValueOnIter beginValueOn() { return ValueOnIter(VMASK_.beginOn(), this); }
704  ValueOffCIter cbeginValueOff() const { return ValueOffCIter(VMASK_.beginOff(), this); }
705  ValueOffCIter beginValueOff() const { return ValueOffCIter(VMASK_.beginOff(), this); }
706  ValueOffIter beginValueOff() { return ValueOffIter(VMASK_.beginOff(), this); }
707  ValueAllCIter cbeginValueAll() const { return ValueAllCIter(VMASK_.beginDense(), this); }
708  ValueAllCIter beginValueAll() const { return ValueAllCIter(VMASK_.beginDense(), this); }
709  ValueAllIter beginValueAll() { return ValueAllIter(VMASK_.beginDense(), this); }
710 
711  ValueOnCIter cendValueOn() const { return ValueOnCIter(VMASK_.endOn(), this); }
712  ValueOnCIter endValueOn() const { return ValueOnCIter(VMASK_.endOn(), this); }
713  ValueOnIter endValueOn() { return ValueOnIter(VMASK_.endOn(), this); }
714  ValueOffCIter cendValueOff() const { return ValueOffCIter(VMASK_.endOff(), this); }
715  ValueOffCIter endValueOff() const { return ValueOffCIter(VMASK_.endOff(), this); }
716  ValueOffIter endValueOff() { return ValueOffIter(VMASK_.endOff(), this); }
717  ValueAllCIter cendValueAll() const { return ValueAllCIter(VMASK_.endDense(), this); }
718  ValueAllCIter endValueAll() const { return ValueAllCIter(VMASK_.endDense(), this); }
719  ValueAllIter endValueAll() { return ValueAllIter(VMASK_.endDense(), this); }
720 
721  ChildOnCIter cbeginChildOn() const { return ChildOnCIter(VMASK_.endOn(), this); }
722  ChildOnCIter beginChildOn() const { return ChildOnCIter(VMASK_.endOn(), this); }
723  ChildOnIter beginChildOn() { return ChildOnIter(VMASK_.endOn(), this); }
724  ChildOffCIter cbeginChildOff() const { return ChildOffCIter(VMASK_.endOff(), this); }
725  ChildOffCIter beginChildOff() const { return ChildOffCIter(VMASK_.endOff(), this); }
726  ChildOffIter beginChildOff() { return ChildOffIter(VMASK_.endOff(), this); }
727  ChildAllCIter cbeginChildAll() const { return ChildAllCIter(VMASK_.beginDense(), this); }
728  ChildAllCIter beginChildAll() const { return ChildAllCIter(VMASK_.beginDense(), this); }
729  ChildAllIter beginChildAll() { return ChildAllIter(VMASK_.beginDense(), this); }
730 
731  ChildOnCIter cendChildOn() const { return ChildOnCIter(VMASK_.endOn(), this); }
732  ChildOnCIter endChildOn() const { return ChildOnCIter(VMASK_.endOn(), this); }
733  ChildOnIter endChildOn() { return ChildOnIter(VMASK_.endOn(), this); }
734  ChildOffCIter cendChildOff() const { return ChildOffCIter(VMASK_.endOff(), this); }
735  ChildOffCIter endChildOff() const { return ChildOffCIter(VMASK_.endOff(), this); }
736  ChildOffIter endChildOff() { return ChildOffIter(VMASK_.endOff(), this); }
737  ChildAllCIter cendChildAll() const { return ChildAllCIter(VMASK_.endDense(), this); }
738  ChildAllCIter endChildAll() const { return ChildAllCIter(VMASK_.endDense(), this); }
739  ChildAllIter endChildAll() { return ChildAllIter(VMASK_.endDense(), this); }
740 #undef VMASK_
741 }; // struct PointDataLeafNode
742 
744 
745 // PointDataLeafNode implementation
746 
747 template<typename T, Index Log2Dim>
748 inline AttributeSet::UniquePtr
750 {
751  AttributeSet::UniquePtr ptr = std::make_unique<AttributeSet>();
752  std::swap(ptr, mAttributeSet);
753  return ptr;
754 }
755 
756 template<typename T, Index Log2Dim>
757 inline void
758 PointDataLeafNode<T, Log2Dim>::initializeAttributes(const Descriptor::Ptr& descriptor, const Index arrayLength,
760 {
761  if (descriptor->size() != 1 ||
762  descriptor->find("P") == AttributeSet::INVALID_POS ||
763  descriptor->valueType(0) != typeNameAsString<Vec3f>())
764  {
765  OPENVDB_THROW(IndexError, "Initializing attributes only allowed with one Vec3f position attribute.");
766  }
767 
768  mAttributeSet.reset(new AttributeSet(descriptor, arrayLength, lock));
769 }
770 
771 template<typename T, Index Log2Dim>
772 inline void
775 {
776  mAttributeSet.reset(new AttributeSet(*mAttributeSet, 0, lock));
777 
778  // zero voxel values
779 
780  this->buffer().fill(ValueType(0));
781 
782  // if updateValueMask, also de-activate all voxels
783 
784  if (updateValueMask) this->setValuesOff();
785 }
786 
787 template<typename T, Index Log2Dim>
788 inline bool
790 {
791  return pos < mAttributeSet->size();
792 }
793 
794 template<typename T, Index Log2Dim>
795 inline bool
797 {
798  const size_t pos = mAttributeSet->find(attributeName);
799  return pos != AttributeSet::INVALID_POS;
800 }
801 
802 template<typename T, Index Log2Dim>
803 inline AttributeArray::Ptr
804 PointDataLeafNode<T, Log2Dim>::appendAttribute( const Descriptor& expected, Descriptor::Ptr& replacement,
805  const size_t pos, const Index strideOrTotalSize,
806  const bool constantStride,
807  const Metadata* metadata,
809 {
810  return mAttributeSet->appendAttribute(
811  expected, replacement, pos, strideOrTotalSize, constantStride, metadata, lock);
812 }
813 
814 // deprecated
815 template<typename T, Index Log2Dim>
816 inline AttributeArray::Ptr
817 PointDataLeafNode<T, Log2Dim>::appendAttribute( const Descriptor& expected, Descriptor::Ptr& replacement,
818  const size_t pos, const Index strideOrTotalSize,
819  const bool constantStride,
821 {
822  return this->appendAttribute(expected, replacement, pos,
823  strideOrTotalSize, constantStride, nullptr, lock);
824 }
825 
826 template<typename T, Index Log2Dim>
827 inline void
828 PointDataLeafNode<T, Log2Dim>::dropAttributes(const std::vector<size_t>& pos,
829  const Descriptor& expected, Descriptor::Ptr& replacement)
830 {
831  mAttributeSet->dropAttributes(pos, expected, replacement);
832 }
833 
834 template<typename T, Index Log2Dim>
835 inline void
836 PointDataLeafNode<T, Log2Dim>::reorderAttributes(const Descriptor::Ptr& replacement)
837 {
838  mAttributeSet->reorderAttributes(replacement);
839 }
840 
841 template<typename T, Index Log2Dim>
842 inline void
843 PointDataLeafNode<T, Log2Dim>::renameAttributes(const Descriptor& expected, Descriptor::Ptr& replacement)
844 {
845  mAttributeSet->renameAttributes(expected, replacement);
846 }
847 
848 template<typename T, Index Log2Dim>
849 inline void
851 {
852  for (size_t i = 0; i < mAttributeSet->size(); i++) {
853  AttributeArray* array = mAttributeSet->get(i);
854  array->compact();
855  }
856 }
857 
858 template<typename T, Index Log2Dim>
859 inline void
860 PointDataLeafNode<T, Log2Dim>::replaceAttributeSet(AttributeSet* attributeSet, bool allowMismatchingDescriptors)
861 {
862  if (!attributeSet) {
863  OPENVDB_THROW(ValueError, "Cannot replace with a null attribute set");
864  }
865 
866  if (!allowMismatchingDescriptors && mAttributeSet->descriptor() != attributeSet->descriptor()) {
867  OPENVDB_THROW(ValueError, "Attribute set descriptors are not equal.");
868  }
869 
870  mAttributeSet.reset(attributeSet);
871 }
872 
873 template<typename T, Index Log2Dim>
874 inline void
875 PointDataLeafNode<T, Log2Dim>::resetDescriptor(const Descriptor::Ptr& replacement)
876 {
877  mAttributeSet->resetDescriptor(replacement);
878 }
879 
880 template<typename T, Index Log2Dim>
881 inline void
882 PointDataLeafNode<T, Log2Dim>::setOffsets(const std::vector<ValueType>& offsets, const bool updateValueMask)
883 {
884  if (offsets.size() != LeafNodeType::NUM_VALUES) {
885  OPENVDB_THROW(ValueError, "Offset vector size doesn't match number of voxels.")
886  }
887 
888  for (Index index = 0; index < offsets.size(); ++index) {
889  setOffsetOnly(index, offsets[index]);
890  }
891 
892  if (updateValueMask) this->updateValueMask();
893 }
894 
895 template<typename T, Index Log2Dim>
896 inline void
898 {
899  // Ensure all of the offset values are monotonically increasing
900  for (Index index = 1; index < BaseLeaf::SIZE; ++index) {
901  if (this->getValue(index-1) > this->getValue(index)) {
902  OPENVDB_THROW(ValueError, "Voxel offset values are not monotonically increasing");
903  }
904  }
905 
906  // Ensure all attribute arrays are of equal length
907  for (size_t attributeIndex = 1; attributeIndex < mAttributeSet->size(); ++attributeIndex ) {
908  if (mAttributeSet->getConst(attributeIndex-1)->size() != mAttributeSet->getConst(attributeIndex)->size()) {
909  OPENVDB_THROW(ValueError, "Attribute arrays have inconsistent length");
910  }
911  }
912 
913  // Ensure the last voxel's offset value matches the size of each attribute array
914  if (mAttributeSet->size() > 0 && this->getValue(BaseLeaf::SIZE-1) != mAttributeSet->getConst(0)->size()) {
915  OPENVDB_THROW(ValueError, "Last voxel offset value does not match attribute array length");
916  }
917 }
918 
919 template<typename T, Index Log2Dim>
920 inline AttributeArray&
922 {
923  if (pos >= mAttributeSet->size()) OPENVDB_THROW(LookupError, "Attribute Out Of Range - " << pos);
924  return *mAttributeSet->get(pos);
925 }
926 
927 template<typename T, Index Log2Dim>
928 inline const AttributeArray&
930 {
931  if (pos >= mAttributeSet->size()) OPENVDB_THROW(LookupError, "Attribute Out Of Range - " << pos);
932  return *mAttributeSet->getConst(pos);
933 }
934 
935 template<typename T, Index Log2Dim>
936 inline const AttributeArray&
938 {
939  return this->attributeArray(pos);
940 }
941 
942 template<typename T, Index Log2Dim>
943 inline AttributeArray&
945 {
946  const size_t pos = mAttributeSet->find(attributeName);
947  if (pos == AttributeSet::INVALID_POS) OPENVDB_THROW(LookupError, "Attribute Not Found - " << attributeName);
948  return *mAttributeSet->get(pos);
949 }
950 
951 template<typename T, Index Log2Dim>
952 inline const AttributeArray&
954 {
955  const size_t pos = mAttributeSet->find(attributeName);
956  if (pos == AttributeSet::INVALID_POS) OPENVDB_THROW(LookupError, "Attribute Not Found - " << attributeName);
957  return *mAttributeSet->getConst(pos);
958 }
959 
960 template<typename T, Index Log2Dim>
961 inline const AttributeArray&
963 {
964  return this->attributeArray(attributeName);
965 }
966 
967 template<typename T, Index Log2Dim>
968 inline GroupHandle
969 PointDataLeafNode<T, Log2Dim>::groupHandle(const AttributeSet::Descriptor::GroupIndex& index) const
970 {
971  const AttributeArray& array = this->attributeArray(index.first);
972  assert(isGroup(array));
973 
974  const GroupAttributeArray& groupArray = GroupAttributeArray::cast(array);
975 
976  return GroupHandle(groupArray, index.second);
977 }
978 
979 template<typename T, Index Log2Dim>
980 inline GroupHandle
982 {
983  const AttributeSet::Descriptor::GroupIndex index = this->attributeSet().groupIndex(name);
984  return this->groupHandle(index);
985 }
986 
987 template<typename T, Index Log2Dim>
988 inline GroupWriteHandle
989 PointDataLeafNode<T, Log2Dim>::groupWriteHandle(const AttributeSet::Descriptor::GroupIndex& index)
990 {
991  AttributeArray& array = this->attributeArray(index.first);
992  assert(isGroup(array));
993 
994  GroupAttributeArray& groupArray = GroupAttributeArray::cast(array);
995 
996  return GroupWriteHandle(groupArray, index.second);
997 }
998 
999 template<typename T, Index Log2Dim>
1000 inline GroupWriteHandle
1002 {
1003  const AttributeSet::Descriptor::GroupIndex index = this->attributeSet().groupIndex(name);
1004  return this->groupWriteHandle(index);
1005 }
1006 
1007 template<typename T, Index Log2Dim>
1008 template<typename ValueIterT, typename FilterT>
1010 PointDataLeafNode<T, Log2Dim>::beginIndex(const FilterT& filter) const
1011 {
1012  // generate no-op iterator if filter evaluates no indices
1013 
1014  if (filter.state() == index::NONE) {
1015  return IndexIter<ValueIterT, FilterT>(ValueIterT(), filter);
1016  }
1017 
1018  // copy filter to ensure thread-safety
1019 
1020  FilterT newFilter(filter);
1021  newFilter.reset(*this);
1022 
1023  using IterTraitsT = tree::IterTraits<LeafNodeType, ValueIterT>;
1024 
1025  // construct the value iterator and reset the filter to use this leaf
1026 
1027  ValueIterT valueIter = IterTraitsT::begin(*this);
1028 
1029  return IndexIter<ValueIterT, FilterT>(valueIter, newFilter);
1030 }
1031 
1032 template<typename T, Index Log2Dim>
1033 inline ValueVoxelCIter
1035 {
1036  const Index index = LeafNodeType::coordToOffset(ijk);
1037  assert(index < BaseLeaf::SIZE);
1038  const ValueType end = this->getValue(index);
1039  const ValueType start = (index == 0) ? ValueType(0) : this->getValue(index - 1);
1040  return ValueVoxelCIter(start, end);
1041 }
1042 
1043 template<typename T, Index Log2Dim>
1046 {
1047  ValueVoxelCIter iter = this->beginValueVoxel(ijk);
1048  return IndexVoxelIter(iter, NullFilter());
1049 }
1050 
1051 template<typename T, Index Log2Dim>
1052 template<typename FilterT>
1054 PointDataLeafNode<T, Log2Dim>::beginIndexVoxel(const Coord& ijk, const FilterT& filter) const
1055 {
1056  ValueVoxelCIter iter = this->beginValueVoxel(ijk);
1057  FilterT newFilter(filter);
1058  newFilter.reset(*this);
1059  return IndexIter<ValueVoxelCIter, FilterT>(iter, newFilter);
1060 }
1061 
1062 template<typename T, Index Log2Dim>
1063 inline Index64
1065 {
1066  return this->getLastValue();
1067 }
1068 
1069 template<typename T, Index Log2Dim>
1070 inline Index64
1072 {
1073  if (this->isEmpty()) return 0;
1074  else if (this->isDense()) return this->pointCount();
1075  return iterCount(this->beginIndexOn());
1076 }
1077 
1078 template<typename T, Index Log2Dim>
1079 inline Index64
1081 {
1082  if (this->isEmpty()) return this->pointCount();
1083  else if (this->isDense()) return 0;
1084  return iterCount(this->beginIndexOff());
1085 }
1086 
1087 template<typename T, Index Log2Dim>
1088 inline Index64
1090 {
1091  if (!this->attributeSet().descriptor().hasGroup(groupName)) {
1092  return Index64(0);
1093  }
1094  GroupFilter filter(groupName, this->attributeSet());
1095  if (filter.state() == index::ALL) {
1096  return this->pointCount();
1097  } else {
1098  return iterCount(this->beginIndexAll(filter));
1099  }
1100 }
1101 
1102 template<typename T, Index Log2Dim>
1103 inline void
1105 {
1106  ValueType start = 0, end = 0;
1107  for (Index n = 0; n < LeafNodeType::NUM_VALUES; n++) {
1108  end = this->getValue(n);
1109  this->setValueMask(n, (end - start) > 0);
1110  start = end;
1111  }
1112 }
1113 
1114 template<typename T, Index Log2Dim>
1115 inline void
1117 {
1118  this->buffer().setValue(offset, val);
1119  this->setValueMaskOn(offset);
1120 }
1121 
1122 template<typename T, Index Log2Dim>
1123 inline void
1125 {
1126  this->buffer().setValue(offset, val);
1127 }
1128 
1129 template<typename T, Index Log2Dim>
1130 inline void
1131 PointDataLeafNode<T, Log2Dim>::readTopology(std::istream& is, bool fromHalf)
1132 {
1133  BaseLeaf::readTopology(is, fromHalf);
1134 }
1135 
1136 template<typename T, Index Log2Dim>
1137 inline void
1138 PointDataLeafNode<T, Log2Dim>::writeTopology(std::ostream& os, bool toHalf) const
1139 {
1140  BaseLeaf::writeTopology(os, toHalf);
1141 }
1142 
1143 template<typename T, Index Log2Dim>
1144 inline Index
1146 {
1147  return Index( /*voxel buffer sizes*/ 1 +
1148  /*voxel buffers*/ 1 +
1149  /*attribute metadata*/ 1 +
1150  /*attribute uniform values*/ mAttributeSet->size() +
1151  /*attribute buffers*/ mAttributeSet->size() +
1152  /*cleanup*/ 1);
1153 }
1154 
1155 template<typename T, Index Log2Dim>
1156 inline void
1157 PointDataLeafNode<T, Log2Dim>::readBuffers(std::istream& is, bool fromHalf)
1158 {
1159  this->readBuffers(is, CoordBBox::inf(), fromHalf);
1160 }
1161 
1162 template<typename T, Index Log2Dim>
1163 inline void
1164 PointDataLeafNode<T, Log2Dim>::readBuffers(std::istream& is, const CoordBBox& /*bbox*/, bool fromHalf)
1165 {
1166  struct Local
1167  {
1168  static void destroyPagedStream(const io::StreamMetadata::AuxDataMap& auxData, const Index index)
1169  {
1170  // if paged stream exists, delete it
1171  std::string key("paged:" + std::to_string(index));
1172  auto it = auxData.find(key);
1173  if (it != auxData.end()) {
1174  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData)).erase(it);
1175  }
1176  }
1177 
1178  static compression::PagedInputStream& getOrInsertPagedStream( const io::StreamMetadata::AuxDataMap& auxData,
1179  const Index index)
1180  {
1181  std::string key("paged:" + std::to_string(index));
1182  auto it = auxData.find(key);
1183  if (it != auxData.end()) {
1184  return *(boost::any_cast<compression::PagedInputStream::Ptr>(it->second));
1185  }
1186  else {
1187  compression::PagedInputStream::Ptr pagedStream = std::make_shared<compression::PagedInputStream>();
1188  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData))[key] = pagedStream;
1189  return *pagedStream;
1190  }
1191  }
1192 
1193  static bool hasMatchingDescriptor(const io::StreamMetadata::AuxDataMap& auxData)
1194  {
1195  std::string matchingKey("hasMatchingDescriptor");
1196  auto itMatching = auxData.find(matchingKey);
1197  return itMatching != auxData.end();
1198  }
1199 
1200  static void clearMatchingDescriptor(const io::StreamMetadata::AuxDataMap& auxData)
1201  {
1202  std::string matchingKey("hasMatchingDescriptor");
1203  std::string descriptorKey("descriptorPtr");
1204  auto itMatching = auxData.find(matchingKey);
1205  auto itDescriptor = auxData.find(descriptorKey);
1206  if (itMatching != auxData.end()) (const_cast<io::StreamMetadata::AuxDataMap&>(auxData)).erase(itMatching);
1207  if (itDescriptor != auxData.end()) (const_cast<io::StreamMetadata::AuxDataMap&>(auxData)).erase(itDescriptor);
1208  }
1209 
1210  static void insertDescriptor( const io::StreamMetadata::AuxDataMap& auxData,
1211  const Descriptor::Ptr descriptor)
1212  {
1213  std::string descriptorKey("descriptorPtr");
1214  std::string matchingKey("hasMatchingDescriptor");
1215  auto itMatching = auxData.find(matchingKey);
1216  if (itMatching == auxData.end()) {
1217  // if matching bool is not found, insert "true" and the descriptor
1218  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData))[matchingKey] = true;
1219  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData))[descriptorKey] = descriptor;
1220  }
1221  }
1222 
1223  static AttributeSet::Descriptor::Ptr retrieveMatchingDescriptor(const io::StreamMetadata::AuxDataMap& auxData)
1224  {
1225  std::string descriptorKey("descriptorPtr");
1226  auto itDescriptor = auxData.find(descriptorKey);
1227  assert(itDescriptor != auxData.end());
1228  const Descriptor::Ptr descriptor = boost::any_cast<AttributeSet::Descriptor::Ptr>(itDescriptor->second);
1229  return descriptor;
1230  }
1231  };
1232 
1234 
1235  if (!meta) {
1236  OPENVDB_THROW(IoError, "Cannot read in a PointDataLeaf without StreamMetadata.");
1237  }
1238 
1239  const Index pass(static_cast<uint16_t>(meta->pass()));
1240  const Index maximumPass(static_cast<uint16_t>(meta->pass() >> 16));
1241 
1242  const Index attributes = (maximumPass - 4) / 2;
1243 
1244  if (pass == 0) {
1245  // pass 0 - voxel data sizes
1246  is.read(reinterpret_cast<char*>(&mVoxelBufferSize), sizeof(uint16_t));
1247  Local::clearMatchingDescriptor(meta->auxData());
1248  }
1249  else if (pass == 1) {
1250  // pass 1 - descriptor and attribute metadata
1251  if (Local::hasMatchingDescriptor(meta->auxData())) {
1252  AttributeSet::Descriptor::Ptr descriptor = Local::retrieveMatchingDescriptor(meta->auxData());
1253  mAttributeSet->resetDescriptor(descriptor, /*allowMismatchingDescriptors=*/true);
1254  }
1255  else {
1256  uint8_t header;
1257  is.read(reinterpret_cast<char*>(&header), sizeof(uint8_t));
1258  mAttributeSet->readDescriptor(is);
1259  if (header & uint8_t(1)) {
1260  AttributeSet::DescriptorPtr descriptor = mAttributeSet->descriptorPtr();
1261  Local::insertDescriptor(meta->auxData(), descriptor);
1262  }
1263  // a forwards-compatibility mechanism for future use,
1264  // if a 0x2 bit is set, read and skip over a specific number of bytes
1265  if (header & uint8_t(2)) {
1266  uint64_t bytesToSkip;
1267  is.read(reinterpret_cast<char*>(&bytesToSkip), sizeof(uint64_t));
1268  if (bytesToSkip > uint64_t(0)) {
1269  auto metadata = io::getStreamMetadataPtr(is);
1270  if (metadata && metadata->seekable()) {
1271  is.seekg(bytesToSkip, std::ios_base::cur);
1272  }
1273  else {
1274  std::vector<uint8_t> tempData(bytesToSkip);
1275  is.read(reinterpret_cast<char*>(&tempData[0]), bytesToSkip);
1276  }
1277  }
1278  }
1279  // this reader is only able to read headers with 0x1 and 0x2 bits set
1280  if (header > uint8_t(3)) {
1281  OPENVDB_THROW(IoError, "Unrecognised header flags in PointDataLeafNode");
1282  }
1283  }
1284  mAttributeSet->readMetadata(is);
1285  }
1286  else if (pass < (attributes + 2)) {
1287  // pass 2...n+2 - attribute uniform values
1288  const size_t attributeIndex = pass - 2;
1289  AttributeArray* array = attributeIndex < mAttributeSet->size() ?
1290  mAttributeSet->get(attributeIndex) : nullptr;
1291  if (array) {
1292  compression::PagedInputStream& pagedStream =
1293  Local::getOrInsertPagedStream(meta->auxData(), static_cast<Index>(attributeIndex));
1294  pagedStream.setInputStream(is);
1295  pagedStream.setSizeOnly(true);
1296  array->readPagedBuffers(pagedStream);
1297  }
1298  }
1299  else if (pass == attributes + 2) {
1300  // pass n+2 - voxel data
1301 
1302  const Index passValue(meta->pass());
1303 
1304  // StreamMetadata pass variable used to temporarily store voxel buffer size
1305  io::StreamMetadata& nonConstMeta = const_cast<io::StreamMetadata&>(*meta);
1306  nonConstMeta.setPass(mVoxelBufferSize);
1307 
1308  // readBuffers() calls readCompressedValues specialization above
1309  BaseLeaf::readBuffers(is, fromHalf);
1310 
1311  // pass now reset to original value
1312  nonConstMeta.setPass(passValue);
1313  }
1314  else if (pass < (attributes*2 + 3)) {
1315  // pass n+2..2n+2 - attribute buffers
1316  const Index attributeIndex = pass - attributes - 3;
1317  AttributeArray* array = attributeIndex < mAttributeSet->size() ?
1318  mAttributeSet->get(attributeIndex) : nullptr;
1319  if (array) {
1320  compression::PagedInputStream& pagedStream =
1321  Local::getOrInsertPagedStream(meta->auxData(), attributeIndex);
1322  pagedStream.setInputStream(is);
1323  pagedStream.setSizeOnly(false);
1324  array->readPagedBuffers(pagedStream);
1325  }
1326  // cleanup paged stream reference in auxiliary metadata
1327  if (pass > attributes + 3) {
1328  Local::destroyPagedStream(meta->auxData(), attributeIndex-1);
1329  }
1330  }
1331  else if (pass < buffers()) {
1332  // pass 2n+3 - cleanup last paged stream
1333  const Index attributeIndex = pass - attributes - 4;
1334  Local::destroyPagedStream(meta->auxData(), attributeIndex);
1335  }
1336 }
1337 
1338 template<typename T, Index Log2Dim>
1339 inline void
1340 PointDataLeafNode<T, Log2Dim>::writeBuffers(std::ostream& os, bool toHalf) const
1341 {
1342  struct Local
1343  {
1344  static void destroyPagedStream(const io::StreamMetadata::AuxDataMap& auxData, const Index index)
1345  {
1346  // if paged stream exists, flush and delete it
1347  std::string key("paged:" + std::to_string(index));
1348  auto it = auxData.find(key);
1349  if (it != auxData.end()) {
1350  compression::PagedOutputStream& stream = *(boost::any_cast<compression::PagedOutputStream::Ptr>(it->second));
1351  stream.flush();
1352  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData)).erase(it);
1353  }
1354  }
1355 
1356  static compression::PagedOutputStream& getOrInsertPagedStream( const io::StreamMetadata::AuxDataMap& auxData,
1357  const Index index)
1358  {
1359  std::string key("paged:" + std::to_string(index));
1360  auto it = auxData.find(key);
1361  if (it != auxData.end()) {
1362  return *(boost::any_cast<compression::PagedOutputStream::Ptr>(it->second));
1363  }
1364  else {
1365  compression::PagedOutputStream::Ptr pagedStream = std::make_shared<compression::PagedOutputStream>();
1366  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData))[key] = pagedStream;
1367  return *pagedStream;
1368  }
1369  }
1370 
1371  static void insertDescriptor( const io::StreamMetadata::AuxDataMap& auxData,
1372  const Descriptor::Ptr descriptor)
1373  {
1374  std::string descriptorKey("descriptorPtr");
1375  std::string matchingKey("hasMatchingDescriptor");
1376  auto itMatching = auxData.find(matchingKey);
1377  auto itDescriptor = auxData.find(descriptorKey);
1378  if (itMatching == auxData.end()) {
1379  // if matching bool is not found, insert "true" and the descriptor
1380  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData))[matchingKey] = true;
1381  assert(itDescriptor == auxData.end());
1382  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData))[descriptorKey] = descriptor;
1383  }
1384  else {
1385  // if matching bool is found and is false, early exit (a previous descriptor did not match)
1386  bool matching = boost::any_cast<bool>(itMatching->second);
1387  if (!matching) return;
1388  assert(itDescriptor != auxData.end());
1389  // if matching bool is true, check whether the existing descriptor matches the current one and set
1390  // matching bool to false if not
1391  const Descriptor::Ptr existingDescriptor = boost::any_cast<AttributeSet::Descriptor::Ptr>(itDescriptor->second);
1392  if (*existingDescriptor != *descriptor) {
1393  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData))[matchingKey] = false;
1394  }
1395  }
1396  }
1397 
1398  static bool hasMatchingDescriptor(const io::StreamMetadata::AuxDataMap& auxData)
1399  {
1400  std::string matchingKey("hasMatchingDescriptor");
1401  auto itMatching = auxData.find(matchingKey);
1402  // if matching key is not found, no matching descriptor
1403  if (itMatching == auxData.end()) return false;
1404  // if matching key is found and is false, no matching descriptor
1405  if (!boost::any_cast<bool>(itMatching->second)) return false;
1406  return true;
1407  }
1408 
1409  static AttributeSet::Descriptor::Ptr retrieveMatchingDescriptor(const io::StreamMetadata::AuxDataMap& auxData)
1410  {
1411  std::string descriptorKey("descriptorPtr");
1412  auto itDescriptor = auxData.find(descriptorKey);
1413  // if matching key is true, however descriptor is not found, it has already been retrieved
1414  if (itDescriptor == auxData.end()) return nullptr;
1415  // otherwise remove it and return it
1416  const Descriptor::Ptr descriptor = boost::any_cast<AttributeSet::Descriptor::Ptr>(itDescriptor->second);
1417  (const_cast<io::StreamMetadata::AuxDataMap&>(auxData)).erase(itDescriptor);
1418  return descriptor;
1419  }
1420 
1421  static void clearMatchingDescriptor(const io::StreamMetadata::AuxDataMap& auxData)
1422  {
1423  std::string matchingKey("hasMatchingDescriptor");
1424  std::string descriptorKey("descriptorPtr");
1425  auto itMatching = auxData.find(matchingKey);
1426  auto itDescriptor = auxData.find(descriptorKey);
1427  if (itMatching != auxData.end()) (const_cast<io::StreamMetadata::AuxDataMap&>(auxData)).erase(itMatching);
1428  if (itDescriptor != auxData.end()) (const_cast<io::StreamMetadata::AuxDataMap&>(auxData)).erase(itDescriptor);
1429  }
1430  };
1431 
1433 
1434  if (!meta) {
1435  OPENVDB_THROW(IoError, "Cannot write out a PointDataLeaf without StreamMetadata.");
1436  }
1437 
1438  const Index pass(static_cast<uint16_t>(meta->pass()));
1439 
1440  // leaf traversal analysis deduces the number of passes to perform for this leaf
1441  // then updates the leaf traversal value to ensure all passes will be written
1442 
1443  if (meta->countingPasses()) {
1444  const Index requiredPasses = this->buffers();
1445  if (requiredPasses > pass) {
1446  meta->setPass(requiredPasses);
1447  }
1448  return;
1449  }
1450 
1451  const Index maximumPass(static_cast<uint16_t>(meta->pass() >> 16));
1452  const Index attributes = (maximumPass - 4) / 2;
1453 
1454  if (pass == 0) {
1455  // pass 0 - voxel data sizes
1456  io::writeCompressedValuesSize(os, this->buffer().data(), SIZE);
1457  // track if descriptor is shared or not
1458  Local::insertDescriptor(meta->auxData(), mAttributeSet->descriptorPtr());
1459  }
1460  else if (pass == 1) {
1461  // pass 1 - descriptor and attribute metadata
1462  bool matchingDescriptor = Local::hasMatchingDescriptor(meta->auxData());
1463  if (matchingDescriptor) {
1464  AttributeSet::Descriptor::Ptr descriptor = Local::retrieveMatchingDescriptor(meta->auxData());
1465  if (descriptor) {
1466  // write a header to indicate a shared descriptor
1467  uint8_t header(1);
1468  os.write(reinterpret_cast<const char*>(&header), sizeof(uint8_t));
1469  mAttributeSet->writeDescriptor(os, /*transient=*/false);
1470  }
1471  }
1472  else {
1473  // write a header to indicate a non-shared descriptor
1474  uint8_t header(0);
1475  os.write(reinterpret_cast<const char*>(&header), sizeof(uint8_t));
1476  mAttributeSet->writeDescriptor(os, /*transient=*/false);
1477  }
1478  mAttributeSet->writeMetadata(os, /*transient=*/false, /*paged=*/true);
1479  }
1480  else if (pass < attributes + 2) {
1481  // pass 2...n+2 - attribute buffer sizes
1482  const Index attributeIndex = pass - 2;
1483  // destroy previous paged stream
1484  if (pass > 2) {
1485  Local::destroyPagedStream(meta->auxData(), attributeIndex-1);
1486  }
1487  const AttributeArray* array = attributeIndex < mAttributeSet->size() ?
1488  mAttributeSet->getConst(attributeIndex) : nullptr;
1489  if (array) {
1490  compression::PagedOutputStream& pagedStream =
1491  Local::getOrInsertPagedStream(meta->auxData(), attributeIndex);
1492  pagedStream.setOutputStream(os);
1493  pagedStream.setSizeOnly(true);
1494  array->writePagedBuffers(pagedStream, /*outputTransient*/false);
1495  }
1496  }
1497  else if (pass == attributes + 2) {
1498  const Index attributeIndex = pass - 3;
1499  Local::destroyPagedStream(meta->auxData(), attributeIndex);
1500  // pass n+2 - voxel data
1501  BaseLeaf::writeBuffers(os, toHalf);
1502  }
1503  else if (pass < (attributes*2 + 3)) {
1504  // pass n+3...2n+3 - attribute buffers
1505  const Index attributeIndex = pass - attributes - 3;
1506  // destroy previous paged stream
1507  if (pass > attributes + 2) {
1508  Local::destroyPagedStream(meta->auxData(), attributeIndex-1);
1509  }
1510  const AttributeArray* array = attributeIndex < mAttributeSet->size() ?
1511  mAttributeSet->getConst(attributeIndex) : nullptr;
1512  if (array) {
1513  compression::PagedOutputStream& pagedStream =
1514  Local::getOrInsertPagedStream(meta->auxData(), attributeIndex);
1515  pagedStream.setOutputStream(os);
1516  pagedStream.setSizeOnly(false);
1517  array->writePagedBuffers(pagedStream, /*outputTransient*/false);
1518  }
1519  }
1520  else if (pass < buffers()) {
1521  Local::clearMatchingDescriptor(meta->auxData());
1522  // pass 2n+3 - cleanup last paged stream
1523  const Index attributeIndex = pass - attributes - 4;
1524  Local::destroyPagedStream(meta->auxData(), attributeIndex);
1525  }
1526 }
1527 
1528 template<typename T, Index Log2Dim>
1529 inline Index64
1531 {
1532  return BaseLeaf::memUsage() + mAttributeSet->memUsage();
1533 }
1534 
1535 template<typename T, Index Log2Dim>
1536 inline void
1538 {
1539  BaseLeaf::evalActiveBoundingBox(bbox, visitVoxels);
1540 }
1541 
1542 template<typename T, Index Log2Dim>
1543 inline CoordBBox
1545 {
1546  return BaseLeaf::getNodeBoundingBox();
1547 }
1548 
1549 template<typename T, Index Log2Dim>
1550 inline void
1551 PointDataLeafNode<T, Log2Dim>::fill(const CoordBBox& bbox, const ValueType& value, bool active)
1552 {
1553  if (!this->allocate()) return;
1554 
1555  this->assertNonModifiableUnlessZero(value);
1556 
1557  // active state is permitted to be updated
1558 
1559  for (Int32 x = bbox.min().x(); x <= bbox.max().x(); ++x) {
1560  const Index offsetX = (x & (DIM-1u)) << 2*Log2Dim;
1561  for (Int32 y = bbox.min().y(); y <= bbox.max().y(); ++y) {
1562  const Index offsetXY = offsetX + ((y & (DIM-1u)) << Log2Dim);
1563  for (Int32 z = bbox.min().z(); z <= bbox.max().z(); ++z) {
1564  const Index offset = offsetXY + (z & (DIM-1u));
1565  this->setValueMask(offset, active);
1566  }
1567  }
1568  }
1569 }
1570 
1571 template<typename T, Index Log2Dim>
1572 inline void
1574 {
1575  this->assertNonModifiableUnlessZero(value);
1576 
1577  // active state is permitted to be updated
1578 
1579  if (active) this->setValuesOn();
1580  else this->setValuesOff();
1581 }
1582 
1583 
1585 
1586 
1587 template <typename PointDataTreeT>
1588 inline AttributeSet::Descriptor::Ptr
1589 makeDescriptorUnique(PointDataTreeT& tree)
1590 {
1591  auto leafIter = tree.beginLeaf();
1592  if (!leafIter) return nullptr;
1593 
1594  const AttributeSet::Descriptor& descriptor = leafIter->attributeSet().descriptor();
1595  auto newDescriptor = std::make_shared<AttributeSet::Descriptor>(descriptor);
1596  for (; leafIter; ++leafIter) {
1597  leafIter->resetDescriptor(newDescriptor);
1598  }
1599 
1600  return newDescriptor;
1601 }
1602 
1603 
1604 template <typename PointDataTreeT>
1605 inline void
1606 setStreamingMode(PointDataTreeT& tree, bool on)
1607 {
1608  auto leafIter = tree.beginLeaf();
1609  for (; leafIter; ++leafIter) {
1610  for (size_t i = 0; i < leafIter->attributeSet().size(); i++) {
1611  leafIter->attributeArray(i).setStreaming(on);
1612  }
1613  }
1614 }
1615 
1616 
1617 template <typename PointDataTreeT>
1618 inline void
1619 prefetch(PointDataTreeT& tree, bool position, bool otherAttributes)
1620 {
1621  // NOTE: the following is intentionally not multi-threaded, as the I/O
1622  // is faster if done in the order in which it is stored in the file
1623 
1624  auto leaf = tree.cbeginLeaf();
1625  if (!leaf) return;
1626 
1627  const auto& attributeSet = leaf->attributeSet();
1628 
1629  // pre-fetch leaf data
1630 
1631  for ( ; leaf; ++leaf) {
1632  leaf->buffer().data();
1633  }
1634 
1635  // pre-fetch position attribute data (position will typically have index 0)
1636 
1637  size_t positionIndex = attributeSet.find("P");
1638 
1639  if (position && positionIndex != AttributeSet::INVALID_POS) {
1640  for (leaf = tree.cbeginLeaf(); leaf; ++leaf) {
1641  assert(leaf->hasAttribute(positionIndex));
1642  leaf->constAttributeArray(positionIndex).loadData();
1643  }
1644  }
1645 
1646  // pre-fetch other attribute data
1647 
1648  if (otherAttributes) {
1649  const size_t attributes = attributeSet.size();
1650  for (size_t attributeIndex = 0; attributeIndex < attributes; attributeIndex++) {
1651  if (attributeIndex == positionIndex) continue;
1652  for (leaf = tree.cbeginLeaf(); leaf; ++leaf) {
1653  assert(leaf->hasAttribute(attributeIndex));
1654  leaf->constAttributeArray(attributeIndex).loadData();
1655  }
1656  }
1657  }
1658 }
1659 
1660 
1661 namespace internal {
1662 
1666 void initialize();
1667 
1672 
1673 
1678 template<typename HeadT, int HeadLevel>
1680 {
1681  using SubtreeT = typename PointDataNodeChain<typename HeadT::ChildNodeType, HeadLevel-1>::Type;
1683  using Type = typename SubtreeT::template Append<RootNodeT>;
1684 };
1685 
1686 // Specialization for internal nodes which require their embedded child type to
1687 // be switched
1688 template <typename ChildT, Index Log2Dim, int HeadLevel>
1689 struct PointDataNodeChain<tree::InternalNode<ChildT, Log2Dim>, HeadLevel>
1690 {
1691  using SubtreeT = typename PointDataNodeChain<ChildT, HeadLevel-1>::Type;
1693  using Type = typename SubtreeT::template Append<InternalNodeT>;
1694 };
1695 
1696 // Specialization for the last internal node of a node chain, expected
1697 // to be templated on a leaf node
1698 template <typename ChildT, Index Log2Dim>
1699 struct PointDataNodeChain<tree::InternalNode<ChildT, Log2Dim>, /*HeadLevel=*/1>
1700 {
1704 };
1705 
1706 } // namespace internal
1707 
1708 
1712 template <typename TreeType>
1714  using RootNodeT = typename TreeType::RootNodeType;
1717 };
1718 
1719 
1720 } // namespace points
1721 
1722 
1724 
1725 
1726 namespace tree
1727 {
1728 
1731 template<Index Dim1, typename T2>
1732 struct SameLeafConfig<Dim1, points::PointDataLeafNode<T2, Dim1>> { static const bool value = true; };
1733 
1734 } // namespace tree
1735 } // namespace OPENVDB_VERSION_NAME
1736 } // namespace openvdb
1737 
1738 #endif // OPENVDB_POINTS_POINT_DATA_GRID_HAS_BEEN_INCLUDED
openvdb::v7_1::points::AttributeSet::DescriptorPtr
std::shared_ptr< Descriptor > DescriptorPtr
Definition: AttributeSet.h:49
openvdb::v7_1::points::PointDataLeafNode::ChildOff
typename BaseLeaf::ChildOff ChildOff
Definition: PointDataGrid.h:605
openvdb::v7_1::points::GroupFilter::state
static index::State state()
Definition: AttributeGroup.h:145
openvdb::v7_1::points::GroupHandle
Definition: AttributeGroup.h:73
openvdb::v7_1::compression::PagedOutputStream::setOutputStream
void setOutputStream(std::ostream &os)
Definition: StreamCompression.h:260
openvdb::v7_1::TypeList
A list of types (not necessarily unique)
Definition: Types.h:653
openvdb::v7_1::points::PointDataLeafNode::endChildAll
ChildAllIter endChildAll()
Definition: PointDataGrid.h:739
openvdb::v7_1::points::internal::PointDataNodeChain
Recursive node chain which generates a openvdb::TypeList value converted types of nodes to PointDataG...
Definition: PointDataGrid.h:1680
openvdb::v7_1::points::PointDataLeafNode::beginChildOff
ChildOffCIter beginChildOff() const
Definition: PointDataGrid.h:725
openvdb::v7_1::points::PointDataLeafNode::endValueOn
ValueOnIter endValueOn()
Definition: PointDataGrid.h:713
openvdb::v7_1::points::AttributeArray::readPagedBuffers
virtual void readPagedBuffers(compression::PagedInputStream &)=0
Read attribute buffers from a paged stream.
AttributeSet.h
Set of Attribute Arrays which tracks metadata about each array.
openvdb::v7_1::points::pointCount
Index64 pointCount(const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool inCoreOnly=false, const bool threaded=true)
Count the total number of points in a PointDataTree.
Definition: PointCount.h:88
StreamCompression.h
Convenience wrappers to using Blosc and reading and writing of Paged data.
openvdb::v7_1::points::PointDataLeafNode::beginChildOff
ChildOffIter beginChildOff()
Definition: PointDataGrid.h:726
openvdb::v7_1::points::PointDataLeafNode::probeConstLeafAndCache
const PointDataLeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Definition: PointDataGrid.h:479
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode(const tree::LeafNode< ValueType, Log2Dim > &other, const T &value, TopologyCopy)
Definition: PointDataGrid.h:297
openvdb::v7_1::points::PointDataLeafNode::setValueOnlyAndCache
void setValueOnlyAndCache(const Coord &, const ValueType &, AccessorT &)
Definition: PointDataGrid.h:569
openvdb::v7_1::points::PointDataLeafNode::endChildOn
ChildOnCIter endChildOn() const
Definition: PointDataGrid.h:732
openvdb::v7_1::io::StreamMetadata::Ptr
SharedPtr< StreamMetadata > Ptr
Definition: io.h:33
openvdb::v7_1::compression::PagedInputStream::Ptr
std::shared_ptr< PagedInputStream > Ptr
Definition: StreamCompression.h:211
openvdb::v7_1::points::PointDataLeafNode::cbeginValueOn
ValueOnCIter cbeginValueOn() const
Definition: PointDataGrid.h:701
openvdb::v7_1::points::PointDataLeafNode::clip
void clip(const CoordBBox &, const ValueType &value)
Definition: PointDataGrid.h:562
openvdb::v7_1::points::PointDataLeafNode::beginIndexOff
IndexIter< ValueOffCIter, FilterT > beginIndexOff(const FilterT &filter) const
Definition: PointDataGrid.h:688
openvdb::v7_1::points::PointDataLeafNode::modifyValue
void modifyValue(const Coord &, const ModifyOp &)
Definition: PointDataGrid.h:556
openvdb::v7_1::points::GroupWriteHandle
Definition: AttributeGroup.h:102
openvdb::v7_1::compression::PagedOutputStream::flush
void flush()
Manually flushes the current page to disk if non-zero.
openvdb::v7_1::compression::PagedInputStream::setSizeOnly
void setSizeOnly(bool sizeOnly)
Size-only mode tags the stream as only reading size data.
Definition: StreamCompression.h:218
openvdb::v7_1::points::PointDataLeafNode::signedFloodFill
void signedFloodFill(const ValueType &, const ValueType &)
Definition: PointDataGrid.h:589
openvdb::v7_1::points::PointDataLeafNode::hasSameTopology
bool hasSameTopology(const PointDataLeafNode< OtherType, OtherLog2Dim > *other) const
Return true if the given node (which may have a different ValueType than this node) has the same acti...
Definition: PointDataGrid.h:439
openvdb::v7_1::points::PointDataLeafNode::beginChildOn
ChildOnIter beginChildOn()
Definition: PointDataGrid.h:723
openvdb::v7_1::points::PointDataLeafNode::setValuesOn
void setValuesOn()
Definition: PointDataGrid.h:549
openvdb::v7_1::points::renameAttributes
void renameAttributes(PointDataTreeT &tree, const std::vector< Name > &oldNames, const std::vector< Name > &newNames)
Rename attributes in a VDB tree.
Definition: PointAttribute.h:465
openvdb::v7_1::TopologyCopy
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:1045
openvdb::v7_1::points::PointDataLeafNode::ChildOffCIter
typename BaseLeaf::template ChildIter< MaskOffIterator, const PointDataLeafNode, ChildOff > ChildOffCIter
Definition: PointDataGrid.h:645
openvdb::v7_1::Index
Index32 Index
Definition: Types.h:31
openvdb::v7_1::tree::LeafNode::ChildOff
Definition: LeafNode.h:204
openvdb::v7_1::points::PointDataLeafNode::setValuesOff
void setValuesOff()
Definition: PointDataGrid.h:550
openvdb::v7_1::points::PointDataLeafNode::probeNodeAndCache
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Definition: PointDataGrid.h:463
openvdb::v7_1::tree::SameLeafConfig
Definition: LeafNode.h:912
openvdb::v7_1::points::PointDataLeafNode::cendChildOn
ChildOnCIter cendChildOn() const
Definition: PointDataGrid.h:731
openvdb::v7_1::points::OPENVDB_DEPRECATED
Index OPENVDB_DEPRECATED
Definition: AttributeArrayString.h:33
openvdb::v7_1::zeroVal
T zeroVal()
Return the value of type T that corresponds to zero.
Definition: Math.h:59
VMASK_
#define VMASK_
Definition: PointDataGrid.h:700
openvdb::v7_1::points::PointDataLeafNode::fill
void fill(const CoordBBox &, const ValueType &, bool)
Definition: PointDataGrid.h:1551
openvdb::v7_1::Name
std::string Name
Definition: Name.h:17
openvdb::v7_1::points::PointDataLeafNode::setValueOffAndCache
void setValueOffAndCache(const Coord &, const ValueType &, AccessorT &)
Definition: PointDataGrid.h:577
openvdb::v7_1::points::ValueVoxelCIter
A forward iterator over array indices in a single voxel.
Definition: IndexIterator.h:65
openvdb::v7_1::points::PointDataLeafNode::ChildOnIter
typename BaseLeaf::template ChildIter< MaskOnIterator, PointDataLeafNode, ChildOn > ChildOnIter
Definition: PointDataGrid.h:639
openvdb::v7_1::points::PointDataLeafNode::probeLeaf
const PointDataLeafNode * probeLeaf(const Coord &) const
Definition: PointDataGrid.h:482
openvdb::v7_1::compression::PagedOutputStream::setSizeOnly
void setSizeOnly(bool sizeOnly)
Size-only mode tags the stream as only writing size data.
Definition: StreamCompression.h:255
openvdb::v7_1::points::PointDataLeafNode::ValueOn
typename BaseLeaf::ValueOn ValueOn
Definition: PointDataGrid.h:595
openvdb::v7_1::points::PointDataLeafNode::ValueOffIter
typename BaseLeaf::template ValueIter< MaskOffIterator, PointDataLeafNode, const ValueType, ValueOff > ValueOffIter
Definition: PointDataGrid.h:631
openvdb::v7_1::points::PointDataLeafNode::resetDescriptor
void resetDescriptor(const Descriptor::Ptr &replacement)
Replace the descriptor with a new one The new Descriptor must exactly match the old one.
Definition: PointDataGrid.h:875
openvdb::v7_1::io::writeCompressedValues
void writeCompressedValues(std::ostream &os, PointDataIndex32 *srcBuf, Index srcCount, const util::NodeMask< 3 > &, const util::NodeMask< 3 > &, bool)
openvdb::io::writeCompressedValues specialized on PointDataIndex32 arrays to ignore the value mask,...
Definition: PointDataGrid.h:106
openvdb::v7_1::tree::IteratorBase
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:30
PointIndexGrid.h
Space-partitioning acceleration structure for points. Partitions the points into voxels to accelerate...
openvdb::v7_1::points::index::NONE
@ NONE
Definition: IndexIterator.h:42
openvdb::v7_1::points::PointDataLeafNode::endChildOff
ChildOffIter endChildOff()
Definition: PointDataGrid.h:736
openvdb::v7_1::points::PointDataLeafNode::endChildOn
ChildOnIter endChildOn()
Definition: PointDataGrid.h:733
openvdb::v7_1::points::compactAttributes
void compactAttributes(PointDataTreeT &tree)
Compact attributes in a VDB tree (if possible).
Definition: PointAttribute.h:524
openvdb::v7_1::points::PointDataLeafNode::ValueAllCIter
typename BaseLeaf::template ValueIter< MaskDenseIterator, const PointDataLeafNode, const ValueType, ValueAll > ValueAllCIter
Definition: PointDataGrid.h:637
openvdb::v7_1::math::Coord::y
Int32 y() const
Definition: Coord.h:132
openvdb::v7_1::points::PointDataLeafNode::cbeginValueAll
ValueAllCIter cbeginValueAll() const
Definition: PointDataGrid.h:707
openvdb::v7_1::points::AttributeArray::Ptr
std::shared_ptr< AttributeArray > Ptr
Definition: AttributeArray.h:125
openvdb::v7_1::points::PointDataLeafNode::operator==
bool operator==(const PointDataLeafNode &other) const
Definition: PointDataGrid.h:445
openvdb::v7_1::points::PointDataLeafNode::cendChildOff
ChildOffCIter cendChildOff() const
Definition: PointDataGrid.h:734
openvdb::v7_1::points::PointDataLeafNode::beginValueOff
ValueOffIter beginValueOff()
Definition: PointDataGrid.h:706
openvdb::v7_1::points::IndexIter
A forward iterator over array indices with filtering IteratorT can be either IndexIter or ValueIndexI...
Definition: IndexIterator.h:140
openvdb::v7_1::Metadata
Base class for storing metadata information in a grid.
Definition: Metadata.h:24
version.h
Library and file format version numbers.
openvdb::v7_1::points::PointDataLeafNode::operator!=
bool operator!=(const PointDataLeafNode &other) const
Definition: PointDataGrid.h:450
openvdb::v7_1::points::PointDataLeafNode::ChildOffIter
typename BaseLeaf::template ChildIter< MaskOffIterator, PointDataLeafNode, ChildOff > ChildOffIter
Definition: PointDataGrid.h:643
openvdb::v7_1::util::OnMaskIterator
Definition: NodeMasks.h:209
openvdb::v7_1::points::appendAttribute
void appendAttribute(PointDataTreeT &tree, const Name &name, const NamePair &type, const Index strideOrTotalSize=1, const bool constantStride=true, const Metadata *defaultValue=nullptr, const bool hidden=false, const bool transient=false)
Appends a new attribute to the VDB tree (this method does not require a templated AttributeType)
Definition: PointAttribute.h:242
openvdb::v7_1::points::PointDataLeafNode::probeConstNodeAndCache
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Definition: PointDataGrid.h:484
AttributeArray.h
Attribute Array storage templated on type and compression codec.
openvdb::v7_1::points::PointDataLeafNode::signedFloodFill
void signedFloodFill(const ValueType &)
Definition: PointDataGrid.h:588
openvdb::v7_1::Index64
uint64_t Index64
Definition: Types.h:30
openvdb::v7_1::points::PointDataLeafNode::cbeginChildOff
ChildOffCIter cbeginChildOff() const
Definition: PointDataGrid.h:724
openvdb::v7_1::points::PointDataLeafNode::ValueOnIter
typename BaseLeaf::template ValueIter< MaskOnIterator, PointDataLeafNode, const ValueType, ValueOn > ValueOnIter
Definition: PointDataGrid.h:627
openvdb::v7_1::points::PointDataLeafNode::endChildAll
ChildAllCIter endChildAll() const
Definition: PointDataGrid.h:738
openvdb::v7_1::math::Coord::x
Int32 x() const
Definition: Coord.h:131
openvdb::v7_1::points::PointDataLeafNode::ChildOn
typename BaseLeaf::ChildOn ChildOn
Definition: PointDataGrid.h:604
Grid.h
openvdb::v7_1::points::PointDataLeafNode::cbeginValueOff
ValueOffCIter cbeginValueOff() const
Definition: PointDataGrid.h:704
openvdb::v7_1::points::PointDataLeafNode::beginChildAll
ChildAllCIter beginChildAll() const
Definition: PointDataGrid.h:728
openvdb::v7_1::points::PointDataLeafNode::cendValueOn
ValueOnCIter cendValueOn() const
Definition: PointDataGrid.h:711
openvdb::v7_1::IoError
Definition: Exceptions.h:58
openvdb::v7_1::tree::InternalNode
Definition: InternalNode.h:34
openvdb::v7_1::points::PointDataLeafNode::probeLeafAndCache
const PointDataLeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Definition: PointDataGrid.h:481
openvdb::v7_1::points::PointDataLeafNode::cendValueOff
ValueOffCIter cendValueOff() const
Definition: PointDataGrid.h:714
openvdb::v7_1::tree::RootNode
Definition: RootNode.h:39
openvdb::v7_1::io::getStreamMetadataPtr
OPENVDB_API SharedPtr< StreamMetadata > getStreamMetadataPtr(std::ios_base &)
Return a shared pointer to an object that stores metadata (file format, compression scheme,...
openvdb::v7_1::points::PointDataLeafNode::setActiveState
void setActiveState(Index offset, bool on)
Definition: PointDataGrid.h:530
openvdb::v7_1::points::PointDataLeafNode::beginChildOn
ChildOnCIter beginChildOn() const
Definition: PointDataGrid.h:722
openvdb::v7_1::tree::Tree
Definition: Tree.h:175
openvdb::v7_1::points::PointDataLeafNode
Definition: PointDataGrid.h:233
openvdb::v7_1::Grid
Container class that associates a tree with a transform and metadata.
Definition: Grid.h:572
openvdb::v7_1::util::OffMaskIterator
Definition: NodeMasks.h:240
openvdb::v7_1::points::isGroup
bool isGroup(const AttributeArray &array)
Definition: AttributeGroup.h:63
openvdb::v7_1::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
openvdb::v7_1::points::PointDataLeafNode::setValueOff
void setValueOff(Index, const ValueType &)
Definition: PointDataGrid.h:539
openvdb::v7_1::points::PointDataLeafNode::beginIndex
IndexIter< IterT, FilterT > beginIndex(const FilterT &filter) const
openvdb::v7_1::io::StreamMetadata
Container for metadata describing how to unserialize grids from and/or serialize grids to a stream (w...
Definition: io.h:31
openvdb::v7_1::points::PointDataLeafNode::endValueOff
ValueOffCIter endValueOff() const
Definition: PointDataGrid.h:715
openvdb::v7_1::points::PointDataLeafNode::setValueOnly
void setValueOnly(const Coord &, const ValueType &)
Definition: PointDataGrid.h:532
openvdb::v7_1::points::PointDataLeafNode::cbeginChildOn
ChildOnCIter cbeginChildOn() const
Definition: PointDataGrid.h:721
openvdb::v7_1::PartialCreate
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:1047
openvdb::v7_1::points::PointDataLeafNode::fill
void fill(const ValueType &value)
Definition: PointDataGrid.h:565
openvdb::v7_1::points::PointDataLeafNode::beginValueOn
ValueOnCIter beginValueOn() const
Definition: PointDataGrid.h:702
openvdb::v7_1::points::internal::PointDataNodeChain::SubtreeT
typename PointDataNodeChain< typename HeadT::ChildNodeType, HeadLevel-1 >::Type SubtreeT
Definition: PointDataGrid.h:1681
AttributeGroup.h
Attribute Group access and filtering for iteration.
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode(PartialCreate, const Coord &coords, const T &value=zeroVal< T >(), bool active=false)
Definition: PointDataGrid.h:308
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode(const PointDataLeafNode &other)
Construct using deep copy of other PointDataLeafNode.
Definition: PointDataGrid.h:268
openvdb::v7_1::points::PointDataLeafNode::ChildAllCIter
typename BaseLeaf::template DenseIter< const PointDataLeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: PointDataGrid.h:649
openvdb::v7_1::points::PointDataLeafNode::beginIndexAll
IndexAllIter beginIndexAll() const
Leaf index iterator.
Definition: PointDataGrid.h:657
openvdb::v7_1::points::PointDataLeafNode::MaskDenseIterator
typename NodeMaskType::DenseIterator MaskDenseIterator
Definition: PointDataGrid.h:610
openvdb::v7_1::compression::bloscDecompress
OPENVDB_API void bloscDecompress(char *uncompressedBuffer, const size_t expectedBytes, const size_t bufferBytes, const char *compressedBuffer)
Decompress into the supplied buffer. Will throw if decompression fails or uncompressed buffer has ins...
openvdb::v7_1::Int32
int32_t Int32
Definition: Types.h:33
openvdb::v7_1::tree::IterTraits
Definition: TreeIterator.h:60
openvdb::v7_1::LookupError
Definition: Exceptions.h:60
openvdb::v7_1::points::GroupFilter
Index filtering on group membership.
Definition: AttributeGroup.h:135
openvdb::v7_1::points::PointDataLeafNode::assertNonmodifiable
void assertNonmodifiable()
Definition: PointDataGrid.h:518
openvdb::v7_1::points::PointDataLeafNode::ValueOff
typename BaseLeaf::ValueOff ValueOff
Definition: PointDataGrid.h:596
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode(const PointDataLeafNode &other, const Coord &coords, const T &value=zeroVal< T >(), bool active=false)
Definition: PointDataGrid.h:280
openvdb::v7_1::points::PointDataLeafNode::ChildOnCIter
typename BaseLeaf::template ChildIter< MaskOnIterator, const PointDataLeafNode, ChildOn > ChildOnCIter
Definition: PointDataGrid.h:641
openvdb::v7_1::points::PointDataLeafNode::probeLeafAndCache
PointDataLeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Definition: PointDataGrid.h:472
openvdb::v7_1::points::AttributeSet::descriptor
Descriptor & descriptor()
Return a reference to this attribute set's descriptor, which might be shared with other sets.
Definition: AttributeSet.h:102
openvdb::v7_1::points::PointDataLeafNode::Ptr
std::shared_ptr< PointDataLeafNode > Ptr
Definition: PointDataGrid.h:237
openvdb::v7_1::points::TypedAttributeArray
Typed class for storing attribute data.
Definition: AttributeArray.h:566
openvdb::v7_1::points::PointDataLeafNode::beginValueAll
ValueAllIter beginValueAll()
Definition: PointDataGrid.h:709
openvdb::v7_1::points::PointDataLeafNode::setValueOff
void setValueOff(Index offset)
Definition: PointDataGrid.h:536
openvdb::v7_1::points::iterCount
Index64 iterCount(const IterT &iter)
Count up the number of times the iterator can iterate.
Definition: IndexIterator.h:314
openvdb::v7_1::tools::PointIndexLeafNode
Definition: PointIndexGrid.h:1355
openvdb::v7_1::compression::PagedInputStream::setInputStream
void setInputStream(std::istream &is)
Definition: StreamCompression.h:223
openvdb::v7_1::points::internal::PointDataNodeChain< tree::InternalNode< ChildT, Log2Dim >, HeadLevel >::Type
typename SubtreeT::template Append< InternalNodeT > Type
Definition: PointDataGrid.h:1693
openvdb::v7_1::tree::LeafNode::ValueOn
Definition: LeafNode.h:203
openvdb::v7_1::points::AttributeArray::compact
virtual bool compact()=0
Compact the existing array to become uniform if all values are identical.
openvdb::v7_1::points::TreeConverter::RootNodeT
typename TreeType::RootNodeType RootNodeT
Definition: PointDataGrid.h:1714
openvdb::v7_1::points::PointDataLeafNode::setValueOff
void setValueOff(const Coord &xyz)
Definition: PointDataGrid.h:535
openvdb::v7_1::util::NodeMask
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation.
Definition: NodeMasks.h:308
openvdb::v7_1::points::PointDataLeafNode::setValueOn
void setValueOn(Index offset)
Definition: PointDataGrid.h:542
openvdb::v7_1::points::makeDescriptorUnique
AttributeSet::Descriptor::Ptr makeDescriptorUnique(PointDataTreeT &tree)
Deep copy the descriptor across all leaf nodes.
Definition: PointDataGrid.h:1589
openvdb::v7_1::points::PointDataLeafNode::ValueAllIter
typename BaseLeaf::template ValueIter< MaskDenseIterator, PointDataLeafNode, const ValueType, ValueAll > ValueAllIter
Definition: PointDataGrid.h:635
openvdb::v7_1::points::PointDataLeafNode::attributeSet
const AttributeSet & attributeSet() const
Retrieve the attribute set.
Definition: PointDataGrid.h:316
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode(const tree::LeafNode< ValueType, Log2Dim > &other, const T &, const T &, TopologyCopy)
Definition: PointDataGrid.h:304
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode(const Coord &coords, const T &value=zeroVal< T >(), bool active=false)
Construct using supplied origin, value and active status.
Definition: PointDataGrid.h:274
openvdb::v7_1::points::PointDataLeafNode::endValueAll
ValueAllIter endValueAll()
Definition: PointDataGrid.h:719
openvdb::v7_1::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:26
openvdb::v7_1::points::PointDataLeafNode::beginIndexOff
IndexOffIter beginIndexOff() const
Definition: PointDataGrid.h:667
openvdb::v7_1::math::Coord::z
Int32 z() const
Definition: Coord.h:133
openvdb::v7_1::points::AttributeArray::size
virtual Index size() const =0
openvdb::v7_1::points::AttributeSet::UniquePtr
std::unique_ptr< AttributeSet > UniquePtr
Definition: AttributeSet.h:45
openvdb::v7_1::points::PointDataLeafNode::ValueOffCIter
typename BaseLeaf::template ValueIter< MaskOffIterator, const PointDataLeafNode, const ValueType, ValueOff > ValueOffCIter
Definition: PointDataGrid.h:633
OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
SIMD Intrinsic Headers.
Definition: Platform.h:114
openvdb::v7_1::points::TreeConverter
Similiar to ValueConverter, but allows for tree configuration conversion to a PointDataTree....
Definition: PointDataGrid.h:1713
openvdb::v7_1::points::PointDataLeafNode::assertNonModifiableUnlessZero
void assertNonModifiableUnlessZero(const ValueType &value)
Definition: PointDataGrid.h:525
openvdb::v7_1::tree::LeafNode::ValueOff
Definition: LeafNode.h:203
openvdb::v7_1::points::PointDataLeafNode::endChildOff
ChildOffCIter endChildOff() const
Definition: PointDataGrid.h:735
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode(const tools::PointIndexLeafNode< OtherValueType, Log2Dim > &other)
Definition: PointDataGrid.h:290
openvdb::v7_1::points::PointDataLeafNode::beginIndexAll
IndexIter< ValueAllCIter, FilterT > beginIndexAll(const FilterT &filter) const
Filtered leaf index iterator.
Definition: PointDataGrid.h:678
openvdb::v7_1::points::dropAttributes
void dropAttributes(PointDataTreeT &tree, const std::vector< size_t > &indices)
Drops attributes from the VDB tree.
Definition: PointAttribute.h:377
openvdb::v7_1::points::PointDataLeafNode::cendValueAll
ValueAllCIter cendValueAll() const
Definition: PointDataGrid.h:717
openvdb::v7_1::compression::PagedOutputStream::Ptr
std::shared_ptr< PagedOutputStream > Ptr
Definition: StreamCompression.h:248
openvdb::v7_1::points::internal::uninitialize
void uninitialize()
Global deregistration of point data-related types.
openvdb::v7_1::points::TreeConverter::NodeChainT
typename internal::PointDataNodeChain< RootNodeT, RootNodeT::LEVEL >::Type NodeChainT
Definition: PointDataGrid.h:1715
openvdb::v7_1::points::PointDataLeafNode::cbeginChildAll
ChildAllCIter cbeginChildAll() const
Definition: PointDataGrid.h:727
AttributeArrayString.h
Attribute array storage for string data using Descriptor Metadata.
openvdb::v7_1::tree::LeafNode
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition: LeafNode.h:38
openvdb::v7_1::points::PointDataLeafNode::memUsage
Index64 memUsage() const
Definition: PointDataGrid.h:1530
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:146
openvdb::v7_1::points::PointDataLeafNode::setValueOn
void setValueOn(const Coord &, const ValueType &)
Definition: PointDataGrid.h:544
openvdb::v7_1::io::MultiPass
Leaf nodes that require multi-pass I/O must inherit from this struct.
Definition: io.h:124
openvdb::v7_1::points::PointDataLeafNode::modifyValueAndActiveStateAndCache
void modifyValueAndActiveStateAndCache(const Coord &, const ModifyOp &, AccessorT &)
Definition: PointDataGrid.h:572
openvdb::v7_1::tree::LeafNode::ValueAll
Definition: LeafNode.h:203
openvdb::v7_1::points::PointDataLeafNode::addLeaf
void addLeaf(PointDataLeafNode *)
Definition: PointDataGrid.h:452
openvdb::v7_1::compression::PagedInputStream
A Paging wrapper to std::istream that is responsible for reading from a given input stream and creati...
Definition: StreamCompression.h:209
openvdb::v7_1::points::PointDataLeafNode::setActiveStateAndCache
void setActiveStateAndCache(const Coord &xyz, bool on, AccessorT &parent)
Definition: PointDataGrid.h:580
openvdb::v7_1::points::PointDataLeafNode::Descriptor
AttributeSet::Descriptor Descriptor
Definition: PointDataGrid.h:243
openvdb::v7_1::points::PointDataLeafNode::setValueOnly
void setValueOnly(Index, const ValueType &)
Definition: PointDataGrid.h:533
Tree.h
openvdb::v7_1::points::PointDataLeafNode::touchLeafAndCache
PointDataLeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Definition: PointDataGrid.h:460
openvdb::v7_1::points::AttributeArray
Base class for storing attribute data.
Definition: AttributeArray.h:93
openvdb::v7_1::points::AttributeSet
Ordered collection of uniquely-named attribute arrays.
Definition: AttributeSet.h:39
openvdb::v7_1::points::PointDataLeafNode::MaskOnIterator
typename NodeMaskType::OnIterator MaskOnIterator
Definition: PointDataGrid.h:608
openvdb::v7_1::points::PointDataLeafNode::cendChildAll
ChildAllCIter cendChildAll() const
Definition: PointDataGrid.h:737
openvdb::v7_1::points::internal::PointDataNodeChain< tree::InternalNode< ChildT, Log2Dim >, HeadLevel >::SubtreeT
typename PointDataNodeChain< ChildT, HeadLevel-1 >::Type SubtreeT
Definition: PointDataGrid.h:1691
openvdb::v7_1::points::PointDataLeafNode::setValueOn
void setValueOn(const Coord &xyz)
Definition: PointDataGrid.h:541
openvdb::v7_1::points::prefetch
void prefetch(PointDataTreeT &tree, bool position=true, bool otherAttributes=true)
Sequentially pre-fetch all delayed-load voxel and attribute data from disk in order to accelerate sub...
Definition: PointDataGrid.h:1619
openvdb::v7_1::math::CoordBBox::max
const Coord & max() const
Definition: Coord.h:322
openvdb::v7_1::io::writeCompressedValuesSize
void writeCompressedValuesSize(std::ostream &os, const T *srcBuf, Index srcCount)
Definition: PointDataGrid.h:139
openvdb::v7_1::PointIndex
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:134
openvdb::v7_1::math::CoordBBox::min
const Coord & min() const
Definition: Coord.h:321
openvdb::v7_1::IndexError
Definition: Exceptions.h:57
openvdb::v7_1::points::PointDataLeafNode::setValue
void setValue(const Coord &, const ValueType &)
Definition: PointDataGrid.h:547
openvdb::v7_1::points::internal::PointDataNodeChain::Type
typename SubtreeT::template Append< RootNodeT > Type
Definition: PointDataGrid.h:1683
openvdb::v7_1::points::PointDataLeafNode::negate
void negate()
Definition: PointDataGrid.h:591
openvdb::v7_1::points::PointDataLeafNode::modifyValueAndActiveState
void modifyValueAndActiveState(const Coord &, const ModifyOp &)
Definition: PointDataGrid.h:559
openvdb::v7_1::io::readCompressedValues
void readCompressedValues(std::istream &is, PointDataIndex32 *destBuf, Index destCount, const util::NodeMask< 3 > &, bool)
openvdb::io::readCompressedValues specialized on PointDataIndex32 arrays to ignore the value mask,...
Definition: PointDataGrid.h:46
openvdb::v7_1::PointDataIndex32
PointIndex< Index32, 1 > PointDataIndex32
Definition: Types.h:158
openvdb::v7_1::points::PointDataLeafNode::MaskOffIterator
typename NodeMaskType::OffIterator MaskOffIterator
Definition: PointDataGrid.h:609
openvdb::v7_1::io::StreamMetadata::setPass
void setPass(uint32_t)
openvdb::v7_1::points::PointDataLeafNode::beginIndexOn
IndexOnIter beginIndexOn() const
Definition: PointDataGrid.h:662
openvdb::v7_1::points::PointDataLeafNode::resetBackground
void resetBackground(const ValueType &, const ValueType &newBackground)
Definition: PointDataGrid.h:584
openvdb::v7_1::points::index::ALL
@ ALL
Definition: IndexIterator.h:43
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:94
openvdb::v7_1::points::PointDataLeafNode::ValueTypePair
std::pair< ValueType, ValueType > ValueTypePair
Definition: PointDataGrid.h:240
openvdb::v7_1::points::PointDataLeafNode::ValueType
T ValueType
Definition: PointDataGrid.h:239
openvdb::v7_1::compression::bloscCompress
OPENVDB_API void bloscCompress(char *compressedBuffer, size_t &compressedBytes, const size_t bufferBytes, const char *uncompressedBuffer, const size_t uncompressedBytes)
Compress into the supplied buffer.
openvdb::v7_1::points::PointDataLeafNode::probeLeaf
PointDataLeafNode * probeLeaf(const Coord &)
Definition: PointDataGrid.h:470
openvdb::v7_1::points::PointDataLeafNode::addLeafAndCache
void addLeafAndCache(PointDataLeafNode *, AccessorT &)
Definition: PointDataGrid.h:454
OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
Definition: Platform.h:115
openvdb::v7_1::points::AttributeArray::ScopedRegistryLock
Definition: AttributeArray.h:119
openvdb::v7_1::points::PointDataLeafNode::beginValueOn
ValueOnIter beginValueOn()
Definition: PointDataGrid.h:703
openvdb::v7_1::points::PointDataLeafNode::endValueOn
ValueOnCIter endValueOn() const
Definition: PointDataGrid.h:712
openvdb::v7_1::points::PointDataLeafNode::beginChildAll
ChildAllIter beginChildAll()
Definition: PointDataGrid.h:729
openvdb::v7_1::tree::LeafNode::ChildOn
Definition: LeafNode.h:204
openvdb::v7_1::points::PointDataLeafNode::beginIndexOn
IndexIter< ValueOnCIter, FilterT > beginIndexOn(const FilterT &filter) const
Definition: PointDataGrid.h:683
openvdb::v7_1::tree::LeafNode::ChildAll
Definition: LeafNode.h:204
openvdb::v7_1::ValueError
Definition: Exceptions.h:65
openvdb::v7_1::typeNameAsString< Vec3f >
const char * typeNameAsString< Vec3f >()
Definition: Types.h:898
openvdb::v7_1::points::setStreamingMode
void setStreamingMode(PointDataTreeT &tree, bool on=true)
Toggle the streaming mode on all attributes in the tree to collapse the attributes after deconstructi...
Definition: PointDataGrid.h:1606
openvdb
Definition: Exceptions.h:13
openvdb::v7_1::points::PointDataLeafNode::modifyValue
void modifyValue(Index, const ModifyOp &)
Definition: PointDataGrid.h:553
LeafNode.h
openvdb::v7_1::points::PointDataLeafNode::beginValueOff
ValueOffCIter beginValueOff() const
Definition: PointDataGrid.h:705
openvdb::v7_1::points::PointDataLeafNode::setValueOff
void setValueOff(const Coord &, const ValueType &)
Definition: PointDataGrid.h:538
openvdb::v7_1::math::CoordBBox::inf
static CoordBBox inf()
Return an "infinite" bounding box, as defined by the Coord value range.
Definition: Coord.h:319
openvdb::v7_1::points::PointDataLeafNode::setValueOn
void setValueOn(Index, const ValueType &)
Definition: PointDataGrid.h:545
openvdb::v7_1::points::AttributeArray::writePagedBuffers
virtual void writePagedBuffers(compression::PagedOutputStream &, bool outputTransient) const =0
openvdb::v7_1::points::PointDataLeafNode::~PointDataLeafNode
~PointDataLeafNode()=default
openvdb::v7_1::points::NullFilter
A no-op filter that can be used when iterating over all indices.
Definition: IndexIterator.h:51
openvdb::v7_1::points::PointDataLeafNode::endValueAll
ValueAllCIter endValueAll() const
Definition: PointDataGrid.h:718
openvdb::v7_1::points::PointDataLeafNode::ChildAllIter
typename BaseLeaf::template DenseIter< PointDataLeafNode, ValueType, ChildAll > ChildAllIter
Definition: PointDataGrid.h:647
openvdb::v7_1::points::PointDataLeafNode::IndexArray
std::vector< ValueType > IndexArray
Definition: PointDataGrid.h:241
openvdb::v7_1::points::PointDataLeafNode::setActiveState
void setActiveState(const Coord &xyz, bool on)
Definition: PointDataGrid.h:529
openvdb::v7_1::points::PointDataLeafNode::ValueAll
typename BaseLeaf::ValueAll ValueAll
Definition: PointDataGrid.h:597
openvdb::v7_1::points::PointDataLeafNode::beginValueAll
ValueAllCIter beginValueAll() const
Definition: PointDataGrid.h:708
openvdb::v7_1::points::PointDataLeafNode::ValueOnCIter
typename BaseLeaf::template ValueIter< MaskOnIterator, const PointDataLeafNode, const ValueType, ValueOn > ValueOnCIter
Definition: PointDataGrid.h:629
openvdb::v7_1::io::StreamMetadata::AuxDataMap
std::map< std::string, boost::any > AuxDataMap
Definition: io.h:92
openvdb::v7_1::points::internal::initialize
void initialize()
Global registration of point data-related types.
openvdb::v7_1::compression::PagedOutputStream
A Paging wrapper to std::ostream that is responsible for writing from a given output stream at interv...
Definition: StreamCompression.h:246
openvdb::v7_1::points::PointDataLeafNode::endValueOff
ValueOffIter endValueOff()
Definition: PointDataGrid.h:716
OPENVDB_THROW
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:82
openvdb::v7_1::compression::bloscCompressedSize
OPENVDB_API size_t bloscCompressedSize(const char *buffer, const size_t uncompressedBytes)
Convenience wrapper to retrieve the compressed size of buffer when compressed.
openvdb::v7_1::points::PointDataLeafNode::reorderAttributes
void reorderAttributes(const Descriptor::Ptr &replacement)
Reorder attribute set.
Definition: PointDataGrid.h:836
openvdb::v7_1::util::DenseMaskIterator
Definition: NodeMasks.h:271
openvdb::v7_1::points::PointDataLeafNode::PointDataLeafNode
PointDataLeafNode()
Default constructor.
Definition: PointDataGrid.h:262
openvdb::v7_1::tools::composite::max
const std::enable_if<!VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:106
openvdb::v7_1::points::PointDataLeafNode::ChildAll
typename BaseLeaf::ChildAll ChildAll
Definition: PointDataGrid.h:606