Go to the documentation of this file.
4 #ifndef OPENVDB_TYPES_HAS_BEEN_INCLUDED
5 #define OPENVDB_TYPES_HAS_BEEN_INCLUDED
11 #ifdef OPENVDB_USE_IMATH_HALF
12 #include <OpenEXR/half.h>
40 #include <type_traits>
55 using Byte =
unsigned char;
110 template<
typename T>
using SharedPtr = std::shared_ptr<T>;
111 template<
typename T>
using WeakPtr = std::weak_ptr<T>;
131 template<
typename T,
typename U>
inline SharedPtr<T>
141 template<
typename T,
typename U>
inline SharedPtr<T>
151 template<
typename IntType_, Index Kind>
154 static_assert(std::is_integral<IntType_>::value,
"PointIndex requires an integer value type");
187 template <
typename T,
template <
typename...>
class Template>
190 template <
typename... Args,
template <
typename...>
class Template>
197 template<typename T, bool = IsSpecializationOf<T, math::Vec2>::value ||
202 static const bool IsVec =
true;
203 static const int Size = T::size;
210 static const bool IsVec =
false;
211 static const int Size = 1;
215 template<typename T, bool = IsSpecializationOf<T, math::Quat>::value>
218 static const bool IsQuat =
true;
219 static const int Size = T::size;
226 static const bool IsQuat =
false;
227 static const int Size = 1;
231 template<typename T, bool = IsSpecializationOf<T, math::Mat3>::value ||
235 static const bool IsMat =
true;
236 static const int Size = T::size;
243 static const bool IsMat =
false;
244 static const int Size = 1;
248 template<typename T, bool = VecTraits<T>::IsVec ||
256 static const bool IsScalar =
false;
257 static const int Size = T::size;
258 static const int Elements = IsMat ? Size*Size : Size;
265 static const bool IsVec =
false;
266 static const bool IsQuat =
false;
267 static const bool IsMat =
false;
268 static const bool IsScalar =
true;
269 static const int Size = 1;
270 static const int Elements = 1;
280 template<
typename FromType,
typename ToType>
281 struct CanConvertType {
enum { value = std::is_constructible<ToType, FromType>::value }; };
292 template<
typename T0,
typename T1>
294 template<
typename T0,
typename T1>
296 template<
typename T0,
typename T1>
317 using Type =
typename std::remove_const<ToType>::type;
321 template<
typename FromType,
typename ToType>
struct CopyConstness<const FromType, ToType> {
322 using Type =
const ToType;
397 template<>
inline const char* typeNameAsString<math::half>() {
return "half"; }
418 template<>
inline const char* typeNameAsString<std::string>() {
return "string"; }
423 template<>
inline const char* typeNameAsString<math::Quats>() {
return "quats"; }
424 template<>
inline const char* typeNameAsString<math::Quatd>() {
return "quatd"; }
445 template<
typename AValueType,
typename BValueType = AValueType>
455 , mResultValPtr(&mResultVal)
458 , mResultIsActive(false)
463 CombineArgs(
const AValueType& a,
const BValueType& b, AValueType& result,
464 bool aOn =
false,
bool bOn =
false)
467 , mResultValPtr(&result)
471 this->updateResultActive();
475 CombineArgs(
const AValueType& a,
const BValueType& b,
bool aOn =
false,
bool bOn =
false)
478 , mResultValPtr(&mResultVal)
482 this->updateResultActive();
486 const AValueType&
a()
const {
return *mAValPtr; }
488 const BValueType&
b()
const {
return *mBValPtr; }
490 const AValueType& result()
const {
return *mResultValPtr; }
492 AValueType&
result() {
return *mResultValPtr; }
536 template<
typename ValueType,
typename CombineOp>
572 #endif // OPENVDB_TYPES_HAS_BEEN_INCLUDED
const char * typeNameAsString< uint16_t >()
Definition: openvdb/Types.h:403
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:122
Vec4< double > Vec4d
Definition: Vec4.h:566
const char * typeNameAsString< int8_t >()
Definition: openvdb/Types.h:400
PointIndex(IntType i=IntType(0))
Definition: openvdb/Types.h:158
@ MERGE_ACTIVE_STATES_AND_NODES
Definition: openvdb/Types.h:387
const AValueType & a() const
Get the A input value.
Definition: openvdb/Types.h:486
unsigned char Byte
Definition: openvdb/Types.h:55
MergePolicy
Definition: openvdb/Types.h:384
CombineOp & op
Definition: openvdb/Types.h:548
SwappedCombineOp(CombineOp &_op)
Definition: openvdb/Types.h:539
AValueType * mResultValPtr
Definition: openvdb/Types.h:527
CopyConstness<T1, T2>::Type is either const T2 or T2 with no const qualifier, depending on whether T1...
Definition: openvdb/Types.h:316
Vec4< int32_t > Vec4i
Definition: Vec4.h:563
@ VEC_COVARIANT
Definition: openvdb/Types.h:363
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: openvdb/Types.h:503
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: openvdb/Types.h:557
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:178
typename T::ValueType ElementType
Definition: openvdb/Types.h:259
T ElementType
Definition: openvdb/Types.h:271
@ VEC_COVARIANT_NORMALIZE
Definition: openvdb/Types.h:364
AValueType & result()
Definition: openvdb/Types.h:492
static const Real LEVEL_SET_HALF_WIDTH
Definition: openvdb/Types.h:339
std::weak_ptr< T > WeakPtr
Definition: openvdb/Types.h:111
const char * typeNameAsString< Mat4d >()
Definition: openvdb/Types.h:422
@ NUM_VEC_TYPES
Definition: openvdb/Types.h:368
T ElementType
Definition: openvdb/Types.h:228
AValueType mResultVal
Definition: openvdb/Types.h:526
Vec2< double > Vec2d
Definition: Vec2.h:537
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: openvdb/Types.h:152
int32_t Int32
Definition: openvdb/Types.h:52
PointIndex operator+(T x)
Needed to support the (zeroVal<PointIndex>() + val) idiom.
Definition: openvdb/Types.h:167
CombineArgs & setResult(const AValueType &val)
Set the output value.
Definition: openvdb/Types.h:496
int16_t Int16
Definition: openvdb/Types.h:51
Vec3< int32_t > Vec3i
Definition: Vec3.h:665
CanConvertType<FromType, ToType>::value is true if a value of type ToType can be constructed from a v...
Definition: openvdb/Types.h:281
bool bIsActive() const
Definition: openvdb/Types.h:508
const char * typeNameAsString< int16_t >()
Definition: openvdb/Types.h:402
const char * typeNameAsString< Vec3f >()
Definition: openvdb/Types.h:413
Vec2< int32_t > Vec2i
Definition: Vec2.h:534
VecType
Definition: openvdb/Types.h:361
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:132
const char * typeNameAsString< Vec4f >()
Definition: openvdb/Types.h:416
const char * typeNameAsString< Vec3i >()
Definition: openvdb/Types.h:412
typename T::ValueType ElementType
Definition: openvdb/Types.h:204
const char * typeNameAsString< uint32_t >()
Definition: openvdb/Types.h:405
const char * typeNameAsString< Vec4d >()
Definition: openvdb/Types.h:417
Quat< float > Quats
Definition: Quat.h:625
const char * typeNameAsString< Vec3d >()
Definition: openvdb/Types.h:414
IntType_ IntType
Definition: openvdb/Types.h:156
const char * typeNameAsString< float >()
Definition: openvdb/Types.h:398
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: openvdb/Types.h:499
AValueType AValueT
Definition: openvdb/Types.h:449
Int32 Int
Definition: openvdb/Types.h:54
BValueType BValueT
Definition: openvdb/Types.h:450
Definition: openvdb/Types.h:107
Tag dispatch class that distinguishes constructors during file input.
Definition: openvdb/Types.h:566
Index32 Index
Definition: openvdb/Types.h:50
Vec4< float > Vec4s
Definition: Vec4.h:565
int64_t Int64
Definition: openvdb/Types.h:53
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Definition: openvdb/Types.h:537
const char * typeNameAsString< Mat3s >()
Definition: openvdb/Types.h:419
Tag dispatch class that distinguishes constructors that deep copy.
Definition: openvdb/Types.h:562
const char * typeNameAsString< Vec3U8 >()
Definition: openvdb/Types.h:410
const char * typeNameAsString()
Definition: openvdb/Types.h:394
@ GRID_STAGGERED
Definition: openvdb/Types.h:335
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: openvdb/Types.h:515
@ GRID_FOG_VOLUME
Definition: openvdb/Types.h:334
Mat3< float > Mat3s
Definition: Mat3.h:847
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: openvdb/Types.h:501
std::shared_ptr< T > SharedPtr
Definition: openvdb/Types.h:110
Definition: openvdb/Types.h:251
const char * typeNameAsString< ValueMask >()
Definition: openvdb/Types.h:396
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: openvdb/Types.h:446
T ElementType
Definition: openvdb/Types.h:245
Vec2< float > Vec2s
Definition: Vec2.h:536
Mat4< float > Mat4s
Definition: Mat4.h:1367
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:463
Definition: openvdb/Types.h:200
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
Definition: openvdb/Types.h:216
@ MERGE_ACTIVE_STATES
Definition: openvdb/Types.h:385
A TypeList provides a compile time sequence of heterogeneous types which can be accessed,...
const char * typeNameAsString< int32_t >()
Definition: openvdb/Types.h:404
const AValueType & result() const
Get the output value.
Definition: openvdb/Types.h:491
const char * typeNameAsString< bool >()
Definition: openvdb/Types.h:395
Helper metafunction used to determine if the first template parameter is a specialization of the clas...
Definition: openvdb/Types.h:188
@ GRID_LEVEL_SET
Definition: openvdb/Types.h:333
double Real
Definition: openvdb/Types.h:56
const char * typeNameAsString< Vec3U16 >()
Definition: openvdb/Types.h:411
uint64_t Index64
Definition: openvdb/Types.h:49
@ VEC_CONTRAVARIANT_ABSOLUTE
Definition: openvdb/Types.h:366
const char * typeNameAsString< double >()
Definition: openvdb/Types.h:399
typename T::ValueType ElementType
Definition: openvdb/Types.h:237
@ NUM_GRID_CLASSES
Definition: openvdb/Types.h:337
bool mResultIsActive
Definition: openvdb/Types.h:529
CombineArgs()
Definition: openvdb/Types.h:452
@ VEC_INVARIANT
Definition: openvdb/Types.h:362
const char * typeNameAsString< Vec2s >()
Definition: openvdb/Types.h:408
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: openvdb/Types.h:560
const char * typeNameAsString< Mat4s >()
Definition: openvdb/Types.h:421
bool aIsActive() const
Definition: openvdb/Types.h:506
Vec3< double > Vec3d
Definition: Vec3.h:668
const char * typeNameAsString< int64_t >()
Definition: openvdb/Types.h:406
Definition: openvdb/Types.h:233
@ MERGE_NODES
Definition: openvdb/Types.h:386
const char * typeNameAsString< PointIndex64 >()
Definition: openvdb/Types.h:426
Vec3< float > Vec3s
Definition: Vec3.h:667
const char * typeNameAsString< PointIndex32 >()
Definition: openvdb/Types.h:425
CombineArgs & setResultIsActive(bool b)
Set the active state of the output value.
Definition: openvdb/Types.h:517
Quat< double > Quatd
Definition: Quat.h:626
const char * typeNameAsString< Mat3d >()
Definition: openvdb/Types.h:420
const BValueType * mBValPtr
Definition: openvdb/Types.h:525
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: openvdb/Types.h:513
uint32_t Index32
Definition: openvdb/Types.h:48
3x3 matrix class.
Definition: Mat3.h:28
Mat4< double > Mat4d
Definition: Mat4.h:1368
void operator()(CombineArgs< ValueType > &args)
Definition: openvdb/Types.h:541
bool mBIsActive
Definition: openvdb/Types.h:528
PointIndex(T i)
Explicit type conversion constructor.
Definition: openvdb/Types.h:161
const AValueType * mAValPtr
Definition: openvdb/Types.h:524
bool resultIsActive() const
Definition: openvdb/Types.h:510
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:475
const BValueType & b() const
Get the B input value.
Definition: openvdb/Types.h:488
const char * typeNameAsString< Vec2d >()
Definition: openvdb/Types.h:409
const char * typeNameAsString< Vec2i >()
Definition: openvdb/Types.h:407
const char * typeNameAsString< PointDataIndex64 >()
Definition: openvdb/Types.h:428
Definition: openvdb/Exceptions.h:13
internal::half half
Definition: openvdb/Types.h:25
typename T::ValueType ElementType
Definition: openvdb/Types.h:220
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:248
T ElementType
Definition: openvdb/Types.h:212
void updateResultActive()
Definition: openvdb/Types.h:522
Tag dispatch class that distinguishes constructors that steal.
Definition: openvdb/Types.h:564
GridClass
Definition: openvdb/Types.h:331
const char * typeNameAsString< PointDataIndex32 >()
Definition: openvdb/Types.h:427
const char * typeNameAsString< uint8_t >()
Definition: openvdb/Types.h:401
@ VEC_CONTRAVARIANT_RELATIVE
Definition: openvdb/Types.h:365
Mat3< double > Mat3d
Definition: Mat3.h:848
const char * typeNameAsString< Vec4i >()
Definition: openvdb/Types.h:415
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:142
typename std::remove_const< ToType >::type Type
Definition: openvdb/Types.h:317
@ GRID_UNKNOWN
Definition: openvdb/Types.h:332