From a512cd495e8fcfa3252673fa5a49ec4b90684958 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 3 Oct 2018 13:42:34 -0400 Subject: [PATCH] Allow runtime construction of DeviceAdapterId When need some way to convert user input such as an integer or string to a device adapter id. This allows for integer to device adapter id. --- vtkm/cont/internal/DeviceAdapterTag.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vtkm/cont/internal/DeviceAdapterTag.h b/vtkm/cont/internal/DeviceAdapterTag.h index e60ab15a3..ace1940c6 100644 --- a/vtkm/cont/internal/DeviceAdapterTag.h +++ b/vtkm/cont/internal/DeviceAdapterTag.h @@ -63,6 +63,8 @@ struct DeviceAdapterId DeviceAdapterNameType GetName() const; protected: + friend DeviceAdapterId make_DeviceAdapterId(vtkm::Int8 id); + constexpr explicit DeviceAdapterId(vtkm::Int8 id) : Value(id) { @@ -72,6 +74,11 @@ private: vtkm::Int8 Value; }; +DeviceAdapterId make_DeviceAdapterId(vtkm::Int8 id) +{ + return DeviceAdapterId(id); +} + template struct DeviceAdapterTraits; }