From 7c54125b668e724e5252dcc61a0318d98dce8b3b Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Tue, 27 Feb 2018 09:25:25 -0500 Subject: [PATCH] Switch over from static const to static constexpr where possible. --- vtkm/CellShape.h | 2 +- vtkm/CellTraits.h | 2 +- vtkm/Hash.h | 4 ++-- vtkm/Matrix.h | 6 +++--- vtkm/TypeListTag.h | 2 +- vtkm/Types.h | 6 +++--- vtkm/VecAxisAlignedPointCoordinates.h | 10 +++++----- vtkm/VecTraits.h | 6 +++--- vtkm/cont/ArrayHandleCompositeVector.h | 6 +++--- vtkm/cont/ArrayHandleDiscard.h | 11 +++-------- vtkm/cont/ArrayHandleExtractComponent.h | 6 +++--- vtkm/cont/ArrayHandleGroupVec.h | 2 +- vtkm/cont/ArrayHandleSwizzle.h | 19 ++++++++++--------- vtkm/cont/arg/TypeCheck.h | 2 +- vtkm/cont/arg/TypeCheckTagArray.h | 6 +++--- vtkm/cont/arg/TypeCheckTagAtomicArray.h | 6 +++--- vtkm/cont/arg/TypeCheckTagCellSet.h | 2 +- vtkm/cont/arg/TypeCheckTagCellSetStructured.h | 3 ++- vtkm/cont/arg/TypeCheckTagKeys.h | 2 +- .../arg/testing/UnitTestTransportArrayIn.cxx | 2 +- .../testing/UnitTestTransportArrayInOut.cxx | 2 +- .../arg/testing/UnitTestTransportArrayOut.cxx | 2 +- .../testing/UnitTestTransportWholeArray.cxx | 2 +- .../internal/DeviceAdapterAlgorithmGeneral.h | 2 +- vtkm/cont/internal/DeviceAdapterTag.h | 10 +++++----- .../UnitTestArrayPortalFromIterators.cxx | 6 +++--- .../testing/UnitTestDynamicTransform.cxx | 2 +- .../UnitTestIteratorFromArrayPortal.cxx | 2 +- .../internal/DeviceAdapterAlgorithmTBB.cxx | 2 +- vtkm/cont/tbb/internal/FunctorsTBB.h | 2 +- vtkm/cont/tbb/internal/ParallelSortTBB.cxx | 2 +- vtkm/cont/tbb/internal/ParallelSortTBB.hxx | 2 +- vtkm/cont/tbb/internal/kxsort.h | 12 ++++++------ vtkm/cont/testing/MakeTestDataSet.h | 4 ++-- .../TestingArrayHandleVirtualCoordinates.h | 2 +- vtkm/cont/testing/TestingArrayHandles.h | 2 +- vtkm/cont/testing/UnitTestAlgorithm.cxx | 2 +- vtkm/cont/testing/UnitTestArrayCopy.cxx | 2 +- .../testing/UnitTestArrayHandleDiscard.cxx | 4 ++-- .../UnitTestArrayPortalToIterators.cxx | 2 +- .../testing/UnitTestDynamicArrayHandle.cxx | 2 +- vtkm/cont/testing/UnitTestTryExecute.cxx | 2 +- vtkm/exec/arg/BasicArg.h | 2 +- vtkm/exec/arg/CellShape.h | 2 +- vtkm/exec/arg/ExecutionSignatureTagBase.h | 2 +- vtkm/exec/arg/FromCount.h | 2 +- vtkm/exec/arg/FromIndices.h | 2 +- vtkm/exec/arg/InputIndex.h | 2 +- vtkm/exec/arg/OnBoundary.h | 2 +- vtkm/exec/arg/OutputIndex.h | 2 +- vtkm/exec/arg/ThreadIndices.h | 2 +- vtkm/exec/arg/ValueCount.h | 2 +- vtkm/exec/arg/VisitIndex.h | 2 +- vtkm/exec/arg/WorkIndex.h | 2 +- .../testing/UnitTestFetchArrayDirectIn.cxx | 2 +- .../testing/UnitTestFetchArrayDirectInOut.cxx | 2 +- .../testing/UnitTestFetchArrayDirectOut.cxx | 2 +- .../UnitTestFetchArrayTopologyMapIn.cxx | 2 +- .../cuda/internal/ArrayPortalFromThrust.h | 8 ++++---- .../internal/WorkletInvokeFunctorDetail.h | 2 +- .../internal/WorkletInvokeFunctorDetail.h.in | 2 +- vtkm/exec/testing/UnitTestCellDerivative.cxx | 2 +- vtkm/exec/testing/UnitTestCellInterpolate.cxx | 2 +- .../testing/UnitTestParametricCoordinates.cxx | 2 +- ...UnitTestClipWithImplicitFunctionFilter.cxx | 4 ++-- vtkm/filter/testing/UnitTestEntropyFilter.cxx | 2 +- .../testing/UnitTestMarchingCubesFilter.cxx | 2 +- .../ConnectivityStructuredInternals.h | 12 ++++++------ vtkm/internal/FunctionInterface.h | 8 ++++---- vtkm/internal/IndexTag.h | 2 +- vtkm/internal/Invocation.h | 2 +- .../UnitTestArrayPortalValueReference.cxx | 2 +- vtkm/io/internal/Endian.h | 2 +- .../testing/glfw/UnitTestMapperGLFW.cxx | 2 +- .../testing/glut/UnitTestMapperGLUT.cxx | 2 +- vtkm/testing/TestingMath.h | 1 - vtkm/testing/UnitTestMatrix.cxx | 6 +++--- vtkm/testing/UnitTestVecFromPortal.cxx | 2 +- vtkm/testing/UnitTestVecFromPortalPermute.cxx | 2 +- vtkm/testing/UnitTestVecTraits.cxx | 4 ++-- vtkm/testing/UnitTestVecVariable.cxx | 2 +- vtkm/worklet/FieldStatistics.h | 10 +++++----- vtkm/worklet/Keys.h | 2 +- vtkm/worklet/Probe.h | 2 +- vtkm/worklet/internal/DispatcherBase.h | 2 +- .../testing/UnitTestDispatcherBase.cxx | 6 +++--- vtkm/worklet/testing/UnitTestAverageByKey.cxx | 6 +++--- .../testing/UnitTestCellSetConnectivity.cpp | 2 +- vtkm/worklet/testing/UnitTestClipping.cxx | 4 ++-- vtkm/worklet/testing/UnitTestKeys.cxx | 4 ++-- .../worklet/testing/UnitTestMarchingCubes.cxx | 2 +- .../testing/UnitTestWorkletMapField.cxx | 2 +- .../UnitTestWorkletMapFieldExecArg.cxx | 2 +- .../UnitTestWorkletMapFieldWholeArray.cxx | 2 +- .../testing/UnitTestWorkletReduceByKey.cxx | 6 +++--- 95 files changed, 165 insertions(+), 169 deletions(-) diff --git a/vtkm/CellShape.h b/vtkm/CellShape.h index b19bd7bed..9d50d1908 100644 --- a/vtkm/CellShape.h +++ b/vtkm/CellShape.h @@ -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 \ { \ diff --git a/vtkm/CellTraits.h b/vtkm/CellTraits.h index 73075f8fa..9d2c1db74 100644 --- a/vtkm/CellTraits.h +++ b/vtkm/CellTraits.h @@ -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 ; diff --git a/vtkm/Hash.h b/vtkm/Hash.h index b08de4629..33b162173 100644 --- a/vtkm/Hash.h +++ b/vtkm/Hash.h @@ -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 /// diff --git a/vtkm/Matrix.h b/vtkm/Matrix.h index 897b43d15..7a34d7d54 100644 --- a/vtkm/Matrix.h +++ b/vtkm/Matrix.h @@ -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; diff --git a/vtkm/TypeListTag.h b/vtkm/TypeListTag.h index d7a4b4fb6..b49e3157e 100644 --- a/vtkm/TypeListTag.h +++ b/vtkm/TypeListTag.h @@ -207,7 +207,7 @@ struct TypeListTagCommon : vtkm::ListTagBase struct ListContains { - static const bool value = true; + static constexpr bool value = true; }; } // namespace vtkm diff --git a/vtkm/Types.h b/vtkm/Types.h index 7db5fd940..46ea13710 100644 --- a/vtkm/Types.h +++ b/vtkm/Types.h @@ -646,7 +646,7 @@ class VTKM_ALWAYS_EXPORT VecBase : public vtkm::detail::VecBaseCommon> 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 { 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&) {} diff --git a/vtkm/VecAxisAlignedPointCoordinates.h b/vtkm/VecAxisAlignedPointCoordinates.h index 1316e5d87..28afa7815 100644 --- a/vtkm/VecAxisAlignedPointCoordinates.h +++ b/vtkm/VecAxisAlignedPointCoordinates.h @@ -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; - static const vtkm::IdComponent NUM_COMPONENTS = + static constexpr vtkm::IdComponent NUM_COMPONENTS = detail::VecAxisAlignedPointCoordinatesNumComponents::NUM_COMPONENTS; VTKM_EXEC_CONT @@ -160,7 +160,7 @@ struct VecTraits> 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; } diff --git a/vtkm/VecTraits.h b/vtkm/VecTraits.h index 918e64e69..9b7ccd7e1 100644 --- a/vtkm/VecTraits.h +++ b/vtkm/VecTraits.h @@ -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> /// 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 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; diff --git a/vtkm/cont/ArrayHandleCompositeVector.h b/vtkm/cont/ArrayHandleCompositeVector.h index ab7eddf0e..5526d154f 100644 --- a/vtkm/cont/ArrayHandleCompositeVector.h +++ b/vtkm/cont/ArrayHandleCompositeVector.h @@ -45,7 +45,7 @@ namespace detail template struct VTKM_ALWAYS_EXPORT CompositeVectorSwizzleFunctor { - static const vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits::NUM_COMPONENTS; + static constexpr vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits::NUM_COMPONENTS; using ComponentMapType = vtkm::Vec; // 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::NUM_COMPONENTS; + static constexpr vtkm::IdComponent NUM_COMPONENTS = vtkm::VecTraits::NUM_COMPONENTS; // Used internally. using ComponentMapType = vtkm::Vec; @@ -262,7 +262,7 @@ class Storage::Va vtkm::cont::internal::StorageTagCompositeVector> { using FunctionInterfaceWithArrays = vtkm::internal::FunctionInterface; - static const vtkm::IdComponent NUM_COMPONENTS = FunctionInterfaceWithArrays::ARITY; + static constexpr vtkm::IdComponent NUM_COMPONENTS = FunctionInterfaceWithArrays::ARITY; using ComponentMapType = vtkm::Vec; using FunctionInterfaceWithPortals = diff --git a/vtkm/cont/ArrayHandleDiscard.h b/vtkm/cont/ArrayHandleDiscard.h index 7af888428..827d4f168 100644 --- a/vtkm/cont/ArrayHandleDiscard.h +++ b/vtkm/cont/ArrayHandleDiscard.h @@ -229,18 +229,13 @@ public: /// Helper to determine if an ArrayHandle type is an ArrayHandleDiscard. template -struct IsArrayHandleDiscard; +struct IsArrayHandleDiscard : std::false_type +{ +}; template struct IsArrayHandleDiscard> : std::true_type { - static const bool Value = true; -}; - -template -struct IsArrayHandleDiscard> : std::false_type -{ - static const bool Value = false; }; } // end namespace cont diff --git a/vtkm/cont/ArrayHandleExtractComponent.h b/vtkm/cont/ArrayHandleExtractComponent.h index 217aee9f9..3a2b619c6 100644 --- a/vtkm/cont/ArrayHandleExtractComponent.h +++ b/vtkm/cont/ArrayHandleExtractComponent.h @@ -40,7 +40,7 @@ public: using Traits = vtkm::VecTraits; 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 class StorageTagExtractComponent { - static const vtkm::IdComponent COMPONENT = Component; + static constexpr vtkm::IdComponent COMPONENT = Component; }; namespace internal @@ -270,7 +270,7 @@ class ArrayHandleExtractComponent StorageTagExtractComponent> { public: - static const vtkm::IdComponent COMPONENT = Component; + static constexpr vtkm::IdComponent COMPONENT = Component; VTKM_ARRAY_HANDLE_SUBCLASS( ArrayHandleExtractComponent, diff --git a/vtkm/cont/ArrayHandleGroupVec.h b/vtkm/cont/ArrayHandleGroupVec.h index 999e10a89..e8b04818b 100644 --- a/vtkm/cont/ArrayHandleGroupVec.h +++ b/vtkm/cont/ArrayHandleGroupVec.h @@ -36,7 +36,7 @@ template 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::type; diff --git a/vtkm/cont/ArrayHandleSwizzle.h b/vtkm/cont/ArrayHandleSwizzle.h index 35efce36c..b7f11b134 100644 --- a/vtkm/cont/ArrayHandleSwizzle.h +++ b/vtkm/cont/ArrayHandleSwizzle.h @@ -63,7 +63,7 @@ struct ValidateComponentMap; template struct ValidateComponentMap { - static const bool Valid = Head >= 0 && Head < InputSize; + static constexpr bool Valid = Head >= 0 && Head < InputSize; }; // Recursive impl: @@ -71,8 +71,8 @@ template { using Next = ValidateComponentMap; - static const bool IsUnique = ComponentIsUnique::IsUnique; - static const bool Valid = Head >= 0 && Head < InputSize && IsUnique && Next::Valid; + static constexpr bool IsUnique = ComponentIsUnique::IsUnique; + static constexpr bool Valid = Head >= 0 && Head < InputSize && IsUnique && Next::Valid; }; } // end namespace internal @@ -82,7 +82,8 @@ template struct ArrayHandleSwizzleTraits { /// The number of elements in the ComponentMap. - static const vtkm::IdComponent COUNT = static_cast(sizeof...(ComponentMap)); + static constexpr vtkm::IdComponent COUNT = + static_cast(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 @@ -153,7 +154,7 @@ private: template struct SwizzleImpl { - 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 { using Next = SwizzleImpl; - 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 struct UnSwizzleImpl { - 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 { using Next = UnSwizzleImpl; - static const vtkm::IdComponent InputIndex = Head; + static constexpr vtkm::IdComponent InputIndex = Head; void operator()(const OutputType& out, InputType& in) const { diff --git a/vtkm/cont/arg/TypeCheck.h b/vtkm/cont/arg/TypeCheck.h index 8900d61d3..2a8837539 100644 --- a/vtkm/cont/arg/TypeCheck.h +++ b/vtkm/cont/arg/TypeCheck.h @@ -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; }; } } diff --git a/vtkm/cont/arg/TypeCheckTagArray.h b/vtkm/cont/arg/TypeCheckTagArray.h index f37d3dea9..c9ab26f72 100644 --- a/vtkm/cont/arg/TypeCheckTagArray.h +++ b/vtkm/cont/arg/TypeCheckTagArray.h @@ -51,13 +51,13 @@ struct TypeCheckArrayValueType; template struct TypeCheckArrayValueType { - static const bool value = vtkm::ListContains::value; + static constexpr bool value = vtkm::ListContains::value; }; template struct TypeCheckArrayValueType { - static const bool value = false; + static constexpr bool value = false; }; } // namespace detail @@ -65,7 +65,7 @@ struct TypeCheckArrayValueType template struct TypeCheck, ArrayType> { - static const bool value = detail::TypeCheckArrayValueType< + static constexpr bool value = detail::TypeCheckArrayValueType< TypeList, ArrayType, vtkm::cont::internal::ArrayHandleCheck::type::value>::value; diff --git a/vtkm/cont/arg/TypeCheckTagAtomicArray.h b/vtkm/cont/arg/TypeCheckTagAtomicArray.h index ca1a3727d..3e500a822 100644 --- a/vtkm/cont/arg/TypeCheckTagAtomicArray.h +++ b/vtkm/cont/arg/TypeCheckTagAtomicArray.h @@ -49,15 +49,15 @@ struct TypeCheckTagAtomicArray template struct TypeCheck, ArrayType> { - static const bool value = false; + static constexpr bool value = false; }; template struct TypeCheck, vtkm::cont::ArrayHandle> { - static const bool value = (vtkm::ListContains::value && - vtkm::ListContains::value); + static constexpr bool value = (vtkm::ListContains::value && + vtkm::ListContains::value); }; } } diff --git a/vtkm/cont/arg/TypeCheckTagCellSet.h b/vtkm/cont/arg/TypeCheckTagCellSet.h index e95d52b66..590aaef94 100644 --- a/vtkm/cont/arg/TypeCheckTagCellSet.h +++ b/vtkm/cont/arg/TypeCheckTagCellSet.h @@ -40,7 +40,7 @@ struct TypeCheckTagCellSet template struct TypeCheck { - static const bool value = vtkm::cont::internal::CellSetCheck::type::value; + static constexpr bool value = vtkm::cont::internal::CellSetCheck::type::value; }; } } diff --git a/vtkm/cont/arg/TypeCheckTagCellSetStructured.h b/vtkm/cont/arg/TypeCheckTagCellSetStructured.h index 0d480f726..01e17daf2 100644 --- a/vtkm/cont/arg/TypeCheckTagCellSetStructured.h +++ b/vtkm/cont/arg/TypeCheckTagCellSetStructured.h @@ -45,7 +45,8 @@ struct TypeCheck using is_2d_cellset = std::is_same>; using is_1d_cellset = std::is_same>; - 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; }; } } diff --git a/vtkm/cont/arg/TypeCheckTagKeys.h b/vtkm/cont/arg/TypeCheckTagKeys.h index bcfcc4d04..821b46bf5 100644 --- a/vtkm/cont/arg/TypeCheckTagKeys.h +++ b/vtkm/cont/arg/TypeCheckTagKeys.h @@ -41,7 +41,7 @@ struct TypeCheckTagKeys template struct TypeCheck { - static const bool value = false; + static constexpr bool value = false; }; } } diff --git a/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx b/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx index ebbb66b33..6c374aec6 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx @@ -30,7 +30,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; template struct TestKernelIn : public vtkm::exec::FunctorBase diff --git a/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx b/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx index 752478479..c930d1b44 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx @@ -30,7 +30,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; template struct TestKernelInOut : public vtkm::exec::FunctorBase diff --git a/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx b/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx index 41c8f5864..2e5682c45 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx @@ -31,7 +31,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; template struct TestKernelOut : public vtkm::exec::FunctorBase diff --git a/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx b/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx index ed09d78ed..1d33bcfb6 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportWholeArray.cxx @@ -34,7 +34,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; #define OFFSET 10 diff --git a/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h b/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h index fc4144263..ec6ee75ea 100644 --- a/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h +++ b/vtkm/cont/internal/DeviceAdapterAlgorithmGeneral.h @@ -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::Value) + if (!vtkm::cont::IsArrayHandleDiscard::value) { //find all the unique keys DerivedAlgorithm::Copy(keys, keys_output); diff --git a/vtkm/cont/internal/DeviceAdapterTag.h b/vtkm/cont/internal/DeviceAdapterTag.h index 10cae18ad..bf9ac5acf 100644 --- a/vtkm/cont/internal/DeviceAdapterTag.h +++ b/vtkm/cont/internal/DeviceAdapterTag.h @@ -47,7 +47,7 @@ struct DeviceAdapterTraits; template 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 \ { \ - 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 \ { \ - static const bool Valid = false; \ + static constexpr bool Valid = false; \ }; \ } \ } diff --git a/vtkm/cont/internal/testing/UnitTestArrayPortalFromIterators.cxx b/vtkm/cont/internal/testing/UnitTestArrayPortalFromIterators.cxx index 89a29e5ad..171c11e38 100644 --- a/vtkm/cont/internal/testing/UnitTestArrayPortalFromIterators.cxx +++ b/vtkm/cont/internal/testing/UnitTestArrayPortalFromIterators.cxx @@ -29,7 +29,7 @@ namespace template struct TemplatedTests { - static const vtkm::Id ARRAY_SIZE = 10; + static constexpr vtkm::Id ARRAY_SIZE = 10; using ValueType = T; using ComponentType = typename vtkm::VecTraits::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 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++) diff --git a/vtkm/cont/internal/testing/UnitTestDynamicTransform.cxx b/vtkm/cont/internal/testing/UnitTestDynamicTransform.cxx index 463b6d403..1639a51d6 100644 --- a/vtkm/cont/internal/testing/UnitTestDynamicTransform.cxx +++ b/vtkm/cont/internal/testing/UnitTestDynamicTransform.cxx @@ -39,7 +39,7 @@ namespace vtkm template <> struct VecTraits { - static const vtkm::IdComponent NUM_COMPONENTS = 1; + static constexpr vtkm::IdComponent NUM_COMPONENTS = 1; using HasMultipleComponents = vtkm::VecTraitsTagSingleComponent; }; diff --git a/vtkm/cont/internal/testing/UnitTestIteratorFromArrayPortal.cxx b/vtkm/cont/internal/testing/UnitTestIteratorFromArrayPortal.cxx index 78de9d1f6..ce6f8b21d 100644 --- a/vtkm/cont/internal/testing/UnitTestIteratorFromArrayPortal.cxx +++ b/vtkm/cont/internal/testing/UnitTestIteratorFromArrayPortal.cxx @@ -31,7 +31,7 @@ namespace template struct TemplatedTests { - static const vtkm::Id ARRAY_SIZE = 10; + static constexpr vtkm::Id ARRAY_SIZE = 10; using ValueType = T; using ComponentType = typename vtkm::VecTraits::ComponentType; diff --git a/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.cxx b/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.cxx index 890dddf02..e2068ad33 100644 --- a/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.cxx +++ b/vtkm/cont/tbb/internal/DeviceAdapterAlgorithmTBB.cxx @@ -50,7 +50,7 @@ void DeviceAdapterAlgorithm::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'; diff --git a/vtkm/cont/tbb/internal/FunctorsTBB.h b/vtkm/cont/tbb/internal/FunctorsTBB.h index 03dade15f..2ecdd4ab6 100644 --- a/vtkm/cont/tbb/internal/FunctorsTBB.h +++ b/vtkm/cont/tbb/internal/FunctorsTBB.h @@ -88,7 +88,7 @@ using WrappedBinaryOperator = vtkm::cont::internal::WrappedBinaryOperator struct CopyBody diff --git a/vtkm/cont/tbb/internal/ParallelSortTBB.cxx b/vtkm/cont/tbb/internal/ParallelSortTBB.cxx index 7f61dffca..e4a7629a8 100644 --- a/vtkm/cont/tbb/internal/ParallelSortTBB.cxx +++ b/vtkm/cont/tbb/internal/ParallelSortTBB.cxx @@ -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_; diff --git a/vtkm/cont/tbb/internal/ParallelSortTBB.hxx b/vtkm/cont/tbb/internal/ParallelSortTBB.hxx index 9aed605c5..fefa43640 100644 --- a/vtkm/cont/tbb/internal/ParallelSortTBB.hxx +++ b/vtkm/cont/tbb/internal/ParallelSortTBB.hxx @@ -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; diff --git a/vtkm/cont/tbb/internal/kxsort.h b/vtkm/cont/tbb/internal/kxsort.h index f628612ea..faa0def81 100644 --- a/vtkm/cont/tbb/internal/kxsort.h +++ b/vtkm/cont/tbb/internal/kxsort.h @@ -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 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 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; } diff --git a/vtkm/cont/testing/MakeTestDataSet.h b/vtkm/cont/testing/MakeTestDataSet.h index 8ba9caf46..d10b8e455 100644 --- a/vtkm/cont/testing/MakeTestDataSet.h +++ b/vtkm/cont/testing/MakeTestDataSet.h @@ -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 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 cellSet("cells"); cellSet.SetPointDimensions(vtkm::make_Vec(2, 2, 2)); dataSet.AddCellSet(cellSet); diff --git a/vtkm/cont/testing/TestingArrayHandleVirtualCoordinates.h b/vtkm/cont/testing/TestingArrayHandleVirtualCoordinates.h index 87293f9a3..bf61eacb3 100644 --- a/vtkm/cont/testing/TestingArrayHandleVirtualCoordinates.h +++ b/vtkm/cont/testing/TestingArrayHandleVirtualCoordinates.h @@ -75,7 +75,7 @@ private: static void TestAll() { using PointType = vtkm::Vec; - static const vtkm::Id length = 64; + static constexpr vtkm::Id length = 64; vtkm::cont::ArrayHandle out; diff --git a/vtkm/cont/testing/TestingArrayHandles.h b/vtkm/cont/testing/TestingArrayHandles.h index 939c500ae..42a970325 100644 --- a/vtkm/cont/testing/TestingArrayHandles.h +++ b/vtkm/cont/testing/TestingArrayHandles.h @@ -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; diff --git a/vtkm/cont/testing/UnitTestAlgorithm.cxx b/vtkm/cont/testing/UnitTestAlgorithm.cxx index 9bb284b21..224190b50 100644 --- a/vtkm/cont/testing/UnitTestAlgorithm.cxx +++ b/vtkm/cont/testing/UnitTestAlgorithm.cxx @@ -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() { diff --git a/vtkm/cont/testing/UnitTestArrayCopy.cxx b/vtkm/cont/testing/UnitTestArrayCopy.cxx index 55e1c671b..4d3a3fe11 100644 --- a/vtkm/cont/testing/UnitTestArrayCopy.cxx +++ b/vtkm/cont/testing/UnitTestArrayCopy.cxx @@ -28,7 +28,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; template void TestValues(const PortalType& portal) diff --git a/vtkm/cont/testing/UnitTestArrayHandleDiscard.cxx b/vtkm/cont/testing/UnitTestArrayHandleDiscard.cxx index cbc7781cd..9940b7bff 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleDiscard.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleDiscard.cxx @@ -38,8 +38,8 @@ namespace UnitTestArrayHandleDiscardDetail template 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; diff --git a/vtkm/cont/testing/UnitTestArrayPortalToIterators.cxx b/vtkm/cont/testing/UnitTestArrayPortalToIterators.cxx index 082db901c..33c874dac 100644 --- a/vtkm/cont/testing/UnitTestArrayPortalToIterators.cxx +++ b/vtkm/cont/testing/UnitTestArrayPortalToIterators.cxx @@ -30,7 +30,7 @@ namespace template struct TemplatedTests { - static const vtkm::Id ARRAY_SIZE = 10; + static constexpr vtkm::Id ARRAY_SIZE = 10; using ValueType = T; using ComponentType = typename vtkm::VecTraits::ComponentType; diff --git a/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx b/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx index 99868f9a1..97a47edd7 100644 --- a/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx +++ b/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx @@ -53,7 +53,7 @@ namespace vtkm template <> struct VecTraits { - static const vtkm::IdComponent NUM_COMPONENTS = 1; + static constexpr vtkm::IdComponent NUM_COMPONENTS = 1; using HasMultipleComponents = vtkm::VecTraitsTagSingleComponent; }; diff --git a/vtkm/cont/testing/UnitTestTryExecute.cxx b/vtkm/cont/testing/UnitTestTryExecute.cxx index f4afe2009..d9c184eea 100644 --- a/vtkm/cont/testing/UnitTestTryExecute.cxx +++ b/vtkm/cont/testing/UnitTestTryExecute.cxx @@ -32,7 +32,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; struct TryExecuteTestFunctor { diff --git a/vtkm/exec/arg/BasicArg.h b/vtkm/exec/arg/BasicArg.h index 67408b5aa..69fce92e9 100644 --- a/vtkm/exec/arg/BasicArg.h +++ b/vtkm/exec/arg/BasicArg.h @@ -41,7 +41,7 @@ namespace arg template struct BasicArg : vtkm::exec::arg::ExecutionSignatureTagBase { - static const vtkm::IdComponent INDEX = ControlSignatureIndex; + static constexpr vtkm::IdComponent INDEX = ControlSignatureIndex; using AspectTag = vtkm::exec::arg::AspectTagDefault; }; } diff --git a/vtkm/exec/arg/CellShape.h b/vtkm/exec/arg/CellShape.h index 978326131..55485264c 100644 --- a/vtkm/exec/arg/CellShape.h +++ b/vtkm/exec/arg/CellShape.h @@ -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; }; diff --git a/vtkm/exec/arg/ExecutionSignatureTagBase.h b/vtkm/exec/arg/ExecutionSignatureTagBase.h index c5750b5e3..a48b9f1e6 100644 --- a/vtkm/exec/arg/ExecutionSignatureTagBase.h +++ b/vtkm/exec/arg/ExecutionSignatureTagBase.h @@ -54,7 +54,7 @@ namespace internal template struct ExecutionSignatureTagCheck { - static const bool Valid = + static constexpr bool Valid = std::is_base_of::value; }; diff --git a/vtkm/exec/arg/FromCount.h b/vtkm/exec/arg/FromCount.h index d18391b7f..de358cbd3 100644 --- a/vtkm/exec/arg/FromCount.h +++ b/vtkm/exec/arg/FromCount.h @@ -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; }; diff --git a/vtkm/exec/arg/FromIndices.h b/vtkm/exec/arg/FromIndices.h index 94c284673..ee1588798 100644 --- a/vtkm/exec/arg/FromIndices.h +++ b/vtkm/exec/arg/FromIndices.h @@ -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; }; diff --git a/vtkm/exec/arg/InputIndex.h b/vtkm/exec/arg/InputIndex.h index 58a27d813..c4593d662 100644 --- a/vtkm/exec/arg/InputIndex.h +++ b/vtkm/exec/arg/InputIndex.h @@ -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; }; diff --git a/vtkm/exec/arg/OnBoundary.h b/vtkm/exec/arg/OnBoundary.h index 339981029..042895a06 100644 --- a/vtkm/exec/arg/OnBoundary.h +++ b/vtkm/exec/arg/OnBoundary.h @@ -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; }; diff --git a/vtkm/exec/arg/OutputIndex.h b/vtkm/exec/arg/OutputIndex.h index 092be832d..87c57c871 100644 --- a/vtkm/exec/arg/OutputIndex.h +++ b/vtkm/exec/arg/OutputIndex.h @@ -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; }; diff --git a/vtkm/exec/arg/ThreadIndices.h b/vtkm/exec/arg/ThreadIndices.h index de35d863a..647da560f 100644 --- a/vtkm/exec/arg/ThreadIndices.h +++ b/vtkm/exec/arg/ThreadIndices.h @@ -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; }; diff --git a/vtkm/exec/arg/ValueCount.h b/vtkm/exec/arg/ValueCount.h index 68f7f2c72..4afb7c3ed 100644 --- a/vtkm/exec/arg/ValueCount.h +++ b/vtkm/exec/arg/ValueCount.h @@ -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; }; diff --git a/vtkm/exec/arg/VisitIndex.h b/vtkm/exec/arg/VisitIndex.h index 230fad58f..cff7c7e04 100644 --- a/vtkm/exec/arg/VisitIndex.h +++ b/vtkm/exec/arg/VisitIndex.h @@ -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; }; diff --git a/vtkm/exec/arg/WorkIndex.h b/vtkm/exec/arg/WorkIndex.h index bef89add4..c5620dda9 100644 --- a/vtkm/exec/arg/WorkIndex.h +++ b/vtkm/exec/arg/WorkIndex.h @@ -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; }; diff --git a/vtkm/exec/arg/testing/UnitTestFetchArrayDirectIn.cxx b/vtkm/exec/arg/testing/UnitTestFetchArrayDirectIn.cxx index fdaf9c07e..e5d128123 100644 --- a/vtkm/exec/arg/testing/UnitTestFetchArrayDirectIn.cxx +++ b/vtkm/exec/arg/testing/UnitTestFetchArrayDirectIn.cxx @@ -27,7 +27,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; template struct TestPortal diff --git a/vtkm/exec/arg/testing/UnitTestFetchArrayDirectInOut.cxx b/vtkm/exec/arg/testing/UnitTestFetchArrayDirectInOut.cxx index 4c1a8939b..a8e8016bd 100644 --- a/vtkm/exec/arg/testing/UnitTestFetchArrayDirectInOut.cxx +++ b/vtkm/exec/arg/testing/UnitTestFetchArrayDirectInOut.cxx @@ -27,7 +27,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; static vtkm::Id g_NumSets; diff --git a/vtkm/exec/arg/testing/UnitTestFetchArrayDirectOut.cxx b/vtkm/exec/arg/testing/UnitTestFetchArrayDirectOut.cxx index 6dde86a0f..50e509960 100644 --- a/vtkm/exec/arg/testing/UnitTestFetchArrayDirectOut.cxx +++ b/vtkm/exec/arg/testing/UnitTestFetchArrayDirectOut.cxx @@ -27,7 +27,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; static vtkm::Id g_NumSets; diff --git a/vtkm/exec/arg/testing/UnitTestFetchArrayTopologyMapIn.cxx b/vtkm/exec/arg/testing/UnitTestFetchArrayTopologyMapIn.cxx index 1b4c226ae..c800b2f52 100644 --- a/vtkm/exec/arg/testing/UnitTestFetchArrayTopologyMapIn.cxx +++ b/vtkm/exec/arg/testing/UnitTestFetchArrayTopologyMapIn.cxx @@ -30,7 +30,7 @@ namespace { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; template struct TestPortal diff --git a/vtkm/exec/cuda/internal/ArrayPortalFromThrust.h b/vtkm/exec/cuda/internal/ArrayPortalFromThrust.h index 8e0777837..6d1f78c8a 100644 --- a/vtkm/exec/cuda/internal/ArrayPortalFromThrust.h +++ b/vtkm/exec/cuda/internal/ArrayPortalFromThrust.h @@ -99,7 +99,7 @@ template <> struct UseMultipleScalarTextureLoads 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 struct load_through_texture::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 struct load_through_texture::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::value>::type> { - static const vtkm::IdComponent WillUseTexture = 1; + static constexpr vtkm::IdComponent WillUseTexture = 1; using NonConstT = typename std::remove_const::type; diff --git a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h index 9bf280d53..75c7972f4 100644 --- a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h +++ b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h @@ -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 diff --git a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in index dbdb849b9..babcaec86 100644 --- a/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in +++ b/vtkm/exec/internal/WorkletInvokeFunctorDetail.h.in @@ -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 diff --git a/vtkm/exec/testing/UnitTestCellDerivative.cxx b/vtkm/exec/testing/UnitTestCellDerivative.cxx index 2728fe43f..a3291e871 100644 --- a/vtkm/exec/testing/UnitTestCellDerivative.cxx +++ b/vtkm/exec/testing/UnitTestCellDerivative.cxx @@ -67,7 +67,7 @@ struct LinearField } }; -static const vtkm::IdComponent MAX_POINTS = 8; +static constexpr vtkm::IdComponent MAX_POINTS = 8; template void GetMinMaxPoints(CellShapeTag, diff --git a/vtkm/exec/testing/UnitTestCellInterpolate.cxx b/vtkm/exec/testing/UnitTestCellInterpolate.cxx index 9339adb37..c20abfc15 100644 --- a/vtkm/exec/testing/UnitTestCellInterpolate.cxx +++ b/vtkm/exec/testing/UnitTestCellInterpolate.cxx @@ -33,7 +33,7 @@ namespace { -static const vtkm::IdComponent MAX_POINTS = 8; +static constexpr vtkm::IdComponent MAX_POINTS = 8; template void GetMinMaxPoints(CellShapeTag, diff --git a/vtkm/exec/testing/UnitTestParametricCoordinates.cxx b/vtkm/exec/testing/UnitTestParametricCoordinates.cxx index aa63b11b1..544fa52dd 100644 --- a/vtkm/exec/testing/UnitTestParametricCoordinates.cxx +++ b/vtkm/exec/testing/UnitTestParametricCoordinates.cxx @@ -35,7 +35,7 @@ namespace std::mt19937 g_RandomGenerator; -static const vtkm::IdComponent MAX_POINTS = 8; +static constexpr vtkm::IdComponent MAX_POINTS = 8; template void GetMinMaxPoints(CellShapeTag, diff --git a/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx b/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx index fe33812e0..69d82c2cd 100644 --- a/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx +++ b/vtkm/filter/testing/UnitTestClipWithImplicitFunctionFilter.cxx @@ -31,9 +31,9 @@ using Coord3D = vtkm::Vec; 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) diff --git a/vtkm/filter/testing/UnitTestEntropyFilter.cxx b/vtkm/filter/testing/UnitTestEntropyFilter.cxx index 0b25e713b..7c25fb709 100644 --- a/vtkm/filter/testing/UnitTestEntropyFilter.cxx +++ b/vtkm/filter/testing/UnitTestEntropyFilter.cxx @@ -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 cellSet("cells"); cellSet.SetPointDimensions(vdims); dataSet.AddCellSet(cellSet); diff --git a/vtkm/filter/testing/UnitTestMarchingCubesFilter.cxx b/vtkm/filter/testing/UnitTestMarchingCubesFilter.cxx index b109fa29b..41eea7a29 100644 --- a/vtkm/filter/testing/UnitTestMarchingCubesFilter.cxx +++ b/vtkm/filter/testing/UnitTestMarchingCubesFilter.cxx @@ -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 cellSet("cells"); cellSet.SetPointDimensions(vdims); dataSet.AddCellSet(cellSet); diff --git a/vtkm/internal/ConnectivityStructuredInternals.h b/vtkm/internal/ConnectivityStructuredInternals.h index 724280a03..02b089ae9 100644 --- a/vtkm/internal/ConnectivityStructuredInternals.h +++ b/vtkm/internal/ConnectivityStructuredInternals.h @@ -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()); } diff --git a/vtkm/internal/FunctionInterface.h b/vtkm/internal/FunctionInterface.h index c92054d77..9955cfeeb 100644 --- a/vtkm/internal/FunctionInterface.h +++ b/vtkm/internal/FunctionInterface.h @@ -263,11 +263,11 @@ public: using type = typename detail::AtType::type; }; - static const bool RETURN_VALID = FunctionInterfaceReturnContainer::VALID; + static constexpr bool RETURN_VALID = FunctionInterfaceReturnContainer::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::ARITY + 1; vtkm::internal::IndexTag 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::ARITY + 1; vtkm::internal::IndexTag indexTag; this->Transform(this->OriginalInterface.GetParameter(indexTag), nextContinue, indexTag); diff --git a/vtkm/internal/IndexTag.h b/vtkm/internal/IndexTag.h index a243e4dc5..f7a4b1d3a 100644 --- a/vtkm/internal/IndexTag.h +++ b/vtkm/internal/IndexTag.h @@ -39,7 +39,7 @@ namespace internal template struct IndexTag { - static const vtkm::IdComponent INDEX = Index; + static constexpr vtkm::IdComponent INDEX = Index; }; } } // namespace vtkm::internal diff --git a/vtkm/internal/Invocation.h b/vtkm/internal/Invocation.h index 5df181a42..7b480ec35 100644 --- a/vtkm/internal/Invocation.h +++ b/vtkm/internal/Invocation.h @@ -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. /// diff --git a/vtkm/internal/testing/UnitTestArrayPortalValueReference.cxx b/vtkm/internal/testing/UnitTestArrayPortalValueReference.cxx index 2030269fc..239afa2d6 100644 --- a/vtkm/internal/testing/UnitTestArrayPortalValueReference.cxx +++ b/vtkm/internal/testing/UnitTestArrayPortalValueReference.cxx @@ -41,7 +41,7 @@ void CheckReference(vtkm::Id index, vtkm::internal::ArrayPortalValueReference(&i16); return (*i8p == 1); } diff --git a/vtkm/rendering/testing/glfw/UnitTestMapperGLFW.cxx b/vtkm/rendering/testing/glfw/UnitTestMapperGLFW.cxx index 7b4ad085d..9385e7937 100644 --- a/vtkm/rendering/testing/glfw/UnitTestMapperGLFW.cxx +++ b/vtkm/rendering/testing/glfw/UnitTestMapperGLFW.cxx @@ -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; diff --git a/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx b/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx index 4eb1a63b4..8520f0b83 100644 --- a/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx +++ b/vtkm/rendering/testing/glut/UnitTestMapperGLUT.cxx @@ -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; diff --git a/vtkm/testing/TestingMath.h b/vtkm/testing/TestingMath.h index ad5ffd0fe..02798e787 100644 --- a/vtkm/testing/TestingMath.h +++ b/vtkm/testing/TestingMath.h @@ -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 }; diff --git a/vtkm/testing/UnitTestMatrix.cxx b/vtkm/testing/UnitTestMatrix.cxx index 21feff5de..c01c45522 100644 --- a/vtkm/testing/UnitTestMatrix.cxx +++ b/vtkm/testing/UnitTestMatrix.cxx @@ -51,8 +51,8 @@ namespace template 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; using ComponentType = typename MatrixType::ComponentType; @@ -372,7 +372,7 @@ T RecursiveDeterminant(const vtkm::Matrix& A) template struct SquareMatrixTest { - static const vtkm::IdComponent SIZE = Size; + static constexpr vtkm::IdComponent SIZE = Size; using MatrixType = vtkm::Matrix; static void CheckMatrixSize() diff --git a/vtkm/testing/UnitTestVecFromPortal.cxx b/vtkm/testing/UnitTestVecFromPortal.cxx index dbafe3d03..d218cfeb0 100644 --- a/vtkm/testing/UnitTestVecFromPortal.cxx +++ b/vtkm/testing/UnitTestVecFromPortal.cxx @@ -25,7 +25,7 @@ namespace UnitTestVecFromPortalNamespace { -static const vtkm::IdComponent ARRAY_SIZE = 10; +static constexpr vtkm::IdComponent ARRAY_SIZE = 10; template void CheckType(T, T) diff --git a/vtkm/testing/UnitTestVecFromPortalPermute.cxx b/vtkm/testing/UnitTestVecFromPortalPermute.cxx index 600565f8d..f1cbc49a6 100644 --- a/vtkm/testing/UnitTestVecFromPortalPermute.cxx +++ b/vtkm/testing/UnitTestVecFromPortalPermute.cxx @@ -27,7 +27,7 @@ namespace UnitTestVecFromPortalPermuteNamespace { -static const vtkm::IdComponent ARRAY_SIZE = 10; +static constexpr vtkm::IdComponent ARRAY_SIZE = 10; template void CheckType(T, T) diff --git a/vtkm/testing/UnitTestVecTraits.cxx b/vtkm/testing/UnitTestVecTraits.cxx index 78cf883ca..f3ae948ae 100644 --- a/vtkm/testing/UnitTestVecTraits.cxx +++ b/vtkm/testing/UnitTestVecTraits.cxx @@ -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 { diff --git a/vtkm/testing/UnitTestVecVariable.cxx b/vtkm/testing/UnitTestVecVariable.cxx index da7171ba8..c8b342638 100644 --- a/vtkm/testing/UnitTestVecVariable.cxx +++ b/vtkm/testing/UnitTestVecVariable.cxx @@ -62,7 +62,7 @@ struct VecVariableTestFunctor template void operator()(T) const { - static const vtkm::IdComponent SIZE = 5; + static constexpr vtkm::IdComponent SIZE = 5; using VecType = vtkm::Vec; using VecVariableType = vtkm::VecVariable; using TTraits = vtkm::TypeTraits; diff --git a/vtkm/worklet/FieldStatistics.h b/vtkm/worklet/FieldStatistics.h index 57532d8b0..d8c01b25e 100644 --- a/vtkm/worklet/FieldStatistics.h +++ b/vtkm/worklet/FieldStatistics.h @@ -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 { diff --git a/vtkm/worklet/Keys.h b/vtkm/worklet/Keys.h index 7fcfe5343..92aff7114 100644 --- a/vtkm/worklet/Keys.h +++ b/vtkm/worklet/Keys.h @@ -271,7 +271,7 @@ namespace arg template struct TypeCheck> { - static const bool value = true; + static constexpr bool value = true; }; template diff --git a/vtkm/worklet/Probe.h b/vtkm/worklet/Probe.h index baa6d7390..756e9b60b 100644 --- a/vtkm/worklet/Probe.h +++ b/vtkm/worklet/Probe.h @@ -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 CellIds; vtkm::cont::ArrayHandle> ParametricCoordinates; diff --git a/vtkm/worklet/internal/DispatcherBase.h b/vtkm/worklet/internal/DispatcherBase.h index 03cab153d..dca1fdf19 100644 --- a/vtkm/worklet/internal/DispatcherBase.h +++ b/vtkm/worklet/internal/DispatcherBase.h @@ -363,7 +363,7 @@ protected: using ExecutionInterface = vtkm::internal::FunctionInterface; - 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 diff --git a/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx b/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx index 20efebee7..e5a6a320b 100644 --- a/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx +++ b/vtkm/worklet/internal/testing/UnitTestDispatcherBase.cxx @@ -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 { - static const bool value = true; + static constexpr bool value = true; }; template <> @@ -197,7 +197,7 @@ struct Fetch void CheckAverageByKey(const KeyArray& uniqueKeys, const ValueArray& averagedValues) diff --git a/vtkm/worklet/testing/UnitTestCellSetConnectivity.cpp b/vtkm/worklet/testing/UnitTestCellSetConnectivity.cpp index f7f801514..0ac230af5 100644 --- a/vtkm/worklet/testing/UnitTestCellSetConnectivity.cpp +++ b/vtkm/worklet/testing/UnitTestCellSetConnectivity.cpp @@ -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 cellSet("cells"); cellSet.SetPointDimensions(vdims); dataSet.AddCellSet(cellSet); diff --git a/vtkm/worklet/testing/UnitTestClipping.cxx b/vtkm/worklet/testing/UnitTestClipping.cxx index ba44346b2..f44bda19a 100644 --- a/vtkm/worklet/testing/UnitTestClipping.cxx +++ b/vtkm/worklet/testing/UnitTestClipping.cxx @@ -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) diff --git a/vtkm/worklet/testing/UnitTestKeys.cxx b/vtkm/worklet/testing/UnitTestKeys.cxx index 0aaf5ca77..8a2d80c66 100644 --- a/vtkm/worklet/testing/UnitTestKeys.cxx +++ b/vtkm/worklet/testing/UnitTestKeys.cxx @@ -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 void CheckKeyReduce(const KeyPortal& originalKeys, diff --git a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx index a9aa40409..422b4a4d3 100644 --- a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx +++ b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx @@ -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 cellSet("cells"); cellSet.SetPointDimensions(vdims); dataSet.AddCellSet(cellSet); diff --git a/vtkm/worklet/testing/UnitTestWorkletMapField.cxx b/vtkm/worklet/testing/UnitTestWorkletMapField.cxx index 107a8aac9..ae63483f7 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapField.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapField.cxx @@ -80,7 +80,7 @@ public: namespace mapfield { -static const vtkm::Id ARRAY_SIZE = 10; +static constexpr vtkm::Id ARRAY_SIZE = 10; template struct DoStaticTestWorklet diff --git a/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx b/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx index 45c7fba52..7b79433ed 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapFieldExecArg.cxx @@ -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 struct DoTestWorklet diff --git a/vtkm/worklet/testing/UnitTestWorkletMapFieldWholeArray.cxx b/vtkm/worklet/testing/UnitTestWorkletMapFieldWholeArray.cxx index 49d9e34e5..e7905bcc4 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapFieldWholeArray.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapFieldWholeArray.cxx @@ -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 { diff --git a/vtkm/worklet/testing/UnitTestWorkletReduceByKey.cxx b/vtkm/worklet/testing/UnitTestWorkletReduceByKey.cxx index bac8b5eb3..bf98c075f 100644 --- a/vtkm/worklet/testing/UnitTestWorkletReduceByKey.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletReduceByKey.cxx @@ -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 {