Go to the documentation of this file.
4 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
10 #include <OpenEXR/half.h>
22 #include <type_traits>
37 using Byte =
unsigned char;
92 template<
typename T>
using SharedPtr = std::shared_ptr<T>;
93 template<
typename T>
using WeakPtr = std::weak_ptr<T>;
133 template<
typename IntType_, Index Kind>
136 static_assert(std::is_integral<IntType_>::value,
"PointIndex requires an integer value type");
169 template <
typename T,
template <
typename...>
class Template>
172 template <
typename... Args,
template <
typename...>
class Template>
179 template<typename T, bool = IsSpecializationOf<T, math::Vec2>::value ||
184 static const bool IsVec =
true;
185 static const int Size = T::size;
192 static const bool IsVec =
false;
193 static const int Size = 1;
197 template<typename T, bool = IsSpecializationOf<T, math::Quat>::value>
200 static const bool IsQuat =
true;
201 static const int Size = T::size;
208 static const bool IsQuat =
false;
209 static const int Size = 1;
213 template<typename T, bool = IsSpecializationOf<T, math::Mat3>::value ||
217 static const bool IsMat =
true;
218 static const int Size = T::size;
225 static const bool IsMat =
false;
226 static const int Size = 1;
230 template<typename T, bool = VecTraits<T>::IsVec ||
238 static const bool IsScalar =
false;
239 static const int Size = T::size;
240 static const int Elements = IsMat ? Size*Size : Size;
247 static const bool IsVec =
false;
248 static const bool IsQuat =
false;
249 static const bool IsMat =
false;
250 static const bool IsScalar =
true;
251 static const int Size = 1;
252 static const int Elements = 1;
262 template<
typename FromType,
typename ToType>
263 struct CanConvertType {
enum { value = std::is_constructible<ToType, FromType>::value }; };
274 template<
typename T0,
typename T1>
276 template<
typename T0,
typename T1>
278 template<
typename T0,
typename T1>
299 using Type =
typename std::remove_const<ToType>::type;
303 template<
typename FromType,
typename ToType>
struct CopyConstness<const FromType, ToType> {
304 using Type =
const ToType;
400 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
405 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
406 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
427 template<
typename AValueType,
typename BValueType = AValueType>
437 , mResultValPtr(&mResultVal)
440 , mResultIsActive(false)
445 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
446 bool aOn =
false,
bool bOn =
false)
449 , mResultValPtr(&result)
453 this->updateResultActive();
457 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false)
460 , mResultValPtr(&mResultVal)
464 this->updateResultActive();
468 const AValueType&
a()
const {
return *mAValPtr; }
470 const BValueType&
b()
const {
return *mBValPtr; }
472 const AValueType& result()
const {
return *mResultValPtr; }
474 AValueType&
result() {
return *mResultValPtr; }
518 template<
typename ValueType,
typename CombineOp>
554 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
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: openvdb/Types.h:445
@ GRID_FOG_VOLUME
Definition: openvdb/Types.h:316
@ VEC_INVARIANT
Definition: openvdb/Types.h:344
Vec4< float > Vec4s
Definition: Vec4.h:559
AValueType * mResultValPtr
Definition: openvdb/Types.h:509
const char * typeNameAsString< Vec4f >()
Definition: openvdb/Types.h:398
typename T::ValueType ElementType
Definition: openvdb/Types.h:219
bool aIsActive() const
Definition: openvdb/Types.h:488
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:26
const char * typeNameAsString< double >()
Definition: openvdb/Types.h:381
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: openvdb/Types.h:124
bool resultIsActive() const
Definition: openvdb/Types.h:492
GridClass
Definition: openvdb/Types.h:313
Definition: openvdb/Types.h:199
bool bIsActive() const
Definition: openvdb/Types.h:490
Mat3< double > Mat3d
Definition: Mat3.h:841
bool mResultIsActive
Definition: openvdb/Types.h:511
const char * typeNameAsString< PointIndex64 >()
Definition: openvdb/Types.h:408
Mat3< float > Mat3s
Definition: Mat3.h:840
PointIndex(IntType i=IntType(0))
Definition: openvdb/Types.h:140
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: openvdb/Types.h:149
Mat4< double > Mat4d
Definition: Mat4.h:1362
Quat< double > Quatd
Definition: Quat.h:620
void operator()(CombineArgs< ValueType > &args)
Definition: openvdb/Types.h:523
std::weak_ptr< T > WeakPtr
Definition: openvdb/Types.h:93
const char * typeNameAsString< Vec4i >()
Definition: openvdb/Types.h:397
const char * typeNameAsString< int64_t >()
Definition: openvdb/Types.h:388
@ GRID_LEVEL_SET
Definition: openvdb/Types.h:315
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: openvdb/Types.h:481
const char * typeNameAsString< uint16_t >()
Definition: openvdb/Types.h:385
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: openvdb/Types.h:478
const char * typeNameAsString< ValueMask >()
Definition: openvdb/Types.h:378
const char * typeNameAsString< Vec2d >()
Definition: openvdb/Types.h:391
const char * typeNameAsString< PointDataIndex64 >()
Definition: openvdb/Types.h:410
const char * typeNameAsString()
Definition: openvdb/Types.h:376
int64_t Int64
Definition: openvdb/Types.h:35
@ NUM_GRID_CLASSES
Definition: openvdb/Types.h:319
const char * typeNameAsString< uint8_t >()
Definition: openvdb/Types.h:383
T ElementType
Definition: openvdb/Types.h:227
Library and file format version numbers.
Vec4< int32_t > Vec4i
Definition: Vec4.h:557
AValueType mResultVal
Definition: openvdb/Types.h:508
const char * typeNameAsString< Mat3s >()
Definition: openvdb/Types.h:401
static const Real LEVEL_SET_HALF_WIDTH
Definition: openvdb/Types.h:321
const char * typeNameAsString< Vec3d >()
Definition: openvdb/Types.h:396
PointIndex(T i)
Explicit type conversion constructor.
Definition: openvdb/Types.h:143
const char * typeNameAsString< PointIndex32 >()
Definition: openvdb/Types.h:407
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: openvdb/Types.h:114
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
Vec3< int32_t > Vec3i
Definition: Vec3.h:659
AValueType AValueT
Definition: openvdb/Types.h:431
Definition: openvdb/Types.h:216
@ MERGE_NODES
Definition: openvdb/Types.h:368
Vec2< double > Vec2d
Definition: Vec2.h:532
const char * typeNameAsString< Mat3d >()
Definition: openvdb/Types.h:402
const char * typeNameAsString< Vec2i >()
Definition: openvdb/Types.h:389
uint32_t Index32
Definition: openvdb/Types.h:30
Tag dispatch class that distinguishes constructors that steal.
Definition: openvdb/Types.h:546
const char * typeNameAsString< int32_t >()
Definition: openvdb/Types.h:386
AValueType & result()
Definition: openvdb/Types.h:474
Int32 Int
Definition: openvdb/Types.h:36
const char * typeNameAsString< Vec3i >()
Definition: openvdb/Types.h:394
int32_t Int32
Definition: openvdb/Types.h:34
T ElementType
Definition: openvdb/Types.h:210
T ElementType
Definition: openvdb/Types.h:194
uint64_t Index64
Definition: openvdb/Types.h:31
const char * typeNameAsString< Vec2s >()
Definition: openvdb/Types.h:390
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
3x3 matrix class.
Definition: Mat3.h:29
@ NUM_VEC_TYPES
Definition: openvdb/Types.h:350
IntType_ IntType
Definition: openvdb/Types.h:138
const char * typeNameAsString< float >()
Definition: openvdb/Types.h:380
VecType
Definition: openvdb/Types.h:343
const AValueType & result() const
Get the output value.
Definition: openvdb/Types.h:473
const char * typeNameAsString< half >()
Definition: openvdb/Types.h:379
@ MERGE_ACTIVE_STATES_AND_NODES
Definition: openvdb/Types.h:369
Vec3< float > Vec3s
Definition: Vec3.h:661
void updateResultActive()
Definition: openvdb/Types.h:504
const char * typeNameAsString< PointDataIndex32 >()
Definition: openvdb/Types.h:409
Vec3< double > Vec3d
Definition: Vec3.h:662
BValueType BValueT
Definition: openvdb/Types.h:432
@ VEC_CONTRAVARIANT_RELATIVE
Definition: openvdb/Types.h:347
typename T::ValueType ElementType
Definition: openvdb/Types.h:186
CombineOp & op
Definition: openvdb/Types.h:530
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: openvdb/Types.h:263
const char * typeNameAsString< Vec3U16 >()
Definition: openvdb/Types.h:393
typename T::ValueType ElementType
Definition: openvdb/Types.h:202
A TypeList provides a compile time sequence of heterogeneous types which can be accessed,...
const BValueType * mBValPtr
Definition: openvdb/Types.h:507
const char * typeNameAsString< int16_t >()
Definition: openvdb/Types.h:384
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: openvdb/Types.h:483
Mat4< float > Mat4s
Definition: Mat4.h:1361
Vec4< double > Vec4d
Definition: Vec4.h:560
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:147
@ VEC_COVARIANT
Definition: openvdb/Types.h:345
const char * typeNameAsString< Mat4s >()
Definition: openvdb/Types.h:403
T ElementType
Definition: openvdb/Types.h:253
const char * typeNameAsString< uint32_t >()
Definition: openvdb/Types.h:387
Vec2< float > Vec2s
Definition: Vec2.h:531
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: openvdb/Types.h:429
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: openvdb/Types.h:170
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: openvdb/Types.h:485
const char * typeNameAsString< Vec3f >()
Definition: openvdb/Types.h:395
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: openvdb/Types.h:497
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: openvdb/Types.h:298
const char * typeNameAsString< Vec3U8 >()
Definition: openvdb/Types.h:392
typename std::remove_const< ToType >::type Type
Definition: openvdb/Types.h:299
CombineArgs()
Definition: openvdb/Types.h:434
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: openvdb/Types.h:135
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: openvdb/Types.h:542
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: openvdb/Types.h:457
bool mBIsActive
Definition: openvdb/Types.h:510
Definition: openvdb/Types.h:520
double Real
Definition: openvdb/Types.h:38
@ VEC_CONTRAVARIANT_ABSOLUTE
Definition: openvdb/Types.h:348
unsigned char Byte
Definition: openvdb/Types.h:37
const char * typeNameAsString< int8_t >()
Definition: openvdb/Types.h:382
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:95
const char * typeNameAsString< Mat4d >()
Definition: openvdb/Types.h:404
@ VEC_COVARIANT_NORMALIZE
Definition: openvdb/Types.h:346
MergePolicy
Definition: openvdb/Types.h:366
const char * typeNameAsString< bool >()
Definition: openvdb/Types.h:377
const char * typeNameAsString< Vec4d >()
Definition: openvdb/Types.h:399
@ MERGE_ACTIVE_STATES
Definition: openvdb/Types.h:367
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: openvdb/Types.h:104
typename T::ValueType ElementType
Definition: openvdb/Types.h:241
SwappedCombineOp(CombineOp &_op)
Definition: openvdb/Types.h:521
@ GRID_UNKNOWN
Definition: openvdb/Types.h:314
const AValueType & a() const
Get the A input value.
Definition: openvdb/Types.h:468
std::shared_ptr< T > SharedPtr
Definition: openvdb/Types.h:92
@ GRID_STAGGERED
Definition: openvdb/Types.h:317
Definition: openvdb/Exceptions.h:13
Tag dispatch class that distinguishes constructors that deep copy.
Definition: openvdb/Types.h:544
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: openvdb/Types.h:539
Quat< float > Quats
Definition: Quat.h:619
const BValueType & b() const
Get the B input value.
Definition: openvdb/Types.h:470
Definition: openvdb/Types.h:183
Vec2< int32_t > Vec2i
Definition: Vec2.h:529
int16_t Int16
Definition: openvdb/Types.h:33
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: openvdb/Types.h:495
Definition: openvdb/Types.h:234
Index32 Index
Definition: openvdb/Types.h:32
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: openvdb/Types.h:499
const AValueType * mAValPtr
Definition: openvdb/Types.h:506
Tag dispatch class that distinguishes constructors during file input.
Definition: openvdb/Types.h:548
Definition: openvdb/Types.h:89