OpenVDB: LeafBuffer.h Source File

OpenVDB 5.2.0

LeafBuffer.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2018 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30
31 #ifndef OPENVDB_TREE_LEAFBUFFER_HAS_BEEN_INCLUDED
32 #define OPENVDB_TREE_LEAFBUFFER_HAS_BEEN_INCLUDED
33
34 #include <openvdb/Types.h>
35 #include <openvdb/io/Compression.h> // for io::readCompressedValues(), etc
36 #include <openvdb/util/NodeMasks.h>
37 #include <tbb/atomic.h>
38 #include <tbb/spin_mutex.h>
39 #include <algorithm> // for std::swap
40 #include <cstddef> // for offsetof()
41 #include <iostream>
42 #include <memory>
43 #include <type_traits>
44
45
46 class TestLeaf;
47
48 namespace openvdb {
49 OPENVDB_USE_VERSION_NAMESPACE
50 namespace OPENVDB_VERSION_NAME {
51 namespace tree {
52
53 namespace internal {
54
66 template<typename T>
67 struct LeafBufferFlags
68 {
69 #if OPENVDB_ABI_VERSION_NUMBER >= 5
70 using type = tbb::atomic<Index32>;
72 static constexpr bool IsAtomic = true;
73 #else // OPENVDB_ABI_VERSION_NUMBER < 5
74 // These structs need to have the same data members as LeafBuffer.
75 struct Atomic { union { T* data; void* ptr; }; tbb::atomic<Index32> i; tbb::spin_mutex mutex; };
76 struct NonAtomic { union { T* data; void* ptr; }; Index32 i; tbb::spin_mutex mutex; };
77
78 #ifndef __INTEL_COMPILER
79 static constexpr bool IsAtomic = ((sizeof(Atomic) == sizeof(NonAtomic))
81 && (offsetof(Atomic, i) == offsetof(NonAtomic, i)));
82 #else
83 // We can't use offsetof() with ICC, because it requires the arguments
84 // to be POD types. (C++11 requires only that they be standard layout types,
85 // which Atomic and NonAtomic are.)
86 static constexpr bool IsAtomic = (sizeof(Atomic) == sizeof(NonAtomic));
87 #endif
88 static constexpr size_t size = sizeof(Atomic);
91 using type = typename std::conditional<IsAtomic, tbb::atomic<Index32>, Index32>::type;
92 #endif
93 };
94
95 } // namespace internal
96
97
100 template<typename T, Index Log2Dim>
101 class LeafBuffer
102 {
103 public:
104 using ValueType = T;
105 using StorageType = ValueType;
106 using NodeMaskType = util::NodeMask<Log2Dim>;
107 static const Index SIZE = 1 << 3 * Log2Dim;
108
109 #if OPENVDB_ABI_VERSION_NUMBER >= 3
110 struct FileInfo
111 {
112 FileInfo(): bufpos(0) , maskpos(0) {}
113 std::streamoff bufpos;
114 std::streamoff maskpos;
115 io::MappedFile::Ptr mapping;
116 SharedPtr<io::StreamMetadata> meta;
117 };
118 #endif
119
120 #if OPENVDB_ABI_VERSION_NUMBER <= 2
121 LeafBuffer(): mData(new ValueType[SIZE]) {}
124 explicit LeafBuffer(const ValueType& val): mData(new ValueType[SIZE]) { this->fill(val); }
126 LeafBuffer(const LeafBuffer& other): mData(new ValueType[SIZE]) { *this = other; }
128 ~LeafBuffer() { delete[] mData; }
129
131 bool isOutOfCore() const { return false; }
133 bool empty() const { return (mData == nullptr); }
134 #else
135 inline LeafBuffer(): mData(new ValueType[SIZE]), mOutOfCore(0) {}
138 explicit inline LeafBuffer(const ValueType&);
140 inline LeafBuffer(const LeafBuffer&);
142 LeafBuffer(PartialCreate, const ValueType&): mData(nullptr), mOutOfCore(0) {}
144 inline ~LeafBuffer();
145
147 bool isOutOfCore() const { return bool(mOutOfCore); }
149 bool empty() const { return !mData || this->isOutOfCore(); }
150 #endif
151 bool allocate() { if (mData == nullptr) mData = new ValueType[SIZE]; return true; }
153
155 inline void fill(const ValueType&);
156
158 const ValueType& getValue(Index i) const { return this->at(i); }
160 const ValueType& operator[](Index i) const { return this->at(i); }
162 inline void setValue(Index i, const ValueType&);
163
165 inline LeafBuffer& operator=(const LeafBuffer&);
166
169 inline bool operator==(const LeafBuffer&) const;
172 inline bool operator!=(const LeafBuffer& other) const { return !(other == *this); }
173
175 inline void swap(LeafBuffer&);
176
178 inline Index memUsage() const;
180 static Index size() { return SIZE; }
181
185 const ValueType* data() const;
189 ValueType* data();
190
191 private:
193 inline const ValueType& at(Index i) const;
194
200 ValueType& operator[](Index i) { return const_cast<ValueType&>(this->at(i)); }
201
202 bool deallocate();
203
204 #if OPENVDB_ABI_VERSION_NUMBER <= 2
205 void setOutOfCore(bool) {}
206 void loadValues() const {}
207 void doLoad() const {}
208 bool detachFromFile() { return false; }
209 #else
210 inline void setOutOfCore(bool b) { mOutOfCore = b; }
211 // To facilitate inlining in the common case in which the buffer is in-core,
212 // the loading logic is split into a separate function, doLoad().
213 inline void loadValues() const { if (this->isOutOfCore()) this->doLoad(); }
214 inline void doLoad() const;
215 inline bool detachFromFile();
216 #endif
217
218
219 #if OPENVDB_ABI_VERSION_NUMBER <= 2
220 ValueType* mData;
221 #else
222 using FlagsType = typename internal::LeafBufferFlags<ValueType>::type;
223
224 union {
225 ValueType* mData;
226 FileInfo* mFileInfo;
227 };
228 FlagsType mOutOfCore; // interpreted as bool; extra bits reserved for future use
229 tbb::spin_mutex mMutex; // 1 byte
230 //int8_t mReserved[3]; // padding for alignment
231
232 static const ValueType sZero;
233 #endif
234
235 friend class ::TestLeaf;
236 // Allow the parent LeafNode to access this buffer's data pointer.
237 template<typename, Index> friend class LeafNode;
238 }; // class LeafBuffer
239
240
242
243
244 #if OPENVDB_ABI_VERSION_NUMBER >= 3
245
246 template<typename T, Index Log2Dim>
247 const T LeafBuffer<T, Log2Dim>::sZero = zeroVal<T>();
248
249
250 template<typename T, Index Log2Dim>
251 inline
252 LeafBuffer<T, Log2Dim>::LeafBuffer(const ValueType& val)
253 : mData(new ValueType[SIZE])
254 , mOutOfCore(0)
255 {
256 this->fill(val);
257 }
258
259
260 template<typename T, Index Log2Dim>
261 inline
262 LeafBuffer<T, Log2Dim>::~LeafBuffer()
263 {
264 if (this->isOutOfCore()) {
265 this->detachFromFile();
266 } else {
267 this->deallocate();
268 }
269 }
270
271
272 template<typename T, Index Log2Dim>
273 inline
274 LeafBuffer<T, Log2Dim>::LeafBuffer(const LeafBuffer& other)
275 : mData(nullptr)
276 , mOutOfCore(other.mOutOfCore)
277 {
278 if (other.isOutOfCore()) {
279 mFileInfo = new FileInfo(*other.mFileInfo);
280 } else if (other.mData != nullptr) {
281 this->allocate();
282 ValueType* target = mData;
283 const ValueType* source = other.mData;
284 Index n = SIZE;
285 while (n--) *target++ = *source++;
286 }
287 }
288
289 #endif // OPENVDB_ABI_VERSION_NUMBER >= 3
290
291
292 template<typename T, Index Log2Dim>
293 inline void
294 LeafBuffer<T, Log2Dim>::setValue(Index i, const ValueType& val)
295 {
296 assert(i < SIZE);
297 #if OPENVDB_ABI_VERSION_NUMBER <= 2
298 mData[i] = val;
299 #else
300 this->loadValues();
301 if (mData) mData[i] = val;
302 #endif
303 }
304
305
306 template<typename T, Index Log2Dim>
307 inline LeafBuffer<T, Log2Dim>&
308 LeafBuffer<T, Log2Dim>::operator=(const LeafBuffer& other)
309 {
310 if (&other != this) {
311 #if OPENVDB_ABI_VERSION_NUMBER <= 2
312 if (other.mData != nullptr) {
313 this->allocate();
314 ValueType* target = mData;
315 const ValueType* source = other.mData;
316 Index n = SIZE;
317 while (n--) *target++ = *source++;
318 }
319 #else // OPENVDB_ABI_VERSION_NUMBER >= 3
320 if (this->isOutOfCore()) {
321 this->detachFromFile();
322 } else {
323 if (other.isOutOfCore()) this->deallocate();
324 }
325 if (other.isOutOfCore()) {
326 mOutOfCore = other.mOutOfCore;
327 mFileInfo = new FileInfo(*other.mFileInfo);
328 } else if (other.mData != nullptr) {
329 this->allocate();
330 ValueType* target = mData;
331 const ValueType* source = other.mData;
332 Index n = SIZE;
333 while (n--) *target++ = *source++;
334 }
335 #endif
336 }
337 return *this;
338 }
339
340
341 template<typename T, Index Log2Dim>
342 inline void
343 LeafBuffer<T, Log2Dim>::fill(const ValueType& val)
344 {
345 this->detachFromFile();
346 if (mData != nullptr) {
347 ValueType* target = mData;
348 Index n = SIZE;
349 while (n--) *target++ = val;
350 }
351 }
352
353
354 template<typename T, Index Log2Dim>
355 inline bool
356 LeafBuffer<T, Log2Dim>::operator==(const LeafBuffer& other) const
357 {
358 this->loadValues();
359 other.loadValues();
360 const ValueType *target = mData, *source = other.mData;
361 if (!target && !source) return true;
362 if (!target || !source) return false;
363 Index n = SIZE;
364 while (n && math::isExactlyEqual(*target++, *source++)) --n;
365 return n == 0;
366 }
367
368
369 template<typename T, Index Log2Dim>
370 inline void
371 LeafBuffer<T, Log2Dim>::swap(LeafBuffer& other)
372 {
373 std::swap(mData, other.mData);
374 #if OPENVDB_ABI_VERSION_NUMBER >= 3
375 std::swap(mOutOfCore, other.mOutOfCore);
376 #endif
377 }
378
379
380 template<typename T, Index Log2Dim>
381 inline Index
382 LeafBuffer<T, Log2Dim>::memUsage() const
383 {
384 size_t n = sizeof(*this);
385 #if OPENVDB_ABI_VERSION_NUMBER <= 2
386 if (mData) n += SIZE * sizeof(ValueType);
387 #else
388 if (this->isOutOfCore()) n += sizeof(FileInfo);
389 else if (mData) n += SIZE * sizeof(ValueType);
390 #endif
391 return static_cast<Index>(n);
392 }
393
394
395 template<typename T, Index Log2Dim>
396 inline const typename LeafBuffer<T, Log2Dim>::ValueType*
397 LeafBuffer<T, Log2Dim>::data() const
398 {
399 #if OPENVDB_ABI_VERSION_NUMBER >= 3
400 this->loadValues();
401 if (mData == nullptr) {
402 LeafBuffer* self = const_cast<LeafBuffer*>(this);
403 // This lock will be contended at most once.
404 tbb::spin_mutex::scoped_lock lock(self->mMutex);
405 if (mData == nullptr) self->mData = new ValueType[SIZE];
406 }
407 #endif
408 return mData;
409 }
410
411 template<typename T, Index Log2Dim>
412 inline typename LeafBuffer<T, Log2Dim>::ValueType*
413 LeafBuffer<T, Log2Dim>::data()
414 {
415 #if OPENVDB_ABI_VERSION_NUMBER >= 3
416 this->loadValues();
417 if (mData == nullptr) {
418 // This lock will be contended at most once.
419 tbb::spin_mutex::scoped_lock lock(mMutex);
420 if (mData == nullptr) mData = new ValueType[SIZE];
421 }
422 #endif
423 return mData;
424 }
425
426
427 template<typename T, Index Log2Dim>
428 inline const typename LeafBuffer<T, Log2Dim>::ValueType&
429 LeafBuffer<T, Log2Dim>::at(Index i) const
430 {
431 assert(i < SIZE);
432 #if OPENVDB_ABI_VERSION_NUMBER <= 2
433 return mData[i];
434 #else
435 this->loadValues();
436 // We can't use the ternary operator here, otherwise Visual C++ returns
437 // a reference to a temporary.
438 if (mData) return mData[i]; else return sZero;
439 #endif
440 }
441
442
443 template<typename T, Index Log2Dim>
444 inline bool
445 LeafBuffer<T, Log2Dim>::deallocate()
446 {
447 if (mData != nullptr && !this->isOutOfCore()) {
448 delete[] mData;
449 mData = nullptr;
450 return true;
451 }
452 return false;
453 }
454
455
456 #if OPENVDB_ABI_VERSION_NUMBER >= 3
457
458 template<typename T, Index Log2Dim>
459 inline void
460 LeafBuffer<T, Log2Dim>::doLoad() const
461 {
462 if (!this->isOutOfCore()) return;
463
464 LeafBuffer<T, Log2Dim>* self = const_cast<LeafBuffer<T, Log2Dim>*>(this);
465
466 // This lock will be contended at most once, after which this buffer
467 // will no longer be out-of-core.
468 tbb::spin_mutex::scoped_lock lock(self->mMutex);
469 if (!this->isOutOfCore()) return;
470
471 std::unique_ptr<FileInfo> info(self->mFileInfo);
472 assert(info.get() != nullptr);
473 assert(info->mapping.get() != nullptr);
474 assert(info->meta.get() != nullptr);
475
477 self->mData = nullptr;
478 self->allocate();
479
480 SharedPtr<std::streambuf> buf = info->mapping->createBuffer();
481 std::istream is(buf.get());
482
483 io::setStreamMetadataPtr(is, info->meta, /*transfer=*/true);
484
485 NodeMaskType mask;
486 is.seekg(info->maskpos);
487 mask.load(is);
488
489 is.seekg(info->bufpos);
490 io::readCompressedValues(is, self->mData, SIZE, mask, io::getHalfFloat(is));
491
492 self->setOutOfCore(false);
493 }
494
495
496 template<typename T, Index Log2Dim>
497 inline bool
498 LeafBuffer<T, Log2Dim>::detachFromFile()
499 {
500 if (this->isOutOfCore()) {
501 delete mFileInfo;
502 mFileInfo = nullptr;
503 this->setOutOfCore(false);
504 return true;
505 }
506 return false;
507 }
508
509 #endif // OPENVDB_ABI_VERSION_NUMBER >= 3
510
511
513
514
515 // Partial specialization for bool ValueType
516 template<Index Log2Dim>
517 class LeafBuffer<bool, Log2Dim>
518 {
519 public:
520 using NodeMaskType = util::NodeMask<Log2Dim>;
521 using WordType = typename NodeMaskType::Word;
522 using ValueType = bool;
523 using StorageType = WordType;
524
525 static const Index WORD_COUNT = NodeMaskType::WORD_COUNT;
526 static const Index SIZE = 1 << 3 * Log2Dim;
527
528 // These static declarations must be on separate lines to avoid VC9 compiler errors.
529 static const bool sOn;
530 static const bool sOff;
531
532 LeafBuffer() {}
533 LeafBuffer(bool on): mData(on) {}
534 LeafBuffer(const NodeMaskType& other): mData(other) {}
535 LeafBuffer(const LeafBuffer& other): mData(other.mData) {}
536 ~LeafBuffer() {}
537 void fill(bool val) { mData.set(val); }
538 LeafBuffer& operator=(const LeafBuffer& b) { if (&b != this) { mData=b.mData; } return *this; }
539
540 const bool& getValue(Index i) const
541 {
542 assert(i < SIZE);
543 // We can't use the ternary operator here, otherwise Visual C++ returns
544 // a reference to a temporary.
545 if (mData.isOn(i)) return sOn; else return sOff;
546 }
547 const bool& operator[](Index i) const { return this->getValue(i); }
548
549 bool operator==(const LeafBuffer& other) const { return mData == other.mData; }
550 bool operator!=(const LeafBuffer& other) const { return mData != other.mData; }
551
552 void setValue(Index i, bool val) { assert(i < SIZE); mData.set(i, val); }
553
554 void swap(LeafBuffer& other) { if (&other != this) std::swap(mData, other.mData); }
555
556 Index memUsage() const { return sizeof(*this); }
557 static Index size() { return SIZE; }
558
561 WordType* data() { return &(mData.template getWord<WordType>(0)); }
564 const WordType* data() const { return const_cast<LeafBuffer*>(this)->data(); }
565
566 private:
567 // Allow the parent LeafNode to access this buffer's data.
568 template<typename, Index> friend class LeafNode;
569
570 NodeMaskType mData;
571 }; // class LeafBuffer
572
573
578 template<Index Log2Dim> const bool LeafBuffer<bool, Log2Dim>::sOn = true;
579 template<Index Log2Dim> const bool LeafBuffer<bool, Log2Dim>::sOff = false;
580
581 } // namespace tree
582 } // namespace OPENVDB_VERSION_NAME
583 } // namespace openvdb
584
585 #endif // OPENVDB_TREE_LEAFBUFFER_HAS_BEEN_INCLUDED
586
587 // Copyright (c) 2012-2018 DreamWorks Animation LLC
588 // All rights reserved. This software is distributed under the
589 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::operator[]
const bool & operator[](Index i) const
Definition: LeafBuffer.h:547
openvdb::v5_2::tree::LeafBuffer::LeafBuffer
LeafBuffer(PartialCreate, const ValueType &)
Construct a buffer but don&#39;t allocate memory for the full array of values.
Definition: LeafBuffer.h:142
openvdb::v5_2::tree::LeafBuffer::FileInfo::meta
SharedPtr< io::StreamMetadata > meta
Definition: LeafBuffer.h:116
Types.h
openvdb::v5_2::tree::LeafBuffer< ValueType, Log2Dim >::ValueType
ValueType ValueType
Definition: LeafBuffer.h:104
openvdb::v5_2::util::NodeMask::Word
Index64 Word
Definition: NodeMasks.h:318
Compression.h
openvdb::v5_2::math::isExactlyEqual
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition: Math.h:395
openvdb::v5_2::io::setStreamMetadataPtr
OPENVDB_API void setStreamMetadataPtr(std::ios_base &, SharedPtr< StreamMetadata > &, bool transfer=true)
Associate the given stream with (a shared pointer to) an object that stores metadata (file format...
openvdb::v5_2::tree::LeafBuffer::operator[]
const ValueType & operator[](Index i) const
Return a const reference to the i&#39;th element of this buffer.
Definition: LeafBuffer.h:160
openvdb::v5_2::tree::LeafBuffer::mFileInfo
FileInfo * mFileInfo
Definition: LeafBuffer.h:226
openvdb::v5_2::SharedPtr
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
openvdb::v5_2::tree::LeafBuffer::operator!=
bool operator!=(const LeafBuffer &other) const
Return true if the contents of the other buffer are not exactly equal to the contents of this buffer...
Definition: LeafBuffer.h:172
openvdb::v5_2::tree::LeafBuffer::FileInfo::maskpos
std::streamoff maskpos
Definition: LeafBuffer.h:114
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::LeafBuffer
LeafBuffer()
Definition: LeafBuffer.h:532
openvdb::v5_2::tree::internal::LeafBufferFlags
Definition: LeafBuffer.h:67
openvdb::v5_2::tree::LeafBuffer< ValueType, Log2Dim >::StorageType
ValueType StorageType
Definition: LeafBuffer.h:105
openvdb::v5_2::tree::LeafBuffer::empty
bool empty() const
Return true if memory for this buffer has not yet been allocated.
Definition: LeafBuffer.h:149
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::ValueType
bool ValueType
Definition: LeafBuffer.h:522
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
openvdb::v5_2::tree::internal::LeafBufferFlags::type
tbb::atomic< Index32 > type
The type of LeafBuffer::mOutOfCore.
Definition: LeafBuffer.h:71
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::LeafBuffer
LeafBuffer(const NodeMaskType &other)
Definition: LeafBuffer.h:534
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::WordType
typename NodeMaskType::Word WordType
Definition: LeafBuffer.h:521
openvdb::v5_2::tree::LeafBuffer::FileInfo::mapping
io::MappedFile::Ptr mapping
Definition: LeafBuffer.h:115
openvdb
Definition: Exceptions.h:40
openvdb::v5_2::io::getHalfFloat
OPENVDB_API bool getHalfFloat(std::ios_base &)
Return true if floating-point values should be quantized to 16 bits when writing to the given stream ...
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::sOff
static const bool sOff
Definition: LeafBuffer.h:530
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::getValue
const bool & getValue(Index i) const
Definition: LeafBuffer.h:540
openvdb::v5_2::tree::LeafBuffer::isOutOfCore
bool isOutOfCore() const
Return true if this buffer&#39;s values have not yet been read from disk.
Definition: LeafBuffer.h:147
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::memUsage
Index memUsage() const
Definition: LeafBuffer.h:556
openvdb::v5_2::tree::LeafBuffer::FileInfo::bufpos
std::streamoff bufpos
Definition: LeafBuffer.h:113
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::swap
void swap(LeafBuffer &other)
Definition: LeafBuffer.h:554
openvdb::v5_2::Index
Index32 Index
Definition: Types.h:61
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::LeafBuffer
LeafBuffer(const LeafBuffer &other)
Definition: LeafBuffer.h:535
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::sOn
static const bool sOn
Definition: LeafBuffer.h:529
openvdb::v5_2::math::operator==
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:488
openvdb::v5_2::tree::LeafBuffer::FileInfo
Definition: LeafBuffer.h:110
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::operator==
bool operator==(const LeafBuffer &other) const
Definition: LeafBuffer.h:549
openvdb::v5_2::tree::LeafBuffer::FileInfo::FileInfo
FileInfo()
Definition: LeafBuffer.h:112
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::StorageType
WordType StorageType
Definition: LeafBuffer.h:523
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::data
WordType * data()
Return a pointer to the C-style array of words encoding the bits.
Definition: LeafBuffer.h:561
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::operator=
LeafBuffer & operator=(const LeafBuffer &b)
Definition: LeafBuffer.h:538
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::size
static Index size()
Definition: LeafBuffer.h:557
openvdb::v5_2::tree::LeafBuffer
Array of fixed size 23Log2Dim that stores the voxel values of a LeafNode.
Definition: LeafBuffer.h:101
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::LeafBuffer
LeafBuffer(bool on)
Definition: LeafBuffer.h:533
NodeMasks.h
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
openvdb::v5_2::io::MappedFile::Ptr
SharedPtr< MappedFile > Ptr
Definition: io.h:152
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::setValue
void setValue(Index i, bool val)
Definition: LeafBuffer.h:552
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::fill
void fill(bool val)
Definition: LeafBuffer.h:537
openvdb::v5_2::tree::LeafBuffer::getValue
const ValueType & getValue(Index i) const
Return a const reference to the i&#39;th element of this buffer.
Definition: LeafBuffer.h:158
openvdb::v5_2::tree::LeafBuffer::size
static Index size()
Return the number of values contained in this buffer.
Definition: LeafBuffer.h:180
openvdb::v5_2::io::readCompressedValues
void readCompressedValues(std::istream &is, ValueT *destBuf, Index destCount, const MaskT &valueMask, bool fromHalf)
Definition: Compression.h:339
openvdb::v5_2::tree::LeafBuffer::mData
ValueType * mData
Definition: LeafBuffer.h:225
openvdb::v5_2::PartialCreate
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:520
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::data
const WordType * data() const
Return a const pointer to the C-style array of words encoding the bits.
Definition: LeafBuffer.h:564
openvdb::v5_2::tree::LeafNode
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:64
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::operator!=
bool operator!=(const LeafBuffer &other) const
Definition: LeafBuffer.h:550
openvdb::v5_2::Index32
uint32_t Index32
Definition: Types.h:59
openvdb::v5_2::tree::LeafBuffer< bool, Log2Dim >::~LeafBuffer
~LeafBuffer()
Definition: LeafBuffer.h:536
openvdb::v5_2::util::NodeMask
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:309