HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Types.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
4 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
6 
7 #include "version.h"
8 #include "Platform.h"
9 #include "TypeList.h" // backwards compat
10 
11 #ifdef OPENVDB_USE_IMATH_HALF
12 #ifdef OPENVDB_IMATH_VERSION
13 #include <Imath/half.h>
14 #else
15 #include <OpenEXR/half.h>
16 #endif
17 namespace openvdb {
19 namespace OPENVDB_VERSION_NAME {
20 namespace math {
21 using half = half;
22 }}}
23 #else
24 #include <openvdb/math/Half.h>
25 namespace openvdb {
27 namespace OPENVDB_VERSION_NAME {
28 namespace math {
30 }}}
31 #endif
32 
33 #include <openvdb/math/Math.h>
34 #include <openvdb/math/BBox.h>
35 #include <openvdb/math/Quat.h>
36 #include <openvdb/math/Vec2.h>
37 #include <openvdb/math/Vec3.h>
38 #include <openvdb/math/Vec4.h>
39 #include <openvdb/math/Mat3.h>
40 #include <openvdb/math/Mat4.h>
41 #include <openvdb/math/Coord.h>
42 #include <cstdint>
43 #include <memory>
44 #include <type_traits>
45 
46 
47 namespace openvdb {
49 namespace OPENVDB_VERSION_NAME {
50 
51 // One-dimensional scalar types
52 using Index32 = uint32_t;
53 using Index64 = uint64_t;
54 using Index = Index32;
55 using Int16 = int16_t;
56 using Int32 = int32_t;
57 using Int64 = int64_t;
58 using Int = Int32;
59 using Byte = unsigned char;
60 using Real = double;
61 
62 // Two-dimensional vector types
67 using math::Vec2i;
68 using math::Vec2s;
69 using math::Vec2d;
70 
71 // Three-dimensional vector types
78 using math::Vec3i;
79 using math::Vec3s;
80 using math::Vec3d;
81 
82 using math::Coord;
83 using math::CoordBBox;
85 
86 // Four-dimensional vector types
91 using math::Vec4i;
92 using math::Vec4s;
93 using math::Vec4d;
94 
95 // Three-dimensional matrix types
97 using math::Mat3s;
98 using math::Mat3d;
99 
100 // Four-dimensional matrix types
102 using math::Mat4s;
103 using math::Mat4d;
104 
105 // Quaternions
107 using math::Quats;
108 using math::Quatd;
109 
110 // Dummy type for a voxel with a binary mask value, e.g. the active state
111 class ValueMask {};
112 
113 // Use STL shared pointers from OpenVDB 4 on.
114 template<typename T> using SharedPtr = std::shared_ptr<T>;
115 template<typename T> using WeakPtr = std::weak_ptr<T>;
116 
117 /// @brief Return a new shared pointer that points to the same object
118 /// as the given pointer but with possibly different <TT>const</TT>-ness.
119 /// @par Example:
120 /// @code
121 /// FloatGrid::ConstPtr grid = ...;
122 /// FloatGrid::Ptr nonConstGrid = ConstPtrCast<FloatGrid>(grid);
123 /// FloatGrid::ConstPtr constGrid = ConstPtrCast<const FloatGrid>(nonConstGrid);
124 /// @endcode
125 template<typename T, typename U> inline SharedPtr<T>
126 ConstPtrCast(const SharedPtr<U>& ptr) { return std::const_pointer_cast<T, U>(ptr); }
127 
128 /// @brief Return a new shared pointer that is either null or points to
129 /// the same object as the given pointer after a @c dynamic_cast.
130 /// @par Example:
131 /// @code
132 /// GridBase::ConstPtr grid = ...;
133 /// FloatGrid::ConstPtr floatGrid = DynamicPtrCast<const FloatGrid>(grid);
134 /// @endcode
135 template<typename T, typename U> inline SharedPtr<T>
136 DynamicPtrCast(const SharedPtr<U>& ptr) { return std::dynamic_pointer_cast<T, U>(ptr); }
137 
138 /// @brief Return a new shared pointer that points to the same object
139 /// as the given pointer after a @c static_cast.
140 /// @par Example:
141 /// @code
142 /// FloatGrid::Ptr floatGrid = ...;
143 /// GridBase::Ptr grid = StaticPtrCast<GridBase>(floatGrid);
144 /// @endcode
145 template<typename T, typename U> inline SharedPtr<T>
146 StaticPtrCast(const SharedPtr<U>& ptr) { return std::static_pointer_cast<T, U>(ptr); }
147 
148 
149 ////////////////////////////////////////
150 
151 
152 /// @brief Integer wrapper, required to distinguish PointIndexGrid and
153 /// PointDataGrid from Int32Grid and Int64Grid
154 /// @note @c Kind is a dummy parameter used to create distinct types.
155 template<typename IntType_, Index Kind>
157 {
158  static_assert(std::is_integral<IntType_>::value, "PointIndex requires an integer value type");
159 
160  using IntType = IntType_;
161 
162  PointIndex(IntType i = IntType(0)): mIndex(i) {}
163 
164  /// Explicit type conversion constructor
165  template<typename T> explicit PointIndex(T i): mIndex(static_cast<IntType>(i)) {}
166 
167  operator IntType() const { return mIndex; }
168 
169  /// Needed to support the <tt>(zeroVal<PointIndex>() + val)</tt> idiom.
170  template<typename T>
171  PointIndex operator+(T x) { return PointIndex(mIndex + IntType(x)); }
172 
173 private:
174  IntType mIndex;
175 };
176 
177 
180 
183 
184 
185 ////////////////////////////////////////
186 
187 
188 /// @brief Helper metafunction used to determine if the first template
189 /// parameter is a specialization of the class template given in the second
190 /// template parameter
191 template <typename T, template <typename...> class Template>
192 struct IsSpecializationOf: public std::false_type {};
193 
194 template <typename... Args, template <typename...> class Template>
195 struct IsSpecializationOf<Template<Args...>, Template>: public std::true_type {};
196 
197 
198 ////////////////////////////////////////
199 
200 
204 struct VecTraits
205 {
206  static const bool IsVec = true;
207  static const int Size = T::size;
208  using ElementType = typename T::ValueType;
209 };
210 
211 template<typename T>
212 struct VecTraits<T, false>
213 {
214  static const bool IsVec = false;
215  static const int Size = 1;
216  using ElementType = T;
217 };
218 
221 {
222  static const bool IsQuat = true;
223  static const int Size = T::size;
224  using ElementType = typename T::ValueType;
225 };
226 
227 template<typename T>
228 struct QuatTraits<T, false>
229 {
230  static const bool IsQuat = false;
231  static const int Size = 1;
232  using ElementType = T;
233 };
234 
237 struct MatTraits
238 {
239  static const bool IsMat = true;
240  static const int Size = T::size;
241  using ElementType = typename T::ValueType;
242 };
243 
244 template<typename T>
245 struct MatTraits<T, false>
246 {
247  static const bool IsMat = false;
248  static const int Size = 1;
249  using ElementType = T;
250 };
251 
252 template<typename T, bool = VecTraits<T>::IsVec ||
256 {
257  static const bool IsVec = VecTraits<T>::IsVec;
258  static const bool IsQuat = QuatTraits<T>::IsQuat;
259  static const bool IsMat = MatTraits<T>::IsMat;
260  static const bool IsScalar = false;
261  static const int Size = T::size;
262  static const int Elements = IsMat ? Size*Size : Size;
263  using ElementType = typename T::ValueType;
264 };
265 
266 template<typename T>
267 struct ValueTraits<T, false>
268 {
269  static const bool IsVec = false;
270  static const bool IsQuat = false;
271  static const bool IsMat = false;
272  static const bool IsScalar = true;
273  static const int Size = 1;
274  static const int Elements = 1;
275  using ElementType = T;
276 };
277 
278 
279 /// @brief Conversion classes for changing the underlying type of VDB types
280 /// @{
281 template<typename T, typename SubT> struct ConvertElementType { using Type = SubT; };
282 template<typename T, typename SubT> struct ConvertElementType<math::Vec2<T>, SubT> { using Type = math::Vec2<SubT>; };
283 template<typename T, typename SubT> struct ConvertElementType<math::Vec3<T>, SubT> { using Type = math::Vec3<SubT>; };
284 template<typename T, typename SubT> struct ConvertElementType<math::Vec4<T>, SubT> { using Type = math::Vec4<SubT>; };
285 template<typename T, typename SubT> struct ConvertElementType<math::Quat<T>, SubT> { using Type = math::Quat<SubT>; };
286 template<typename T, typename SubT> struct ConvertElementType<math::Mat3<T>, SubT> { using Type = math::Mat3<SubT>; };
287 template<typename T, typename SubT> struct ConvertElementType<math::Mat4<T>, SubT> { using Type = math::Mat4<SubT>; };
288 /// @}
289 
290 namespace types_internal
291 {
292 template <size_t Bits, bool Signed> struct int_t;
293 template <> struct int_t<8ul, true> { using type = int8_t; };
294 template <> struct int_t<16ul, true> { using type = int16_t; };
295 template <> struct int_t<32ul, true> { using type = int32_t; };
296 template <> struct int_t<64ul, true> { using type = int64_t; };
297 template <> struct int_t<8ul, false> { using type = uint8_t; };
298 template <> struct int_t<16ul, false> { using type = uint16_t; };
299 template <> struct int_t<32ul, false> { using type = uint32_t; };
300 template <> struct int_t<64ul, false> { using type = uint64_t; };
301 
302 template <size_t Bits> struct flt_t;
303 template <> struct flt_t<16ul> { using type = math::half; };
304 template <> struct flt_t<32ul> { using type = float; };
305 template <> struct flt_t<64ul> { using type = double; };
306 }
307 
308 /// @brief Promotion classes which provide an interface for elevating and
309 /// demoting a scalar or VDB type to a higher or lower precision. Integer
310 /// types preserve their sign. Types promotion are only valid between
311 /// 8 to 64 bits (long doubles are not supported).
312 /// @{
313 template<typename T>
315 {
316 private:
317  template <size_t bits>
318  using TypeT = typename std::conditional<std::is_integral<T>::value,
321 public:
322  static_assert(sizeof(T) <= 8ul, "Unsupported source type for promotion");
323 
324 #define OPENVDB_TARGET_BITS(SHIFT, PROMOTE) \
325  std::max(size_t(8), \
326  std::min(size_t(64), (PROMOTE ? size_t(8)*(sizeof(T)<<SHIFT) : \
327  size_t(8)*(sizeof(T)>>SHIFT))))
328  template <size_t Shift = ~0UL> using Promote = typename TypeT<OPENVDB_TARGET_BITS(Shift, true)>::type;
329  template <size_t Shift = ~0UL> using Demote = typename TypeT<OPENVDB_TARGET_BITS(Shift, false)>::type;
330 #undef OPENVDB_TARGET_BITS
331 
332  using Highest = typename TypeT<64ul>::type;
333  using Lowest = typename TypeT<8ul>::type;
334  using Next = Promote<1>;
336 };
337 
338 template <typename T, template <typename> class ContainerT>
340 {
341  template <size_t Shift = ~0UL> using Promote = ContainerT<typename PromoteType<T>::template Promote<Shift>>;
342  template <size_t Shift = ~0UL> using Demote = ContainerT<typename PromoteType<T>::template Demote<Shift>>;
343  using Highest = ContainerT<typename PromoteType<T>::Highest>;
344  using Lowest = ContainerT<typename PromoteType<T>::Lowest>;
345  using Next = ContainerT<typename PromoteType<T>::Next>;
346  using Previous = ContainerT<typename PromoteType<T>::Previous>;
347 };
348 
349 template<typename T> struct PromoteType<math::Vec2<T>> : public PromoteContainerType<T, math::Vec2> {};
350 template<typename T> struct PromoteType<math::Vec3<T>> : public PromoteContainerType<T, math::Vec3> {};
351 template<typename T> struct PromoteType<math::Vec4<T>> : public PromoteContainerType<T, math::Vec4> {};
352 template<typename T> struct PromoteType<math::Quat<T>> : public PromoteContainerType<T, math::Quat> {};
353 template<typename T> struct PromoteType<math::Mat3<T>> : public PromoteContainerType<T, math::Mat3> {};
354 template<typename T> struct PromoteType<math::Mat4<T>> : public PromoteContainerType<T, math::Mat4> {};
355 /// @}
356 
357 
358 ////////////////////////////////////////
359 
360 
361 /// @brief CanConvertType<FromType, ToType>::value is @c true if a value
362 /// of type @a ToType can be constructed from a value of type @a FromType.
363 template<typename FromType, typename ToType>
365 
366 // Specializations for vector types, which can be constructed from values
367 // of their own ValueTypes (or values that can be converted to their ValueTypes),
368 // but only explicitly
369 template<typename T> struct CanConvertType<T, math::Vec2<T> > { enum { value = true }; };
370 template<typename T> struct CanConvertType<T, math::Vec3<T> > { enum { value = true }; };
371 template<typename T> struct CanConvertType<T, math::Vec4<T> > { enum { value = true }; };
372 template<typename T> struct CanConvertType<math::Vec2<T>, math::Vec2<T> > { enum {value = true}; };
373 template<typename T> struct CanConvertType<math::Vec3<T>, math::Vec3<T> > { enum {value = true}; };
374 template<typename T> struct CanConvertType<math::Vec4<T>, math::Vec4<T> > { enum {value = true}; };
375 template<typename T0, typename T1>
376 struct CanConvertType<T0, math::Vec2<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
377 template<typename T0, typename T1>
378 struct CanConvertType<T0, math::Vec3<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
379 template<typename T0, typename T1>
380 struct CanConvertType<T0, math::Vec4<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
381 template<> struct CanConvertType<PointIndex32, PointDataIndex32> { enum {value = true}; };
382 template<> struct CanConvertType<PointDataIndex32, PointIndex32> { enum {value = true}; };
383 template<typename T>
385 template<typename T>
387 
388 
389 ////////////////////////////////////////
390 
391 
392 /// @brief CopyConstness<T1, T2>::Type is either <tt>const T2</tt>
393 /// or @c T2 with no @c const qualifier, depending on whether @c T1 is @c const.
394 /// @details For example,
395 /// - CopyConstness<int, int>::Type is @c int
396 /// - CopyConstness<int, const int>::Type is @c int
397 /// - CopyConstness<const int, int>::Type is <tt>const int</tt>
398 /// - CopyConstness<const int, const int>::Type is <tt>const int</tt>
399 template<typename FromType, typename ToType> struct CopyConstness {
401 };
402 
403 /// @cond OPENVDB_DOCS_INTERNAL
404 template<typename FromType, typename ToType> struct CopyConstness<const FromType, ToType> {
405  using Type = const ToType;
406 };
407 /// @endcond
408 
409 
410 ////////////////////////////////////////
411 
412 
413 // Add new items to the *end* of this list, and update NUM_GRID_CLASSES.
414 enum GridClass {
419 };
421 
422 static const Real LEVEL_SET_HALF_WIDTH = 3;
423 
424 /// The type of a vector determines how transforms are applied to it:
425 /// <dl>
426 /// <dt><b>Invariant</b>
427 /// <dd>Does not transform (e.g., tuple, uvw, color)
428 ///
429 /// <dt><b>Covariant</b>
430 /// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation
431 /// (e.g., gradient/normal)
432 ///
433 /// <dt><b>Covariant Normalize</b>
434 /// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation,
435 /// vectors are renormalized (e.g., unit normal)
436 ///
437 /// <dt><b>Contravariant Relative</b>
438 /// <dd>Apply "regular" transformation: @e w = 0, ignores translation
439 /// (e.g., displacement, velocity, acceleration)
440 ///
441 /// <dt><b>Contravariant Absolute</b>
442 /// <dd>Apply "regular" transformation: @e w = 1, vector translates (e.g., position)
443 /// </dl>
444 enum VecType {
450 };
452 
453 
454 /// Specify how grids should be merged during certain (typically multithreaded) operations.
455 /// <dl>
456 /// <dt><b>MERGE_ACTIVE_STATES</b>
457 /// <dd>The output grid is active wherever any of the input grids is active.
458 ///
459 /// <dt><b>MERGE_NODES</b>
460 /// <dd>The output grid's tree has a node wherever any of the input grids' trees
461 /// has a node, regardless of any active states.
462 ///
463 /// <dt><b>MERGE_ACTIVE_STATES_AND_NODES</b>
464 /// <dd>The output grid is active wherever any of the input grids is active,
465 /// and its tree has a node wherever any of the input grids' trees has a node.
466 /// </dl>
471 };
472 
473 
474 ////////////////////////////////////////
475 
476 
477 template<typename T> const char* typeNameAsString() { return typeid(T).name(); }
478 template<> inline const char* typeNameAsString<bool>() { return "bool"; }
479 template<> inline const char* typeNameAsString<ValueMask>() { return "mask"; }
480 template<> inline const char* typeNameAsString<math::half>() { return "half"; }
481 template<> inline const char* typeNameAsString<float>() { return "float"; }
482 template<> inline const char* typeNameAsString<double>() { return "double"; }
483 template<> inline const char* typeNameAsString<int8_t>() { return "int8"; }
484 template<> inline const char* typeNameAsString<uint8_t>() { return "uint8"; }
485 template<> inline const char* typeNameAsString<int16_t>() { return "int16"; }
486 template<> inline const char* typeNameAsString<uint16_t>() { return "uint16"; }
487 template<> inline const char* typeNameAsString<int32_t>() { return "int32"; }
488 template<> inline const char* typeNameAsString<uint32_t>() { return "uint32"; }
489 template<> inline const char* typeNameAsString<int64_t>() { return "int64"; }
490 template<> inline const char* typeNameAsString<Vec2i>() { return "vec2i"; }
491 template<> inline const char* typeNameAsString<Vec2s>() { return "vec2s"; }
492 template<> inline const char* typeNameAsString<Vec2d>() { return "vec2d"; }
493 template<> inline const char* typeNameAsString<Vec3U8>() { return "vec3u8"; }
494 template<> inline const char* typeNameAsString<Vec3U16>() { return "vec3u16"; }
495 template<> inline const char* typeNameAsString<Vec3i>() { return "vec3i"; }
496 template<> inline const char* typeNameAsString<Vec3f>() { return "vec3s"; }
497 template<> inline const char* typeNameAsString<Vec3d>() { return "vec3d"; }
498 template<> inline const char* typeNameAsString<Vec4i>() { return "vec4i"; }
499 template<> inline const char* typeNameAsString<Vec4f>() { return "vec4s"; }
500 template<> inline const char* typeNameAsString<Vec4d>() { return "vec4d"; }
501 template<> inline const char* typeNameAsString<std::string>() { return "string"; }
502 template<> inline const char* typeNameAsString<Mat3s>() { return "mat3s"; }
503 template<> inline const char* typeNameAsString<Mat3d>() { return "mat3d"; }
504 template<> inline const char* typeNameAsString<Mat4s>() { return "mat4s"; }
505 template<> inline const char* typeNameAsString<Mat4d>() { return "mat4d"; }
506 template<> inline const char* typeNameAsString<math::Quats>() { return "quats"; }
507 template<> inline const char* typeNameAsString<math::Quatd>() { return "quatd"; }
508 template<> inline const char* typeNameAsString<PointIndex32>() { return "ptidx32"; }
509 template<> inline const char* typeNameAsString<PointIndex64>() { return "ptidx64"; }
510 template<> inline const char* typeNameAsString<PointDataIndex32>() { return "ptdataidx32"; }
511 template<> inline const char* typeNameAsString<PointDataIndex64>() { return "ptdataidx64"; }
512 
513 
514 ////////////////////////////////////////
515 
516 
517 /// @brief This struct collects both input and output arguments to "grid combiner" functors
518 /// used with the tree::TypedGrid::combineExtended() and combine2Extended() methods.
519 /// AValueType and BValueType are the value types of the two grids being combined.
520 ///
521 /// @see openvdb/tree/Tree.h for usage information.
522 ///
523 /// Setter methods return references to this object, to facilitate the following usage:
524 /// @code
525 /// CombineArgs<float> args;
526 /// myCombineOp(args.setARef(aVal).setBRef(bVal).setAIsActive(true).setBIsActive(false));
527 /// @endcode
528 template<typename AValueType, typename BValueType = AValueType>
530 {
531 public:
532  using AValueT = AValueType;
533  using BValueT = BValueType;
534 
536  : mAValPtr(nullptr)
537  , mBValPtr(nullptr)
539  , mAIsActive(false)
540  , mBIsActive(false)
541  , mResultIsActive(false)
542  {
543  }
544 
545  /// Use this constructor when the result value is stored externally.
546  CombineArgs(const AValueType& a, const BValueType& b, AValueType& result,
547  bool aOn = false, bool bOn = false)
548  : mAValPtr(&a)
549  , mBValPtr(&b)
550  , mResultValPtr(&result)
551  , mAIsActive(aOn)
552  , mBIsActive(bOn)
553  {
554  this->updateResultActive();
555  }
556 
557  /// Use this constructor when the result value should be stored in this struct.
558  CombineArgs(const AValueType& a, const BValueType& b, bool aOn = false, bool bOn = false)
559  : mAValPtr(&a)
560  , mBValPtr(&b)
562  , mAIsActive(aOn)
563  , mBIsActive(bOn)
564  {
565  this->updateResultActive();
566  }
567 
568  /// Get the A input value.
569  const AValueType& a() const { return *mAValPtr; }
570  /// Get the B input value.
571  const BValueType& b() const { return *mBValPtr; }
572  //@{
573  /// Get the output value.
574  const AValueType& result() const { return *mResultValPtr; }
575  AValueType& result() { return *mResultValPtr; }
576  //@}
577 
578  /// Set the output value.
579  CombineArgs& setResult(const AValueType& val) { *mResultValPtr = val; return *this; }
580 
581  /// Redirect the A value to a new external source.
582  CombineArgs& setARef(const AValueType& a) { mAValPtr = &a; return *this; }
583  /// Redirect the B value to a new external source.
584  CombineArgs& setBRef(const BValueType& b) { mBValPtr = &b; return *this; }
585  /// Redirect the result value to a new external destination.
586  CombineArgs& setResultRef(AValueType& val) { mResultValPtr = &val; return *this; }
587 
588  /// @return true if the A value is active
589  bool aIsActive() const { return mAIsActive; }
590  /// @return true if the B value is active
591  bool bIsActive() const { return mBIsActive; }
592  /// @return true if the output value is active
593  bool resultIsActive() const { return mResultIsActive; }
594 
595  /// Set the active state of the A value.
596  CombineArgs& setAIsActive(bool b) { mAIsActive = b; updateResultActive(); return *this; }
597  /// Set the active state of the B value.
598  CombineArgs& setBIsActive(bool b) { mBIsActive = b; updateResultActive(); return *this; }
599  /// Set the active state of the output value.
600  CombineArgs& setResultIsActive(bool b) { mResultIsActive = b; return *this; }
601 
602 protected:
603  /// By default, the result value is active if either of the input values is active,
604  /// but this behavior can be overridden by calling setResultIsActive().
606 
607  const AValueType* mAValPtr; // pointer to input value from A grid
608  const BValueType* mBValPtr; // pointer to input value from B grid
609  AValueType mResultVal; // computed output value (unused if stored externally)
610  AValueType* mResultValPtr; // pointer to either mResultVal or an external value
611  bool mAIsActive, mBIsActive; // active states of A and B values
612  bool mResultIsActive; // computed active state (default: A active || B active)
613 };
614 
615 
616 /// This struct adapts a "grid combiner" functor to swap the A and B grid values
617 /// (e.g., so that if the original functor computes a + 2 * b, the adapted functor
618 /// will compute b + 2 * a).
619 template<typename ValueType, typename CombineOp>
621 {
622  SwappedCombineOp(CombineOp& _op): op(_op) {}
623 
625  {
626  CombineArgs<ValueType> swappedArgs(args.b(), args.a(), args.result(),
627  args.bIsActive(), args.aIsActive());
628  op(swappedArgs);
629  args.setResultIsActive(swappedArgs.resultIsActive());
630  }
631 
632  CombineOp& op;
633 };
634 
635 
636 ////////////////////////////////////////
637 
638 
639 /// @brief Tag dispatch class that distinguishes shallow copy constructors
640 /// from deep copy constructors
641 class ShallowCopy {};
642 /// @brief Tag dispatch class that distinguishes topology copy constructors
643 /// from deep copy constructors
644 class TopologyCopy {};
645 /// @brief Tag dispatch class that distinguishes constructors that deep copy
646 class DeepCopy {};
647 /// @brief Tag dispatch class that distinguishes constructors that steal
648 class Steal {};
649 /// @brief Tag dispatch class that distinguishes constructors during file input
650 class PartialCreate {};
651 
652 } // namespace OPENVDB_VERSION_NAME
653 } // namespace openvdb
654 
655 
656 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
const AValueType & result() const
Get the output value.
Definition: Types.h:574
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:146
typename TypeT< OPENVDB_TARGET_BITS(Shift, true)>::type Promote
Definition: Types.h:328
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:171
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
const char * typeNameAsString< ValueMask >()
Definition: Types.h:479
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:529
typename T::ValueType ElementType
Definition: Types.h:263
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:641
Definition: ImathVec.h:32
Definition: ImathQuat.h:42
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Definition: half.h:266
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:508
typename T::ValueType ElementType
Definition: Types.h:208
const char * typeNameAsString< int32_t >()
Definition: Types.h:487
const char * typeNameAsString< Vec3i >()
Definition: Types.h:495
const char * typeNameAsString< uint16_t >()
Definition: Types.h:486
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:558
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:598
const char * typeNameAsString< int8_t >()
Definition: Types.h:483
const char * typeNameAsString< int16_t >()
Definition: Types.h:485
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:207
const char * typeNameAsString< Mat3s >()
Definition: Types.h:502
GLuint const GLchar * name
Definition: glcorearb.h:786
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:24
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:650
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:509
const char * typeNameAsString< Vec3d >()
Definition: Types.h:497
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:126
const char * typeNameAsString< Mat4s >()
Definition: Types.h:504
GLint GLenum GLint x
Definition: glcorearb.h:409
GLsizeiptr size
Definition: glcorearb.h:664
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
const AValueType & a() const
Get the A input value.
Definition: Types.h:569
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:494
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: Types.h:192
const char * typeNameAsString< Vec3f >()
Definition: Types.h:496
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:510
typename TypeT< OPENVDB_TARGET_BITS(Shift, false)>::type Demote
Definition: Types.h:329
GLuint64EXT * result
Definition: glew.h:14311
const char * typeNameAsString< uint32_t >()
Definition: Types.h:488
A TypeList provides a compile time sequence of heterogeneous types which can be accessed, transformed and executed over in various ways. It incorporates a subset of functionality similar to hboost::mpl::vector however provides most of its content through using declarations rather than additional typed classes.
std::weak_ptr< T > WeakPtr
Definition: Types.h:115
PointIndex(T i)
Explicit type conversion constructor.
Definition: Types.h:165
const char * typeNameAsString< uint8_t >()
Definition: Types.h:484
const char * typeNameAsString< float >()
Definition: Types.h:481
const char * typeNameAsString< Vec2i >()
Definition: Types.h:490
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:596
typename std::remove_const< ToType >::type Type
Definition: Types.h:400
const char * typeNameAsString()
Definition: Types.h:477
const char * typeNameAsString< int64_t >()
Definition: Types.h:489
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:248
Tag dispatch class that distinguishes constructors that steal.
Definition: Types.h:648
Promotion classes which provide an interface for elevating and demoting a scalar or VDB type to a hig...
Definition: Types.h:314
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: Types.h:399
const char * typeNameAsString< Vec4d >()
Definition: Types.h:500
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:546
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:600
const char * typeNameAsString< double >()
Definition: Types.h:482
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:364
typename TypeT< 8ul >::type Lowest
Definition: Types.h:333
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:136
typename T::ValueType ElementType
Definition: Types.h:241
GLuint GLfloat * val
Definition: glcorearb.h:1608
Library and file format version numbers.
const char * typeNameAsString< bool >()
Definition: Types.h:478
AValueType & result()
Get the output value.
Definition: Types.h:575
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:584
Definition: ImathVec.h:31
const char * typeNameAsString< Mat4d >()
Definition: Types.h:505
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:586
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:493
const char * typeNameAsString< Vec2d >()
Definition: Types.h:492
typename TypeT< 64ul >::type Highest
Definition: Types.h:332
auto ptr(T p) -> const void *
Definition: format.h:2448
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:624
GLsizei const GLfloat * value
Definition: glcorearb.h:824
unsigned char Byte
Definition: Types.h:59
**If you just want to fire and args
Definition: thread.h:609
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:582
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:156
Definition: core.h:1131
const char * typeNameAsString< Vec4f >()
Definition: Types.h:499
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:644
const BValueType & b() const
Get the B input value.
Definition: Types.h:571
#define const
Definition: zconf.h:214
Tag dispatch class that distinguishes constructors that deep copy.
Definition: Types.h:646
const char * typeNameAsString< Vec4i >()
Definition: Types.h:498
Definition: ImathVec.h:33
type
Definition: core.h:1059
typename T::ValueType ElementType
Definition: Types.h:224
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:119
Conversion classes for changing the underlying type of VDB types.
Definition: Types.h:281
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:511
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:579
const char * typeNameAsString< Vec2s >()
Definition: Types.h:491
PointIndex(IntType i=IntType(0))
Definition: Types.h:162
const char * typeNameAsString< Mat3d >()
Definition: Types.h:503