Merge topic 'vtk_vtkm_idtype_matching'

4a7085f4 Update VecTraits/TypeTraits to include types that VTK uses.
8820c0fb Make sure vtk and vtkm types match when long and long long are both 8bytes.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !339
This commit is contained in:
Robert Maynard 2016-02-23 16:10:30 -05:00 committed by Kitware Robot
commit f53c8af170
3 changed files with 43 additions and 28 deletions

@ -86,28 +86,37 @@ struct TypeTraits<const T> : TypeTraits<T>
typedef TypeTraitsRealTag NumericTag; \ typedef TypeTraitsRealTag NumericTag; \
typedef TypeTraitsScalarTag DimensionalityTag; \ typedef TypeTraitsScalarTag DimensionalityTag; \
VTKM_EXEC_CONT_EXPORT static T ZeroInitialization() { return T(); } \ VTKM_EXEC_CONT_EXPORT static T ZeroInitialization() { return T(); } \
} };
#define VTKM_BASIC_INTEGER_TYPE(T) \ #define VTKM_BASIC_INTEGER_TYPE(T) \
template<> struct TypeTraits<T> { \ template<> struct TypeTraits< T > { \
typedef TypeTraitsIntegerTag NumericTag; \ typedef TypeTraitsIntegerTag NumericTag; \
typedef TypeTraitsScalarTag DimensionalityTag; \ typedef TypeTraitsScalarTag DimensionalityTag; \
VTKM_EXEC_CONT_EXPORT static T ZeroInitialization() { return T(); } \ VTKM_EXEC_CONT_EXPORT static T ZeroInitialization() \
} { \
typedef T ReturnType; \
return ReturnType(); \
} \
}; \
/// Traits for basic C++ types. /// Traits for basic C++ types.
/// ///
VTKM_BASIC_REAL_TYPE(vtkm::Float32); VTKM_BASIC_REAL_TYPE(float)
VTKM_BASIC_REAL_TYPE(vtkm::Float64); VTKM_BASIC_REAL_TYPE(double)
VTKM_BASIC_INTEGER_TYPE(vtkm::Int8);
VTKM_BASIC_INTEGER_TYPE(vtkm::UInt8); VTKM_BASIC_INTEGER_TYPE(char)
VTKM_BASIC_INTEGER_TYPE(vtkm::Int16); VTKM_BASIC_INTEGER_TYPE(signed char)
VTKM_BASIC_INTEGER_TYPE(vtkm::UInt16); VTKM_BASIC_INTEGER_TYPE(unsigned char)
VTKM_BASIC_INTEGER_TYPE(vtkm::Int32); VTKM_BASIC_INTEGER_TYPE(short)
VTKM_BASIC_INTEGER_TYPE(vtkm::UInt32); VTKM_BASIC_INTEGER_TYPE(unsigned short)
VTKM_BASIC_INTEGER_TYPE(vtkm::Int64); VTKM_BASIC_INTEGER_TYPE(int)
VTKM_BASIC_INTEGER_TYPE(vtkm::UInt64); VTKM_BASIC_INTEGER_TYPE(unsigned int)
VTKM_BASIC_INTEGER_TYPE(long)
VTKM_BASIC_INTEGER_TYPE(unsigned long)
VTKM_BASIC_INTEGER_TYPE(long long)
VTKM_BASIC_INTEGER_TYPE(unsigned long long)
#undef VTKM_BASIC_REAL_TYPE #undef VTKM_BASIC_REAL_TYPE
#undef VTKM_BASIC_INTEGER_TYPE #undef VTKM_BASIC_INTEGER_TYPE

@ -126,12 +126,13 @@ typedef unsigned int UInt32;
#error Could not find a 32-bit integer. #error Could not find a 32-bit integer.
#endif #endif
#if VTKM_SIZE_LONG == 8 //In this order so that we exactly match the logic that exists in VTK
typedef signed long Int64; #if VTKM_SIZE_LONG_LONG == 8
typedef unsigned long UInt64;
#elif VTKM_SIZE_LONG_LONG == 8
typedef signed long long Int64; typedef signed long long Int64;
typedef unsigned long long UInt64; typedef unsigned long long UInt64;
#elif VTKM_SIZE_LONG == 8
typedef signed long Int64;
typedef unsigned long UInt64;
#else #else
#error Could not find a 64-bit integer. #error Could not find a 64-bit integer.
#endif #endif

@ -264,16 +264,21 @@ struct VecTraits<vtkm::Pair<T,U> >
/// Allows you to treat basic types as if they were vectors. /// Allows you to treat basic types as if they were vectors.
VTKM_BASIC_TYPE_VECTOR(vtkm::Float32) VTKM_BASIC_TYPE_VECTOR(float)
VTKM_BASIC_TYPE_VECTOR(vtkm::Float64) VTKM_BASIC_TYPE_VECTOR(double)
VTKM_BASIC_TYPE_VECTOR(vtkm::Int8)
VTKM_BASIC_TYPE_VECTOR(vtkm::UInt8) VTKM_BASIC_TYPE_VECTOR(char)
VTKM_BASIC_TYPE_VECTOR(vtkm::Int16) VTKM_BASIC_TYPE_VECTOR(signed char)
VTKM_BASIC_TYPE_VECTOR(vtkm::UInt16) VTKM_BASIC_TYPE_VECTOR(unsigned char)
VTKM_BASIC_TYPE_VECTOR(vtkm::Int32) VTKM_BASIC_TYPE_VECTOR(short)
VTKM_BASIC_TYPE_VECTOR(vtkm::UInt32) VTKM_BASIC_TYPE_VECTOR(unsigned short)
VTKM_BASIC_TYPE_VECTOR(vtkm::Int64) VTKM_BASIC_TYPE_VECTOR(int)
VTKM_BASIC_TYPE_VECTOR(vtkm::UInt64) VTKM_BASIC_TYPE_VECTOR(unsigned int)
VTKM_BASIC_TYPE_VECTOR(long)
VTKM_BASIC_TYPE_VECTOR(unsigned long)
VTKM_BASIC_TYPE_VECTOR(long long)
VTKM_BASIC_TYPE_VECTOR(unsigned long long)
//#undef VTKM_BASIC_TYPE_VECTOR //#undef VTKM_BASIC_TYPE_VECTOR