Switch over from static const to static constexpr where possible.
This commit is contained in:
parent
66e356f7d9
commit
7c54125b66
@ -96,7 +96,7 @@ struct CellShapeIdToTag
|
||||
#define VTKM_DEFINE_CELL_TAG(name, idname) \
|
||||
struct CellShapeTag##name \
|
||||
{ \
|
||||
static const vtkm::UInt8 Id = vtkm::idname; \
|
||||
static constexpr vtkm::UInt8 Id = vtkm::idname; \
|
||||
}; \
|
||||
namespace internal \
|
||||
{ \
|
||||
|
@ -81,7 +81,7 @@ struct CellTraits
|
||||
/// This is only defined for cell shapes of a fixed number of points (i.e.
|
||||
/// \c IsSizedFixed is set to \c CellTraitsTagSizeFixed.
|
||||
///
|
||||
static const vtkm::IdComponent NUM_POINTS = 3;
|
||||
static constexpr vtkm::IdComponent NUM_POINTS = 3;
|
||||
};
|
||||
#else // VTKM_DOXYGEN_ONLY
|
||||
;
|
||||
|
@ -32,8 +32,8 @@ using HashType = vtkm::UInt32;
|
||||
namespace detail
|
||||
{
|
||||
|
||||
static const vtkm::HashType FNV1A_OFFSET = 2166136261;
|
||||
static const vtkm::HashType FNV1A_PRIME = 16777619;
|
||||
static constexpr vtkm::HashType FNV1A_OFFSET = 2166136261;
|
||||
static constexpr vtkm::HashType FNV1A_PRIME = 16777619;
|
||||
|
||||
/// \brief Performs an FNV-1a hash on 32-bit integers returning a 32-bit hash
|
||||
///
|
||||
|
@ -46,8 +46,8 @@ class Matrix
|
||||
{
|
||||
public:
|
||||
using ComponentType = T;
|
||||
static const vtkm::IdComponent NUM_ROWS = NumRow;
|
||||
static const vtkm::IdComponent NUM_COLUMNS = NumCol;
|
||||
static constexpr vtkm::IdComponent NUM_ROWS = NumRow;
|
||||
static constexpr vtkm::IdComponent NUM_COLUMNS = NumCol;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
Matrix() {}
|
||||
@ -547,7 +547,7 @@ private:
|
||||
|
||||
public:
|
||||
using ComponentType = T;
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = NumRow * NumCol;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = NumRow * NumCol;
|
||||
using HasMultipleComponents = vtkm::VecTraitsTagMultipleComponents;
|
||||
using IsSizeStatic = vtkm::VecTraitsTagSizeStatic;
|
||||
|
||||
|
@ -207,7 +207,7 @@ struct TypeListTagCommon : vtkm::ListTagBase<vtkm::Int32,
|
||||
template <typename Type>
|
||||
struct ListContains<vtkm::TypeListTagAll, Type>
|
||||
{
|
||||
static const bool value = true;
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
} // namespace vtkm
|
||||
|
@ -646,7 +646,7 @@ class VTKM_ALWAYS_EXPORT VecBase : public vtkm::detail::VecBaseCommon<T, Derived
|
||||
{
|
||||
public:
|
||||
using ComponentType = T;
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = Size;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = Size;
|
||||
|
||||
protected:
|
||||
VTKM_EXEC_CONT
|
||||
@ -805,7 +805,7 @@ class VTKM_ALWAYS_EXPORT Vec : public detail::VecBase<T, Size, Vec<T, Size>>
|
||||
public:
|
||||
#ifdef VTKM_DOXYGEN_ONLY
|
||||
using ComponentType = T;
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = Size;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = Size;
|
||||
#endif
|
||||
|
||||
VTKM_EXEC_CONT Vec() = default;
|
||||
@ -833,7 +833,7 @@ class VTKM_ALWAYS_EXPORT Vec<T, 0>
|
||||
{
|
||||
public:
|
||||
using ComponentType = T;
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 0;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = 0;
|
||||
|
||||
VTKM_EXEC_CONT Vec() = default;
|
||||
VTKM_EXEC_CONT explicit Vec(const ComponentType&) {}
|
||||
|
@ -42,19 +42,19 @@ struct VecAxisAlignedPointCoordinatesNumComponents;
|
||||
template <>
|
||||
struct VecAxisAlignedPointCoordinatesNumComponents<1>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 2;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = 2;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VecAxisAlignedPointCoordinatesNumComponents<2>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 4;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = 4;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct VecAxisAlignedPointCoordinatesNumComponents<3>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 8;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = 8;
|
||||
};
|
||||
|
||||
struct VecAxisAlignedPointCoordinatesOffsetTable
|
||||
@ -90,7 +90,7 @@ class VecAxisAlignedPointCoordinates
|
||||
public:
|
||||
using ComponentType = vtkm::Vec<vtkm::FloatDefault, 3>;
|
||||
|
||||
static const vtkm::IdComponent NUM_COMPONENTS =
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS =
|
||||
detail::VecAxisAlignedPointCoordinatesNumComponents<NumDimensions>::NUM_COMPONENTS;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
@ -160,7 +160,7 @@ struct VecTraits<vtkm::VecAxisAlignedPointCoordinates<NumDimensions>>
|
||||
using HasMultipleComponents = vtkm::VecTraitsTagMultipleComponents;
|
||||
using IsSizeStatic = vtkm::VecTraitsTagSizeStatic;
|
||||
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
static vtkm::IdComponent GetNumberOfComponents(const VecType&) { return NUM_COMPONENTS; }
|
||||
|
@ -84,7 +84,7 @@ struct VecTraits
|
||||
///
|
||||
/// This is only defined for vectors of a static size.
|
||||
///
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
|
||||
|
||||
/// Number of components in the given vector.
|
||||
///
|
||||
@ -149,7 +149,7 @@ struct VecTraits<vtkm::Vec<T, Size>>
|
||||
|
||||
/// Number of components in the vector.
|
||||
///
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
|
||||
|
||||
/// Number of components in the given vector.
|
||||
///
|
||||
@ -335,7 +335,7 @@ template <typename ScalarType>
|
||||
struct VecTraitsBasic
|
||||
{
|
||||
using ComponentType = ScalarType;
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 1;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = 1;
|
||||
using HasMultipleComponents = vtkm::VecTraitsTagSingleComponent;
|
||||
using IsSizeStatic = vtkm::VecTraitsTagSizeStatic;
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace detail
|
||||
template <typename ValueType>
|
||||
struct VTKM_ALWAYS_EXPORT CompositeVectorSwizzleFunctor
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits<ValueType>::NUM_COMPONENTS;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits<ValueType>::NUM_COMPONENTS;
|
||||
using ComponentMapType = vtkm::Vec<vtkm::IdComponent, NUM_COMPONENTS>;
|
||||
|
||||
// Caution! This is a reference.
|
||||
@ -183,7 +183,7 @@ class VTKM_ALWAYS_EXPORT ArrayPortalCompositeVector
|
||||
|
||||
public:
|
||||
using ValueType = typename PortalTypes::ResultType;
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits<ValueType>::NUM_COMPONENTS;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits<ValueType>::NUM_COMPONENTS;
|
||||
|
||||
// Used internally.
|
||||
using ComponentMapType = vtkm::Vec<vtkm::IdComponent, NUM_COMPONENTS>;
|
||||
@ -262,7 +262,7 @@ class Storage<typename ArrayHandleCompositeVectorTraits<SignatureWithArrays>::Va
|
||||
vtkm::cont::internal::StorageTagCompositeVector<SignatureWithArrays>>
|
||||
{
|
||||
using FunctionInterfaceWithArrays = vtkm::internal::FunctionInterface<SignatureWithArrays>;
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = FunctionInterfaceWithArrays::ARITY;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = FunctionInterfaceWithArrays::ARITY;
|
||||
using ComponentMapType = vtkm::Vec<vtkm::IdComponent, NUM_COMPONENTS>;
|
||||
|
||||
using FunctionInterfaceWithPortals =
|
||||
|
@ -229,18 +229,13 @@ public:
|
||||
|
||||
/// Helper to determine if an ArrayHandle type is an ArrayHandleDiscard.
|
||||
template <typename T>
|
||||
struct IsArrayHandleDiscard;
|
||||
struct IsArrayHandleDiscard : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct IsArrayHandleDiscard<ArrayHandle<T, internal::StorageTagDiscard>> : std::true_type
|
||||
{
|
||||
static const bool Value = true;
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct IsArrayHandleDiscard<ArrayHandle<T, U>> : std::false_type
|
||||
{
|
||||
static const bool Value = false;
|
||||
};
|
||||
|
||||
} // end namespace cont
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
using Traits = vtkm::VecTraits<VectorType>;
|
||||
using ValueType = typename Traits::ComponentType;
|
||||
|
||||
static const vtkm::IdComponent COMPONENT = Component;
|
||||
static constexpr vtkm::IdComponent COMPONENT = Component;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalExtractComponent()
|
||||
@ -90,7 +90,7 @@ private:
|
||||
template <typename ArrayHandleType, vtkm::IdComponent Component>
|
||||
class StorageTagExtractComponent
|
||||
{
|
||||
static const vtkm::IdComponent COMPONENT = Component;
|
||||
static constexpr vtkm::IdComponent COMPONENT = Component;
|
||||
};
|
||||
|
||||
namespace internal
|
||||
@ -270,7 +270,7 @@ class ArrayHandleExtractComponent
|
||||
StorageTagExtractComponent<ArrayHandleType, Component>>
|
||||
{
|
||||
public:
|
||||
static const vtkm::IdComponent COMPONENT = Component;
|
||||
static constexpr vtkm::IdComponent COMPONENT = Component;
|
||||
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleExtractComponent,
|
||||
|
@ -36,7 +36,7 @@ template <typename _SourcePortalType, vtkm::IdComponent _NUM_COMPONENTS>
|
||||
class VTKM_ALWAYS_EXPORT ArrayPortalGroupVec
|
||||
{
|
||||
public:
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = _NUM_COMPONENTS;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = _NUM_COMPONENTS;
|
||||
using SourcePortalType = _SourcePortalType;
|
||||
|
||||
using ComponentType = typename std::remove_const<typename SourcePortalType::ValueType>::type;
|
||||
|
@ -63,7 +63,7 @@ struct ValidateComponentMap;
|
||||
template <vtkm::IdComponent InputSize, vtkm::IdComponent Head>
|
||||
struct ValidateComponentMap<InputSize, Head>
|
||||
{
|
||||
static const bool Valid = Head >= 0 && Head < InputSize;
|
||||
static constexpr bool Valid = Head >= 0 && Head < InputSize;
|
||||
};
|
||||
|
||||
// Recursive impl:
|
||||
@ -71,8 +71,8 @@ template <vtkm::IdComponent InputSize, vtkm::IdComponent Head, vtkm::IdComponent
|
||||
struct ValidateComponentMap<InputSize, Head, Tail...>
|
||||
{
|
||||
using Next = ValidateComponentMap<InputSize, Tail...>;
|
||||
static const bool IsUnique = ComponentIsUnique<Head, Tail...>::IsUnique;
|
||||
static const bool Valid = Head >= 0 && Head < InputSize && IsUnique && Next::Valid;
|
||||
static constexpr bool IsUnique = ComponentIsUnique<Head, Tail...>::IsUnique;
|
||||
static constexpr bool Valid = Head >= 0 && Head < InputSize && IsUnique && Next::Valid;
|
||||
};
|
||||
|
||||
} // end namespace internal
|
||||
@ -82,7 +82,8 @@ template <typename InputValueType, vtkm::IdComponent... ComponentMap>
|
||||
struct ArrayHandleSwizzleTraits
|
||||
{
|
||||
/// The number of elements in the ComponentMap.
|
||||
static const vtkm::IdComponent COUNT = static_cast<vtkm::IdComponent>(sizeof...(ComponentMap));
|
||||
static constexpr vtkm::IdComponent COUNT =
|
||||
static_cast<vtkm::IdComponent>(sizeof...(ComponentMap));
|
||||
VTKM_STATIC_ASSERT_MSG(COUNT > 0, "Invalid ComponentMap: Cannot swizzle zero components.");
|
||||
|
||||
/// A std::array containing the ComponentMap for runtime querying.
|
||||
@ -114,7 +115,7 @@ struct ArrayHandleSwizzleTraits
|
||||
|
||||
/// If true, we use all components in the input vector. If false, we'll need
|
||||
/// to make sure to preserve existing values on write.
|
||||
static const bool ALL_COMPS_USED = InputTraits::NUM_COMPONENTS == COUNT;
|
||||
static constexpr bool ALL_COMPS_USED = InputTraits::NUM_COMPONENTS == COUNT;
|
||||
|
||||
private:
|
||||
template <vtkm::IdComponent OutputIndex, vtkm::IdComponent... Map>
|
||||
@ -153,7 +154,7 @@ private:
|
||||
template <vtkm::IdComponent OutputIndex, vtkm::IdComponent Head>
|
||||
struct SwizzleImpl<OutputIndex, Head>
|
||||
{
|
||||
static const vtkm::IdComponent InputIndex = Head;
|
||||
static constexpr vtkm::IdComponent InputIndex = Head;
|
||||
|
||||
void operator()(const InputType& in, OutputType& out) const
|
||||
{
|
||||
@ -166,7 +167,7 @@ private:
|
||||
struct SwizzleImpl<OutputIndex, Head, Tail...>
|
||||
{
|
||||
using Next = SwizzleImpl<OutputIndex + 1, Tail...>;
|
||||
static const vtkm::IdComponent InputIndex = Head;
|
||||
static constexpr vtkm::IdComponent InputIndex = Head;
|
||||
|
||||
void operator()(const InputType& in, OutputType& out) const
|
||||
{
|
||||
@ -191,7 +192,7 @@ private:
|
||||
template <vtkm::IdComponent OutputIndex, vtkm::IdComponent Head>
|
||||
struct UnSwizzleImpl<OutputIndex, Head>
|
||||
{
|
||||
static const vtkm::IdComponent InputIndex = Head;
|
||||
static constexpr vtkm::IdComponent InputIndex = Head;
|
||||
|
||||
void operator()(const OutputType& out, InputType& in) const
|
||||
{
|
||||
@ -204,7 +205,7 @@ private:
|
||||
struct UnSwizzleImpl<OutputIndex, Head, Tail...>
|
||||
{
|
||||
using Next = UnSwizzleImpl<OutputIndex + 1, Tail...>;
|
||||
static const vtkm::IdComponent InputIndex = Head;
|
||||
static constexpr vtkm::IdComponent InputIndex = Head;
|
||||
|
||||
void operator()(const OutputType& out, InputType& in) const
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ struct TypeCheck
|
||||
/// The static constant boolean \c value is set to \c true if the type is
|
||||
/// valid for the given check tag and \c false otherwise.
|
||||
///
|
||||
static const bool value = false;
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ struct TypeCheckArrayValueType;
|
||||
template <typename TypeList, typename ArrayType>
|
||||
struct TypeCheckArrayValueType<TypeList, ArrayType, true>
|
||||
{
|
||||
static const bool value = vtkm::ListContains<TypeList, typename ArrayType::ValueType>::value;
|
||||
static constexpr bool value = vtkm::ListContains<TypeList, typename ArrayType::ValueType>::value;
|
||||
};
|
||||
|
||||
template <typename TypeList, typename ArrayType>
|
||||
struct TypeCheckArrayValueType<TypeList, ArrayType, false>
|
||||
{
|
||||
static const bool value = false;
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@ -65,7 +65,7 @@ struct TypeCheckArrayValueType<TypeList, ArrayType, false>
|
||||
template <typename TypeList, typename ArrayType>
|
||||
struct TypeCheck<TypeCheckTagArray<TypeList>, ArrayType>
|
||||
{
|
||||
static const bool value = detail::TypeCheckArrayValueType<
|
||||
static constexpr bool value = detail::TypeCheckArrayValueType<
|
||||
TypeList,
|
||||
ArrayType,
|
||||
vtkm::cont::internal::ArrayHandleCheck<ArrayType>::type::value>::value;
|
||||
|
@ -49,15 +49,15 @@ struct TypeCheckTagAtomicArray
|
||||
template <typename TypeList, typename ArrayType>
|
||||
struct TypeCheck<TypeCheckTagAtomicArray<TypeList>, ArrayType>
|
||||
{
|
||||
static const bool value = false;
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
template <typename T, typename TypeList>
|
||||
struct TypeCheck<TypeCheckTagAtomicArray<TypeList>,
|
||||
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic>>
|
||||
{
|
||||
static const bool value = (vtkm::ListContains<TypeList, T>::value &&
|
||||
vtkm::ListContains<vtkm::exec::AtomicArrayTypeListTag, T>::value);
|
||||
static constexpr bool value = (vtkm::ListContains<TypeList, T>::value &&
|
||||
vtkm::ListContains<vtkm::exec::AtomicArrayTypeListTag, T>::value);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ struct TypeCheckTagCellSet
|
||||
template <typename CellSetType>
|
||||
struct TypeCheck<TypeCheckTagCellSet, CellSetType>
|
||||
{
|
||||
static const bool value = vtkm::cont::internal::CellSetCheck<CellSetType>::type::value;
|
||||
static constexpr bool value = vtkm::cont::internal::CellSetCheck<CellSetType>::type::value;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,8 @@ struct TypeCheck<TypeCheckTagCellSetStructured, CellSetType>
|
||||
using is_2d_cellset = std::is_same<CellSetType, vtkm::cont::CellSetStructured<2>>;
|
||||
using is_1d_cellset = std::is_same<CellSetType, vtkm::cont::CellSetStructured<1>>;
|
||||
|
||||
static const bool value = is_3d_cellset::value || is_2d_cellset::value || is_1d_cellset::value;
|
||||
static constexpr bool value =
|
||||
is_3d_cellset::value || is_2d_cellset::value || is_1d_cellset::value;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ struct TypeCheckTagKeys
|
||||
template <typename Type>
|
||||
struct TypeCheck<TypeCheckTagKeys, Type>
|
||||
{
|
||||
static const bool value = false;
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename PortalType>
|
||||
struct TestKernelIn : public vtkm::exec::FunctorBase
|
||||
|
@ -30,7 +30,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename PortalType>
|
||||
struct TestKernelInOut : public vtkm::exec::FunctorBase
|
||||
|
@ -31,7 +31,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename PortalType>
|
||||
struct TestKernelOut : public vtkm::exec::FunctorBase
|
||||
|
@ -34,7 +34,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
#define OFFSET 10
|
||||
|
||||
|
@ -430,7 +430,7 @@ public:
|
||||
|
||||
// Don't bother with the keys_output if it's an ArrayHandleDiscard -- there
|
||||
// will be a runtime exception in Unique() otherwise:
|
||||
if (!vtkm::cont::IsArrayHandleDiscard<KeysOutputType>::Value)
|
||||
if (!vtkm::cont::IsArrayHandleDiscard<KeysOutputType>::value)
|
||||
{
|
||||
//find all the unique keys
|
||||
DerivedAlgorithm::Copy(keys, keys_output);
|
||||
|
@ -47,7 +47,7 @@ struct DeviceAdapterTraits;
|
||||
template <typename DeviceAdapter>
|
||||
struct DeviceAdapterTagCheck
|
||||
{
|
||||
static const bool Valid = false;
|
||||
static constexpr bool Valid = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -68,12 +68,12 @@ struct DeviceAdapterTagCheck
|
||||
{ \
|
||||
static DeviceAdapterId GetId() { return DeviceAdapterId(Id); } \
|
||||
static DeviceAdapterNameType GetName() { return DeviceAdapterNameType(#Name); } \
|
||||
static const bool Valid = true; \
|
||||
static constexpr bool Valid = true; \
|
||||
}; \
|
||||
template <> \
|
||||
struct DeviceAdapterTagCheck<vtkm::cont::DeviceAdapterTag##Name> \
|
||||
{ \
|
||||
static const bool Valid = true; \
|
||||
static constexpr bool Valid = true; \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
@ -94,12 +94,12 @@ struct DeviceAdapterTagCheck
|
||||
{ \
|
||||
static DeviceAdapterId GetId() { return DeviceAdapterId(Id); } \
|
||||
static DeviceAdapterNameType GetName() { return DeviceAdapterNameType(#Name); } \
|
||||
static const bool Valid = false; \
|
||||
static constexpr bool Valid = false; \
|
||||
}; \
|
||||
template <> \
|
||||
struct DeviceAdapterTagCheck<vtkm::cont::DeviceAdapterTag##Name> \
|
||||
{ \
|
||||
static const bool Valid = false; \
|
||||
static constexpr bool Valid = false; \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace
|
||||
template <typename T>
|
||||
struct TemplatedTests
|
||||
{
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
using ValueType = T;
|
||||
using ComponentType = typename vtkm::VecTraits<ValueType>::ComponentType;
|
||||
@ -76,7 +76,7 @@ struct TemplatedTests
|
||||
{
|
||||
ValueType array[ARRAY_SIZE];
|
||||
|
||||
static const ComponentType ORIGINAL_VALUE = 109;
|
||||
constexpr ComponentType ORIGINAL_VALUE = 109;
|
||||
FillIterator(array, array + ARRAY_SIZE, ORIGINAL_VALUE);
|
||||
|
||||
::vtkm::cont::internal::ArrayPortalFromIterators<ValueType*> portal(array, array + ARRAY_SIZE);
|
||||
@ -124,7 +124,7 @@ struct TemplatedTests
|
||||
VTKM_TEST_ASSERT(CheckPortal(const_portal, ORIGINAL_VALUE),
|
||||
"Const portal iterator has bad value.");
|
||||
|
||||
static const ComponentType SET_VALUE = 62;
|
||||
constexpr ComponentType SET_VALUE = 62;
|
||||
|
||||
std::cout << " Check get/set methods." << std::endl;
|
||||
for (vtkm::Id index = 0; index < ARRAY_SIZE; index++)
|
||||
|
@ -39,7 +39,7 @@ namespace vtkm
|
||||
template <>
|
||||
struct VecTraits<std::string>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 1;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = 1;
|
||||
using HasMultipleComponents = vtkm::VecTraitsTagSingleComponent;
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace
|
||||
template <typename T>
|
||||
struct TemplatedTests
|
||||
{
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
using ValueType = T;
|
||||
using ComponentType = typename vtkm::VecTraits<ValueType>::ComponentType;
|
||||
|
@ -50,7 +50,7 @@ void DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagTBB>::ScheduleTask(
|
||||
vtkm::exec::tbb::internal::TaskTiling3D& functor,
|
||||
vtkm::Id3 size)
|
||||
{
|
||||
static const vtkm::UInt32 TBB_GRAIN_SIZE_3D[3] = { 1, 4, 256 };
|
||||
static constexpr vtkm::UInt32 TBB_GRAIN_SIZE_3D[3] = { 1, 4, 256 };
|
||||
const vtkm::Id MESSAGE_SIZE = 1024;
|
||||
char errorString[MESSAGE_SIZE];
|
||||
errorString[0] = '\0';
|
||||
|
@ -88,7 +88,7 @@ using WrappedBinaryOperator = vtkm::cont::internal::WrappedBinaryOperator<Result
|
||||
|
||||
// The "grain size" of scheduling with TBB. Not a lot of thought has gone
|
||||
// into picking this size.
|
||||
static const vtkm::Id TBB_GRAIN_SIZE = 1024;
|
||||
static constexpr vtkm::Id TBB_GRAIN_SIZE = 1024;
|
||||
|
||||
template <typename InputPortalType, typename OutputPortalType>
|
||||
struct CopyBody
|
||||
|
@ -686,7 +686,7 @@ private:
|
||||
size_t max_elems_;
|
||||
int max_threads_;
|
||||
|
||||
static const size_t kOutBufferSize = internal::kOutBufferSize;
|
||||
static constexpr size_t kOutBufferSize = internal::kOutBufferSize;
|
||||
ValueType *original_, *tmp_;
|
||||
ValueType *src_, *dst_;
|
||||
ValueType*** out_buf_;
|
||||
|
@ -72,7 +72,7 @@ class quick_sort_range : private no_assign
|
||||
}
|
||||
|
||||
public:
|
||||
static const size_t grainsize = 500;
|
||||
static constexpr size_t grainsize = 500;
|
||||
const Compare& comp;
|
||||
RandomAccessIterator begin;
|
||||
size_t size;
|
||||
|
@ -31,17 +31,17 @@
|
||||
namespace kx
|
||||
{
|
||||
|
||||
static const int kRadixBits = 8;
|
||||
static const size_t kInsertSortThreshold = 64;
|
||||
static const int kRadixMask = (1 << kRadixBits) - 1;
|
||||
static const int kRadixBin = 1 << kRadixBits;
|
||||
static constexpr int kRadixBits = 8;
|
||||
static constexpr size_t kInsertSortThreshold = 64;
|
||||
static constexpr int kRadixMask = (1 << kRadixBits) - 1;
|
||||
static constexpr int kRadixBin = 1 << kRadixBits;
|
||||
|
||||
//================= HELPING FUNCTIONS ====================
|
||||
|
||||
template <class T>
|
||||
struct RadixTraitsUnsigned
|
||||
{
|
||||
static const int nBytes = sizeof(T);
|
||||
static constexpr int nBytes = sizeof(T);
|
||||
int kth_byte(const T& x, int k) { return (x >> (kRadixBits * k)) & kRadixMask; }
|
||||
bool compare(const T& x, const T& y) { return x < y; }
|
||||
};
|
||||
@ -49,7 +49,7 @@ struct RadixTraitsUnsigned
|
||||
template <class T>
|
||||
struct RadixTraitsSigned
|
||||
{
|
||||
static const int nBytes = sizeof(T);
|
||||
static constexpr int nBytes = sizeof(T);
|
||||
static const T kMSB = T(0x80) << ((sizeof(T) - 1) * 8);
|
||||
int kth_byte(const T& x, int k) { return ((x ^ kMSB) >> (kRadixBits * k)) & kRadixMask; }
|
||||
bool compare(const T& x, const T& y) { return x < y; }
|
||||
|
@ -322,7 +322,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DRegularDataSet0()
|
||||
dataSet.AddField(make_Field(
|
||||
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 4, vtkm::CopyFlag::On));
|
||||
|
||||
static const vtkm::IdComponent dim = 3;
|
||||
static constexpr vtkm::IdComponent dim = 3;
|
||||
vtkm::cont::CellSetStructured<dim> cellSet("cells");
|
||||
cellSet.SetPointDimensions(vtkm::make_Vec(3, 2, 3));
|
||||
dataSet.AddCellSet(cellSet);
|
||||
@ -349,7 +349,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DRegularDataSet1()
|
||||
dataSet.AddField(make_Field(
|
||||
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 1, vtkm::CopyFlag::On));
|
||||
|
||||
static const vtkm::IdComponent dim = 3;
|
||||
static constexpr vtkm::IdComponent dim = 3;
|
||||
vtkm::cont::CellSetStructured<dim> cellSet("cells");
|
||||
cellSet.SetPointDimensions(vtkm::make_Vec(2, 2, 2));
|
||||
dataSet.AddCellSet(cellSet);
|
||||
|
@ -75,7 +75,7 @@ private:
|
||||
static void TestAll()
|
||||
{
|
||||
using PointType = vtkm::Vec<vtkm::FloatDefault, 3>;
|
||||
static const vtkm::Id length = 64;
|
||||
static constexpr vtkm::Id length = 64;
|
||||
|
||||
vtkm::cont::ArrayHandle<PointType> out;
|
||||
|
||||
|
@ -132,7 +132,7 @@ struct TestingArrayHandles
|
||||
};
|
||||
|
||||
private:
|
||||
static const vtkm::Id ARRAY_SIZE = 100;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 100;
|
||||
|
||||
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapterTag>;
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace
|
||||
// need to ensure we instatiate each algorithm in a source
|
||||
// file to verify compilation.
|
||||
//
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
void CopyTest()
|
||||
{
|
||||
|
@ -28,7 +28,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename PortalType>
|
||||
void TestValues(const PortalType& portal)
|
||||
|
@ -38,8 +38,8 @@ namespace UnitTestArrayHandleDiscardDetail
|
||||
template <typename ValueType>
|
||||
struct Test
|
||||
{
|
||||
static const vtkm::Id ARRAY_SIZE = 100;
|
||||
static const vtkm::Id NUM_KEYS = 3;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 100;
|
||||
static constexpr vtkm::Id NUM_KEYS = 3;
|
||||
|
||||
using DeviceTag = vtkm::cont::DeviceAdapterTagSerial;
|
||||
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceTag>;
|
||||
|
@ -30,7 +30,7 @@ namespace
|
||||
template <typename T>
|
||||
struct TemplatedTests
|
||||
{
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
using ValueType = T;
|
||||
using ComponentType = typename vtkm::VecTraits<ValueType>::ComponentType;
|
||||
|
@ -53,7 +53,7 @@ namespace vtkm
|
||||
template <>
|
||||
struct VecTraits<std::string>
|
||||
{
|
||||
static const vtkm::IdComponent NUM_COMPONENTS = 1;
|
||||
static constexpr vtkm::IdComponent NUM_COMPONENTS = 1;
|
||||
using HasMultipleComponents = vtkm::VecTraitsTagSingleComponent;
|
||||
};
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
struct TryExecuteTestFunctor
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace arg
|
||||
template <vtkm::IdComponent ControlSignatureIndex>
|
||||
struct BasicArg : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = ControlSignatureIndex;
|
||||
static constexpr vtkm::IdComponent INDEX = ControlSignatureIndex;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagDefault;
|
||||
};
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ struct AspectTagCellShape
|
||||
///
|
||||
struct CellShape : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagCellShape;
|
||||
};
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace internal
|
||||
template <typename ExecutionSignatureTag>
|
||||
struct ExecutionSignatureTagCheck
|
||||
{
|
||||
static const bool Valid =
|
||||
static constexpr bool Valid =
|
||||
std::is_base_of<vtkm::exec::arg::ExecutionSignatureTagBase, ExecutionSignatureTag>::value;
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ struct AspectTagFromCount
|
||||
///
|
||||
struct FromCount : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagFromCount;
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ struct AspectTagFromIndices
|
||||
///
|
||||
struct FromIndices : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagFromIndices;
|
||||
};
|
||||
|
||||
|
@ -56,7 +56,7 @@ struct InputIndex : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
// ControlSignature because the templating is going to grab a fetch tag
|
||||
// whether we use it or not. 1 should be guaranteed to be valid since you
|
||||
// need at least one argument for the input domain.
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagInputIndex;
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ struct AspectTagOnBoundary
|
||||
///
|
||||
struct OnBoundary : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagOnBoundary;
|
||||
};
|
||||
|
||||
|
@ -56,7 +56,7 @@ struct OutputIndex : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
// ControlSignature because the templating is going to grab a fetch tag
|
||||
// whether we use it or not. 1 should be guaranteed to be valid since you
|
||||
// need at least one argument for the output domain.
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagOutputIndex;
|
||||
};
|
||||
|
||||
|
@ -55,7 +55,7 @@ struct ThreadIndices : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
// ControlSignature because the templating is going to grab a fetch tag
|
||||
// whether we use it or not. 1 should be guaranteed to be valid since you
|
||||
// need at least one argument for the input domain.
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagThreadIndices;
|
||||
};
|
||||
|
||||
|
@ -49,7 +49,7 @@ struct AspectTagValueCount
|
||||
///
|
||||
struct ValueCount : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagValueCount;
|
||||
};
|
||||
|
||||
|
@ -57,7 +57,7 @@ struct VisitIndex : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
// ControlSignature because the templating is going to grab a fetch tag
|
||||
// whether we use it or not. 1 should be guaranteed to be valid since you
|
||||
// need at least one argument for the input domain.
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagVisitIndex;
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ struct WorkIndex : vtkm::exec::arg::ExecutionSignatureTagBase
|
||||
// ControlSignature because the templating is going to grab a fetch tag
|
||||
// whether we use it or not. 1 should be guaranteed to be valid since you
|
||||
// need at least one argument for the input domain.
|
||||
static const vtkm::IdComponent INDEX = 1;
|
||||
static constexpr vtkm::IdComponent INDEX = 1;
|
||||
using AspectTag = vtkm::exec::arg::AspectTagWorkIndex;
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename T>
|
||||
struct TestPortal
|
||||
|
@ -27,7 +27,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
static vtkm::Id g_NumSets;
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
static vtkm::Id g_NumSets;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename T>
|
||||
struct TestPortal
|
||||
|
@ -99,7 +99,7 @@ template <> struct UseMultipleScalarTextureLoads<const vtkm::Vec<vtkm::Float64,
|
||||
template <typename T, typename Enable = void>
|
||||
struct load_through_texture
|
||||
{
|
||||
static const vtkm::IdComponent WillUseTexture = 0;
|
||||
static constexpr vtkm::IdComponent WillUseTexture = 0;
|
||||
|
||||
__device__ static T get(const T* const data) { return *data; }
|
||||
};
|
||||
@ -111,7 +111,7 @@ template <typename T>
|
||||
struct load_through_texture<T, typename std::enable_if<UseScalarTextureLoad<const T>::value>::type>
|
||||
{
|
||||
|
||||
static const vtkm::IdComponent WillUseTexture = 1;
|
||||
static constexpr vtkm::IdComponent WillUseTexture = 1;
|
||||
|
||||
__device__ static T get(const T* const data)
|
||||
{
|
||||
@ -128,7 +128,7 @@ struct load_through_texture<T, typename std::enable_if<UseScalarTextureLoad<cons
|
||||
template <typename T>
|
||||
struct load_through_texture<T, typename std::enable_if<UseVecTextureLoads<const T>::value>::type>
|
||||
{
|
||||
static const vtkm::IdComponent WillUseTexture = 1;
|
||||
static constexpr vtkm::IdComponent WillUseTexture = 1;
|
||||
|
||||
__device__ static T get(const T* const data)
|
||||
{
|
||||
@ -189,7 +189,7 @@ struct load_through_texture<
|
||||
T,
|
||||
typename std::enable_if<UseMultipleScalarTextureLoads<const T>::value>::type>
|
||||
{
|
||||
static const vtkm::IdComponent WillUseTexture = 1;
|
||||
static constexpr vtkm::IdComponent WillUseTexture = 1;
|
||||
|
||||
using NonConstT = typename std::remove_const<T>::type;
|
||||
|
||||
|
@ -66,7 +66,7 @@ struct InvocationToFetch
|
||||
// Expected fields from ExecutionSignatureTag. If these do not exist in
|
||||
// ExecutionSignatureTag, then something that is not really an execution
|
||||
// signature tag was used in an ExecutionSignature.
|
||||
static const vtkm::IdComponent ControlParameterIndex = ExecutionSignatureTag::INDEX;
|
||||
static constexpr vtkm::IdComponent ControlParameterIndex = ExecutionSignatureTag::INDEX;
|
||||
using AspectTag = typename ExecutionSignatureTag::AspectTag;
|
||||
|
||||
// Find the fetch tag from the control signature tag pointed to by
|
||||
|
@ -127,7 +127,7 @@ struct InvocationToFetch
|
||||
// Expected fields from ExecutionSignatureTag. If these do not exist in
|
||||
// ExecutionSignatureTag, then something that is not really an execution
|
||||
// signature tag was used in an ExecutionSignature.
|
||||
static const vtkm::IdComponent ControlParameterIndex = ExecutionSignatureTag::INDEX;
|
||||
static constexpr vtkm::IdComponent ControlParameterIndex = ExecutionSignatureTag::INDEX;
|
||||
using AspectTag = typename ExecutionSignatureTag::AspectTag;
|
||||
|
||||
// Find the fetch tag from the control signature tag pointed to by
|
||||
|
@ -67,7 +67,7 @@ struct LinearField
|
||||
}
|
||||
};
|
||||
|
||||
static const vtkm::IdComponent MAX_POINTS = 8;
|
||||
static constexpr vtkm::IdComponent MAX_POINTS = 8;
|
||||
|
||||
template <typename CellShapeTag>
|
||||
void GetMinMaxPoints(CellShapeTag,
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::IdComponent MAX_POINTS = 8;
|
||||
static constexpr vtkm::IdComponent MAX_POINTS = 8;
|
||||
|
||||
template <typename CellShapeTag>
|
||||
void GetMinMaxPoints(CellShapeTag,
|
||||
|
@ -35,7 +35,7 @@ namespace
|
||||
|
||||
std::mt19937 g_RandomGenerator;
|
||||
|
||||
static const vtkm::IdComponent MAX_POINTS = 8;
|
||||
static constexpr vtkm::IdComponent MAX_POINTS = 8;
|
||||
|
||||
template <typename CellShapeTag>
|
||||
void GetMinMaxPoints(CellShapeTag,
|
||||
|
@ -31,9 +31,9 @@ using Coord3D = vtkm::Vec<vtkm::FloatDefault, 3>;
|
||||
|
||||
vtkm::cont::DataSet MakeTestDatasetStructured()
|
||||
{
|
||||
static const vtkm::Id xdim = 3, ydim = 3;
|
||||
static constexpr vtkm::Id xdim = 3, ydim = 3;
|
||||
static const vtkm::Id2 dim(xdim, ydim);
|
||||
static const vtkm::Id numVerts = xdim * ydim;
|
||||
static constexpr vtkm::Id numVerts = xdim * ydim;
|
||||
|
||||
vtkm::Float32 scalars[numVerts];
|
||||
for (vtkm::Id i = 0; i < numVerts; ++i)
|
||||
|
@ -102,7 +102,7 @@ vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
|
||||
|
||||
dataSet.AddField(vtkm::cont::Field("nodevar", vtkm::cont::Field::ASSOC_POINTS, fieldArray));
|
||||
|
||||
static const vtkm::IdComponent ndim = 3;
|
||||
static constexpr vtkm::IdComponent ndim = 3;
|
||||
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
|
||||
cellSet.SetPointDimensions(vdims);
|
||||
dataSet.AddCellSet(cellSet);
|
||||
|
@ -111,7 +111,7 @@ vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
|
||||
dataSet.AddField(
|
||||
vtkm::cont::Field(std::string("nodevar"), vtkm::cont::Field::ASSOC_POINTS, fieldArray));
|
||||
|
||||
static const vtkm::IdComponent ndim = 3;
|
||||
static constexpr vtkm::IdComponent ndim = 3;
|
||||
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
|
||||
cellSet.SetPointDimensions(vdims);
|
||||
dataSet.AddCellSet(cellSet);
|
||||
|
@ -63,8 +63,8 @@ public:
|
||||
return this->GetNumberOfPoints();
|
||||
}
|
||||
|
||||
static const vtkm::IdComponent NUM_POINTS_IN_CELL = 2;
|
||||
static const vtkm::IdComponent MAX_CELL_TO_POINT = 2;
|
||||
static constexpr vtkm::IdComponent NUM_POINTS_IN_CELL = 2;
|
||||
static constexpr vtkm::IdComponent MAX_CELL_TO_POINT = 2;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Id GetNumberOfPoints() const { return this->PointDimensions; }
|
||||
@ -171,8 +171,8 @@ public:
|
||||
return this->GetPointDimensions();
|
||||
}
|
||||
|
||||
static const vtkm::IdComponent NUM_POINTS_IN_CELL = 4;
|
||||
static const vtkm::IdComponent MAX_CELL_TO_POINT = 4;
|
||||
static constexpr vtkm::IdComponent NUM_POINTS_IN_CELL = 4;
|
||||
static constexpr vtkm::IdComponent MAX_CELL_TO_POINT = 4;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Id GetNumberOfCells() const { return vtkm::ReduceProduct(this->GetCellDimensions()); }
|
||||
@ -334,8 +334,8 @@ public:
|
||||
return this->GetPointDimensions();
|
||||
}
|
||||
|
||||
static const vtkm::IdComponent NUM_POINTS_IN_CELL = 8;
|
||||
static const vtkm::IdComponent MAX_CELL_TO_POINT = 8;
|
||||
static constexpr vtkm::IdComponent NUM_POINTS_IN_CELL = 8;
|
||||
static constexpr vtkm::IdComponent MAX_CELL_TO_POINT = 8;
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Id GetNumberOfCells() const { return vtkm::ReduceProduct(this->GetCellDimensions()); }
|
||||
|
@ -263,11 +263,11 @@ public:
|
||||
using type = typename detail::AtType<ParameterIndex, FunctionSignature>::type;
|
||||
};
|
||||
|
||||
static const bool RETURN_VALID = FunctionInterfaceReturnContainer<ResultType>::VALID;
|
||||
static constexpr bool RETURN_VALID = FunctionInterfaceReturnContainer<ResultType>::VALID;
|
||||
|
||||
/// The number of parameters in this \c Function Interface.
|
||||
///
|
||||
static const vtkm::IdComponent ARITY = SigInfo::Arity;
|
||||
static constexpr vtkm::IdComponent ARITY = SigInfo::Arity;
|
||||
|
||||
/// Returns the number of parameters held in this \c FunctionInterface. The
|
||||
/// return value is the same as \c ARITY.
|
||||
@ -793,7 +793,7 @@ public:
|
||||
FinishFunctor>;
|
||||
NextContinueType nextContinue =
|
||||
NextContinueType(this->OriginalInterface, nextInterface, this->Transform, this->Finish);
|
||||
static const vtkm::IdComponent Index =
|
||||
static constexpr vtkm::IdComponent Index =
|
||||
vtkm::internal::FunctionInterface<NextFunction>::ARITY + 1;
|
||||
vtkm::internal::IndexTag<Index> indexTag;
|
||||
this->Transform(this->OriginalInterface.GetParameter(indexTag), nextContinue, indexTag);
|
||||
@ -810,7 +810,7 @@ private:
|
||||
FinishFunctor>;
|
||||
NextContinueType nextContinue =
|
||||
NextContinueType(this->OriginalInterface, nextInterface, this->Transform, this->Finish);
|
||||
static const vtkm::IdComponent Index =
|
||||
static constexpr vtkm::IdComponent Index =
|
||||
vtkm::internal::FunctionInterface<NextFunction>::ARITY + 1;
|
||||
vtkm::internal::IndexTag<Index> indexTag;
|
||||
this->Transform(this->OriginalInterface.GetParameter(indexTag), nextContinue, indexTag);
|
||||
|
@ -39,7 +39,7 @@ namespace internal
|
||||
template <vtkm::IdComponent Index>
|
||||
struct IndexTag
|
||||
{
|
||||
static const vtkm::IdComponent INDEX = Index;
|
||||
static constexpr vtkm::IdComponent INDEX = Index;
|
||||
};
|
||||
}
|
||||
} // namespace vtkm::internal
|
||||
|
@ -70,7 +70,7 @@ struct Invocation
|
||||
/// constituent element of the input (such as the points or cells). This
|
||||
/// index points to the parameter that defines this input domain.
|
||||
///
|
||||
static const vtkm::IdComponent InputDomainIndex = _InputDomainIndex;
|
||||
static constexpr vtkm::IdComponent InputDomainIndex = _InputDomainIndex;
|
||||
|
||||
/// \brief An array representing the output to input map.
|
||||
///
|
||||
|
@ -41,7 +41,7 @@ void CheckReference(vtkm::Id index, vtkm::internal::ArrayPortalValueReference<Ar
|
||||
VTKM_TEST_ASSERT(test_equal(ref, TestValue(index, ValueType())), "Got bad value from reference.");
|
||||
}
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
struct DoTestForType
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ namespace internal
|
||||
|
||||
inline bool IsLittleEndian()
|
||||
{
|
||||
static const vtkm::Int16 i16 = 0x1;
|
||||
static constexpr vtkm::Int16 i16 = 0x1;
|
||||
const vtkm::Int8* i8p = reinterpret_cast<const vtkm::Int8*>(&i16);
|
||||
return (*i8p == 1);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
static const vtkm::Id WIDTH = 512, HEIGHT = 512;
|
||||
static constexpr vtkm::Id WIDTH = 512, HEIGHT = 512;
|
||||
static vtkm::Id which = 0, NUM_DATASETS = 5;
|
||||
static bool done = false;
|
||||
static bool batch = false;
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
static const vtkm::Id WIDTH = 512, HEIGHT = 512;
|
||||
static constexpr vtkm::Id WIDTH = 512, HEIGHT = 512;
|
||||
static vtkm::Id windowID, which = 0, NUM_DATASETS = 4;
|
||||
static bool done = false;
|
||||
static bool batch = false;
|
||||
|
@ -48,7 +48,6 @@ class Lists
|
||||
public:
|
||||
static constexpr vtkm::IdComponent NUM_NUMBERS = 5;
|
||||
|
||||
|
||||
VTKM_EXEC_CONT vtkm::Float64 NumberList(vtkm::Int32 i) const
|
||||
{
|
||||
vtkm::Float64 numberList[NUM_NUMBERS] = { 0.25, 0.5, 1.0, 2.0, 3.75 };
|
||||
|
@ -51,8 +51,8 @@ namespace
|
||||
template <typename T, vtkm::IdComponent NumRow, vtkm::IdComponent NumCol>
|
||||
struct MatrixTest
|
||||
{
|
||||
static const vtkm::IdComponent NUM_ROWS = NumRow;
|
||||
static const vtkm::IdComponent NUM_COLS = NumCol;
|
||||
static constexpr vtkm::IdComponent NUM_ROWS = NumRow;
|
||||
static constexpr vtkm::IdComponent NUM_COLS = NumCol;
|
||||
using MatrixType = vtkm::Matrix<T, NUM_ROWS, NUM_COLS>;
|
||||
using ComponentType = typename MatrixType::ComponentType;
|
||||
|
||||
@ -372,7 +372,7 @@ T RecursiveDeterminant(const vtkm::Matrix<T, Size, Size>& A)
|
||||
template <typename T, vtkm::IdComponent Size>
|
||||
struct SquareMatrixTest
|
||||
{
|
||||
static const vtkm::IdComponent SIZE = Size;
|
||||
static constexpr vtkm::IdComponent SIZE = Size;
|
||||
using MatrixType = vtkm::Matrix<T, Size, Size>;
|
||||
|
||||
static void CheckMatrixSize()
|
||||
|
@ -25,7 +25,7 @@
|
||||
namespace UnitTestVecFromPortalNamespace
|
||||
{
|
||||
|
||||
static const vtkm::IdComponent ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::IdComponent ARRAY_SIZE = 10;
|
||||
|
||||
template <typename T>
|
||||
void CheckType(T, T)
|
||||
|
@ -27,7 +27,7 @@
|
||||
namespace UnitTestVecFromPortalPermuteNamespace
|
||||
{
|
||||
|
||||
static const vtkm::IdComponent ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::IdComponent ARRAY_SIZE = 10;
|
||||
|
||||
template <typename T>
|
||||
void CheckType(T, T)
|
||||
|
@ -24,8 +24,8 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id MAX_VECTOR_SIZE = 5;
|
||||
static const vtkm::Id VecInit[MAX_VECTOR_SIZE] = { 42, 54, 67, 12, 78 };
|
||||
static constexpr vtkm::Id MAX_VECTOR_SIZE = 5;
|
||||
static constexpr vtkm::Id VecInit[MAX_VECTOR_SIZE] = { 42, 54, 67, 12, 78 };
|
||||
|
||||
struct TestVecTypeFunctor
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ struct VecVariableTestFunctor
|
||||
template <typename T>
|
||||
void operator()(T) const
|
||||
{
|
||||
static const vtkm::IdComponent SIZE = 5;
|
||||
static constexpr vtkm::IdComponent SIZE = 5;
|
||||
using VecType = vtkm::Vec<T, SIZE>;
|
||||
using VecVariableType = vtkm::VecVariable<T, SIZE>;
|
||||
using TTraits = vtkm::TypeTraits<VecVariableType>;
|
||||
|
@ -42,11 +42,11 @@ class FieldStatistics
|
||||
{
|
||||
public:
|
||||
// For moments readability
|
||||
static const vtkm::Id FIRST = 0;
|
||||
static const vtkm::Id SECOND = 1;
|
||||
static const vtkm::Id THIRD = 2;
|
||||
static const vtkm::Id FOURTH = 3;
|
||||
static const vtkm::Id NUM_POWERS = 4;
|
||||
static constexpr vtkm::Id FIRST = 0;
|
||||
static constexpr vtkm::Id SECOND = 1;
|
||||
static constexpr vtkm::Id THIRD = 2;
|
||||
static constexpr vtkm::Id FOURTH = 3;
|
||||
static constexpr vtkm::Id NUM_POWERS = 4;
|
||||
|
||||
struct StatInfo
|
||||
{
|
||||
|
@ -271,7 +271,7 @@ namespace arg
|
||||
template <typename KeyType>
|
||||
struct TypeCheck<vtkm::cont::arg::TypeCheckTagKeys, vtkm::worklet::Keys<KeyType>>
|
||||
{
|
||||
static const bool value = true;
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
template <typename KeyType, typename Device>
|
||||
|
@ -319,7 +319,7 @@ public:
|
||||
|
||||
//============================================================================
|
||||
private:
|
||||
static const vtkm::UInt8 HIDDEN = 2; // from vtk
|
||||
static constexpr vtkm::UInt8 HIDDEN = 2; // from vtk
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> CellIds;
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> ParametricCoordinates;
|
||||
|
@ -363,7 +363,7 @@ protected:
|
||||
using ExecutionInterface =
|
||||
vtkm::internal::FunctionInterface<typename WorkletType::ExecutionSignature>;
|
||||
|
||||
static const vtkm::IdComponent NUM_INVOKE_PARAMS = ControlInterface::ARITY;
|
||||
static constexpr vtkm::IdComponent NUM_INVOKE_PARAMS = ControlInterface::ARITY;
|
||||
|
||||
private:
|
||||
// We don't really need these types, but declaring them checks the arguments
|
||||
|
@ -31,7 +31,7 @@ namespace
|
||||
|
||||
using Device = vtkm::cont::DeviceAdapterTagSerial;
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
struct TestExecObject
|
||||
{
|
||||
@ -94,7 +94,7 @@ namespace arg
|
||||
template <>
|
||||
struct TypeCheck<TestTypeCheckTag, vtkm::Id*>
|
||||
{
|
||||
static const bool value = true;
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
template <>
|
||||
@ -197,7 +197,7 @@ struct Fetch<TestFetchTagOutput,
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id EXPECTED_EXEC_OBJECT_VALUE = 123;
|
||||
static constexpr vtkm::Id EXPECTED_EXEC_OBJECT_VALUE = 123;
|
||||
|
||||
class TestWorkletBase : public vtkm::worklet::internal::WorkletBase
|
||||
{
|
||||
|
@ -32,9 +32,9 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id NUM_UNIQUE = 100;
|
||||
static const vtkm::Id NUM_PER_GROUP = 10;
|
||||
static const vtkm::Id ARRAY_SIZE = NUM_UNIQUE * NUM_PER_GROUP;
|
||||
static constexpr vtkm::Id NUM_UNIQUE = 100;
|
||||
static constexpr vtkm::Id NUM_PER_GROUP = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = NUM_UNIQUE * NUM_PER_GROUP;
|
||||
|
||||
template <typename KeyArray, typename ValueArray>
|
||||
void CheckAverageByKey(const KeyArray& uniqueKeys, const ValueArray& averagedValues)
|
||||
|
@ -104,7 +104,7 @@ static vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates coordinates(vdims, origin, spacing);
|
||||
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates));
|
||||
|
||||
static const vtkm::IdComponent ndim = 3;
|
||||
static constexpr vtkm::IdComponent ndim = 3;
|
||||
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
|
||||
cellSet.SetPointDimensions(vdims);
|
||||
dataSet.AddCellSet(cellSet);
|
||||
|
@ -99,9 +99,9 @@ vtkm::cont::DataSet MakeTestDatasetExplicit()
|
||||
|
||||
vtkm::cont::DataSet MakeTestDatasetStructured()
|
||||
{
|
||||
static const vtkm::Id xdim = 3, ydim = 3;
|
||||
static constexpr vtkm::Id xdim = 3, ydim = 3;
|
||||
static const vtkm::Id2 dim(xdim, ydim);
|
||||
static const vtkm::Id numVerts = xdim * ydim;
|
||||
static constexpr vtkm::Id numVerts = xdim * ydim;
|
||||
|
||||
vtkm::Float32 scalars[numVerts];
|
||||
for (vtkm::Id i = 0; i < numVerts; ++i)
|
||||
|
@ -29,8 +29,8 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 1033;
|
||||
static const vtkm::Id NUM_UNIQUE = ARRAY_SIZE / 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 1033;
|
||||
static constexpr vtkm::Id NUM_UNIQUE = ARRAY_SIZE / 10;
|
||||
|
||||
template <typename KeyPortal, typename IdPortal, typename IdComponentPortal>
|
||||
void CheckKeyReduce(const KeyPortal& originalKeys,
|
||||
|
@ -110,7 +110,7 @@ vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates coordinates(vdims, origin, spacing);
|
||||
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates));
|
||||
|
||||
static const vtkm::IdComponent ndim = 3;
|
||||
static constexpr vtkm::IdComponent ndim = 3;
|
||||
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
|
||||
cellSet.SetPointDimensions(vdims);
|
||||
dataSet.AddCellSet(cellSet);
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
namespace mapfield
|
||||
{
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename WorkletType>
|
||||
struct DoStaticTestWorklet
|
||||
|
@ -57,7 +57,7 @@ struct TestExecObjectWorklet
|
||||
namespace map_exec_field
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
template <typename WorkletType>
|
||||
struct DoTestWorklet
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
namespace map_whole_array
|
||||
{
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 10;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 10;
|
||||
|
||||
struct DoTestWholeArrayWorklet
|
||||
{
|
||||
|
@ -45,9 +45,9 @@ namespace
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
static const vtkm::Id ARRAY_SIZE = 1033;
|
||||
static const vtkm::IdComponent GROUP_SIZE = 10;
|
||||
static const vtkm::Id NUM_UNIQUE = ARRAY_SIZE / GROUP_SIZE;
|
||||
static constexpr vtkm::Id ARRAY_SIZE = 1033;
|
||||
static constexpr vtkm::IdComponent GROUP_SIZE = 10;
|
||||
static constexpr vtkm::Id NUM_UNIQUE = ARRAY_SIZE / GROUP_SIZE;
|
||||
|
||||
struct CheckKeyValuesWorklet : vtkm::worklet::WorkletReduceByKey
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user