Commit 7c54125b authored by Robert Maynard's avatar Robert Maynard

Switch over from static const to static constexpr where possible.

parent 66e356f7
......@@ -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;
template <typename T>
struct IsArrayHandleDiscard<ArrayHandle<T, internal::StorageTagDiscard>> : std::true_type
struct IsArrayHandleDiscard : std::false_type
{
static const bool Value = true;
};
template <typename T, typename U>
struct IsArrayHandleDiscard<ArrayHandle<T, U>> : std::false_type
template <typename T>
struct IsArrayHandleDiscard<ArrayHandle<T, internal::StorageTagDiscard>> : std::true_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;