OpenVDB  6.2.0
Types.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 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 {
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
74 using math::Vec2i;
75 using math::Vec2s;
76 using math::Vec2d;
77 
78 // Three-dimensional vector types
85 using math::Vec3i;
86 using math::Vec3s;
87 using math::Vec3d;
88 
89 using math::Coord;
90 using math::CoordBBox;
92 
93 // Four-dimensional vector types
98 using math::Vec4i;
99 using math::Vec4s;
100 using math::Vec4d;
101 
102 // Three-dimensional matrix types
104 using math::Mat3s;
105 using math::Mat3d;
106 
107 // Four-dimensional matrix types
109 using math::Mat4s;
110 using math::Mat4d;
111 
112 // Quaternions
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>
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 
207 
210 
211 
213 
214 
218 template <typename T, template <typename...> class Template>
219 struct IsSpecializationOf: public std::false_type {};
220 
221 template <typename... Args, template <typename...> class Template>
222 struct IsSpecializationOf<Template<Args...>, Template>: public std::true_type {};
223 
224 
226 
227 
228 template<typename T, bool = IsSpecializationOf<T, math::Vec2>::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>
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 ||
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 ||
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>
333 template<typename T>
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 {
507 };
509 
510 static const Real LEVEL_SET_HALF_WIDTH = 3;
511 
532 enum VecType {
538 };
540 
541 
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>
618 {
619 public:
620  using AValueT = AValueType;
621  using BValueT = BValueType;
622 
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>
709 {
710  SwappedCombineOp(CombineOp& _op): op(_op) {}
711 
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) 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/ )
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
AValueType * mResultValPtr
Definition: Types.h:698
PointIndex(T i)
Explicit type conversion constructor.
Definition: Types.h:192
const char * typeNameAsString< half >()
Definition: Types.h:568
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:710
const char * typeNameAsString< Vec3d >()
Definition: Types.h:585
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:596
std::weak_ptr< T > WeakPtr
Definition: Types.h:140
bool bIsActive() const
Definition: Types.h:679
bool mResultIsActive
Definition: Types.h:700
#define OPENVDB_DEPRECATED
Definition: Platform.h:69
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
3x3 matrix class.
Definition: Mat3.h:55
Vec4< int32_t > Vec4i
Definition: Vec4.h:584
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
const char * typeNameAsString< Mat3s >()
Definition: Types.h:590
Definition: Types.h:534
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:674
const AValueType & result() const
Get the output value.
Definition: Types.h:662
Vec4< float > Vec4s
Definition: Vec4.h:586
const char * typeNameAsString< int16_t >()
Definition: Types.h:573
T ElementType
Definition: Types.h:276
Definition: Types.h:282
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:312
Quat< double > Quatd
Definition: Quat.h:647
Definition: Mat4.h:51
typename T::ValueType ElementType
Definition: Types.h:290
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:183
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:52
const char * typeNameAsString< ValueMask >()
Definition: Types.h:567
A list of types (not necessarily unique)
Definition: Types.h:439
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:510
const char * typeNameAsString< bool >()
Definition: Types.h:566
typename T::ValueType ElementType
Definition: Types.h:251
Vec2< double > Vec2d
Definition: Vec2.h:559
int64_t Int64
Definition: Types.h:64
const BValueType & b() const
Get the B input value.
Definition: Types.h:659
Index32 Index
Definition: Types.h:61
Definition: Types.h:508
const char * typeNameAsString< int32_t >()
Definition: Types.h:575
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
const char * typeNameAsString< int8_t >()
Definition: Types.h:571
AValueType mResultVal
Definition: Types.h:697
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:747
typename T::ValueType ElementType
Definition: Types.h:235
Vec3< int32_t > Vec3i
Definition: Vec3.h:686
unsigned char Byte
Definition: Types.h:66
const char * typeNameAsString< double >()
Definition: Types.h:570
const char * typeNameAsString< Vec3i >()
Definition: Types.h:583
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
const char * typeNameAsString< int64_t >()
Definition: Types.h:577
T ElementType
Definition: Types.h:243
Mat4< double > Mat4d
Definition: Mat4.h:1361
BValueType BValueT
Definition: Types.h:621
Definition: Types.h:231
const char * typeNameAsString< Vec3f >()
Definition: Types.h:584
Vec3< double > Vec3d
Definition: Vec3.h:689
AValueType AValueT
Definition: Types.h:620
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:581
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:750
Definition: Types.h:539
const char * typeNameAsString< Vec4d >()
Definition: Types.h:588
CombineOp & op
Definition: Types.h:719
const char * typeNameAsString< Mat4s >()
Definition: Types.h:592
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:688
const char * typeNameAsString< Mat3d >()
Definition: Types.h:591
double Real
Definition: Types.h:67
MergePolicy
Definition: Types.h:555
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:667
Definition: Types.h:556
const BValueType * mBValPtr
Definition: Types.h:696
AValueType & result()
Get the output value.
Definition: Types.h:663
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:712
typename std::remove_const< ToType >::type Type
Definition: Types.h:348
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
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:128
T ElementType
Definition: Types.h:302
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:597
IntType_ IntType
Definition: Types.h:187
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: Types.h:347
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:686
typename T::ValueType ElementType
Definition: Types.h:268
const char * typeNameAsString()
Definition: Types.h:565
Mat4< float > Mat4s
Definition: Mat4.h:1360
bool aIsActive() const
Definition: Types.h:677
typename internal::TSAppendImpl< Self, TypesToAppend... >::type Append
Append types, or the members of another TypeList, to this list.
Definition: Types.h:458
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:275
const char * typeNameAsString< float >()
Definition: Types.h:569
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:198
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:599
Int32 Int
Definition: Types.h:65
Vec4< double > Vec4d
Definition: Vec4.h:587
T ElementType
Definition: Types.h:259
Definition: Exceptions.h:40
GridClass
Definition: Types.h:502
Vec2< int32_t > Vec2i
Definition: Vec2.h:556
const char * typeNameAsString< Vec2s >()
Definition: Types.h:579
Vec3< float > Vec3s
Definition: Vec3.h:688
VecType
Definition: Types.h:532
uint64_t Index64
Definition: Types.h:60
Definition: Types.h:504
bool resultIsActive() const
Definition: Types.h:681
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:672
Library and file format version numbers.
const char * typeNameAsString< Vec4i >()
Definition: Types.h:586
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
const char * typeNameAsString< Vec4f >()
Definition: Types.h:587
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:617
Definition: Types.h:503
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: Types.h:219
const AValueType * mAValPtr
Definition: Types.h:695
CombineArgs()
Definition: Types.h:623
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:670
Definition: Types.h:505
const AValueType & a() const
Get the A input value.
Definition: Types.h:657
Definition: Types.h:264
Definition: Mat.h:196
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
bool mBIsActive
Definition: Types.h:699
const char * typeNameAsString< Vec2i >()
Definition: Types.h:578
void updateResultActive()
Definition: Types.h:693
Definition: Types.h:557
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:582
Quat< float > Quats
Definition: Quat.h:646
Definition: Types.h:118
const char * typeNameAsString< uint8_t >()
Definition: Types.h:572
int32_t Int32
Definition: Types.h:63
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:598
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:180
Vec2< float > Vec2s
Definition: Vec2.h:558
Definition: Vec2.h:50
int16_t Int16
Definition: Types.h:62
Definition: Types.h:247
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:752
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:684
const char * typeNameAsString< uint32_t >()
Definition: Types.h:576
Definition: Types.h:533
PointIndex(IntType i=IntType(0))
Definition: Types.h:189
const char * typeNameAsString< Vec2d >()
Definition: Types.h:580
uint32_t Index32
Definition: Types.h:59
Definition: Types.h:708
const char * typeNameAsString< Mat4d >()
Definition: Types.h:593
Mat3< double > Mat3d
Definition: Mat3.h:843
Definition: Types.h:506
const char * typeNameAsString< uint16_t >()
Definition: Types.h:574
Mat3< float > Mat3s
Definition: Mat3.h:842