OpenVDB 12.1.0

Loading...
Searching...
No Matches
Types.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-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 {
18 OPENVDB_USE_VERSION_NAMESPACE
19 namespace OPENVDB_VERSION_NAME {
20 namespace math {
21 using half = half;
22}}}
23#else
24#include <openvdb/math/Half.h>
25 namespace openvdb {
26 OPENVDB_USE_VERSION_NAMESPACE
27 namespace OPENVDB_VERSION_NAME {
28 namespace math {
29 using half = internal::half;
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 {
48 OPENVDB_USE_VERSION_NAMESPACE
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
63 using Vec2R = math::Vec2<Real>;
64 using Vec2I = math::Vec2<Index32>;
65 using Vec2f = math::Vec2<float>;
66 using Vec2H = math::Vec2<math::half>;
67 using math::Vec2i;
68 using math::Vec2s;
69 using math::Vec2d;
70
71// Three-dimensional vector types
72 using Vec3R = math::Vec3<Real>;
73 using Vec3I = math::Vec3<Index32>;
74 using Vec3f = math::Vec3<float>;
75 using Vec3H = math::Vec3<math::half>;
76 using Vec3U8 = math::Vec3<uint8_t>;
77 using Vec3U16 = math::Vec3<uint16_t>;
78 using math::Vec3i;
79 using math::Vec3s;
80 using math::Vec3d;
81
82 using math::Coord;
83 using math::CoordBBox;
84 using BBoxd = math::BBox<Vec3d>;
85
86// Four-dimensional vector types
87 using Vec4R = math::Vec4<Real>;
88 using Vec4I = math::Vec4<Index32>;
89 using Vec4f = math::Vec4<float>;
90 using Vec4H = math::Vec4<math::half>;
91 using math::Vec4i;
92 using math::Vec4s;
93 using math::Vec4d;
94
95// Three-dimensional matrix types
96 using Mat3R = math::Mat3<Real>;
97 using math::Mat3s;
98 using math::Mat3d;
99
100// Four-dimensional matrix types
101 using Mat4R = math::Mat4<Real>;
102 using math::Mat4s;
103 using math::Mat4d;
104
105// Quaternions
106 using QuatR = math::Quat<Real>;
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>
156 struct PointIndex
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
178 using PointIndex32 = PointIndex<Index32, 0>;
179 using PointIndex64 = PointIndex<Index64, 0>;
180
181 using PointDataIndex32 = PointIndex<Index32, 1>;
182 using PointDataIndex64 = PointIndex<Index64, 1>;
183
184
185////////////////////////////////////////
186
187/// @brief Macros to help determine whether or not a class has a particular
188/// member function.
189/// @details These macros work by instantiating unique templated instances
190/// of helper structs for a particular member function signature and name
191/// which can then be queried.
192/// - The first macro, INVOKABLE, defines a helper struct which determines
193/// if a member function can be called with a given set of argument types.
194/// Note that the return type is not provided.
195/// - The second macro defines a helper struct which determines if the
196/// member function exists with the _exact_ same signature, including
197/// all argument and function attributes (const-ness, noexcept, etc)
198///
199/// Use the first solution if all you want to determine is whether a given
200/// method can be called, and the second if you need exact resolution.
201/// @code
202/// // example class
203/// struct MyClass { int test(double) { return 0; } };
204///
205/// // The following examples work from the struct type created by:
206/// OPENVDB_INIT_INVOKABLE_MEMBER_FUNCTION(test);
207///
208/// // Will assert true!
209/// static_assert(OPENVDB_HAS_INVOKABLE_MEMBER_FUNCTION(MyClass, test, double));
210/// // Will assert true, int can be converted to double
211/// static_assert(OPENVDB_HAS_INVOKABLE_MEMBER_FUNCTION(MyClass, test, int));
212/// // Will assert false, needs at least one argument
213/// static_assert(OPENVDB_HAS_INVOKABLE_MEMBER_FUNCTION(MyClass, test);
214///
215///
216/// // The following examples work from the struct type created by:
217/// OPENVDB_INIT_MEMBER_FUNCTION(test);
218///
219/// // Will assert fail
220/// static_assert(OPENVDB_HAS_MEMBER_FUNCTION(MyClass, test, void(MyClass::*)(double)));
221/// // Only case where this assert true
222/// static_assert(OPENVDB_HAS_MEMBER_FUNCTION(MyClass, test, int(MyClass::*)(double)));
223///
224/// @endcode
225#define OPENVDB_INIT_INVOKABLE_MEMBER_FUNCTION(F) \
226 template <typename ClassT, typename... Args> \
227 struct HasInvokableMemberFunction_##F { \
228 private: \
229 template <typename T> \
230 static auto check(T*) -> \
231 decltype(std::declval<T>(). \
232 F(std::declval<Args>()...), std::true_type()); \
233 template <typename T> \
234 static auto check(...) -> std::false_type; \
235 public: \
236 static constexpr bool value = \
237 decltype(check<ClassT>(nullptr))::value; \
238 };
239#define OPENVDB_HAS_INVOKABLE_MEMBER_FUNCTION(T, F, ...) \
240 HasInvokableMemberFunction_##F<T, __VA_ARGS__>::value
241
242#define OPENVDB_INIT_MEMBER_FUNCTION(F) \
243 template<typename ClassT, typename Signature> \
244 struct HasMemberFunction_##F { \
245 template <typename U, U> struct sigmatch; \
246 template <typename U> static std::true_type \
247 check(sigmatch<Signature, &U::F>*); \
248 template <typename> static std::false_type check(...); \
249 static const bool value = std::is_same<std::true_type, \
250 decltype(check<ClassT>(nullptr))>::value; \
251 };
252#define OPENVDB_HAS_MEMBER_FUNCTION(T, F, S) \
253 HasMemberFunction_##F<T, S>::value
254
255
256////////////////////////////////////////
257
258
259/// @brief Helper metafunction used to determine if the first template
260/// parameter is a specialization of the class template given in the second
261/// template parameter
262 template <typename T, template <typename...> class Template>
263 struct IsSpecializationOf: public std::false_type {};
264
265 template <typename... Args, template <typename...> class Template>
266 struct IsSpecializationOf<Template<Args...>, Template>: public std::true_type {};
267
268
269////////////////////////////////////////
270
271
272/// @brief Re-implementation of C++17's index_sequence and the helper alias
273/// make_index_sequence. This was introduced to fix an issue with clang's
274/// builtin implementation which treats template specializations of builtin
275/// templates differently when a subsequent parameter is dependent. The
276/// result is a resolution failure during partial specialization selection.
277/// For example, the following will fail to specialize:
278///
279/// @code
280/// struct Test { static const int VALUE = 1; };
281///
282/// template <typename T, typename S = std::make_index_sequence<T::VALUE>>
283/// struct Item {};
284/// template <typename T> struct Adapter {};
285/// template <typename T> struct Adapter<Item<T>> {}; // FAIL: will never be selected.
286/// @endcode
287///
288/// This is fixed from Clang16. See also:
289/// https://reviews.llvm.org/D133262
290/// https://github.com/llvm/llvm-project/issues/42102
291/// https://github.com/llvm/llvm-project/issues/51928
292/// https://github.com/llvm/llvm-project/commit/f4ea3bd4b2086e6de10131b197aaf7d066a24df8
293 template <std::size_t... Ns>
294 struct index_sequence {};
295
296 template <std::size_t N, std::size_t... Is>
297 auto make_index_sequence_impl() {
298 // only one branch is considered. The other may be ill-formed
299 if constexpr (N == 0) return index_sequence<Is...>(); // end case
300 else return make_index_sequence_impl<N-1, N-1, Is...>(); // recursion
301}
302
303 template <std::size_t N>
304 using make_index_sequence =
305 std::decay_t<decltype(make_index_sequence_impl<N>())>;
306
307
308////////////////////////////////////////
309
310
311template<typename T, bool = IsSpecializationOf<T, math::Vec2>::value ||
312 IsSpecializationOf<T, math::Vec3>::value ||
313 IsSpecializationOf<T, math::Vec4>::value>
314 struct VecTraits
315{
316 static const bool IsVec = true;
317 static const int Size = T::size;
318 using ElementType = typename T::ValueType;
319};
320
321 template<typename T>
322 struct VecTraits<T, false>
323{
324 static const bool IsVec = false;
325 static const int Size = 1;
326 using ElementType = T;
327};
328
329template<typename T, bool = IsSpecializationOf<T, math::Quat>::value>
330 struct QuatTraits
331{
332 static const bool IsQuat = true;
333 static const int Size = T::size;
334 using ElementType = typename T::ValueType;
335};
336
337 template<typename T>
338 struct QuatTraits<T, false>
339{
340 static const bool IsQuat = false;
341 static const int Size = 1;
342 using ElementType = T;
343};
344
345template<typename T, bool = IsSpecializationOf<T, math::Mat3>::value ||
346 IsSpecializationOf<T, math::Mat4>::value>
347 struct MatTraits
348{
349 static const bool IsMat = true;
350 static const int Size = T::size;
351 using ElementType = typename T::ValueType;
352};
353
354 template<typename T>
355 struct MatTraits<T, false>
356{
357 static const bool IsMat = false;
358 static const int Size = 1;
359 using ElementType = T;
360};
361
362template<typename T, bool = VecTraits<T>::IsVec ||
363 QuatTraits<T>::IsQuat ||
364 MatTraits<T>::IsMat>
365 struct ValueTraits
366{
367 static const bool IsVec = VecTraits<T>::IsVec;
368 static const bool IsQuat = QuatTraits<T>::IsQuat;
369 static const bool IsMat = MatTraits<T>::IsMat;
370 static const bool IsScalar = false;
371 static const int Size = T::size;
372 static const int Elements = IsMat ? Size*Size : Size;
373 using ElementType = typename T::ValueType;
374};
375
376 template<typename T>
377 struct ValueTraits<T, false>
378{
379 static const bool IsVec = false;
380 static const bool IsQuat = false;
381 static const bool IsMat = false;
382 static const bool IsScalar = true;
383 static const int Size = 1;
384 static const int Elements = 1;
385 using ElementType = T;
386};
387
388
389/// @brief Conversion classes for changing the underlying type of VDB types
390/// @{
391 template<typename T, typename SubT> struct ConvertElementType { using Type = SubT; };
392 template<typename T, typename SubT> struct ConvertElementType<math::Vec2<T>, SubT> { using Type = math::Vec2<SubT>; };
393 template<typename T, typename SubT> struct ConvertElementType<math::Vec3<T>, SubT> { using Type = math::Vec3<SubT>; };
394 template<typename T, typename SubT> struct ConvertElementType<math::Vec4<T>, SubT> { using Type = math::Vec4<SubT>; };
395 template<typename T, typename SubT> struct ConvertElementType<math::Quat<T>, SubT> { using Type = math::Quat<SubT>; };
396 template<typename T, typename SubT> struct ConvertElementType<math::Mat3<T>, SubT> { using Type = math::Mat3<SubT>; };
397 template<typename T, typename SubT> struct ConvertElementType<math::Mat4<T>, SubT> { using Type = math::Mat4<SubT>; };
398/// @}
399
400 namespace types_internal
401{
402 template <size_t Bits, bool Signed> struct int_t;
403 template <> struct int_t<8ul, true> { using type = int8_t; };
404 template <> struct int_t<16ul, true> { using type = int16_t; };
405 template <> struct int_t<32ul, true> { using type = int32_t; };
406 template <> struct int_t<64ul, true> { using type = int64_t; };
407 template <> struct int_t<8ul, false> { using type = uint8_t; };
408 template <> struct int_t<16ul, false> { using type = uint16_t; };
409 template <> struct int_t<32ul, false> { using type = uint32_t; };
410 template <> struct int_t<64ul, false> { using type = uint64_t; };
411
412 template <size_t Bits> struct flt_t;
413 template <> struct flt_t<16ul> { using type = math::half; };
414 template <> struct flt_t<32ul> { using type = float; };
415 template <> struct flt_t<64ul> { using type = double; };
416}
417
418/// @brief Promotion classes which provide an interface for elevating and
419/// demoting a scalar or VDB type to a higher or lower precision. Integer
420/// types preserve their sign. Types promotion are only valid between
421/// 8 to 64 bits (long doubles are not supported).
422/// @{
423 template<typename T>
424 struct PromoteType
425{
426 private:
427 template <size_t bits>
428 using TypeT = typename std::conditional<std::is_integral<T>::value,
429 types_internal::int_t<bits, std::is_signed<T>::value>,
430 types_internal::flt_t<std::max(size_t(16), bits)>>::type;
431 public:
432 static_assert(sizeof(T) <= 8ul, "Unsupported source type for promotion");
433
434#define OPENVDB_TARGET_BITS(SHIFT, PROMOTE) \
435 std::max(size_t(8), \
436 std::min(size_t(64), (PROMOTE ? size_t(8)*(sizeof(T)<<SHIFT) : \
437 size_t(8)*(sizeof(T)>>SHIFT))))
438 template <size_t Shift = ~0UL> using Promote = typename TypeT<OPENVDB_TARGET_BITS(Shift, true)>::type;
439 template <size_t Shift = ~0UL> using Demote = typename TypeT<OPENVDB_TARGET_BITS(Shift, false)>::type;
440#undef OPENVDB_TARGET_BITS
441
442 using Highest = typename TypeT<64ul>::type;
443 using Lowest = typename TypeT<8ul>::type;
444 using Next = Promote<1>;
445 using Previous = Demote<1>;
446};
447
448 template <typename T, template <typename> class ContainerT>
449 struct PromoteContainerType
450{
451 template <size_t Shift = ~0UL> using Promote = ContainerT<typename PromoteType<T>::template Promote<Shift>>;
452 template <size_t Shift = ~0UL> using Demote = ContainerT<typename PromoteType<T>::template Demote<Shift>>;
453 using Highest = ContainerT<typename PromoteType<T>::Highest>;
454 using Lowest = ContainerT<typename PromoteType<T>::Lowest>;
455 using Next = ContainerT<typename PromoteType<T>::Next>;
456 using Previous = ContainerT<typename PromoteType<T>::Previous>;
457};
458
459 template<typename T> struct PromoteType<math::Vec2<T>> : public PromoteContainerType<T, math::Vec2> {};
460 template<typename T> struct PromoteType<math::Vec3<T>> : public PromoteContainerType<T, math::Vec3> {};
461 template<typename T> struct PromoteType<math::Vec4<T>> : public PromoteContainerType<T, math::Vec4> {};
462 template<typename T> struct PromoteType<math::Quat<T>> : public PromoteContainerType<T, math::Quat> {};
463 template<typename T> struct PromoteType<math::Mat3<T>> : public PromoteContainerType<T, math::Mat3> {};
464 template<typename T> struct PromoteType<math::Mat4<T>> : public PromoteContainerType<T, math::Mat4> {};
465/// @}
466
467
468////////////////////////////////////////
469
470
471/// @brief CanConvertType<FromType, ToType>::value is @c true if a value
472/// of type @a ToType can be constructed from a value of type @a FromType.
473 template<typename FromType, typename ToType>
474 struct CanConvertType { enum { value = std::is_constructible<ToType, FromType>::value }; };
475
476// Specializations for vector types, which can be constructed from values
477// of their own ValueTypes (or values that can be converted to their ValueTypes),
478// but only explicitly
479 template<typename T> struct CanConvertType<T, math::Vec2<T> > { enum { value = true }; };
480 template<typename T> struct CanConvertType<T, math::Vec3<T> > { enum { value = true }; };
481 template<typename T> struct CanConvertType<T, math::Vec4<T> > { enum { value = true }; };
482 template<typename T> struct CanConvertType<math::Vec2<T>, math::Vec2<T> > { enum {value = true}; };
483 template<typename T> struct CanConvertType<math::Vec3<T>, math::Vec3<T> > { enum {value = true}; };
484 template<typename T> struct CanConvertType<math::Vec4<T>, math::Vec4<T> > { enum {value = true}; };
485 template<typename T0, typename T1>
486 struct CanConvertType<T0, math::Vec2<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
487 template<typename T0, typename T1>
488 struct CanConvertType<T0, math::Vec3<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
489 template<typename T0, typename T1>
490 struct CanConvertType<T0, math::Vec4<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
491 template<> struct CanConvertType<PointIndex32, PointDataIndex32> { enum {value = true}; };
492 template<> struct CanConvertType<PointDataIndex32, PointIndex32> { enum {value = true}; };
493 template<typename T>
494 struct CanConvertType<T, ValueMask> { enum {value = CanConvertType<T, bool>::value}; };
495 template<typename T>
496 struct CanConvertType<ValueMask, T> { enum {value = CanConvertType<bool, T>::value}; };
497
498
499////////////////////////////////////////
500
501
502/// @brief CopyConstness<T1, T2>::Type is either <tt>const T2</tt>
503/// or @c T2 with no @c const qualifier, depending on whether @c T1 is @c const.
504/// @details For example,
505/// - CopyConstness<int, int>::Type is @c int
506/// - CopyConstness<int, const int>::Type is @c int
507/// - CopyConstness<const int, int>::Type is <tt>const int</tt>
508/// - CopyConstness<const int, const int>::Type is <tt>const int</tt>
509 template<typename FromType, typename ToType> struct CopyConstness {
510 using Type = typename std::remove_const<ToType>::type;
511};
512
513/// @cond OPENVDB_DOCS_INTERNAL
514 template<typename FromType, typename ToType> struct CopyConstness<const FromType, ToType> {
515 using Type = const ToType;
516};
517/// @endcond
518
519
520////////////////////////////////////////
521
522
523// Add new items to the *end* of this list, and update NUM_GRID_CLASSES.
524 enum GridClass {
525 GRID_UNKNOWN = 0,
526 GRID_LEVEL_SET,
527 GRID_FOG_VOLUME,
528 GRID_STAGGERED
529};
530 enum { NUM_GRID_CLASSES = GRID_STAGGERED + 1 };
531
532 static const Real LEVEL_SET_HALF_WIDTH = 3;
533
534/// The type of a vector determines how transforms are applied to it:
535/// <dl>
536/// <dt><b>Invariant</b>
537/// <dd>Does not transform (e.g., tuple, uvw, color)
538///
539/// <dt><b>Covariant</b>
540/// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation
541/// (e.g., gradient/normal)
542///
543/// <dt><b>Covariant Normalize</b>
544/// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation,
545/// vectors are renormalized (e.g., unit normal)
546///
547/// <dt><b>Contravariant Relative</b>
548/// <dd>Apply "regular" transformation: @e w = 0, ignores translation
549/// (e.g., displacement, velocity, acceleration)
550///
551/// <dt><b>Contravariant Absolute</b>
552/// <dd>Apply "regular" transformation: @e w = 1, vector translates (e.g., position)
553/// </dl>
554 enum VecType {
555 VEC_INVARIANT = 0,
556 VEC_COVARIANT,
557 VEC_COVARIANT_NORMALIZE,
558 VEC_CONTRAVARIANT_RELATIVE,
559 VEC_CONTRAVARIANT_ABSOLUTE
560};
561 enum { NUM_VEC_TYPES = VEC_CONTRAVARIANT_ABSOLUTE + 1 };
562
563
564/// Specify how grids should be merged during certain (typically multithreaded) operations.
565/// <dl>
566/// <dt><b>MERGE_ACTIVE_STATES</b>
567/// <dd>The output grid is active wherever any of the input grids is active.
568///
569/// <dt><b>MERGE_NODES</b>
570/// <dd>The output grid's tree has a node wherever any of the input grids' trees
571/// has a node, regardless of any active states.
572///
573/// <dt><b>MERGE_ACTIVE_STATES_AND_NODES</b>
574/// <dd>The output grid is active wherever any of the input grids is active,
575/// and its tree has a node wherever any of the input grids' trees has a node.
576/// </dl>
577 enum MergePolicy {
578 MERGE_ACTIVE_STATES = 0,
579 MERGE_NODES,
580 MERGE_ACTIVE_STATES_AND_NODES
581};
582
583
584////////////////////////////////////////
585
586
587 template<typename T> const char* typeNameAsString() { return typeid(T).name(); }
588 template<> inline const char* typeNameAsString<bool>() { return "bool"; }
589 template<> inline const char* typeNameAsString<ValueMask>() { return "mask"; }
590 template<> inline const char* typeNameAsString<math::half>() { return "half"; }
591 template<> inline const char* typeNameAsString<float>() { return "float"; }
592 template<> inline const char* typeNameAsString<double>() { return "double"; }
593 template<> inline const char* typeNameAsString<int8_t>() { return "int8"; }
594 template<> inline const char* typeNameAsString<uint8_t>() { return "uint8"; }
595 template<> inline const char* typeNameAsString<int16_t>() { return "int16"; }
596 template<> inline const char* typeNameAsString<uint16_t>() { return "uint16"; }
597 template<> inline const char* typeNameAsString<int32_t>() { return "int32"; }
598 template<> inline const char* typeNameAsString<uint32_t>() { return "uint32"; }
599 template<> inline const char* typeNameAsString<int64_t>() { return "int64"; }
600 template<> inline const char* typeNameAsString<Vec2i>() { return "vec2i"; }
601 template<> inline const char* typeNameAsString<Vec2s>() { return "vec2s"; }
602 template<> inline const char* typeNameAsString<Vec2d>() { return "vec2d"; }
603 template<> inline const char* typeNameAsString<Vec3U8>() { return "vec3u8"; }
604 template<> inline const char* typeNameAsString<Vec3U16>() { return "vec3u16"; }
605 template<> inline const char* typeNameAsString<Vec3i>() { return "vec3i"; }
606 template<> inline const char* typeNameAsString<Vec3f>() { return "vec3s"; }
607 template<> inline const char* typeNameAsString<Vec3d>() { return "vec3d"; }
608 template<> inline const char* typeNameAsString<Vec4i>() { return "vec4i"; }
609 template<> inline const char* typeNameAsString<Vec4f>() { return "vec4s"; }
610 template<> inline const char* typeNameAsString<Vec4d>() { return "vec4d"; }
611 template<> inline const char* typeNameAsString<std::string>() { return "string"; }
612 template<> inline const char* typeNameAsString<Mat3s>() { return "mat3s"; }
613 template<> inline const char* typeNameAsString<Mat3d>() { return "mat3d"; }
614 template<> inline const char* typeNameAsString<Mat4s>() { return "mat4s"; }
615 template<> inline const char* typeNameAsString<Mat4d>() { return "mat4d"; }
616 template<> inline const char* typeNameAsString<math::Quats>() { return "quats"; }
617 template<> inline const char* typeNameAsString<math::Quatd>() { return "quatd"; }
618 template<> inline const char* typeNameAsString<PointIndex32>() { return "ptidx32"; }
619 template<> inline const char* typeNameAsString<PointIndex64>() { return "ptidx64"; }
620 template<> inline const char* typeNameAsString<PointDataIndex32>() { return "ptdataidx32"; }
621 template<> inline const char* typeNameAsString<PointDataIndex64>() { return "ptdataidx64"; }
622
623
624////////////////////////////////////////
625
626
627/// @brief This struct collects both input and output arguments to "grid combiner" functors
628/// used with the tree::TypedGrid::combineExtended() and combine2Extended() methods.
629/// AValueType and BValueType are the value types of the two grids being combined.
630///
631/// @see openvdb/tree/Tree.h for usage information.
632///
633/// Setter methods return references to this object, to facilitate the following usage:
634/// @code
635/// CombineArgs<float> args;
636/// myCombineOp(args.setARef(aVal).setBRef(bVal).setAIsActive(true).setBIsActive(false));
637/// @endcode
638 template<typename AValueType, typename BValueType = AValueType>
639 class CombineArgs
640{
641 public:
642 using AValueT = AValueType;
643 using BValueT = BValueType;
644
645 CombineArgs()
646 : mAValPtr(nullptr)
647 , mBValPtr(nullptr)
648 , mResultValPtr(&mResultVal)
649 , mAIsActive(false)
650 , mBIsActive(false)
651 , mResultIsActive(false)
652 {
653 }
654
655 /// Use this constructor when the result value is stored externally.
656 CombineArgs(const AValueType& a, const BValueType& b, AValueType& result,
657 bool aOn = false, bool bOn = false)
658 : mAValPtr(&a)
659 , mBValPtr(&b)
660 , mResultValPtr(&result)
661 , mAIsActive(aOn)
662 , mBIsActive(bOn)
663 {
664 this->updateResultActive();
665 }
666
667 /// Use this constructor when the result value should be stored in this struct.
668 CombineArgs(const AValueType& a, const BValueType& b, bool aOn = false, bool bOn = false)
669 : mAValPtr(&a)
670 , mBValPtr(&b)
671 , mResultValPtr(&mResultVal)
672 , mAIsActive(aOn)
673 , mBIsActive(bOn)
674 {
675 this->updateResultActive();
676 }
677
678 /// Get the A input value.
679 const AValueType& a() const { return *mAValPtr; }
680 /// Get the B input value.
681 const BValueType& b() const { return *mBValPtr; }
682 //@{
683 /// Get the output value.
684 const AValueType& result() const { return *mResultValPtr; }
685 AValueType& result() { return *mResultValPtr; }
686 //@}
687
688 /// Set the output value.
689 CombineArgs& setResult(const AValueType& val) { *mResultValPtr = val; return *this; }
690
691 /// Redirect the A value to a new external source.
692 CombineArgs& setARef(const AValueType& a) { mAValPtr = &a; return *this; }
693 /// Redirect the B value to a new external source.
694 CombineArgs& setBRef(const BValueType& b) { mBValPtr = &b; return *this; }
695 /// Redirect the result value to a new external destination.
696 CombineArgs& setResultRef(AValueType& val) { mResultValPtr = &val; return *this; }
697
698 /// @return true if the A value is active
699 bool aIsActive() const { return mAIsActive; }
700 /// @return true if the B value is active
701 bool bIsActive() const { return mBIsActive; }
702 /// @return true if the output value is active
703 bool resultIsActive() const { return mResultIsActive; }
704
705 /// Set the active state of the A value.
706 CombineArgs& setAIsActive(bool b) { mAIsActive = b; updateResultActive(); return *this; }
707 /// Set the active state of the B value.
708 CombineArgs& setBIsActive(bool b) { mBIsActive = b; updateResultActive(); return *this; }
709 /// Set the active state of the output value.
710 CombineArgs& setResultIsActive(bool b) { mResultIsActive = b; return *this; }
711
712 protected:
713 /// By default, the result value is active if either of the input values is active,
714 /// but this behavior can be overridden by calling setResultIsActive().
715 void updateResultActive() { mResultIsActive = mAIsActive || mBIsActive; }
716
717 const AValueType* mAValPtr; // pointer to input value from A grid
718 const BValueType* mBValPtr; // pointer to input value from B grid
719 AValueType mResultVal; // computed output value (unused if stored externally)
720 AValueType* mResultValPtr; // pointer to either mResultVal or an external value
721 bool mAIsActive, mBIsActive; // active states of A and B values
722 bool mResultIsActive; // computed active state (default: A active || B active)
723};
724
725
726/// This struct adapts a "grid combiner" functor to swap the A and B grid values
727/// (e.g., so that if the original functor computes a + 2 * b, the adapted functor
728/// will compute b + 2 * a).
729 template<typename ValueType, typename CombineOp>
730 struct SwappedCombineOp
731{
732 SwappedCombineOp(CombineOp& _op): op(_op) {}
733
734 void operator()(CombineArgs<ValueType>& args)
735 {
736 CombineArgs<ValueType> swappedArgs(args.b(), args.a(), args.result(),
737 args.bIsActive(), args.aIsActive());
738 op(swappedArgs);
739 args.setResultIsActive(swappedArgs.resultIsActive());
740 }
741
742 CombineOp& op;
743};
744
745
746////////////////////////////////////////
747
748
749/// @brief Tag dispatch class that distinguishes shallow copy constructors
750/// from deep copy constructors
751 class ShallowCopy {};
752/// @brief Tag dispatch class that distinguishes topology copy constructors
753/// from deep copy constructors
754 class TopologyCopy {};
755/// @brief Tag dispatch class that distinguishes constructors that deep copy
756 class DeepCopy {};
757/// @brief Tag dispatch class that distinguishes constructors that steal
758 class Steal {};
759/// @brief Tag dispatch class that distinguishes constructors during file input
760 class PartialCreate {};
761
762// For half compilation
763 namespace math {
764 template<>
765 inline auto cwiseAdd(const math::Vec3<math::half>& v, const float s)
766{
767 math::Vec3<math::half> out;
768 const math::half* ip = v.asPointer();
769 math::half* op = out.asPointer();
770 for (unsigned i = 0; i < 3; ++i, ++op, ++ip) {
771 OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN
772 *op = *ip + s;
773 OPENVDB_NO_TYPE_CONVERSION_WARNING_END
774 }
775 return out;
776}
777} // namespace math
778
779} // namespace OPENVDB_VERSION_NAME
780} // namespace openvdb
781
782
783#endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
BBox.h
Coord.h
Half.h
half
imath_half_bits_t half
if we're in a C-only context, alias the half bits type to half
Definition Half.h:283
Mat3.h
Mat4.h
Math.h
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Platform.h
OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN
#define OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN
Bracket code with OPENVDB_NO_TYPE_CONVERSION_WARNING_BEGIN/_END, to inhibit warnings about type conve...
Definition Platform.h:244
OPENVDB_NO_TYPE_CONVERSION_WARNING_END
#define OPENVDB_NO_TYPE_CONVERSION_WARNING_END
Definition Platform.h:245
Quat.h
TypeList.h
A TypeList provides a compile time sequence of heterogeneous types which can be accessed,...
Vec2.h
Vec3.h
Vec4.h
openvdb::v12_1::CombineArgs
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition Types.h:640
openvdb::v12_1::CombineArgs::setARef
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition Types.h:692
openvdb::v12_1::CombineArgs::bIsActive
bool bIsActive() const
Definition Types.h:701
openvdb::v12_1::CombineArgs::result
const AValueType & result() const
Get the output value.
Definition Types.h:684
openvdb::v12_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:656
openvdb::v12_1::CombineArgs::mAIsActive
bool mAIsActive
Definition Types.h:721
openvdb::v12_1::CombineArgs::mResultValPtr
AValueType * mResultValPtr
Definition Types.h:720
openvdb::v12_1::CombineArgs::updateResultActive
void updateResultActive()
Definition Types.h:715
openvdb::v12_1::CombineArgs::setResultIsActive
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition Types.h:710
openvdb::v12_1::CombineArgs::mAValPtr
const AValueType * mAValPtr
Definition Types.h:717
openvdb::v12_1::CombineArgs::mResultVal
AValueType mResultVal
Definition Types.h:719
openvdb::v12_1::CombineArgs::aIsActive
bool aIsActive() const
Definition Types.h:699
openvdb::v12_1::CombineArgs::mBIsActive
bool mBIsActive
Definition Types.h:721
openvdb::v12_1::CombineArgs::setBIsActive
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition Types.h:708
openvdb::v12_1::CombineArgs::b
const BValueType & b() const
Get the B input value.
Definition Types.h:681
openvdb::v12_1::CombineArgs::mBValPtr
const BValueType * mBValPtr
Definition Types.h:718
openvdb::v12_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:668
openvdb::v12_1::CombineArgs::setResultRef
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition Types.h:696
openvdb::v12_1::CombineArgs::result
AValueType & result()
Definition Types.h:685
openvdb::v12_1::CombineArgs::AValueT
AValueType AValueT
Definition Types.h:642
openvdb::v12_1::CombineArgs::setBRef
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition Types.h:694
openvdb::v12_1::CombineArgs::a
const AValueType & a() const
Get the A input value.
Definition Types.h:679
openvdb::v12_1::CombineArgs::resultIsActive
bool resultIsActive() const
Definition Types.h:703
openvdb::v12_1::CombineArgs::mResultIsActive
bool mResultIsActive
Definition Types.h:722
openvdb::v12_1::CombineArgs::BValueT
BValueType BValueT
Definition Types.h:643
openvdb::v12_1::CombineArgs::CombineArgs
CombineArgs()
Definition Types.h:645
openvdb::v12_1::CombineArgs::setResult
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition Types.h:689
openvdb::v12_1::CombineArgs::setAIsActive
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition Types.h:706
openvdb::v12_1::DeepCopy
Tag dispatch class that distinguishes constructors that deep copy.
Definition Types.h:756
openvdb::v12_1::PartialCreate
Tag dispatch class that distinguishes constructors during file input.
Definition Types.h:760
openvdb::v12_1::ShallowCopy
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition Types.h:751
openvdb::v12_1::Steal
Tag dispatch class that distinguishes constructors that steal.
Definition Types.h:758
openvdb::v12_1::TopologyCopy
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition Types.h:754
openvdb::v12_1::ValueMask
Definition Types.h:111
openvdb::v12_1::math::BBox
Axis-aligned bounding box.
Definition BBox.h:24
openvdb::v12_1::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition Coord.h:252
openvdb::v12_1::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:26
openvdb::v12_1::math::Mat3
3x3 matrix class.
Definition Mat3.h:29
openvdb::v12_1::math::Mat4
4x4 -matrix class.
Definition Mat4.h:31
openvdb::v12_1::math::Quat
Definition Quat.h:80
openvdb::v12_1::math::Vec2
Definition Vec2.h:24
openvdb::v12_1::math::Vec3
Definition Vec3.h:25
openvdb::v12_1::math::Vec3::asPointer
T * asPointer()
Definition Vec3.h:95
openvdb::v12_1::math::Vec4
Definition Vec4.h:25
openvdb::v12_1::math
Definition Types.h:28
openvdb::v12_1::math::Vec2i
Vec2< int32_t > Vec2i
Definition Vec2.h:530
openvdb::v12_1::math::Mat4s
Mat4< float > Mat4s
Definition Mat4.h:1354
openvdb::v12_1::math::Vec2d
Vec2< double > Vec2d
Definition Vec2.h:533
openvdb::v12_1::math::Mat3d
Mat3< double > Mat3d
Definition Mat3.h:833
openvdb::v12_1::math::Vec2s
Vec2< float > Vec2s
Definition Vec2.h:532
openvdb::v12_1::math::Vec4s
Vec4< float > Vec4s
Definition Vec4.h:561
openvdb::v12_1::math::Mat3s
Mat3< float > Mat3s
Definition Mat3.h:832
openvdb::v12_1::math::Vec3d
Vec3< double > Vec3d
Definition Vec3.h:665
openvdb::v12_1::math::cwiseAdd
auto cwiseAdd(const math::Vec3< math::half > &v, const float s)
Definition Types.h:765
openvdb::v12_1::math::Mat4d
Mat4< double > Mat4d
Definition Mat4.h:1355
openvdb::v12_1::math::Vec4i
Vec4< int32_t > Vec4i
Definition Vec4.h:559
openvdb::v12_1::math::Quatd
Quat< double > Quatd
Definition Quat.h:602
openvdb::v12_1::math::half
internal::half half
Definition Types.h:29
openvdb::v12_1::math::Vec3i
Vec3< int32_t > Vec3i
Definition Vec3.h:662
openvdb::v12_1::math::Vec4d
Vec4< double > Vec4d
Definition Vec4.h:562
openvdb::v12_1::math::Quats
Quat< float > Quats
Definition Quat.h:601
openvdb::v12_1::math::Vec3s
Vec3< float > Vec3s
Definition Vec3.h:664
openvdb::v12_1::types_internal
Definition Types.h:401
openvdb::v12_1::LEVEL_SET_HALF_WIDTH
static const Real LEVEL_SET_HALF_WIDTH
Definition Types.h:532
openvdb::v12_1::Vec4f
math::Vec4< float > Vec4f
Definition Types.h:89
openvdb::v12_1::Vec2H
math::Vec2< math::half > Vec2H
Definition Types.h:66
openvdb::v12_1::Index
Index32 Index
Definition Types.h:54
openvdb::v12_1::Vec4I
math::Vec4< Index32 > Vec4I
Definition Types.h:88
openvdb::v12_1::Vec3U16
math::Vec3< uint16_t > Vec3U16
Definition Types.h:77
openvdb::v12_1::PointDataIndex64
PointIndex< Index64, 1 > PointDataIndex64
Definition Types.h:182
openvdb::v12_1::Vec2R
math::Vec2< Real > Vec2R
Definition Types.h:63
openvdb::v12_1::Int16
int16_t Int16
Definition Types.h:55
openvdb::v12_1::Vec3H
math::Vec3< math::half > Vec3H
Definition Types.h:75
openvdb::v12_1::PointIndex64
PointIndex< Index64, 0 > PointIndex64
Definition Types.h:179
openvdb::v12_1::make_index_sequence_impl
auto make_index_sequence_impl()
Definition Types.h:297
openvdb::v12_1::Byte
unsigned char Byte
Definition Types.h:59
openvdb::v12_1::Vec3f
math::Vec3< float > Vec3f
Definition Types.h:74
openvdb::v12_1::Real
double Real
Definition Types.h:60
openvdb::v12_1::GridClass
GridClass
Definition Types.h:524
openvdb::v12_1::GRID_FOG_VOLUME
@ GRID_FOG_VOLUME
Definition Types.h:527
openvdb::v12_1::GRID_STAGGERED
@ GRID_STAGGERED
Definition Types.h:528
openvdb::v12_1::GRID_LEVEL_SET
@ GRID_LEVEL_SET
Definition Types.h:526
openvdb::v12_1::GRID_UNKNOWN
@ GRID_UNKNOWN
Definition Types.h:525
openvdb::v12_1::Int64
int64_t Int64
Definition Types.h:57
openvdb::v12_1::PointIndex32
PointIndex< Index32, 0 > PointIndex32
Definition Types.h:178
openvdb::v12_1::Int
Int32 Int
Definition Types.h:58
openvdb::v12_1::Vec2I
math::Vec2< Index32 > Vec2I
Definition Types.h:64
openvdb::v12_1::make_index_sequence
std::decay_t< decltype(make_index_sequence_impl< N >())> make_index_sequence
Definition Types.h:304
openvdb::v12_1::WeakPtr
std::weak_ptr< T > WeakPtr
Definition Types.h:115
openvdb::v12_1::Mat4R
math::Mat4< Real > Mat4R
Definition Types.h:101
openvdb::v12_1::Index32
uint32_t Index32
Definition Types.h:52
openvdb::v12_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:126
openvdb::v12_1::BBoxd
math::BBox< Vec3d > BBoxd
Definition Types.h:84
openvdb::v12_1::Mat3R
math::Mat3< Real > Mat3R
Definition Types.h:96
openvdb::v12_1::Vec3I
math::Vec3< Index32 > Vec3I
Definition Types.h:73
openvdb::v12_1::Vec3R
math::Vec3< Real > Vec3R
Definition Types.h:72
openvdb::v12_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:136
openvdb::v12_1::Vec4H
math::Vec4< math::half > Vec4H
Definition Types.h:90
openvdb::v12_1::Int32
int32_t Int32
Definition Types.h:56
openvdb::v12_1::Index64
uint64_t Index64
Definition Types.h:53
openvdb::v12_1::NUM_GRID_CLASSES
@ NUM_GRID_CLASSES
Definition Types.h:530
openvdb::v12_1::Vec2f
math::Vec2< float > Vec2f
Definition Types.h:65
openvdb::v12_1::SharedPtr
std::shared_ptr< T > SharedPtr
Definition Types.h:114
openvdb::v12_1::MergePolicy
MergePolicy
Definition Types.h:577
openvdb::v12_1::MERGE_ACTIVE_STATES
@ MERGE_ACTIVE_STATES
Definition Types.h:578
openvdb::v12_1::MERGE_NODES
@ MERGE_NODES
Definition Types.h:579
openvdb::v12_1::MERGE_ACTIVE_STATES_AND_NODES
@ MERGE_ACTIVE_STATES_AND_NODES
Definition Types.h:580
openvdb::v12_1::Vec4R
math::Vec4< Real > Vec4R
Definition Types.h:87
openvdb::v12_1::Vec3U8
math::Vec3< uint8_t > Vec3U8
Definition Types.h:76
openvdb::v12_1::VecType
VecType
Definition Types.h:554
openvdb::v12_1::VEC_CONTRAVARIANT_ABSOLUTE
@ VEC_CONTRAVARIANT_ABSOLUTE
Definition Types.h:559
openvdb::v12_1::VEC_CONTRAVARIANT_RELATIVE
@ VEC_CONTRAVARIANT_RELATIVE
Definition Types.h:558
openvdb::v12_1::VEC_COVARIANT
@ VEC_COVARIANT
Definition Types.h:556
openvdb::v12_1::VEC_COVARIANT_NORMALIZE
@ VEC_COVARIANT_NORMALIZE
Definition Types.h:557
openvdb::v12_1::VEC_INVARIANT
@ VEC_INVARIANT
Definition Types.h:555
openvdb::v12_1::NUM_VEC_TYPES
@ NUM_VEC_TYPES
Definition Types.h:561
openvdb::v12_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:146
openvdb::v12_1::QuatR
math::Quat< Real > QuatR
Definition Types.h:106
openvdb::v12_1::typeNameAsString
const char * typeNameAsString()
Definition Types.h:587
openvdb::v12_1::PointDataIndex32
PointIndex< Index32, 1 > PointDataIndex32
Definition Types.h:181
openvdb
Definition Exceptions.h:13
OPENVDB_TARGET_BITS
#define OPENVDB_TARGET_BITS(SHIFT, PROMOTE)
Definition Types.h:434
openvdb::v12_1::CanConvertType< PointDataIndex32, PointIndex32 >::value
@ value
Definition Types.h:492
openvdb::v12_1::CanConvertType< PointIndex32, PointDataIndex32 >::value
@ value
Definition Types.h:491
openvdb::v12_1::CanConvertType< T0, math::Vec2< T1 > >::value
@ value
Definition Types.h:486
openvdb::v12_1::CanConvertType< T0, math::Vec3< T1 > >::value
@ value
Definition Types.h:488
openvdb::v12_1::CanConvertType< T0, math::Vec4< T1 > >::value
@ value
Definition Types.h:490
openvdb::v12_1::CanConvertType< T, ValueMask >::value
@ value
Definition Types.h:494
openvdb::v12_1::CanConvertType< T, math::Vec2< T > >::value
@ value
Definition Types.h:479
openvdb::v12_1::CanConvertType< T, math::Vec3< T > >::value
@ value
Definition Types.h:480
openvdb::v12_1::CanConvertType< T, math::Vec4< T > >::value
@ value
Definition Types.h:481
openvdb::v12_1::CanConvertType< ValueMask, T >::value
@ value
Definition Types.h:496
openvdb::v12_1::CanConvertType< math::Vec2< T >, math::Vec2< T > >::value
@ value
Definition Types.h:482
openvdb::v12_1::CanConvertType< math::Vec3< T >, math::Vec3< T > >::value
@ value
Definition Types.h:483
openvdb::v12_1::CanConvertType< math::Vec4< T >, math::Vec4< T > >::value
@ value
Definition Types.h:484
openvdb::v12_1::CanConvertType
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition Types.h:474
openvdb::v12_1::CanConvertType::value
@ value
Definition Types.h:474
openvdb::v12_1::ConvertElementType< math::Mat3< T >, SubT >::Type
math::Mat3< SubT > Type
Definition Types.h:396
openvdb::v12_1::ConvertElementType< math::Mat4< T >, SubT >::Type
math::Mat4< SubT > Type
Definition Types.h:397
openvdb::v12_1::ConvertElementType< math::Quat< T >, SubT >::Type
math::Quat< SubT > Type
Definition Types.h:395
openvdb::v12_1::ConvertElementType< math::Vec2< T >, SubT >::Type
math::Vec2< SubT > Type
Definition Types.h:392
openvdb::v12_1::ConvertElementType< math::Vec3< T >, SubT >::Type
math::Vec3< SubT > Type
Definition Types.h:393
openvdb::v12_1::ConvertElementType< math::Vec4< T >, SubT >::Type
math::Vec4< SubT > Type
Definition Types.h:394
openvdb::v12_1::ConvertElementType
Conversion classes for changing the underlying type of VDB types.
Definition Types.h:391
openvdb::v12_1::ConvertElementType::Type
SubT Type
Definition Types.h:391
openvdb::v12_1::CopyConstness
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition Types.h:509
openvdb::v12_1::CopyConstness::Type
typename std::remove_const< ToType >::type Type
Definition Types.h:510
openvdb::v12_1::IsSpecializationOf
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition Types.h:263
openvdb::v12_1::MatTraits< T, false >::ElementType
T ElementType
Definition Types.h:359
openvdb::v12_1::MatTraits< T, false >::Size
static const int Size
Definition Types.h:358
openvdb::v12_1::MatTraits< T, false >::IsMat
static const bool IsMat
Definition Types.h:357
openvdb::v12_1::MatTraits
Definition Types.h:348
openvdb::v12_1::MatTraits::Size
static const int Size
Definition Types.h:350
openvdb::v12_1::MatTraits::ElementType
typename T::ValueType ElementType
Definition Types.h:351
openvdb::v12_1::MatTraits::IsMat
static const bool IsMat
Definition Types.h:349
openvdb::v12_1::PointIndex
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition Types.h:157
openvdb::v12_1::PointIndex::PointIndex
PointIndex(T i)
Explicit type conversion constructor.
Definition Types.h:165
openvdb::v12_1::PointIndex::PointIndex
PointIndex(IntType i=IntType(0))
Definition Types.h:162
openvdb::v12_1::PointIndex::operator+
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition Types.h:171
openvdb::v12_1::PointIndex::IntType
IntType_ IntType
Definition Types.h:160
openvdb::v12_1::PromoteContainerType
Definition Types.h:450
openvdb::v12_1::PromoteContainerType::Previous
ContainerT< typename PromoteType< T >::Previous > Previous
Definition Types.h:456
openvdb::v12_1::PromoteContainerType::Demote
ContainerT< typename PromoteType< T >::template Demote< Shift > > Demote
Definition Types.h:452
openvdb::v12_1::PromoteContainerType::Highest
ContainerT< typename PromoteType< T >::Highest > Highest
Definition Types.h:453
openvdb::v12_1::PromoteContainerType::Lowest
ContainerT< typename PromoteType< T >::Lowest > Lowest
Definition Types.h:454
openvdb::v12_1::PromoteContainerType::Next
ContainerT< typename PromoteType< T >::Next > Next
Definition Types.h:455
openvdb::v12_1::PromoteContainerType::Promote
ContainerT< typename PromoteType< T >::template Promote< Shift > > Promote
Definition Types.h:451
openvdb::v12_1::PromoteType
Promotion classes which provide an interface for elevating and demoting a scalar or VDB type to a hig...
Definition Types.h:425
openvdb::v12_1::PromoteType::Next
Promote< 1 > Next
Definition Types.h:444
openvdb::v12_1::PromoteType::Promote
typename TypeT< std::max(size_t(8), std::min(size_t(64),(true ? size_t(8) *(sizeof(T)<< Shift) : size_t(8) *(sizeof(T)> >Shift)))) >::type Promote
Definition Types.h:438
openvdb::v12_1::PromoteType::Previous
Demote< 1 > Previous
Definition Types.h:445
openvdb::v12_1::PromoteType::Lowest
typename TypeT< 8ul >::type Lowest
Definition Types.h:443
openvdb::v12_1::PromoteType::Demote
typename TypeT< std::max(size_t(8), std::min(size_t(64),(false ? size_t(8) *(sizeof(T)<< Shift) : size_t(8) *(sizeof(T)> >Shift)))) >::type Demote
Definition Types.h:439
openvdb::v12_1::PromoteType::Highest
typename TypeT< 64ul >::type Highest
Definition Types.h:442
openvdb::v12_1::QuatTraits< T, false >::ElementType
T ElementType
Definition Types.h:342
openvdb::v12_1::QuatTraits< T, false >::Size
static const int Size
Definition Types.h:341
openvdb::v12_1::QuatTraits< T, false >::IsQuat
static const bool IsQuat
Definition Types.h:340
openvdb::v12_1::QuatTraits
Definition Types.h:331
openvdb::v12_1::QuatTraits::Size
static const int Size
Definition Types.h:333
openvdb::v12_1::QuatTraits::ElementType
typename T::ValueType ElementType
Definition Types.h:334
openvdb::v12_1::QuatTraits::IsQuat
static const bool IsQuat
Definition Types.h:332
openvdb::v12_1::SwappedCombineOp::SwappedCombineOp
SwappedCombineOp(CombineOp &_op)
Definition Types.h:732
openvdb::v12_1::SwappedCombineOp::operator()
void operator()(CombineArgs< ValueType > &args)
Definition Types.h:734
openvdb::v12_1::SwappedCombineOp::op
CombineOp & op
Definition Types.h:742
openvdb::v12_1::ValueTraits< T, false >::ElementType
T ElementType
Definition Types.h:385
openvdb::v12_1::ValueTraits< T, false >::Elements
static const int Elements
Definition Types.h:384
openvdb::v12_1::ValueTraits< T, false >::IsVec
static const bool IsVec
Definition Types.h:379
openvdb::v12_1::ValueTraits< T, false >::Size
static const int Size
Definition Types.h:383
openvdb::v12_1::ValueTraits< T, false >::IsQuat
static const bool IsQuat
Definition Types.h:380
openvdb::v12_1::ValueTraits< T, false >::IsScalar
static const bool IsScalar
Definition Types.h:382
openvdb::v12_1::ValueTraits< T, false >::IsMat
static const bool IsMat
Definition Types.h:381
openvdb::v12_1::ValueTraits
Definition Types.h:366
openvdb::v12_1::ValueTraits::Elements
static const int Elements
Definition Types.h:372
openvdb::v12_1::ValueTraits::IsVec
static const bool IsVec
Definition Types.h:367
openvdb::v12_1::ValueTraits::Size
static const int Size
Definition Types.h:371
openvdb::v12_1::ValueTraits::ElementType
typename T::ValueType ElementType
Definition Types.h:373
openvdb::v12_1::ValueTraits::IsQuat
static const bool IsQuat
Definition Types.h:368
openvdb::v12_1::ValueTraits::IsScalar
static const bool IsScalar
Definition Types.h:370
openvdb::v12_1::ValueTraits::IsMat
static const bool IsMat
Definition Types.h:369
openvdb::v12_1::VecTraits< T, false >::ElementType
T ElementType
Definition Types.h:326
openvdb::v12_1::VecTraits< T, false >::IsVec
static const bool IsVec
Definition Types.h:324
openvdb::v12_1::VecTraits< T, false >::Size
static const int Size
Definition Types.h:325
openvdb::v12_1::VecTraits
Definition Types.h:315
openvdb::v12_1::VecTraits::IsVec
static const bool IsVec
Definition Types.h:316
openvdb::v12_1::VecTraits::Size
static const int Size
Definition Types.h:317
openvdb::v12_1::VecTraits::ElementType
typename T::ValueType ElementType
Definition Types.h:318
openvdb::v12_1::index_sequence
Re-implementation of C++17's index_sequence and the helper alias make_index_sequence....
Definition Types.h:294
openvdb::v12_1::types_internal::flt_t< 16ul >::type
math::half type
Definition Types.h:413
openvdb::v12_1::types_internal::flt_t< 32ul >::type
float type
Definition Types.h:414
openvdb::v12_1::types_internal::flt_t< 64ul >::type
double type
Definition Types.h:415
openvdb::v12_1::types_internal::flt_t
Definition Types.h:412
openvdb::v12_1::types_internal::int_t< 16ul, false >::type
uint16_t type
Definition Types.h:408
openvdb::v12_1::types_internal::int_t< 16ul, true >::type
int16_t type
Definition Types.h:404
openvdb::v12_1::types_internal::int_t< 32ul, false >::type
uint32_t type
Definition Types.h:409
openvdb::v12_1::types_internal::int_t< 32ul, true >::type
int32_t type
Definition Types.h:405
openvdb::v12_1::types_internal::int_t< 64ul, false >::type
uint64_t type
Definition Types.h:410
openvdb::v12_1::types_internal::int_t< 64ul, true >::type
int64_t type
Definition Types.h:406
openvdb::v12_1::types_internal::int_t< 8ul, false >::type
uint8_t type
Definition Types.h:407
openvdb::v12_1::types_internal::int_t< 8ul, true >::type
int8_t type
Definition Types.h:403
openvdb::v12_1::types_internal::int_t
Definition Types.h:402
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218