OpenVDB: Types.h Source File

OpenVDB 6.1.0

Types.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2019 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_TYPES_HAS_BEEN_INCLUDED
32 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
33
34 #include "version.h"
35 #include "Platform.h"
36 #include <OpenEXR/half.h>
37 #include <openvdb/math/Math.h>
38 #include <openvdb/math/BBox.h>
39 #include <openvdb/math/Quat.h>
40 #include <openvdb/math/Vec2.h>
41 #include <openvdb/math/Vec3.h>
42 #include <openvdb/math/Vec4.h>
43 #include <openvdb/math/Mat3.h>
44 #include <openvdb/math/Mat4.h>
45 #include <openvdb/math/Coord.h>
46 #include <memory>
47 #include <type_traits>
48 #if OPENVDB_ABI_VERSION_NUMBER <= 3
49 #include <boost/shared_ptr.hpp>
50 #include <boost/weak_ptr.hpp>
51 #endif
52
53
54 namespace openvdb {
55 OPENVDB_USE_VERSION_NAMESPACE
56 namespace OPENVDB_VERSION_NAME {
57
58 // One-dimensional scalar types
59 using Index32 = uint32_t;
60 using Index64 = uint64_t;
61 using Index = Index32;
62 using Int16 = int16_t;
63 using Int32 = int32_t;
64 using Int64 = int64_t;
65 using Int = Int32;
66 using Byte = unsigned char;
67 using Real = double;
68
69 // Two-dimensional vector types
70 using Vec2R = math::Vec2<Real>;
71 using Vec2I = math::Vec2<Index32>;
72 using Vec2f = math::Vec2<float>;
73 using Vec2H = math::Vec2<half>;
74 using math::Vec2i;
75 using math::Vec2s;
76 using math::Vec2d;
77
78 // Three-dimensional vector types
79 using Vec3R = math::Vec3<Real>;
80 using Vec3I = math::Vec3<Index32>;
81 using Vec3f = math::Vec3<float>;
82 using Vec3H = math::Vec3<half>;
83 using Vec3U8 = math::Vec3<uint8_t>;
84 using Vec3U16 = math::Vec3<uint16_t>;
85 using math::Vec3i;
86 using math::Vec3s;
87 using math::Vec3d;
88
89 using math::Coord;
90 using math::CoordBBox;
91 using BBoxd = math::BBox<Vec3d>;
92
93 // Four-dimensional vector types
94 using Vec4R = math::Vec4<Real>;
95 using Vec4I = math::Vec4<Index32>;
96 using Vec4f = math::Vec4<float>;
97 using Vec4H = math::Vec4<half>;
98 using math::Vec4i;
99 using math::Vec4s;
100 using math::Vec4d;
101
102 // Three-dimensional matrix types
103 using Mat3R = math::Mat3<Real>;
104 using math::Mat3s;
105 using math::Mat3d;
106
107 // Four-dimensional matrix types
108 using Mat4R = math::Mat4<Real>;
109 using math::Mat4s;
110 using math::Mat4d;
111
112 // Quaternions
113 using QuatR = math::Quat<Real>;
114 using math::Quats;
115 using math::Quatd;
116
117 // Dummy type for a voxel with a binary mask value, e.g. the active state
118 class ValueMask {};
119
120
121 #if OPENVDB_ABI_VERSION_NUMBER <= 3
122
123 // Use Boost shared pointers in OpenVDB 3 ABI compatibility mode.
124 template<typename T> using SharedPtr = boost::shared_ptr<T>;
125 template<typename T> using WeakPtr = boost::weak_ptr<T>;
126
127 template<typename T, typename U> inline SharedPtr<T>
128 ConstPtrCast(const SharedPtr<U>& ptr) { return boost::const_pointer_cast<T, U>(ptr); }
129
130 template<typename T, typename U> inline SharedPtr<T>
131 DynamicPtrCast(const SharedPtr<U>& ptr) { return boost::dynamic_pointer_cast<T, U>(ptr); }
132
133 template<typename T, typename U> inline SharedPtr<T>
134 StaticPtrCast(const SharedPtr<U>& ptr) { return boost::static_pointer_cast<T, U>(ptr); }
135
136 #else // if OPENVDB_ABI_VERSION_NUMBER > 3
137
138 // Use STL shared pointers from OpenVDB 4 on.
139 template<typename T> using SharedPtr = std::shared_ptr<T>;
140 template<typename T> using WeakPtr = std::weak_ptr<T>;
141
150 template<typename T, typename U> inline SharedPtr<T>
151 ConstPtrCast(const SharedPtr<U>& ptr) { return std::const_pointer_cast<T, U>(ptr); }
152
160 template<typename T, typename U> inline SharedPtr<T>
161 DynamicPtrCast(const SharedPtr<U>& ptr) { return std::dynamic_pointer_cast<T, U>(ptr); }
162
170 template<typename T, typename U> inline SharedPtr<T>
171 StaticPtrCast(const SharedPtr<U>& ptr) { return std::static_pointer_cast<T, U>(ptr); }
172
173 #endif
174
175
177
178
182 template<typename IntType_, Index Kind>
183 struct PointIndex
184 {
185 static_assert(std::is_integral<IntType_>::value, "PointIndex requires an integer value type");
186
187 using IntType = IntType_;
188
189 PointIndex(IntType i = IntType(0)): mIndex(i) {}
190
192 template<typename T> explicit PointIndex(T i): mIndex(static_cast<IntType>(i)) {}
193
194 operator IntType() const { return mIndex; }
195
197 template<typename T>
198 PointIndex operator+(T x) { return PointIndex(mIndex + IntType(x)); }
199
200 private:
201 IntType mIndex;
202 };
203
204
205 using PointIndex32 = PointIndex<Index32, 0>;
206 using PointIndex64 = PointIndex<Index64, 0>;
207
208 using PointDataIndex32 = PointIndex<Index32, 1>;
209 using PointDataIndex64 = PointIndex<Index64, 1>;
210
211
213
214
218 template <typename T, template <typename...> class Template>
219 struct IsSpecializationOf : std::false_type {};
220
221 template <typename... Args, template <typename...> class Template>
222 struct IsSpecializationOf<Template<Args...>, Template> : std::true_type {};
223
224
226
227
228 template<typename T, bool = IsSpecializationOf<T, math::Vec2>::value ||
229 IsSpecializationOf<T, math::Vec3>::value ||
230 IsSpecializationOf<T, math::Vec4>::value>
231 struct VecTraits
232 {
233 static const bool IsVec = true;
234 static const int Size = T::size;
235 using ElementType = typename T::ValueType;
236 };
237
238 template<typename T>
239 struct VecTraits<T, false>
240 {
241 static const bool IsVec = false;
242 static const int Size = 1;
243 using ElementType = T;
244 };
245
246 template<typename T, bool = IsSpecializationOf<T, math::Quat>::value>
247 struct QuatTraits
248 {
249 static const bool IsQuat = true;
250 static const int Size = T::size;
251 using ElementType = typename T::ValueType;
252 };
253
254 template<typename T>
255 struct QuatTraits<T, false>
256 {
257 static const bool IsQuat = false;
258 static const int Size = 1;
259 using ElementType = T;
260 };
261
262 template<typename T, bool = IsSpecializationOf<T, math::Mat3>::value ||
263 IsSpecializationOf<T, math::Mat4>::value>
264 struct MatTraits
265 {
266 static const bool IsMat = true;
267 static const int Size = T::size;
268 using ElementType = typename T::ValueType;
269 };
270
271 template<typename T>
272 struct MatTraits<T, false>
273 {
274 static const bool IsMat = false;
275 static const int Size = 1;
276 using ElementType = T;
277 };
278
279 template<typename T, bool = VecTraits<T>::IsVec ||
280 QuatTraits<T>::IsQuat ||
281 MatTraits<T>::IsMat>
282 struct ValueTraits
283 {
284 static const bool IsVec = VecTraits<T>::IsVec;
285 static const bool IsQuat = QuatTraits<T>::IsQuat;
286 static const bool IsMat = MatTraits<T>::IsMat;
287 static const bool IsScalar = false;
288 static const int Size = T::size;
289 static const int Elements = IsMat ? Size*Size : Size;
290 using ElementType = typename T::ValueType;
291 };
292
293 template<typename T>
294 struct ValueTraits<T, false>
295 {
296 static const bool IsVec = false;
297 static const bool IsQuat = false;
298 static const bool IsMat = false;
299 static const bool IsScalar = true;
300 static const int Size = 1;
301 static const int Elements = 1;
302 using ElementType = T;
303 };
304
305
307
308
311 template<typename FromType, typename ToType>
312 struct CanConvertType { enum { value = std::is_constructible<ToType, FromType>::value }; };
313
314 // Specializations for vector types, which can be constructed from values
315 // of their own ValueTypes (or values that can be converted to their ValueTypes),
316 // but only explicitly
317 template<typename T> struct CanConvertType<T, math::Vec2<T> > { enum { value = true }; };
318 template<typename T> struct CanConvertType<T, math::Vec3<T> > { enum { value = true }; };
319 template<typename T> struct CanConvertType<T, math::Vec4<T> > { enum { value = true }; };
320 template<typename T> struct CanConvertType<math::Vec2<T>, math::Vec2<T> > { enum {value = true}; };
321 template<typename T> struct CanConvertType<math::Vec3<T>, math::Vec3<T> > { enum {value = true}; };
322 template<typename T> struct CanConvertType<math::Vec4<T>, math::Vec4<T> > { enum {value = true}; };
323 template<typename T0, typename T1>
324 struct CanConvertType<T0, math::Vec2<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
325 template<typename T0, typename T1>
326 struct CanConvertType<T0, math::Vec3<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
327 template<typename T0, typename T1>
328 struct CanConvertType<T0, math::Vec4<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
329 template<> struct CanConvertType<PointIndex32, PointDataIndex32> { enum {value = true}; };
330 template<> struct CanConvertType<PointDataIndex32, PointIndex32> { enum {value = true}; };
331 template<typename T>
332 struct CanConvertType<T, ValueMask> { enum {value = CanConvertType<T, bool>::value}; };
333 template<typename T>
334 struct CanConvertType<ValueMask, T> { enum {value = CanConvertType<bool, T>::value}; };
335
336
338
339
347 template<typename FromType, typename ToType> struct CopyConstness {
348 using Type = typename std::remove_const<ToType>::type;
349 };
350
352 template<typename FromType, typename ToType> struct CopyConstness<const FromType, ToType> {
353 using Type = const ToType;
354 };
356
357
359
360
362
363 template<typename... Ts> struct TypeList; // forward declaration
364
365 namespace internal {
366
367 // Implementation details of TypeList
368
369 template<typename ListT, typename... Ts> struct TSAppendImpl;
370
371 // Append zero or more types.
372 template<typename... Ts, typename... OtherTs>
373 struct TSAppendImpl<TypeList<Ts...>, OtherTs...> {
374 using type = TypeList<Ts..., OtherTs...>;
375 };
376
377 // Append another TypeList's members.
378 template<typename... Ts, typename... OtherTs>
379 struct TSAppendImpl<TypeList<Ts...>, TypeList<OtherTs...>> {
380 using type = TypeList<Ts..., OtherTs...>;
381 };
382
383
384 // Remove all occurrences of type T.
385 template<typename ListT, typename T> struct TSEraseImpl;
386
387 // TypeList<>::Erase<int> = TypeList<>
388 template<typename T>
389 struct TSEraseImpl<TypeList<>, T> { using type = TypeList<>; };
390
391 // TypeList<int, char, ...>::Erase<int> = TypeList<char, ...>::Erase<int>
392 template<typename... Ts, typename T>
393 struct TSEraseImpl<TypeList<T, Ts...>, T> {
394 using type = typename TSEraseImpl<TypeList<Ts...>, T>::type;
395 };
396
397 // TypeList<float, int, char...>::Erase<int> =
398 // TypeList<float>::Append<TypeList<int, char...>::Erase<int>>
399 template<typename T2, typename... Ts, typename T>
400 struct TSEraseImpl<TypeList<T2, Ts...>, T> {
401 using type = typename TSAppendImpl<TypeList<T2>,
402 typename TSEraseImpl<TypeList<Ts...>, T>::type>::type;
403 };
404
405
406 template<typename ListT, typename... Ts> struct TSRemoveImpl;
407
408 template<typename ListT>
409 struct TSRemoveImpl<ListT> { using type = ListT; };
410
411 // Remove one or more types.
412 template<typename ListT, typename T, typename... Ts>
413 struct TSRemoveImpl<ListT, T, Ts...> {
414 using type = typename TSRemoveImpl<typename TSEraseImpl<ListT, T>::type, Ts...>::type;
415 };
416
417 // Remove the members of another TypeList.
418 template<typename ListT, typename... Ts>
419 struct TSRemoveImpl<ListT, TypeList<Ts...>> {
420 using type = typename TSRemoveImpl<ListT, Ts...>::type;
421 };
422
423
424 template<typename OpT> inline void TSForEachImpl(OpT) {}
425 template<typename OpT, typename T, typename... Ts>
426 inline void TSForEachImpl(OpT op) { op(T()); TSForEachImpl<OpT, Ts...>(op); }
427
428 } // namespace internal
429
431
432
438 template<typename... Ts>
439 struct TypeList
440 {
442 using Self = TypeList;
443
457 template<typename... TypesToAppend>
458 using Append = typename internal::TSAppendImpl<Self, TypesToAppend...>::type;
459
470 template<typename... TypesToRemove>
471 using Remove = typename internal::TSRemoveImpl<Self, TypesToRemove...>::type;
472
493 template<typename OpT>
494 static void foreach(OpT op) { internal::TSForEachImpl<OpT, Ts...>(op); }
495 };
496
497
499
500
501 // Add new items to the *end* of this list, and update NUM_GRID_CLASSES.
502 enum GridClass {
503 GRID_UNKNOWN = 0,
504 GRID_LEVEL_SET,
505 GRID_FOG_VOLUME,
506 GRID_STAGGERED
507 };
508 enum { NUM_GRID_CLASSES = GRID_STAGGERED + 1 };
509
510 static const Real LEVEL_SET_HALF_WIDTH = 3;
511
532 enum VecType {
533 VEC_INVARIANT = 0,
534 VEC_COVARIANT,
535 VEC_COVARIANT_NORMALIZE,
536 VEC_CONTRAVARIANT_RELATIVE,
537 VEC_CONTRAVARIANT_ABSOLUTE
538 };
539 enum { NUM_VEC_TYPES = VEC_CONTRAVARIANT_ABSOLUTE + 1 };
540
541
555 enum MergePolicy {
556 MERGE_ACTIVE_STATES = 0,
557 MERGE_NODES,
558 MERGE_ACTIVE_STATES_AND_NODES
559 };
560
561
563
564
565 template<typename T> const char* typeNameAsString() { return typeid(T).name(); }
566 template<> inline const char* typeNameAsString<bool>() { return "bool"; }
567 template<> inline const char* typeNameAsString<ValueMask>() { return "mask"; }
568 template<> inline const char* typeNameAsString<half>() { return "half"; }
569 template<> inline const char* typeNameAsString<float>() { return "float"; }
570 template<> inline const char* typeNameAsString<double>() { return "double"; }
571 template<> inline const char* typeNameAsString<int8_t>() { return "int8"; }
572 template<> inline const char* typeNameAsString<uint8_t>() { return "uint8"; }
573 template<> inline const char* typeNameAsString<int16_t>() { return "int16"; }
574 template<> inline const char* typeNameAsString<uint16_t>() { return "uint16"; }
575 template<> inline const char* typeNameAsString<int32_t>() { return "int32"; }
576 template<> inline const char* typeNameAsString<uint32_t>() { return "uint32"; }
577 template<> inline const char* typeNameAsString<int64_t>() { return "int64"; }
578 template<> inline const char* typeNameAsString<Vec2i>() { return "vec2i"; }
579 template<> inline const char* typeNameAsString<Vec2s>() { return "vec2s"; }
580 template<> inline const char* typeNameAsString<Vec2d>() { return "vec2d"; }
581 template<> inline const char* typeNameAsString<Vec3U8>() { return "vec3u8"; }
582 template<> inline const char* typeNameAsString<Vec3U16>() { return "vec3u16"; }
583 template<> inline const char* typeNameAsString<Vec3i>() { return "vec3i"; }
584 template<> inline const char* typeNameAsString<Vec3f>() { return "vec3s"; }
585 template<> inline const char* typeNameAsString<Vec3d>() { return "vec3d"; }
586 template<> inline const char* typeNameAsString<Vec4i>() { return "vec4i"; }
587 template<> inline const char* typeNameAsString<Vec4f>() { return "vec4s"; }
588 template<> inline const char* typeNameAsString<Vec4d>() { return "vec4d"; }
589 template<> inline const char* typeNameAsString<std::string>() { return "string"; }
590 template<> inline const char* typeNameAsString<Mat3s>() { return "mat3s"; }
591 template<> inline const char* typeNameAsString<Mat3d>() { return "mat3d"; }
592 template<> inline const char* typeNameAsString<Mat4s>() { return "mat4s"; }
593 template<> inline const char* typeNameAsString<Mat4d>() { return "mat4d"; }
594 template<> inline const char* typeNameAsString<math::Quats>() { return "quats"; }
595 template<> inline const char* typeNameAsString<math::Quatd>() { return "quatd"; }
596 template<> inline const char* typeNameAsString<PointIndex32>() { return "ptidx32"; }
597 template<> inline const char* typeNameAsString<PointIndex64>() { return "ptidx64"; }
598 template<> inline const char* typeNameAsString<PointDataIndex32>() { return "ptdataidx32"; }
599 template<> inline const char* typeNameAsString<PointDataIndex64>() { return "ptdataidx64"; }
600
601
603
604
616 template<typename AValueType, typename BValueType = AValueType>
617 class CombineArgs
618 {
619 public:
620 using AValueT = AValueType;
621 using BValueT = BValueType;
622
623 CombineArgs()
624 : mAValPtr(nullptr)
625 , mBValPtr(nullptr)
626 , mResultValPtr(&mResultVal)
627 , mAIsActive(false)
628 , mBIsActive(false)
629 , mResultIsActive(false)
630 {
631 }
632
634 CombineArgs(const AValueType& a, const BValueType& b, AValueType& result,
635 bool aOn = false, bool bOn = false)
636 : mAValPtr(&a)
637 , mBValPtr(&b)
638 , mResultValPtr(&result)
639 , mAIsActive(aOn)
640 , mBIsActive(bOn)
641 {
642 this->updateResultActive();
643 }
644
646 CombineArgs(const AValueType& a, const BValueType& b, bool aOn = false, bool bOn = false)
647 : mAValPtr(&a)
648 , mBValPtr(&b)
649 , mResultValPtr(&mResultVal)
650 , mAIsActive(aOn)
651 , mBIsActive(bOn)
652 {
653 this->updateResultActive();
654 }
655
657 const AValueType& a() const { return *mAValPtr; }
659 const BValueType& b() const { return *mBValPtr; }
661 const AValueType& result() const { return *mResultValPtr; }
663 AValueType& result() { return *mResultValPtr; }
665
667 CombineArgs& setResult(const AValueType& val) { *mResultValPtr = val; return *this; }
668
670 CombineArgs& setARef(const AValueType& a) { mAValPtr = &a; return *this; }
672 CombineArgs& setBRef(const BValueType& b) { mBValPtr = &b; return *this; }
674 CombineArgs& setResultRef(AValueType& val) { mResultValPtr = &val; return *this; }
675
677 bool aIsActive() const { return mAIsActive; }
679 bool bIsActive() const { return mBIsActive; }
681 bool resultIsActive() const { return mResultIsActive; }
682
684 CombineArgs& setAIsActive(bool b) { mAIsActive = b; updateResultActive(); return *this; }
686 CombineArgs& setBIsActive(bool b) { mBIsActive = b; updateResultActive(); return *this; }
688 CombineArgs& setResultIsActive(bool b) { mResultIsActive = b; return *this; }
689
690 protected:
693 void updateResultActive() { mResultIsActive = mAIsActive || mBIsActive; }
694
695 const AValueType* mAValPtr; // pointer to input value from A grid
696 const BValueType* mBValPtr; // pointer to input value from B grid
697 AValueType mResultVal; // computed output value (unused if stored externally)
698 AValueType* mResultValPtr; // pointer to either mResultVal or an external value
699 bool mAIsActive, mBIsActive; // active states of A and B values
700 bool mResultIsActive; // computed active state (default: A active || B active)
701 };
702
703
707 template<typename ValueType, typename CombineOp>
708 struct SwappedCombineOp
709 {
710 SwappedCombineOp(CombineOp& _op): op(_op) {}
711
712 void operator()(CombineArgs<ValueType>& args)
713 {
714 CombineArgs<ValueType> swappedArgs(args.b(), args.a(), args.result(),
715 args.bIsActive(), args.aIsActive());
716 op(swappedArgs);
717 }
718
719 CombineOp& op;
720 };
721
722
724
725
726 #if OPENVDB_ABI_VERSION_NUMBER <= 3
727 enum OPENVDB_DEPRECATED CopyPolicy { CP_NEW, CP_SHARE, CP_COPY };
742 #endif
743
744
747 class ShallowCopy {};
750 class TopologyCopy {};
752 class PartialCreate {};
753
754 } // namespace OPENVDB_VERSION_NAME
755 } // namespace openvdb
756
757
758 #if defined(__ICC)
759
760 // Use these defines to bracket a region of code that has safe static accesses.
761 // Keep the region as small as possible.
762 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710))
763 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710))
764 #define OPENVDB_START_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))
765 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))
766 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712))
767 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712))
768
769 // Use these defines to bracket a region of code that has unsafe static accesses.
770 // Keep the region as small as possible.
771 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(disable:1710))
772 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE __pragma(warning(default:1710))
773 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE __pragma(warning(disable:1711))
774 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE __pragma(warning(default:1711))
775 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(disable:1712))
776 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS __pragma(warning(default:1712))
777
778 // Simpler version for one-line cases
779 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) \
780 __pragma(warning(disable:1710)); CODE; __pragma(warning(default:1710))
781 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) \
782 __pragma(warning(disable:1711)); CODE; __pragma(warning(default:1711))
783 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) \
784 __pragma(warning(disable:1712)); CODE; __pragma(warning(default:1712))
785
786 #else // GCC does not support these compiler warnings
787
788 #define OPENVDB_START_THREADSAFE_STATIC_REFERENCE
789 #define OPENVDB_FINISH_THREADSAFE_STATIC_REFERENCE
790 #define OPENVDB_START_THREADSAFE_STATIC_WRITE
791 #define OPENVDB_FINISH_THREADSAFE_STATIC_WRITE
792 #define OPENVDB_START_THREADSAFE_STATIC_ADDRESS
793 #define OPENVDB_FINISH_THREADSAFE_STATIC_ADDRESS
794
795 #define OPENVDB_START_NON_THREADSAFE_STATIC_REFERENCE
796 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_REFERENCE
797 #define OPENVDB_START_NON_THREADSAFE_STATIC_WRITE
798 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_WRITE
799 #define OPENVDB_START_NON_THREADSAFE_STATIC_ADDRESS
800 #define OPENVDB_FINISH_NON_THREADSAFE_STATIC_ADDRESS
801
802 #define OPENVDB_THREADSAFE_STATIC_REFERENCE(CODE) CODE
803 #define OPENVDB_THREADSAFE_STATIC_WRITE(CODE) CODE
804 #define OPENVDB_THREADSAFE_STATIC_ADDRESS(CODE) CODE
805
806 #endif // defined(__ICC)
807
808 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
809
810 // Copyright (c) 2012-2019 DreamWorks Animation LLC
811 // All rights reserved. This software is distributed under the
812 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
openvdb::v6_1::math::Vec4d
Vec4< double > Vec4d
Definition: Vec4.h:587
openvdb::v6_1::typeNameAsString< int64_t >
const char * typeNameAsString< int64_t >()
Definition: Types.h:577
openvdb::v6_1::VecTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:235
openvdb::v6_1::CombineArgs::setBIsActive
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:686
openvdb::v6_1::ValueTraits
Definition: Types.h:282
openvdb::v6_1::CombineArgs::setResultIsActive
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:688
Vec2.h
openvdb::v6_1::typeNameAsString< Vec2d >
const char * typeNameAsString< Vec2d >()
Definition: Types.h:580
openvdb::v6_1::CombineArgs::mBValPtr
const BValueType * mBValPtr
Definition: Types.h:696
OPENVDB_DEPRECATED
#define OPENVDB_DEPRECATED
Definition: Platform.h:69
openvdb::v6_1::typeNameAsString< Vec4d >
const char * typeNameAsString< Vec4d >()
Definition: Types.h:588
Vec3.h
openvdb::v6_1::typeNameAsString< Vec2i >
const char * typeNameAsString< Vec2i >()
Definition: Types.h:578
openvdb::v6_1::math::Vec2i
Vec2< int32_t > Vec2i
Definition: Vec2.h:556
openvdb::v6_1::CombineArgs::setBRef
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:672
openvdb::v6_1::CombineArgs::setARef
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:670
Math.h
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
openvdb::v6_1::typeNameAsString< Vec2s >
const char * typeNameAsString< Vec2s >()
Definition: Types.h:579
openvdb::v6_1::math::Vec2
Definition: Vec2.h:50
openvdb::v6_1::typeNameAsString< int8_t >
const char * typeNameAsString< int8_t >()
Definition: Types.h:571
openvdb::v6_1::TypeList::Remove
typename internal::TSRemoveImpl< Self, TypesToRemove... >::type Remove
Remove all occurrences of one or more types, or the members of another TypeList, from this list.
Definition: Types.h:471
openvdb::v6_1::MatTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:268
openvdb::v6_1::IsSpecializationOf
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: Types.h:219
openvdb::v6_1::math::Vec4i
Vec4< int32_t > Vec4i
Definition: Vec4.h:584
Coord.h
openvdb::v6_1::typeNameAsString< int32_t >
const char * typeNameAsString< int32_t >()
Definition: Types.h:575
openvdb::v6_1::SwappedCombineOp::SwappedCombineOp
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:710
openvdb::v6_1::typeNameAsString< Vec3f >
const char * typeNameAsString< Vec3f >()
Definition: Types.h:584
openvdb::v6_1::typeNameAsString< PointIndex64 >
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:597
openvdb::v6_1::CombineArgs::mAValPtr
const AValueType * mAValPtr
Definition: Types.h:695
openvdb::v6_1::Int64
int64_t Int64
Definition: Types.h:64
openvdb::v6_1::PointIndex
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:183
openvdb::v6_1::CombineArgs::updateResultActive
void updateResultActive()
Definition: Types.h:693
openvdb::v6_1::typeNameAsString< Vec3U16 >
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:582
Mat4.h
openvdb::v6_1::math::Vec3i
Vec3< int32_t > Vec3i
Definition: Vec3.h:686
openvdb::v6_1::ShallowCopy
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:747
openvdb::v6_1::CombineArgs::CombineArgs
CombineArgs()
Definition: Types.h:623
openvdb::v6_1::ConstPtrCast
SharedPtr< T > ConstPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that points to the same object as the given pointer but with possibly dif...
Definition: Types.h:151
openvdb::v6_1::CombineArgs::setAIsActive
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:684
openvdb::v6_1::StaticPtrCast
SharedPtr< T > StaticPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that points to the same object as the given pointer after a static_cast.
Definition: Types.h:171
openvdb::v6_1::MergePolicy
MergePolicy
Definition: Types.h:555
openvdb::v6_1::math::Vec2d
Vec2< double > Vec2d
Definition: Vec2.h:559
openvdb::v6_1::typeNameAsString< Vec3i >
const char * typeNameAsString< Vec3i >()
Definition: Types.h:583
openvdb::v6_1::typeNameAsString< Mat3s >
const char * typeNameAsString< Mat3s >()
Definition: Types.h:590
openvdb::v6_1::math::BBox< Vec3d >
BBox.h
openvdb::v6_1::VecTraits< T, false >::ElementType
T ElementType
Definition: Types.h:243
Mat3.h
openvdb::v6_1::typeNameAsString< uint16_t >
const char * typeNameAsString< uint16_t >()
Definition: Types.h:574
openvdb::v6_1::typeNameAsString< PointDataIndex64 >
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:599
openvdb::v6_1::CombineArgs::mBIsActive
bool mBIsActive
Definition: Types.h:699
Quat.h
openvdb::v6_1::CombineArgs::CombineArgs
CombineArgs(const AValueType &a, const BValueType &b, AValueType &result, bool aOn=false, bool bOn=false)
Use this constructor when the result value is stored externally.
Definition: Types.h:634
openvdb::v6_1::QuatTraits< T, false >::ElementType
T ElementType
Definition: Types.h:259
openvdb::v6_1::SharedPtr
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
openvdb::v6_1::typeNameAsString< Mat3d >
const char * typeNameAsString< Mat3d >()
Definition: Types.h:591
openvdb::v6_1::math::Quats
Quat< float > Quats
Definition: Quat.h:646
openvdb::v6_1::PartialCreate
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:752
openvdb::v6_1::ValueMask
Definition: Types.h:118
openvdb::v6_1::typeNameAsString< Vec3d >
const char * typeNameAsString< Vec3d >()
Definition: Types.h:585
openvdb::v6_1::CombineArgs::result
const AValueType & result() const
Get the output value.
Definition: Types.h:662
openvdb::v6_1::math::Vec4
Definition: Mat4.h:51
openvdb::v6_1::PointIndex::IntType
IntType_ IntType
Definition: Types.h:187
openvdb::v6_1::math::Vec3d
Vec3< double > Vec3d
Definition: Vec3.h:689
openvdb::v6_1::DynamicPtrCast
SharedPtr< T > DynamicPtrCast(const SharedPtr< U > &ptr)
Return a new shared pointer that is either null or points to the same object as the given pointer aft...
Definition: Types.h:161
openvdb::v6_1::typeNameAsString< PointDataIndex32 >
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:598
openvdb::v6_1::CombineArgs::mResultIsActive
bool mResultIsActive
Definition: Types.h:700
openvdb::v6_1::CombineArgs::mResultValPtr
AValueType * mResultValPtr
Definition: Types.h:698
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:125
openvdb::v6_1::QuatTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:251
openvdb::v6_1::typeNameAsString< uint8_t >
const char * typeNameAsString< uint8_t >()
Definition: Types.h:572
openvdb::v6_1::CopyConstness::Type
typename std::remove_const< ToType >::type Type
Definition: Types.h:348
openvdb::v6_1::CombineArgs::b
const BValueType & b() const
Get the B input value.
Definition: Types.h:659
openvdb::v6_1::CombineArgs::a
const AValueType & a() const
Get the A input value.
Definition: Types.h:657
openvdb::v6_1::Int16
int16_t Int16
Definition: Types.h:62
openvdb::v6_1::math::Mat3s
Mat3< float > Mat3s
Definition: Mat3.h:842
openvdb::v6_1::GRID_FOG_VOLUME
Definition: Types.h:505
openvdb::v6_1::Index
Index32 Index
Definition: Types.h:61
openvdb::v6_1::SwappedCombineOp::operator()
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:712
openvdb::v6_1::PointIndex::PointIndex
PointIndex(T i)
Explicit type conversion constructor.
Definition: Types.h:192
openvdb::v6_1::Index64
uint64_t Index64
Definition: Types.h:60
openvdb::v6_1::math::Mat4s
Mat4< float > Mat4s
Definition: Mat4.h:1360
openvdb::v6_1::Real
double Real
Definition: Types.h:67
openvdb
Definition: Exceptions.h:40
openvdb::v6_1::typeNameAsString< bool >
const char * typeNameAsString< bool >()
Definition: Types.h:566
openvdb::v6_1::CombineArgs::CombineArgs
CombineArgs(const AValueType &a, const BValueType &b, bool aOn=false, bool bOn=false)
Use this constructor when the result value should be stored in this struct.
Definition: Types.h:646
openvdb::v6_1::VEC_INVARIANT
Definition: Types.h:533
openvdb::v6_1::CombineArgs::setResultRef
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:674
openvdb::v6_1::typeNameAsString
const char * typeNameAsString()
Definition: Types.h:565
openvdb::v6_1::PointIndex::operator+
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:198
openvdb::v6_1::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:271
openvdb::v6_1::CombineArgs::resultIsActive
bool resultIsActive() const
Definition: Types.h:681
openvdb::v6_1::typeNameAsString< float >
const char * typeNameAsString< float >()
Definition: Types.h:569
openvdb::v6_1::math::Vec3< Real >
openvdb::v6_1::VEC_CONTRAVARIANT_ABSOLUTE
Definition: Types.h:537
openvdb::v6_1::math::Mat4< Real >
openvdb::v6_1::math::Vec4s
Vec4< float > Vec4s
Definition: Vec4.h:586
version.h
Library and file format version numbers.
openvdb::v6_1::math::Vec3s
Vec3< float > Vec3s
Definition: Vec3.h:688
openvdb::v6_1::CombineArgs
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:617
openvdb::v6_1::CombineArgs::BValueT
BValueType BValueT
Definition: Types.h:621
openvdb::v6_1::VEC_CONTRAVARIANT_RELATIVE
Definition: Types.h:536
openvdb::v6_1::TypeList::Append
typename internal::TSAppendImpl< Self, TypesToAppend... >::type Append
Append types, or the members of another TypeList, to this list.
Definition: Types.h:458
openvdb::v6_1::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:52
openvdb::v6_1::typeNameAsString< half >
const char * typeNameAsString< half >()
Definition: Types.h:568
openvdb::v6_1::Int
Int32 Int
Definition: Types.h:65
openvdb::v6_1::VecType
VecType
Definition: Types.h:532
openvdb::v6_1::VEC_COVARIANT
Definition: Types.h:534
openvdb::v6_1::math::Quatd
Quat< double > Quatd
Definition: Quat.h:647
openvdb::v6_1::VecTraits
Definition: Types.h:231
openvdb::v6_1::CombineArgs::result
AValueType & result()
Get the output value.
Definition: Types.h:663
openvdb::v6_1::typeNameAsString< ValueMask >
const char * typeNameAsString< ValueMask >()
Definition: Types.h:567
openvdb::v6_1::TopologyCopy
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:750
openvdb::v6_1::CombineArgs::aIsActive
bool aIsActive() const
Definition: Types.h:677
openvdb::v6_1::GridClass
GridClass
Definition: Types.h:502
openvdb::v6_1::SwappedCombineOp::op
CombineOp & op
Definition: Types.h:719
openvdb::v6_1::LEVEL_SET_HALF_WIDTH
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:510
openvdb::v6_1::CopyConstness
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: Types.h:347
openvdb::v6_1::GRID_STAGGERED
Definition: Types.h:506
openvdb::v6_1::math::Mat4d
Mat4< double > Mat4d
Definition: Mat4.h:1361
openvdb::v6_1::math::Vec2s
Vec2< float > Vec2s
Definition: Vec2.h:558
openvdb::v6_1::WeakPtr
std::weak_ptr< T > WeakPtr
Definition: Types.h:140
openvdb::v6_1::typeNameAsString< int16_t >
const char * typeNameAsString< int16_t >()
Definition: Types.h:573
openvdb::v6_1::ValueTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:290
openvdb::v6_1::typeNameAsString< Vec3U8 >
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:581
openvdb::v6_1::NUM_VEC_TYPES
Definition: Types.h:539
openvdb::v6_1::CombineArgs::mResultVal
AValueType mResultVal
Definition: Types.h:697
openvdb::v6_1::math::Mat3
3x3 matrix class.
Definition: Mat3.h:55
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:177
openvdb::v6_1::PointIndex::PointIndex
PointIndex(IntType i=IntType(0))
Definition: Types.h:189
openvdb::v6_1::TypeList
A list of types (not necessarily unique)
Definition: Types.h:439
openvdb::v6_1::GRID_UNKNOWN
Definition: Types.h:503
openvdb::v6_1::typeNameAsString< Vec4i >
const char * typeNameAsString< Vec4i >()
Definition: Types.h:586
openvdb::v6_1::typeNameAsString< double >
const char * typeNameAsString< double >()
Definition: Types.h:570
openvdb::v6_1::Byte
unsigned char Byte
Definition: Types.h:66
openvdb::v6_1::MERGE_ACTIVE_STATES_AND_NODES
Definition: Types.h:558
openvdb::v6_1::typeNameAsString< Mat4s >
const char * typeNameAsString< Mat4s >()
Definition: Types.h:592
openvdb::v6_1::VEC_COVARIANT_NORMALIZE
Definition: Types.h:535
openvdb::v6_1::Int32
int32_t Int32
Definition: Types.h:63
openvdb::v6_1::ValueTraits< T, false >::ElementType
T ElementType
Definition: Types.h:302
openvdb::v6_1::QuatTraits
Definition: Types.h:247
openvdb::v6_1::GRID_LEVEL_SET
Definition: Types.h:504
openvdb::v6_1::NUM_GRID_CLASSES
Definition: Types.h:508
openvdb::v6_1::MatTraits
Definition: Types.h:264
openvdb::v6_1::math::Mat3d
Mat3< double > Mat3d
Definition: Mat3.h:843
openvdb::v6_1::CombineArgs::AValueT
AValueType AValueT
Definition: Types.h:620
openvdb::v6_1::CombineArgs::bIsActive
bool bIsActive() const
Definition: Types.h:679
openvdb::v6_1::typeNameAsString< PointIndex32 >
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:596
openvdb::v6_1::MERGE_NODES
Definition: Types.h:557
openvdb::v6_1::MERGE_ACTIVE_STATES
Definition: Types.h:556
openvdb::v6_1::CanConvertType
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:312
openvdb::v6_1::typeNameAsString< Mat4d >
const char * typeNameAsString< Mat4d >()
Definition: Types.h:593
openvdb::v6_1::CombineArgs::setResult
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:667
openvdb::v6_1::typeNameAsString< Vec4f >
const char * typeNameAsString< Vec4f >()
Definition: Types.h:587
openvdb::v6_1::typeNameAsString< uint32_t >
const char * typeNameAsString< uint32_t >()
Definition: Types.h:576
openvdb::v6_1::MatTraits< T, false >::ElementType
T ElementType
Definition: Types.h:276
openvdb::v6_1::math::Quat
Definition: Mat.h:196
Platform.h
openvdb::v6_1::SwappedCombineOp
Definition: Types.h:708
openvdb::v6_1::Index32
uint32_t Index32
Definition: Types.h:59
Vec4.h