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