OpenVDB: openvdb/Types.h Source File

OpenVDB 9.0.0

Types.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: MPL-2.0
3
4#ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5#define OPENVDB_TYPES_HAS_BEEN_INCLUDED
6
7#include "version.h"
8#include "Platform.h"
9#include "TypeList.h" // backwards compat
10
11#ifdef OPENVDB_USE_IMATH_HALF
12#ifdef OPENVDB_IMATH_VERSION
13#include <Imath/half.h>
14#else
15#include <OpenEXR/half.h>
16#endif
17namespace openvdb {
18 OPENVDB_USE_VERSION_NAMESPACE
19namespace OPENVDB_VERSION_NAME {
20namespace math {
21using half = half;
22}}}
23#else
24#include <openvdb/math/Half.h>
25namespace openvdb {
26 OPENVDB_USE_VERSION_NAMESPACE
27namespace 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
47namespace openvdb {
48 OPENVDB_USE_VERSION_NAMESPACE
49namespace 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>;
67using math::Vec2i;
68using math::Vec2s;
69using 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>;
78using math::Vec3i;
79using math::Vec3s;
80using math::Vec3d;
81
82using math::Coord;
83using 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>;
91using math::Vec4i;
92using math::Vec4s;
93using math::Vec4d;
94
95// Three-dimensional matrix types
96 using Mat3R = math::Mat3<Real>;
97using math::Mat3s;
98using math::Mat3d;
99
100// Four-dimensional matrix types
101 using Mat4R = math::Mat4<Real>;
102using math::Mat4s;
103using math::Mat4d;
104
105// Quaternions
106 using QuatR = math::Quat<Real>;
107using math::Quats;
108using 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
125template<typename T, typename U> inline SharedPtr<T>
126ConstPtrCast(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
135template<typename T, typename U> inline SharedPtr<T>
136DynamicPtrCast(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
145template<typename T, typename U> inline SharedPtr<T>
146StaticPtrCast(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.
155template<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
173private:
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
188/// @brief Helper metafunction used to determine if the first template
189/// parameter is a specialization of the class template given in the second
190/// template parameter
191template <typename T, template <typename...> class Template>
192 struct IsSpecializationOf: public std::false_type {};
193
194template <typename... Args, template <typename...> class Template>
195 struct IsSpecializationOf<Template<Args...>, Template>: public std::true_type {};
196
197
198////////////////////////////////////////
199
200
201 template<typename T, bool = IsSpecializationOf<T, math::Vec2>::value ||
202 IsSpecializationOf<T, math::Vec3>::value ||
203 IsSpecializationOf<T, math::Vec4>::value>
204 struct VecTraits
205{
206 static const bool IsVec = true;
207 static const int Size = T::size;
208 using ElementType = typename T::ValueType;
209};
210
211template<typename T>
212 struct VecTraits<T, false>
213{
214 static const bool IsVec = false;
215 static const int Size = 1;
216 using ElementType = T;
217};
218
219 template<typename T, bool = IsSpecializationOf<T, math::Quat>::value>
220 struct QuatTraits
221{
222 static const bool IsQuat = true;
223 static const int Size = T::size;
224 using ElementType = typename T::ValueType;
225};
226
227template<typename T>
228 struct QuatTraits<T, false>
229{
230 static const bool IsQuat = false;
231 static const int Size = 1;
232 using ElementType = T;
233};
234
235 template<typename T, bool = IsSpecializationOf<T, math::Mat3>::value ||
236 IsSpecializationOf<T, math::Mat4>::value>
237 struct MatTraits
238{
239 static const bool IsMat = true;
240 static const int Size = T::size;
241 using ElementType = typename T::ValueType;
242};
243
244template<typename T>
245 struct MatTraits<T, false>
246{
247 static const bool IsMat = false;
248 static const int Size = 1;
249 using ElementType = T;
250};
251
252template<typename T, bool = VecTraits<T>::IsVec ||
253 QuatTraits<T>::IsQuat ||
254 MatTraits<T>::IsMat>
255 struct ValueTraits
256{
257 static const bool IsVec = VecTraits<T>::IsVec;
258 static const bool IsQuat = QuatTraits<T>::IsQuat;
259 static const bool IsMat = MatTraits<T>::IsMat;
260 static const bool IsScalar = false;
261 static const int Size = T::size;
262 static const int Elements = IsMat ? Size*Size : Size;
263 using ElementType = typename T::ValueType;
264};
265
266template<typename T>
267 struct ValueTraits<T, false>
268{
269 static const bool IsVec = false;
270 static const bool IsQuat = false;
271 static const bool IsMat = false;
272 static const bool IsScalar = true;
273 static const int Size = 1;
274 static const int Elements = 1;
275 using ElementType = T;
276};
277
278
279////////////////////////////////////////
280
281
282/// @brief CanConvertType<FromType, ToType>::value is @c true if a value
283/// of type @a ToType can be constructed from a value of type @a FromType.
284template<typename FromType, typename ToType>
285 struct CanConvertType { enum { value = std::is_constructible<ToType, FromType>::value }; };
286
287// Specializations for vector types, which can be constructed from values
288// of their own ValueTypes (or values that can be converted to their ValueTypes),
289// but only explicitly
290 template<typename T> struct CanConvertType<T, math::Vec2<T> > { enum { value = true }; };
291 template<typename T> struct CanConvertType<T, math::Vec3<T> > { enum { value = true }; };
292 template<typename T> struct CanConvertType<T, math::Vec4<T> > { enum { value = true }; };
293 template<typename T> struct CanConvertType<math::Vec2<T>, math::Vec2<T> > { enum {value = true}; };
294 template<typename T> struct CanConvertType<math::Vec3<T>, math::Vec3<T> > { enum {value = true}; };
295 template<typename T> struct CanConvertType<math::Vec4<T>, math::Vec4<T> > { enum {value = true}; };
296template<typename T0, typename T1>
297 struct CanConvertType<T0, math::Vec2<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
298template<typename T0, typename T1>
299 struct CanConvertType<T0, math::Vec3<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
300template<typename T0, typename T1>
301 struct CanConvertType<T0, math::Vec4<T1> > { enum { value = CanConvertType<T0, T1>::value }; };
302 template<> struct CanConvertType<PointIndex32, PointDataIndex32> { enum {value = true}; };
303 template<> struct CanConvertType<PointDataIndex32, PointIndex32> { enum {value = true}; };
304template<typename T>
305 struct CanConvertType<T, ValueMask> { enum {value = CanConvertType<T, bool>::value}; };
306template<typename T>
307 struct CanConvertType<ValueMask, T> { enum {value = CanConvertType<bool, T>::value}; };
308
309
310////////////////////////////////////////
311
312
313/// @brief CopyConstness<T1, T2>::Type is either <tt>const T2</tt>
314/// or @c T2 with no @c const qualifier, depending on whether @c T1 is @c const.
315/// @details For example,
316/// - CopyConstness<int, int>::Type is @c int
317/// - CopyConstness<int, const int>::Type is @c int
318/// - CopyConstness<const int, int>::Type is <tt>const int</tt>
319/// - CopyConstness<const int, const int>::Type is <tt>const int</tt>
320 template<typename FromType, typename ToType> struct CopyConstness {
321 using Type = typename std::remove_const<ToType>::type;
322};
323
324/// @cond OPENVDB_DOCS_INTERNAL
325template<typename FromType, typename ToType> struct CopyConstness<const FromType, ToType> {
326 using Type = const ToType;
327};
328/// @endcond
329
330
331////////////////////////////////////////
332
333
334// Add new items to the *end* of this list, and update NUM_GRID_CLASSES.
335 enum GridClass {
336 GRID_UNKNOWN = 0,
337 GRID_LEVEL_SET,
338 GRID_FOG_VOLUME,
339 GRID_STAGGERED
340};
341 enum { NUM_GRID_CLASSES = GRID_STAGGERED + 1 };
342
343 static const Real LEVEL_SET_HALF_WIDTH = 3;
344
345/// The type of a vector determines how transforms are applied to it:
346/// <dl>
347/// <dt><b>Invariant</b>
348/// <dd>Does not transform (e.g., tuple, uvw, color)
349///
350/// <dt><b>Covariant</b>
351/// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation
352/// (e.g., gradient/normal)
353///
354/// <dt><b>Covariant Normalize</b>
355/// <dd>Apply inverse-transpose transformation: @e w = 0, ignores translation,
356/// vectors are renormalized (e.g., unit normal)
357///
358/// <dt><b>Contravariant Relative</b>
359/// <dd>Apply "regular" transformation: @e w = 0, ignores translation
360/// (e.g., displacement, velocity, acceleration)
361///
362/// <dt><b>Contravariant Absolute</b>
363/// <dd>Apply "regular" transformation: @e w = 1, vector translates (e.g., position)
364/// </dl>
365 enum VecType {
366 VEC_INVARIANT = 0,
367 VEC_COVARIANT,
368 VEC_COVARIANT_NORMALIZE,
369 VEC_CONTRAVARIANT_RELATIVE,
370 VEC_CONTRAVARIANT_ABSOLUTE
371};
372 enum { NUM_VEC_TYPES = VEC_CONTRAVARIANT_ABSOLUTE + 1 };
373
374
375/// Specify how grids should be merged during certain (typically multithreaded) operations.
376/// <dl>
377/// <dt><b>MERGE_ACTIVE_STATES</b>
378/// <dd>The output grid is active wherever any of the input grids is active.
379///
380/// <dt><b>MERGE_NODES</b>
381/// <dd>The output grid's tree has a node wherever any of the input grids' trees
382/// has a node, regardless of any active states.
383///
384/// <dt><b>MERGE_ACTIVE_STATES_AND_NODES</b>
385/// <dd>The output grid is active wherever any of the input grids is active,
386/// and its tree has a node wherever any of the input grids' trees has a node.
387/// </dl>
388 enum MergePolicy {
389 MERGE_ACTIVE_STATES = 0,
390 MERGE_NODES,
391 MERGE_ACTIVE_STATES_AND_NODES
392};
393
394
395////////////////////////////////////////
396
397
398 template<typename T> const char* typeNameAsString() { return typeid(T).name(); }
399 template<> inline const char* typeNameAsString<bool>() { return "bool"; }
400 template<> inline const char* typeNameAsString<ValueMask>() { return "mask"; }
401 template<> inline const char* typeNameAsString<math::half>() { return "half"; }
402 template<> inline const char* typeNameAsString<float>() { return "float"; }
403 template<> inline const char* typeNameAsString<double>() { return "double"; }
404 template<> inline const char* typeNameAsString<int8_t>() { return "int8"; }
405 template<> inline const char* typeNameAsString<uint8_t>() { return "uint8"; }
406 template<> inline const char* typeNameAsString<int16_t>() { return "int16"; }
407 template<> inline const char* typeNameAsString<uint16_t>() { return "uint16"; }
408 template<> inline const char* typeNameAsString<int32_t>() { return "int32"; }
409 template<> inline const char* typeNameAsString<uint32_t>() { return "uint32"; }
410 template<> inline const char* typeNameAsString<int64_t>() { return "int64"; }
411 template<> inline const char* typeNameAsString<Vec2i>() { return "vec2i"; }
412 template<> inline const char* typeNameAsString<Vec2s>() { return "vec2s"; }
413 template<> inline const char* typeNameAsString<Vec2d>() { return "vec2d"; }
414 template<> inline const char* typeNameAsString<Vec3U8>() { return "vec3u8"; }
415 template<> inline const char* typeNameAsString<Vec3U16>() { return "vec3u16"; }
416 template<> inline const char* typeNameAsString<Vec3i>() { return "vec3i"; }
417 template<> inline const char* typeNameAsString<Vec3f>() { return "vec3s"; }
418 template<> inline const char* typeNameAsString<Vec3d>() { return "vec3d"; }
419 template<> inline const char* typeNameAsString<Vec4i>() { return "vec4i"; }
420 template<> inline const char* typeNameAsString<Vec4f>() { return "vec4s"; }
421 template<> inline const char* typeNameAsString<Vec4d>() { return "vec4d"; }
422 template<> inline const char* typeNameAsString<std::string>() { return "string"; }
423 template<> inline const char* typeNameAsString<Mat3s>() { return "mat3s"; }
424 template<> inline const char* typeNameAsString<Mat3d>() { return "mat3d"; }
425 template<> inline const char* typeNameAsString<Mat4s>() { return "mat4s"; }
426 template<> inline const char* typeNameAsString<Mat4d>() { return "mat4d"; }
427 template<> inline const char* typeNameAsString<math::Quats>() { return "quats"; }
428 template<> inline const char* typeNameAsString<math::Quatd>() { return "quatd"; }
429 template<> inline const char* typeNameAsString<PointIndex32>() { return "ptidx32"; }
430 template<> inline const char* typeNameAsString<PointIndex64>() { return "ptidx64"; }
431 template<> inline const char* typeNameAsString<PointDataIndex32>() { return "ptdataidx32"; }
432 template<> inline const char* typeNameAsString<PointDataIndex64>() { return "ptdataidx64"; }
433
434
435////////////////////////////////////////
436
437
438/// @brief This struct collects both input and output arguments to "grid combiner" functors
439/// used with the tree::TypedGrid::combineExtended() and combine2Extended() methods.
440/// AValueType and BValueType are the value types of the two grids being combined.
441///
442/// @see openvdb/tree/Tree.h for usage information.
443///
444/// Setter methods return references to this object, to facilitate the following usage:
445/// @code
446/// CombineArgs<float> args;
447/// myCombineOp(args.setARef(aVal).setBRef(bVal).setAIsActive(true).setBIsActive(false));
448/// @endcode
449template<typename AValueType, typename BValueType = AValueType>
450 class CombineArgs
451{
452public:
453 using AValueT = AValueType;
454 using BValueT = BValueType;
455
456 CombineArgs()
457 : mAValPtr(nullptr)
458 , mBValPtr(nullptr)
459 , mResultValPtr(&mResultVal)
460 , mAIsActive(false)
461 , mBIsActive(false)
462 , mResultIsActive(false)
463 {
464 }
465
466 /// Use this constructor when the result value is stored externally.
467 CombineArgs(const AValueType& a, const BValueType& b, AValueType& result,
468 bool aOn = false, bool bOn = false)
469 : mAValPtr(&a)
470 , mBValPtr(&b)
471 , mResultValPtr(&result)
472 , mAIsActive(aOn)
473 , mBIsActive(bOn)
474 {
475 this->updateResultActive();
476 }
477
478 /// Use this constructor when the result value should be stored in this struct.
479 CombineArgs(const AValueType& a, const BValueType& b, bool aOn = false, bool bOn = false)
480 : mAValPtr(&a)
481 , mBValPtr(&b)
482 , mResultValPtr(&mResultVal)
483 , mAIsActive(aOn)
484 , mBIsActive(bOn)
485 {
486 this->updateResultActive();
487 }
488
489 /// Get the A input value.
490 const AValueType& a() const { return *mAValPtr; }
491 /// Get the B input value.
492 const BValueType& b() const { return *mBValPtr; }
493 //@{
494 /// Get the output value.
495 const AValueType& result() const { return *mResultValPtr; }
496 AValueType& result() { return *mResultValPtr; }
497 //@}
498
499 /// Set the output value.
500 CombineArgs& setResult(const AValueType& val) { *mResultValPtr = val; return *this; }
501
502 /// Redirect the A value to a new external source.
503 CombineArgs& setARef(const AValueType& a) { mAValPtr = &a; return *this; }
504 /// Redirect the B value to a new external source.
505 CombineArgs& setBRef(const BValueType& b) { mBValPtr = &b; return *this; }
506 /// Redirect the result value to a new external destination.
507 CombineArgs& setResultRef(AValueType& val) { mResultValPtr = &val; return *this; }
508
509 /// @return true if the A value is active
510 bool aIsActive() const { return mAIsActive; }
511 /// @return true if the B value is active
512 bool bIsActive() const { return mBIsActive; }
513 /// @return true if the output value is active
514 bool resultIsActive() const { return mResultIsActive; }
515
516 /// Set the active state of the A value.
517 CombineArgs& setAIsActive(bool b) { mAIsActive = b; updateResultActive(); return *this; }
518 /// Set the active state of the B value.
519 CombineArgs& setBIsActive(bool b) { mBIsActive = b; updateResultActive(); return *this; }
520 /// Set the active state of the output value.
521 CombineArgs& setResultIsActive(bool b) { mResultIsActive = b; return *this; }
522
523protected:
524 /// By default, the result value is active if either of the input values is active,
525 /// but this behavior can be overridden by calling setResultIsActive().
526 void updateResultActive() { mResultIsActive = mAIsActive || mBIsActive; }
527
528 const AValueType* mAValPtr; // pointer to input value from A grid
529 const BValueType* mBValPtr; // pointer to input value from B grid
530 AValueType mResultVal; // computed output value (unused if stored externally)
531 AValueType* mResultValPtr; // pointer to either mResultVal or an external value
532 bool mAIsActive, mBIsActive; // active states of A and B values
533 bool mResultIsActive; // computed active state (default: A active || B active)
534};
535
536
537/// This struct adapts a "grid combiner" functor to swap the A and B grid values
538/// (e.g., so that if the original functor computes a + 2 * b, the adapted functor
539/// will compute b + 2 * a).
540template<typename ValueType, typename CombineOp>
541 struct SwappedCombineOp
542{
543 SwappedCombineOp(CombineOp& _op): op(_op) {}
544
545 void operator()(CombineArgs<ValueType>& args)
546 {
547 CombineArgs<ValueType> swappedArgs(args.b(), args.a(), args.result(),
548 args.bIsActive(), args.aIsActive());
549 op(swappedArgs);
550 }
551
552 CombineOp& op;
553};
554
555
556////////////////////////////////////////
557
558
559/// @brief Tag dispatch class that distinguishes shallow copy constructors
560/// from deep copy constructors
561 class ShallowCopy {};
562/// @brief Tag dispatch class that distinguishes topology copy constructors
563/// from deep copy constructors
564 class TopologyCopy {};
565/// @brief Tag dispatch class that distinguishes constructors that deep copy
566 class DeepCopy {};
567/// @brief Tag dispatch class that distinguishes constructors that steal
568 class Steal {};
569/// @brief Tag dispatch class that distinguishes constructors during file input
570 class PartialCreate {};
571
572} // namespace OPENVDB_VERSION_NAME
573} // namespace openvdb
574
575
576#endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
BBox.h
Coord.h
value
ValueT value
Definition: GridBuilder.h:1287
Half.h
Mat3.h
Mat4.h
Math.h
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Platform.h
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::v9_0::CombineArgs
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:451
openvdb::v9_0::CombineArgs::setARef
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:503
openvdb::v9_0::CombineArgs::bIsActive
bool bIsActive() const
Definition: Types.h:512
openvdb::v9_0::CombineArgs::result
const AValueType & result() const
Get the output value.
Definition: Types.h:495
openvdb::v9_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:467
openvdb::v9_0::CombineArgs::mAIsActive
bool mAIsActive
Definition: Types.h:532
openvdb::v9_0::CombineArgs::mResultValPtr
AValueType * mResultValPtr
Definition: Types.h:531
openvdb::v9_0::CombineArgs::updateResultActive
void updateResultActive()
Definition: Types.h:526
openvdb::v9_0::CombineArgs::setResultIsActive
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: Types.h:521
openvdb::v9_0::CombineArgs::mAValPtr
const AValueType * mAValPtr
Definition: Types.h:528
openvdb::v9_0::CombineArgs::mResultVal
AValueType mResultVal
Definition: Types.h:530
openvdb::v9_0::CombineArgs::aIsActive
bool aIsActive() const
Definition: Types.h:510
openvdb::v9_0::CombineArgs::setBIsActive
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:519
openvdb::v9_0::CombineArgs::b
const BValueType & b() const
Get the B input value.
Definition: Types.h:492
openvdb::v9_0::CombineArgs::mBValPtr
const BValueType * mBValPtr
Definition: Types.h:529
openvdb::v9_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:479
openvdb::v9_0::CombineArgs::setResultRef
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:507
openvdb::v9_0::CombineArgs::result
AValueType & result()
Definition: Types.h:496
openvdb::v9_0::CombineArgs::AValueT
AValueType AValueT
Definition: Types.h:453
openvdb::v9_0::CombineArgs::setBRef
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:505
openvdb::v9_0::CombineArgs::a
const AValueType & a() const
Get the A input value.
Definition: Types.h:490
openvdb::v9_0::CombineArgs::resultIsActive
bool resultIsActive() const
Definition: Types.h:514
openvdb::v9_0::CombineArgs::mResultIsActive
bool mResultIsActive
Definition: Types.h:533
openvdb::v9_0::CombineArgs::BValueT
BValueType BValueT
Definition: Types.h:454
openvdb::v9_0::CombineArgs::CombineArgs
CombineArgs()
Definition: Types.h:456
openvdb::v9_0::CombineArgs::setResult
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: Types.h:500
openvdb::v9_0::CombineArgs::setAIsActive
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:517
openvdb::v9_0::DeepCopy
Tag dispatch class that distinguishes constructors that deep copy.
Definition: Types.h:566
openvdb::v9_0::PartialCreate
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:570
openvdb::v9_0::ShallowCopy
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:561
openvdb::v9_0::Steal
Tag dispatch class that distinguishes constructors that steal.
Definition: Types.h:568
openvdb::v9_0::TopologyCopy
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:564
openvdb::v9_0::ValueMask
Definition: Types.h:111
openvdb::v9_0::math::BBox< Vec3d >
openvdb::v9_0::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
openvdb::v9_0::math::Mat3
3x3 matrix class.
Definition: Mat3.h:29
openvdb::v9_0::math::Mat4< Real >
openvdb::v9_0::math::Quat
Definition: Quat.h:79
openvdb::v9_0::math::Vec2
Definition: Vec2.h:24
openvdb::v9_0::math::Vec3< Real >
openvdb::v9_0::math::Vec4
Definition: Vec4.h:25
openvdb::v9_0::math::internal::half
Definition: Half.h:99
nanovdb::CoordBBox
BBox< Coord > CoordBBox
Definition: NanoVDB.h:1658
openvdb::v9_0::math::Vec2i
Vec2< int32_t > Vec2i
Definition: Vec2.h:534
openvdb::v9_0::math::Mat4s
Mat4< float > Mat4s
Definition: Mat4.h:1367
openvdb::v9_0::math::Vec2d
Vec2< double > Vec2d
Definition: Vec2.h:537
openvdb::v9_0::math::Mat3d
Mat3< double > Mat3d
Definition: Mat3.h:848
openvdb::v9_0::math::Vec2s
Vec2< float > Vec2s
Definition: Vec2.h:536
openvdb::v9_0::math::Vec4s
Vec4< float > Vec4s
Definition: Vec4.h:565
openvdb::v9_0::math::Mat3s
Mat3< float > Mat3s
Definition: Mat3.h:847
openvdb::v9_0::math::Vec3d
Vec3< double > Vec3d
Definition: Vec3.h:668
openvdb::v9_0::math::Mat4d
Mat4< double > Mat4d
Definition: Mat4.h:1368
openvdb::v9_0::math::Vec4i
Vec4< int32_t > Vec4i
Definition: Vec4.h:563
openvdb::v9_0::math::Quatd
Quat< double > Quatd
Definition: Quat.h:626
openvdb::v9_0::math::half
internal::half half
Definition: Types.h:29
openvdb::v9_0::math::Vec3i
Vec3< int32_t > Vec3i
Definition: Vec3.h:665
openvdb::v9_0::math::Vec4d
Vec4< double > Vec4d
Definition: Vec4.h:566
openvdb::v9_0::math::Quats
Quat< float > Quats
Definition: Quat.h:625
openvdb::v9_0::math::Vec3s
Vec3< float > Vec3s
Definition: Vec3.h:667
openvdb::v9_0::typeNameAsString< Vec3d >
const char * typeNameAsString< Vec3d >()
Definition: Types.h:418
openvdb::v9_0::LEVEL_SET_HALF_WIDTH
static const Real LEVEL_SET_HALF_WIDTH
Definition: Types.h:343
openvdb::v9_0::NUM_GRID_CLASSES
@ NUM_GRID_CLASSES
Definition: Types.h:341
openvdb::v9_0::typeNameAsString< ValueMask >
const char * typeNameAsString< ValueMask >()
Definition: Types.h:400
openvdb::v9_0::typeNameAsString< uint16_t >
const char * typeNameAsString< uint16_t >()
Definition: Types.h:407
openvdb::v9_0::typeNameAsString< Vec3f >
const char * typeNameAsString< Vec3f >()
Definition: Types.h:417
openvdb::v9_0::typeNameAsString< int64_t >
const char * typeNameAsString< int64_t >()
Definition: Types.h:410
openvdb::v9_0::typeNameAsString< uint32_t >
const char * typeNameAsString< uint32_t >()
Definition: Types.h:409
openvdb::v9_0::Index
Index32 Index
Definition: Types.h:54
openvdb::v9_0::typeNameAsString< double >
const char * typeNameAsString< double >()
Definition: Types.h:403
openvdb::v9_0::typeNameAsString< Vec4f >
const char * typeNameAsString< Vec4f >()
Definition: Types.h:420
openvdb::v9_0::typeNameAsString
const char * typeNameAsString()
Definition: Types.h:398
openvdb::v9_0::typeNameAsString< uint8_t >
const char * typeNameAsString< uint8_t >()
Definition: Types.h:405
openvdb::v9_0::typeNameAsString< Vec3i >
const char * typeNameAsString< Vec3i >()
Definition: Types.h:416
openvdb::v9_0::Int16
int16_t Int16
Definition: Types.h:55
openvdb::v9_0::typeNameAsString< Vec3U8 >
const char * typeNameAsString< Vec3U8 >()
Definition: Types.h:414
openvdb::v9_0::typeNameAsString< int8_t >
const char * typeNameAsString< int8_t >()
Definition: Types.h:404
openvdb::v9_0::Byte
unsigned char Byte
Definition: Types.h:59
openvdb::v9_0::typeNameAsString< Vec2i >
const char * typeNameAsString< Vec2i >()
Definition: Types.h:411
openvdb::v9_0::Real
double Real
Definition: Types.h:60
openvdb::v9_0::GridClass
GridClass
Definition: Types.h:335
openvdb::v9_0::GRID_FOG_VOLUME
@ GRID_FOG_VOLUME
Definition: Types.h:338
openvdb::v9_0::GRID_STAGGERED
@ GRID_STAGGERED
Definition: Types.h:339
openvdb::v9_0::GRID_LEVEL_SET
@ GRID_LEVEL_SET
Definition: Types.h:337
openvdb::v9_0::GRID_UNKNOWN
@ GRID_UNKNOWN
Definition: Types.h:336
openvdb::v9_0::Int64
int64_t Int64
Definition: Types.h:57
openvdb::v9_0::typeNameAsString< Mat3d >
const char * typeNameAsString< Mat3d >()
Definition: Types.h:424
openvdb::v9_0::typeNameAsString< PointDataIndex64 >
const char * typeNameAsString< PointDataIndex64 >()
Definition: Types.h:432
openvdb::v9_0::Int
Int32 Int
Definition: Types.h:58
openvdb::v9_0::typeNameAsString< bool >
const char * typeNameAsString< bool >()
Definition: Types.h:399
openvdb::v9_0::WeakPtr
std::weak_ptr< T > WeakPtr
Definition: Types.h:115
openvdb::v9_0::typeNameAsString< PointIndex64 >
const char * typeNameAsString< PointIndex64 >()
Definition: Types.h:430
openvdb::v9_0::typeNameAsString< PointDataIndex32 >
const char * typeNameAsString< PointDataIndex32 >()
Definition: Types.h:431
openvdb::v9_0::typeNameAsString< Vec2s >
const char * typeNameAsString< Vec2s >()
Definition: Types.h:412
openvdb::v9_0::typeNameAsString< Vec2d >
const char * typeNameAsString< Vec2d >()
Definition: Types.h:413
openvdb::v9_0::typeNameAsString< int16_t >
const char * typeNameAsString< int16_t >()
Definition: Types.h:406
openvdb::v9_0::typeNameAsString< Mat4d >
const char * typeNameAsString< Mat4d >()
Definition: Types.h:426
openvdb::v9_0::Index32
uint32_t Index32
Definition: Types.h:52
openvdb::v9_0::typeNameAsString< Mat3s >
const char * typeNameAsString< Mat3s >()
Definition: Types.h:423
openvdb::v9_0::typeNameAsString< Vec4i >
const char * typeNameAsString< Vec4i >()
Definition: Types.h:419
openvdb::v9_0::Int32
int32_t Int32
Definition: Types.h:56
openvdb::v9_0::typeNameAsString< Mat4s >
const char * typeNameAsString< Mat4s >()
Definition: Types.h:425
openvdb::v9_0::Index64
uint64_t Index64
Definition: Types.h:53
openvdb::v9_0::SharedPtr
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
openvdb::v9_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:126
openvdb::v9_0::MergePolicy
MergePolicy
Definition: Types.h:388
openvdb::v9_0::MERGE_ACTIVE_STATES
@ MERGE_ACTIVE_STATES
Definition: Types.h:389
openvdb::v9_0::MERGE_NODES
@ MERGE_NODES
Definition: Types.h:390
openvdb::v9_0::MERGE_ACTIVE_STATES_AND_NODES
@ MERGE_ACTIVE_STATES_AND_NODES
Definition: Types.h:391
openvdb::v9_0::NUM_VEC_TYPES
@ NUM_VEC_TYPES
Definition: Types.h:372
openvdb::v9_0::typeNameAsString< Vec3U16 >
const char * typeNameAsString< Vec3U16 >()
Definition: Types.h:415
openvdb::v9_0::VecType
VecType
Definition: Types.h:365
openvdb::v9_0::VEC_CONTRAVARIANT_ABSOLUTE
@ VEC_CONTRAVARIANT_ABSOLUTE
Definition: Types.h:370
openvdb::v9_0::VEC_CONTRAVARIANT_RELATIVE
@ VEC_CONTRAVARIANT_RELATIVE
Definition: Types.h:369
openvdb::v9_0::VEC_COVARIANT
@ VEC_COVARIANT
Definition: Types.h:367
openvdb::v9_0::VEC_COVARIANT_NORMALIZE
@ VEC_COVARIANT_NORMALIZE
Definition: Types.h:368
openvdb::v9_0::VEC_INVARIANT
@ VEC_INVARIANT
Definition: Types.h:366
openvdb::v9_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:136
openvdb::v9_0::typeNameAsString< float >
const char * typeNameAsString< float >()
Definition: Types.h:402
openvdb::v9_0::typeNameAsString< PointIndex32 >
const char * typeNameAsString< PointIndex32 >()
Definition: Types.h:429
openvdb::v9_0::typeNameAsString< Vec4d >
const char * typeNameAsString< Vec4d >()
Definition: Types.h:421
openvdb::v9_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:146
openvdb::v9_0::typeNameAsString< int32_t >
const char * typeNameAsString< int32_t >()
Definition: Types.h:408
openvdb
Definition: Exceptions.h:13
openvdb::v9_0::CanConvertType
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: Types.h:285
openvdb::v9_0::CopyConstness
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: Types.h:320
openvdb::v9_0::CopyConstness::Type
typename std::remove_const< ToType >::type Type
Definition: Types.h:321
openvdb::v9_0::IsSpecializationOf
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: Types.h:192
openvdb::v9_0::MatTraits< T, false >::ElementType
T ElementType
Definition: Types.h:249
openvdb::v9_0::MatTraits
Definition: Types.h:238
openvdb::v9_0::MatTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:241
openvdb::v9_0::PointIndex
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:157
openvdb::v9_0::PointIndex::PointIndex
PointIndex(T i)
Explicit type conversion constructor.
Definition: Types.h:165
openvdb::v9_0::PointIndex::PointIndex
PointIndex(IntType i=IntType(0))
Definition: Types.h:162
openvdb::v9_0::PointIndex::operator+
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: Types.h:171
openvdb::v9_0::PointIndex::IntType
IntType_ IntType
Definition: Types.h:160
openvdb::v9_0::QuatTraits< T, false >::ElementType
T ElementType
Definition: Types.h:232
openvdb::v9_0::QuatTraits
Definition: Types.h:221
openvdb::v9_0::QuatTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:224
openvdb::v9_0::SwappedCombineOp
Definition: Types.h:542
openvdb::v9_0::SwappedCombineOp::SwappedCombineOp
SwappedCombineOp(CombineOp &_op)
Definition: Types.h:543
openvdb::v9_0::SwappedCombineOp::operator()
void operator()(CombineArgs< ValueType > &args)
Definition: Types.h:545
openvdb::v9_0::SwappedCombineOp::op
CombineOp & op
Definition: Types.h:552
openvdb::v9_0::ValueTraits< T, false >::ElementType
T ElementType
Definition: Types.h:275
openvdb::v9_0::ValueTraits
Definition: Types.h:256
openvdb::v9_0::ValueTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:263
openvdb::v9_0::VecTraits< T, false >::ElementType
T ElementType
Definition: Types.h:216
openvdb::v9_0::VecTraits
Definition: Types.h:205
openvdb::v9_0::VecTraits::ElementType
typename T::ValueType ElementType
Definition: Types.h:208
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202