Threshold worklet is not templated on device adapter.

This should help reduce the amount of code generation, when building the
Threshold worklet for all device adapters.
This commit is contained in:
Robert Maynard 2016-01-08 13:32:04 -05:00
parent dbee92752e
commit 18b866d6e0
2 changed files with 20 additions and 13 deletions

@ -33,7 +33,6 @@
namespace vtkm {
namespace worklet {
template <typename DeviceAdapter>
class Threshold
{
public:
@ -102,10 +101,12 @@ public:
UnaryPredicate Predicate;
};
template <typename CellSetType, typename UnaryPredicate>
template <typename CellSetType, typename UnaryPredicate, typename DeviceAdapter>
vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>, CellSetType>
Run(const CellSetType &cellSet, const vtkm::cont::Field &field,
const UnaryPredicate &predicate)
Run(const CellSetType &cellSet,
const vtkm::cont::Field &field,
const UnaryPredicate &predicate,
DeviceAdapter)
{
typedef vtkm::cont::CellSetPermutation<vtkm::cont::ArrayHandle<vtkm::Id>,
CellSetType> OutputType;

@ -70,9 +70,11 @@ public:
CellSetType cellset = dataset.GetCellSet(0).CastTo(CellSetType());
vtkm::worklet::Threshold<DeviceAdapter> threshold;
OutCellSetType outCellSet = threshold.Run(cellset, dataset.GetField("pointvar"),
HasValue(60.1f));
vtkm::worklet::Threshold threshold;
OutCellSetType outCellSet = threshold.Run(cellset,
dataset.GetField("pointvar"),
HasValue(60.1f),
DeviceAdapter());
vtkm::cont::Field cellField =
threshold.ProcessCellField(dataset.GetField("cellvar"));
@ -101,9 +103,11 @@ public:
CellSetType cellset = dataset.GetCellSet(0).CastTo(CellSetType());
vtkm::worklet::Threshold<DeviceAdapter> threshold;
OutCellSetType outCellSet = threshold.Run(cellset, dataset.GetField("pointvar"),
HasValue(20.1f));
vtkm::worklet::Threshold threshold;
OutCellSetType outCellSet = threshold.Run(cellset,
dataset.GetField("pointvar"),
HasValue(20.1f),
DeviceAdapter());
vtkm::cont::Field cellField =
threshold.ProcessCellField(dataset.GetField("cellvar"));
@ -133,9 +137,11 @@ public:
CellSetType cellset = dataset.GetCellSet(0).CastTo(CellSetType());
vtkm::worklet::Threshold<DeviceAdapter> threshold;
OutCellSetType outCellSet = threshold.Run(cellset, dataset.GetField("cellvar"),
HasValue(100.1f));
vtkm::worklet::Threshold threshold;
OutCellSetType outCellSet = threshold.Run(cellset,
dataset.GetField("cellvar"),
HasValue(100.1f),
DeviceAdapter());
vtkm::cont::Field cellField =
threshold.ProcessCellField(dataset.GetField("cellvar"));