Remove VS2013 workarounds from VTK-m.

This commit is contained in:
Robert Maynard 2018-02-22 11:34:08 -05:00
parent 01c9d6e2a6
commit ee69c7a4b7
28 changed files with 48 additions and 174 deletions

@ -86,12 +86,6 @@ function(vtkm_setup_msvc_properties target )
# removed when doing header test builds. # removed when doing header test builds.
target_compile_options(${target} PRIVATE -wd4702 -wd4505) target_compile_options(${target} PRIVATE -wd4702 -wd4505)
# In VS2013 the C4127 warning has a bug in the implementation and
# generates false positive warnings for lots of template code
if(MSVC_VERSION LESS 1900)
target_compile_options(${target} PRIVATE -wd4127 )
endif()
endfunction(vtkm_setup_msvc_properties) endfunction(vtkm_setup_msvc_properties)
# vtkm_target_name(<name>) # vtkm_target_name(<name>)

@ -61,7 +61,7 @@ VTK-m Requires:
+ GCC 4.8+ + GCC 4.8+
+ Clang 3.3+ + Clang 3.3+
+ XCode 5.0+ + XCode 5.0+
+ MSVC 2013+ + MSVC 2015+
+ [CMake](http://www.cmake.org/download/) + [CMake](http://www.cmake.org/download/)
+ CMake 3.3+ (for any build) + CMake 3.3+ (for any build)
+ CMake 3.9+ (for CUDA build) + CMake 3.9+ (for CUDA build)

@ -168,8 +168,7 @@ class ExposedClass;
namespace references are preferred). namespace references are preferred).
+ All code must be valid by the C++11 specifications. It must also + All code must be valid by the C++11 specifications. It must also
compile correctly with Microsoft Visual Studio 2013, which implements a compile with Microsoft Visual Studio 2015.
subset of the C++11 standard.
+ New code must include regression tests that will run on the dashboards. + New code must include regression tests that will run on the dashboards.
Generally a new class will have an associated "UnitTest" that will test Generally a new class will have an associated "UnitTest" that will test

@ -36,7 +36,7 @@ namespace internal
template <typename ListTag> template <typename ListTag>
struct ListTagCheck : std::is_base_of<vtkm::detail::ListRoot, ListTag> struct ListTagCheck : std::is_base_of<vtkm::detail::ListRoot, ListTag>
{ {
static VTKM_CONSTEXPR bool Valid = std::is_base_of<vtkm::detail::ListRoot, ListTag>::value; static constexpr bool Valid = std::is_base_of<vtkm::detail::ListRoot, ListTag>::value;
}; };
} // namespace internal } // namespace internal
@ -111,7 +111,7 @@ template <typename ListTag, typename Type>
struct ListContains struct ListContains
{ {
VTKM_IS_LIST_TAG(ListTag); VTKM_IS_LIST_TAG(ListTag);
static VTKM_CONSTEXPR bool value = detail::ListContainsImpl<Type, typename ListTag::list>::value; static constexpr bool value = detail::ListContainsImpl<Type, typename ListTag::list>::value;
}; };
} // namespace vtkm } // namespace vtkm

@ -87,7 +87,7 @@ struct ArrayHandleSwizzleTraits
/// A std::array containing the ComponentMap for runtime querying. /// A std::array containing the ComponentMap for runtime querying.
using RuntimeComponentMapType = std::array<vtkm::IdComponent, COUNT>; using RuntimeComponentMapType = std::array<vtkm::IdComponent, COUNT>;
static VTKM_CONSTEXPR RuntimeComponentMapType GenerateRuntimeComponentMap() static constexpr RuntimeComponentMapType GenerateRuntimeComponentMap()
{ {
return RuntimeComponentMapType{ { ComponentMap... } }; return RuntimeComponentMapType{ { ComponentMap... } };
} }
@ -124,7 +124,7 @@ private:
template <vtkm::IdComponent OutputIndex, vtkm::IdComponent Head> template <vtkm::IdComponent OutputIndex, vtkm::IdComponent Head>
struct GetImpl<OutputIndex, Head> struct GetImpl<OutputIndex, Head>
{ {
VTKM_CONSTEXPR vtkm::IdComponent operator()() const { return OutputIndex == 0 ? Head : -1; } constexpr vtkm::IdComponent operator()() const { return OutputIndex == 0 ? Head : -1; }
}; };
// Recursive case: // Recursive case:
@ -133,17 +133,14 @@ private:
{ {
using Next = GetImpl<OutputIndex - 1, Tail...>; using Next = GetImpl<OutputIndex - 1, Tail...>;
VTKM_CONSTEXPR vtkm::IdComponent operator()() const constexpr vtkm::IdComponent operator()() const { return OutputIndex == 0 ? Head : Next()(); }
{
return OutputIndex == 0 ? Head : Next()();
}
}; };
public: public:
/// Get the component from ComponentMap at the specified index as a /// Get the component from ComponentMap at the specified index as a
/// compile-time constant: /// compile-time constant:
template <vtkm::IdComponent OutputIndex> template <vtkm::IdComponent OutputIndex>
static VTKM_CONSTEXPR vtkm::IdComponent Get() static constexpr vtkm::IdComponent Get()
{ {
return GetImpl<OutputIndex, ComponentMap...>()(); return GetImpl<OutputIndex, ComponentMap...>()();
} }

@ -183,15 +183,7 @@ template <typename ArrayHandleType,
typename InverseFunctorType = NullFunctorType> typename InverseFunctorType = NullFunctorType>
struct VTKM_ALWAYS_EXPORT StorageTagTransform struct VTKM_ALWAYS_EXPORT StorageTagTransform
{ {
#if defined(VTKM_MSVC) && (_MSC_VER == 1800) // workaround for VS2013
private:
using ArrayHandleValueType = typename ArrayHandleType::ValueType;
public:
using ValueType = decltype(FunctorType{}(ArrayHandleValueType{}));
#else
using ValueType = decltype(FunctorType{}(typename ArrayHandleType::ValueType{})); using ValueType = decltype(FunctorType{}(typename ArrayHandleType::ValueType{}));
#endif
}; };
template <typename ArrayHandleType, typename FunctorType> template <typename ArrayHandleType, typename FunctorType>

@ -27,7 +27,7 @@
#include <exception> #include <exception>
#include <string> #include <string>
#include <vtkm/internal/ExportMacros.h> // For VTKM_NOEXCEPT #include <vtkm/internal/ExportMacros.h>
namespace vtkm namespace vtkm
{ {
@ -55,7 +55,7 @@ public:
#endif #endif
// For std::exception compatibility: // For std::exception compatibility:
const char* what() const VTKM_NOEXCEPT override { return this->Message.c_str(); } const char* what() const noexcept override { return this->Message.c_str(); }
protected: protected:
Error() {} Error() {}

@ -53,7 +53,7 @@ namespace internal
template <typename ControlSignatureTag> template <typename ControlSignatureTag>
struct ControlSignatureTagCheck struct ControlSignatureTagCheck
{ {
static VTKM_CONSTEXPR bool Valid = static constexpr bool Valid =
std::is_base_of<vtkm::cont::arg::ControlSignatureTagBase, ControlSignatureTag>::value; std::is_base_of<vtkm::cont::arg::ControlSignatureTagBase, ControlSignatureTag>::value;
}; };

@ -46,7 +46,7 @@ struct TypeCheckTagExecObject
template <typename Type> template <typename Type>
struct TypeCheck<TypeCheckTagExecObject, Type> struct TypeCheck<TypeCheckTagExecObject, Type>
{ {
static VTKM_CONSTEXPR bool value = std::is_base_of<vtkm::exec::ExecutionObjectBase, Type>::value; static constexpr bool value = std::is_base_of<vtkm::exec::ExecutionObjectBase, Type>::value;
}; };
} }
} }

@ -433,7 +433,7 @@ public:
const BinaryCompare& binary_compare) const BinaryCompare& binary_compare)
{ {
internal::WrappedBinaryOperator<bool, BinaryCompare> wrappedCompare(binary_compare); internal::WrappedBinaryOperator<bool, BinaryCompare> wrappedCompare(binary_compare);
VTKM_CONSTEXPR bool larger_than_64bits = sizeof(U) > sizeof(vtkm::Int64); constexpr bool larger_than_64bits = sizeof(U) > sizeof(vtkm::Int64);
if (larger_than_64bits) if (larger_than_64bits)
{ {
/// More efficient sort: /// More efficient sort:

@ -195,7 +195,7 @@ void parallel_sort_bykey(vtkm::cont::ArrayHandle<T, StorageT>& keys,
PSortTag) PSortTag)
{ {
using KeyType = vtkm::cont::ArrayHandle<T, StorageT>; using KeyType = vtkm::cont::ArrayHandle<T, StorageT>;
VTKM_CONSTEXPR bool larger_than_64bits = sizeof(U) > sizeof(vtkm::Int64); constexpr bool larger_than_64bits = sizeof(U) > sizeof(vtkm::Int64);
if (larger_than_64bits) if (larger_than_64bits)
{ {
/// More efficient sort: /// More efficient sort:

@ -129,8 +129,8 @@ inline vtkm::filter::Result Gradient::DoExecute(
transpose_3x3(outArray, adapter); transpose_3x3(outArray, adapter);
} }
VTKM_CONSTEXPR bool isVector = std::is_same<typename vtkm::VecTraits<T>::HasMultipleComponents, constexpr bool isVector = std::is_same<typename vtkm::VecTraits<T>::HasMultipleComponents,
vtkm::VecTraitsTagMultipleComponents>::value; vtkm::VecTraitsTagMultipleComponents>::value;
vtkm::cont::Field::AssociationEnum fieldAssociation(this->ComputePointGradient vtkm::cont::Field::AssociationEnum fieldAssociation(this->ComputePointGradient
? vtkm::cont::Field::ASSOC_POINTS ? vtkm::cont::Field::ASSOC_POINTS

@ -272,7 +272,7 @@
#cmakedefine VTKM_ENABLE_MPI #cmakedefine VTKM_ENABLE_MPI
#if __cplusplus >= 201103L || \ #if __cplusplus >= 201103L || \
( defined(VTKM_MSVC) && _MSC_VER >= 1800 ) || \ ( defined(VTKM_MSVC) && _MSC_VER >= 1900 ) || \
( defined(VTKM_ICC) && defined(__INTEL_CXX11_MODE__) ) ( defined(VTKM_ICC) && defined(__INTEL_CXX11_MODE__) )
#define VTKM_HAVE_CXX_11 #define VTKM_HAVE_CXX_11
#else #else
@ -340,17 +340,6 @@
// //
#pragma warning(disable:4251) #pragma warning(disable:4251)
// MSVC 2013 and earlier only:
#if _MSC_VER <= 1800
// Generates numerous warnings that implicit constructors can't
// be constructed. This is understood and we don't care.
#pragma warning(disable:4510)
// Generates numerous warnings that implicit assignment operators can't
// be constructed. This is understood and we don't care.
#pragma warning(disable:4512)
#endif // MSVC <= 2013
#endif #endif
#endif //vtkm_internal_Configure_h #endif //vtkm_internal_Configure_h

@ -77,16 +77,6 @@
#define VTKM_NEVER_EXPORT __attribute__((visibility("hidden"))) #define VTKM_NEVER_EXPORT __attribute__((visibility("hidden")))
#endif #endif
// constexpr support was added to VisualStudio 2015 and above. So this makes
// sure when that we gracefully fall back to just const when using 2013
#if defined(VTKM_MSVC) && _MSC_VER < 1900
#define VTKM_CONSTEXPR const
#define VTKM_NOEXCEPT
#else
#define VTKM_CONSTEXPR constexpr
#define VTKM_NOEXCEPT noexcept
#endif
// Clang will warn about weak vtables (-Wweak-vtables) on exception classes, // Clang will warn about weak vtables (-Wweak-vtables) on exception classes,
// but there's no good way to eliminate them in this case because MSVC (See // but there's no good way to eliminate them in this case because MSVC (See
// http://stackoverflow.com/questions/24511376). These macros will silence the // http://stackoverflow.com/questions/24511376). These macros will silence the

@ -389,7 +389,7 @@ public:
{ {
this->Result = src.GetReturnValueSafe(); this->Result = src.GetReturnValueSafe();
VTKM_CONSTEXPR vtkm::UInt16 minArity = (ARITY < FunctionInterface<SrcFunctionSignature>::ARITY) constexpr vtkm::UInt16 minArity = (ARITY < FunctionInterface<SrcFunctionSignature>::ARITY)
? ARITY ? ARITY
: FunctionInterface<SrcFunctionSignature>::ARITY; : FunctionInterface<SrcFunctionSignature>::ARITY;
@ -774,8 +774,8 @@ public:
using interfaceSig = typename detail::AsSigType<appended>::type; using interfaceSig = typename detail::AsSigType<appended>::type;
using NextInterfaceType = FunctionInterface<interfaceSig>; using NextInterfaceType = FunctionInterface<interfaceSig>;
static VTKM_CONSTEXPR std::size_t newArity = NextInterfaceType::ARITY; static constexpr std::size_t newArity = NextInterfaceType::ARITY;
static VTKM_CONSTEXPR std::size_t oldArity = detail::FunctionSigInfo<OriginalFunction>::Arity; static constexpr std::size_t oldArity = detail::FunctionSigInfo<OriginalFunction>::Arity;
typedef std::integral_constant<bool, (newArity < oldArity)> ShouldDoNextTransformType; typedef std::integral_constant<bool, (newArity < oldArity)> ShouldDoNextTransformType;
NextInterfaceType nextInterface = this->NewInterface.Append(newParameter); NextInterfaceType nextInterface = this->NewInterface.Append(newParameter);

@ -50,14 +50,14 @@ template <typename T>
struct FunctionInterfaceReturnContainer struct FunctionInterfaceReturnContainer
{ {
T Value; T Value;
static VTKM_CONSTEXPR bool VALID = true; static constexpr bool VALID = true;
}; };
template <> template <>
struct FunctionInterfaceReturnContainer<void> struct FunctionInterfaceReturnContainer<void>
{ {
// Nothing to store for void return. // Nothing to store for void return.
static VTKM_CONSTEXPR bool VALID = false; static constexpr bool VALID = false;
}; };
namespace detail namespace detail
@ -648,7 +648,7 @@ struct FunctionSigInfo;
template <typename R, typename... ArgTypes> template <typename R, typename... ArgTypes>
struct FunctionSigInfo<R(ArgTypes...)> struct FunctionSigInfo<R(ArgTypes...)>
{ {
static VTKM_CONSTEXPR std::size_t Arity = sizeof...(ArgTypes); static constexpr std::size_t Arity = sizeof...(ArgTypes);
using ArityType = std::integral_constant<int, static_cast<int>(Arity)>; using ArityType = std::integral_constant<int, static_cast<int>(Arity)>;
using ResultType = R; using ResultType = R;

@ -96,14 +96,14 @@ template <typename T>
struct FunctionInterfaceReturnContainer struct FunctionInterfaceReturnContainer
{ {
T Value; T Value;
static VTKM_CONSTEXPR bool VALID = true; static constexpr bool VALID = true;
}; };
template <> template <>
struct FunctionInterfaceReturnContainer<void> struct FunctionInterfaceReturnContainer<void>
{ {
// Nothing to store for void return. // Nothing to store for void return.
static VTKM_CONSTEXPR bool VALID = false; static constexpr bool VALID = false;
}; };
namespace detail namespace detail
@ -139,7 +139,7 @@ struct FunctionSigInfo;
template <typename R, typename... ArgTypes> template <typename R, typename... ArgTypes>
struct FunctionSigInfo<R(ArgTypes...)> struct FunctionSigInfo<R(ArgTypes...)>
{ {
static VTKM_CONSTEXPR std::size_t Arity = sizeof...(ArgTypes); static constexpr std::size_t Arity = sizeof...(ArgTypes);
using ArityType = std::integral_constant<int, static_cast<int>(Arity)>; using ArityType = std::integral_constant<int, static_cast<int>(Arity)>;
using ResultType = R; using ResultType = R;

@ -80,35 +80,35 @@ struct ListContainsImpl;
template <typename Type> template <typename Type>
struct ListContainsImpl<Type, brigand::empty_sequence> struct ListContainsImpl<Type, brigand::empty_sequence>
{ {
static VTKM_CONSTEXPR bool value = false; static constexpr bool value = false;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename Type> template <typename Type>
struct ListContainsImpl<Type, brigand::list<vtkm::detail::UniversalTag>> struct ListContainsImpl<Type, brigand::list<vtkm::detail::UniversalTag>>
{ {
static VTKM_CONSTEXPR bool value = true; static constexpr bool value = true;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename Type, typename T1> template <typename Type, typename T1>
struct ListContainsImpl<Type, brigand::list<T1>> struct ListContainsImpl<Type, brigand::list<T1>>
{ {
static VTKM_CONSTEXPR bool value = std::is_same<Type, T1>::value; static constexpr bool value = std::is_same<Type, T1>::value;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename Type, typename T1, typename T2> template <typename Type, typename T1, typename T2>
struct ListContainsImpl<Type, brigand::list<T1, T2>> struct ListContainsImpl<Type, brigand::list<T1, T2>>
{ {
static VTKM_CONSTEXPR bool value = std::is_same<Type, T1>::value || std::is_same<Type, T2>::value; static constexpr bool value = std::is_same<Type, T1>::value || std::is_same<Type, T2>::value;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename Type, typename T1, typename T2, typename T3> template <typename Type, typename T1, typename T2, typename T3>
struct ListContainsImpl<Type, brigand::list<T1, T2, T3>> struct ListContainsImpl<Type, brigand::list<T1, T2, T3>>
{ {
static VTKM_CONSTEXPR bool value = static constexpr bool value =
std::is_same<Type, T1>::value || std::is_same<Type, T2>::value || std::is_same<Type, T3>::value; std::is_same<Type, T1>::value || std::is_same<Type, T2>::value || std::is_same<Type, T3>::value;
}; };
@ -116,8 +116,8 @@ struct ListContainsImpl<Type, brigand::list<T1, T2, T3>>
template <typename Type, typename T1, typename T2, typename T3, typename T4> template <typename Type, typename T1, typename T2, typename T3, typename T4>
struct ListContainsImpl<Type, brigand::list<T1, T2, T3, T4>> struct ListContainsImpl<Type, brigand::list<T1, T2, T3, T4>>
{ {
static VTKM_CONSTEXPR bool value = std::is_same<Type, T1>::value || static constexpr bool value = std::is_same<Type, T1>::value || std::is_same<Type, T2>::value ||
std::is_same<Type, T2>::value || std::is_same<Type, T3>::value || std::is_same<Type, T4>::value; std::is_same<Type, T3>::value || std::is_same<Type, T4>::value;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -126,7 +126,7 @@ struct ListContainsImpl
{ {
using find_result = brigand::find<List, std::is_same<brigand::_1, Type>>; using find_result = brigand::find<List, std::is_same<brigand::_1, Type>>;
using size = brigand::size<find_result>; using size = brigand::size<find_result>;
static VTKM_CONSTEXPR bool value = (size::value != 0); static constexpr bool value = (size::value != 0);
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -213,30 +213,7 @@ VTKM_CONT void ListForEachImpl(Functor&& f,
template <typename R1, typename R2> template <typename R1, typename R2>
struct ListCrossProductImpl struct ListCrossProductImpl
{ {
#if defined(VTKM_MSVC) && _MSC_VER == 1800 // This is a lazy Cartesian product generator.
// This is a Cartesian product generator that is used
// when building with visual studio 2013. Visual Studio
// 2013 is unable to handle the lazy version as it can't
// deduce the correct template parameters
using type = brigand::reverse_fold<
brigand::list<R1, R2>,
brigand::list<brigand::list<>>,
brigand::bind<
brigand::join,
brigand::bind<
brigand::transform,
brigand::_2,
brigand::defer<brigand::bind<
brigand::join,
brigand::bind<
brigand::transform,
brigand::parent<brigand::_1>,
brigand::defer<brigand::bind<
brigand::list,
brigand::bind<brigand::push_front, brigand::_1, brigand::parent<brigand::_1>>>>>>>>>>;
#else
// This is a lazy Cartesian product generator that is used
// when using any compiler other than visual studio 2013.
// This version was settled on as being the best default // This version was settled on as being the best default
// version as all compilers including Intel handle this // version as all compilers including Intel handle this
// implementation without issue for very large cross products // implementation without issue for very large cross products
@ -250,7 +227,6 @@ struct ListCrossProductImpl
brigand::defer<brigand::bind< brigand::defer<brigand::bind<
brigand::list, brigand::list,
brigand::lazy::push_front<brigand::_1, brigand::parent<brigand::_1>>>>>>>>>>; brigand::lazy::push_front<brigand::_1, brigand::parent<brigand::_1>>>>>>>>>>;
#endif
}; };

@ -14,8 +14,6 @@
#define BRIGAND_COMP_MSVC #define BRIGAND_COMP_MSVC
#if _MSC_VER == 1900 #if _MSC_VER == 1900
#define BRIGAND_COMP_MSVC_2015 #define BRIGAND_COMP_MSVC_2015
#elif _MSC_VER == 1800
#define BRIGAND_COMP_MSVC_2013
#endif #endif
#elif __INTEL_COMPILER #elif __INTEL_COMPILER
#define BRIGAND_COMP_INTEL #define BRIGAND_COMP_INTEL
@ -902,7 +900,7 @@ namespace detail
#include <initializer_list> #include <initializer_list>
namespace brigand namespace brigand
{ {
#if defined(BRIGAND_COMP_MSVC_2013) || defined(BRIGAND_COMP_CUDA) || defined(BRIGAND_COMP_INTEL) #if defined(BRIGAND_COMP_CUDA) || defined(BRIGAND_COMP_INTEL)
namespace detail namespace detail
{ {
template<class P, class T> template<class P, class T>
@ -961,7 +959,7 @@ namespace brigand
} }
namespace brigand namespace brigand
{ {
#if defined(BRIGAND_COMP_MSVC_2013) || defined(BRIGAND_COMP_CUDA) || defined(BRIGAND_COMP_INTEL) #if defined(BRIGAND_COMP_CUDA) || defined(BRIGAND_COMP_INTEL)
namespace detail namespace detail
{ {
template<typename T> template<typename T>
@ -1522,9 +1520,7 @@ namespace brigand
namespace detail namespace detail
{ {
template<class, class T> struct unique_x_t template<class, class T> struct unique_x_t
#ifdef BRIGAND_COMP_MSVC_2013 #if defined(BRIGAND_COMP_GCC)
{ operator T (); };
#elif defined(BRIGAND_COMP_GCC)
: type_<T> : type_<T>
{}; {};
#else #else
@ -1545,39 +1541,11 @@ namespace detail
template<class... Us> template<class... Us>
static auto is_set(Us...) -> decltype(true_fn(static_cast<Us>(Pack())...)); static auto is_set(Us...) -> decltype(true_fn(static_cast<Us>(Pack())...));
static std::false_type is_set(...); static std::false_type is_set(...);
#ifdef BRIGAND_COMP_MSVC_2013
using type = decltype(is_set(Ts()...));
#else
using type = decltype(is_set(type_<Ts>()...)); using type = decltype(is_set(type_<Ts>()...));
#endif
}; };
#ifdef BRIGAND_COMP_MSVC_2013
template<class> struct qrref {};
template<class> struct qref {};
template<class> struct qnoref {};
template<class T>
struct msvc_quali_ref
{
using type = qnoref<T>;
};
template<class T>
struct msvc_quali_ref<T&>
{
using type = qref<T>;
};
template<class T>
struct msvc_quali_ref<T&&>
{
using type = qrref<T>;
};
#endif
} }
template<class... Ts> template<class... Ts>
#ifdef BRIGAND_COMP_MSVC_2013
using is_set = typename detail::is_set_impl<range<int, 0, static_cast<int>(sizeof...(Ts))>, detail::msvc_quali_ref<Ts>...>::type;
#else
using is_set = typename detail::is_set_impl<range<int, 0, static_cast<int>(sizeof...(Ts))>, Ts...>::type; using is_set = typename detail::is_set_impl<range<int, 0, static_cast<int>(sizeof...(Ts))>, Ts...>::type;
#endif
} }
#include <type_traits> #include <type_traits>
namespace brigand namespace brigand

@ -186,7 +186,7 @@ vtkm::cont::DynamicArrayHandle CreateDynamicArrayHandle(const std::vector<T>& ve
case 1: case 1:
{ {
using CommonType = typename ClosestCommonType<T>::Type; using CommonType = typename ClosestCommonType<T>::Type;
VTKM_CONSTEXPR bool not_same = !std::is_same<T, CommonType>::value; constexpr bool not_same = !std::is_same<T, CommonType>::value;
if (not_same) if (not_same)
{ {
std::cerr << "Type " << vtkm::io::internal::DataTypeName<T>::Name() std::cerr << "Type " << vtkm::io::internal::DataTypeName<T>::Name()
@ -209,7 +209,7 @@ vtkm::cont::DynamicArrayHandle CreateDynamicArrayHandle(const std::vector<T>& ve
using InComponentType = typename vtkm::VecTraits<T>::ComponentType; using InComponentType = typename vtkm::VecTraits<T>::ComponentType;
using OutComponentType = typename ClosestFloat<InComponentType>::Type; using OutComponentType = typename ClosestFloat<InComponentType>::Type;
using CommonType = vtkm::Vec<OutComponentType, 3>; using CommonType = vtkm::Vec<OutComponentType, 3>;
VTKM_CONSTEXPR bool not_same = !std::is_same<T, CommonType>::value; constexpr bool not_same = !std::is_same<T, CommonType>::value;
if (not_same) if (not_same)
{ {
std::cerr << "Type " << vtkm::io::internal::DataTypeName<InComponentType>::Name() << "[" std::cerr << "Type " << vtkm::io::internal::DataTypeName<InComponentType>::Name() << "["

@ -23,9 +23,6 @@
#include <vtkm/rendering/vtkm_rendering_export.h> #include <vtkm/rendering/vtkm_rendering_export.h>
#include <vtkm/Range.h> #include <vtkm/Range.h>
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#include <vtkm/cont/DataSet.h> #include <vtkm/cont/DataSet.h>
#include <vtkm/rendering/AxisAnnotation.h> #include <vtkm/rendering/AxisAnnotation.h>

@ -519,7 +519,7 @@ static inline VTKM_EXEC_CONT bool test_equal(bool bool1, bool bool2)
template <typename T> template <typename T>
static inline VTKM_EXEC_CONT T TestValue(vtkm::Id index, T, vtkm::TypeTraitsIntegerTag) static inline VTKM_EXEC_CONT T TestValue(vtkm::Id index, T, vtkm::TypeTraitsIntegerTag)
{ {
VTKM_CONSTEXPR bool larger_than_2bytes = sizeof(T) > 2; constexpr bool larger_than_2bytes = sizeof(T) > 2;
if (larger_than_2bytes) if (larger_than_2bytes)
{ {
return T(index * 100); return T(index * 100);

@ -119,7 +119,7 @@ void CheckContains(TestClass<N>, ListTag, const std::vector<int>& contents)
//Use intersect to verify at compile time that ListTag contains TestClass<N> //Use intersect to verify at compile time that ListTag contains TestClass<N>
using intersectWith = vtkm::ListTagBase<TestClass<N>>; using intersectWith = vtkm::ListTagBase<TestClass<N>>;
using intersectResult = typename vtkm::ListTagIntersect<intersectWith, ListTag>::list; using intersectResult = typename vtkm::ListTagIntersect<intersectWith, ListTag>::list;
VTKM_CONSTEXPR bool intersectContains = (brigand::size<intersectResult>::value != 0); constexpr bool intersectContains = (brigand::size<intersectResult>::value != 0);
bool listContains = vtkm::ListContains<ListTag, TestClass<N>>::value; bool listContains = vtkm::ListContains<ListTag, TestClass<N>>::value;
bool shouldContain = std::find(contents.begin(), contents.end(), N) != contents.end(); bool shouldContain = std::find(contents.begin(), contents.end(), N) != contents.end();
@ -135,8 +135,8 @@ void CheckContains(TestClass<N>, TestListTagUniversal, const std::vector<int>&)
using intersectWith = vtkm::ListTagBase<TestClass<N>>; using intersectWith = vtkm::ListTagBase<TestClass<N>>;
using intersectResult = using intersectResult =
typename vtkm::ListTagIntersect<intersectWith, TestListTagUniversal>::list; typename vtkm::ListTagIntersect<intersectWith, TestListTagUniversal>::list;
VTKM_CONSTEXPR bool intersectContains = (brigand::size<intersectResult>::value != 0); constexpr bool intersectContains = (brigand::size<intersectResult>::value != 0);
VTKM_CONSTEXPR bool listContains = vtkm::ListContains<TestListTagUniversal, TestClass<N>>::value; constexpr bool listContains = vtkm::ListContains<TestListTagUniversal, TestClass<N>>::value;
VTKM_TEST_ASSERT(intersectContains == listContains, "ListTagIntersect check failed."); VTKM_TEST_ASSERT(intersectContains == listContains, "ListTagIntersect check failed.");
} }

@ -324,7 +324,7 @@ template <typename T, int Size>
void SingularMatrix(vtkm::Matrix<T, Size, Size>& singularMatrix) void SingularMatrix(vtkm::Matrix<T, Size, Size>& singularMatrix)
{ {
FOR_ROW_COL(singularMatrix) { singularMatrix(row, col) = static_cast<T>(row + col); } FOR_ROW_COL(singularMatrix) { singularMatrix(row, col) = static_cast<T>(row + col); }
VTKM_CONSTEXPR bool larger_than_1 = Size > 1; constexpr bool larger_than_1 = Size > 1;
if (larger_than_1) if (larger_than_1)
{ {
vtkm::MatrixSetRow(singularMatrix, 0, vtkm::MatrixGetRow(singularMatrix, (Size + 1) / 2)); vtkm::MatrixSetRow(singularMatrix, 0, vtkm::MatrixGetRow(singularMatrix, (Size + 1) / 2));

@ -167,7 +167,7 @@ template <int Neighborhood_>
class WorkletPointNeighborhood : public WorkletPointNeighborhoodBase class WorkletPointNeighborhood : public WorkletPointNeighborhoodBase
{ {
public: public:
static VTKM_CONSTEXPR vtkm::IdComponent Neighborhood = Neighborhood_; static constexpr vtkm::IdComponent Neighborhood = Neighborhood_;
/// \brief A control signature tag for neighborhood input values. /// \brief A control signature tag for neighborhood input values.
/// ///

@ -171,49 +171,21 @@ struct GradientVecOutput : public vtkm::exec::ExecutionObjectBase
template <typename T, typename DeviceAdapter> template <typename T, typename DeviceAdapter>
struct GradientOutput : public GradientScalarOutput<T, DeviceAdapter> struct GradientOutput : public GradientScalarOutput<T, DeviceAdapter>
{ {
#if defined(VTKM_MSVC) && (_MSC_VER == 1800) // workaround for VS2013
template <typename... Args>
GradientOutput(Args&&... args)
: GradientScalarOutput<T, DeviceAdapter>::GradientScalarOutput(std::forward<Args>(args)...)
{
}
#else
using GradientScalarOutput<T, DeviceAdapter>::GradientScalarOutput; using GradientScalarOutput<T, DeviceAdapter>::GradientScalarOutput;
#endif
}; };
template <typename DeviceAdapter> template <typename DeviceAdapter>
struct GradientOutput<vtkm::Vec<vtkm::Float32, 3>, DeviceAdapter> struct GradientOutput<vtkm::Vec<vtkm::Float32, 3>, DeviceAdapter>
: public GradientVecOutput<vtkm::Vec<vtkm::Float32, 3>, DeviceAdapter> : public GradientVecOutput<vtkm::Vec<vtkm::Float32, 3>, DeviceAdapter>
{ {
#if defined(VTKM_MSVC) && (_MSC_VER == 1800) // workaround for VS2013
template <typename... Args>
GradientOutput(Args&&... args)
: GradientVecOutput<vtkm::Vec<vtkm::Float32, 3>, DeviceAdapter>::GradientVecOutput(
std::forward<Args>(args)...)
{
}
#else
using GradientVecOutput<vtkm::Vec<vtkm::Float32, 3>, DeviceAdapter>::GradientVecOutput; using GradientVecOutput<vtkm::Vec<vtkm::Float32, 3>, DeviceAdapter>::GradientVecOutput;
#endif
}; };
template <typename DeviceAdapter> template <typename DeviceAdapter>
struct GradientOutput<vtkm::Vec<vtkm::Float64, 3>, DeviceAdapter> struct GradientOutput<vtkm::Vec<vtkm::Float64, 3>, DeviceAdapter>
: public GradientVecOutput<vtkm::Vec<vtkm::Float64, 3>, DeviceAdapter> : public GradientVecOutput<vtkm::Vec<vtkm::Float64, 3>, DeviceAdapter>
{ {
#if defined(VTKM_MSVC) && (_MSC_VER == 1800) // workaround for VS2013
template <typename... Args>
GradientOutput(Args&&... args)
: GradientVecOutput<vtkm::Vec<vtkm::Float64, 3>, DeviceAdapter>::GradientVecOutput(
std::forward<Args>(args)...)
{
}
#else
using GradientVecOutput<vtkm::Vec<vtkm::Float64, 3>, DeviceAdapter>::GradientVecOutput; using GradientVecOutput<vtkm::Vec<vtkm::Float64, 3>, DeviceAdapter>::GradientVecOutput;
#endif
}; };
} }
} // namespace vtkm::exec } // namespace vtkm::exec

@ -114,7 +114,7 @@ struct DetermineHasCorrectParameters
using ControlSignatureTag = typename brigand::at_c<SigTypes, State::value>; using ControlSignatureTag = typename brigand::at_c<SigTypes, State::value>;
using TypeCheckTag = typename ControlSignatureTag::TypeCheckTag; using TypeCheckTag = typename ControlSignatureTag::TypeCheckTag;
static VTKM_CONSTEXPR bool isCorrect = vtkm::cont::arg::TypeCheck<TypeCheckTag, T>::value; static constexpr bool isCorrect = vtkm::cont::arg::TypeCheck<TypeCheckTag, T>::value;
// If you get an error on the line below, that means that your code has called the // If you get an error on the line below, that means that your code has called the
// Invoke method on a dispatcher, and one of the arguments of the Invoke is the wrong // Invoke method on a dispatcher, and one of the arguments of the Invoke is the wrong

@ -59,7 +59,7 @@ struct Gaussian : public KernelBase<Gaussian<Dimensions>>
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// return the multiplier between smoothing length and max cutoff distance // return the multiplier between smoothing length and max cutoff distance
VTKM_EXEC_CONT VTKM_EXEC_CONT
VTKM_CONSTEXPR double getDilationFactor() const { return 5.0; } constexpr double getDilationFactor() const { return 5.0; }
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// compute w(h) for the given distance // compute w(h) for the given distance