mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Add Algorithm::Transform
Adding Algorithm::Transform API to match API provided by `DeviceAdatorAlgorithm`.
This commit is contained in:
parent
22f38ecc43
commit
60a8ea67b4
@ -239,6 +239,17 @@ struct SynchronizeFunctor
|
||||
}
|
||||
};
|
||||
|
||||
struct TransformFunctor
|
||||
{
|
||||
template <typename Device, typename... Args>
|
||||
VTKM_CONT bool operator()(Device, Args&&... args) const
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||
vtkm::cont::DeviceAdapterAlgorithm<Device>::Transform(std::forward<Args>(args)...);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct UniqueFunctor
|
||||
{
|
||||
template <typename Device, typename... Args>
|
||||
@ -494,6 +505,21 @@ struct Algorithm
|
||||
|
||||
VTKM_CONT static void Synchronize() { vtkm::cont::TryExecute(SynchronizeFunctor()); }
|
||||
|
||||
template <typename T,
|
||||
typename U,
|
||||
typename V,
|
||||
typename StorageT,
|
||||
typename StorageU,
|
||||
typename StorageV,
|
||||
typename BinaryFunctor>
|
||||
VTKM_CONT static void Transform(const vtkm::cont::ArrayHandle<T, StorageT>& input1,
|
||||
const vtkm::cont::ArrayHandle<U, StorageU>& input2,
|
||||
vtkm::cont::ArrayHandle<V, StorageV>& output,
|
||||
BinaryFunctor binaryFunctor)
|
||||
{
|
||||
vtkm::cont::TryExecute(TransformFunctor(), input1, input2, output, binaryFunctor);
|
||||
}
|
||||
|
||||
template <typename T, class Storage>
|
||||
VTKM_CONT static void Unique(vtkm::cont::ArrayHandle<T, Storage>& values)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user