mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Make DeviceAdapterId constructor protected.
This forces users to use a defined tag, since they shouldn't need to create their own.
This commit is contained in:
parent
e9d8ff4371
commit
024a75821d
@ -31,7 +31,7 @@ namespace internal
|
||||
|
||||
DeviceAdapterId ExecutionArrayInterfaceBasic<DeviceAdapterTagCuda>::GetDeviceId() const
|
||||
{
|
||||
return DeviceAdapterId(VTKM_DEVICE_ADAPTER_CUDA);
|
||||
return DeviceAdapterTagCuda{};
|
||||
}
|
||||
|
||||
void ExecutionArrayInterfaceBasic<DeviceAdapterTagCuda>::Allocate(TypelessExecutionArray& execArray,
|
||||
|
@ -44,11 +44,6 @@ namespace cont
|
||||
|
||||
struct DeviceAdapterId
|
||||
{
|
||||
constexpr explicit DeviceAdapterId(vtkm::Int8 id)
|
||||
: Value(id)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr bool operator==(DeviceAdapterId other) const { return this->Value == other.Value; }
|
||||
constexpr bool operator!=(DeviceAdapterId other) const { return this->Value != other.Value; }
|
||||
constexpr bool operator<(DeviceAdapterId other) const { return this->Value < other.Value; }
|
||||
@ -60,6 +55,12 @@ struct DeviceAdapterId
|
||||
|
||||
constexpr vtkm::Int8 GetValue() const { return this->Value; }
|
||||
|
||||
protected:
|
||||
constexpr explicit DeviceAdapterId(vtkm::Int8 id)
|
||||
: Value(id)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::Int8 Value;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ namespace internal
|
||||
|
||||
DeviceAdapterId ExecutionArrayInterfaceBasic<DeviceAdapterTagOpenMP>::GetDeviceId() const
|
||||
{
|
||||
return DeviceAdapterId(VTKM_DEVICE_ADAPTER_OPENMP);
|
||||
return DeviceAdapterTagOpenMP{};
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -27,7 +27,7 @@ namespace internal
|
||||
{
|
||||
DeviceAdapterId ExecutionArrayInterfaceBasic<DeviceAdapterTagSerial>::GetDeviceId() const
|
||||
{
|
||||
return DeviceAdapterId(VTKM_DEVICE_ADAPTER_SERIAL);
|
||||
return DeviceAdapterTagSerial{};
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -27,7 +27,7 @@ namespace internal
|
||||
{
|
||||
DeviceAdapterId ExecutionArrayInterfaceBasic<DeviceAdapterTagTBB>::GetDeviceId() const
|
||||
{
|
||||
return DeviceAdapterId(VTKM_DEVICE_ADAPTER_TBB);
|
||||
return DeviceAdapterTagTBB{};
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -131,7 +131,7 @@ struct ExecutionArrayInterfaceBasic<DeviceAdapterTagTestAlgorithmGeneral>
|
||||
using ExecutionArrayInterfaceBasicShareWithControl::ExecutionArrayInterfaceBasicShareWithControl;
|
||||
|
||||
VTKM_CONT
|
||||
DeviceAdapterId GetDeviceId() const final { return DeviceAdapterId(7); }
|
||||
DeviceAdapterId GetDeviceId() const final { return DeviceAdapterTagTestAlgorithmGeneral{}; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user