17 #ifndef vtkToDax_Threshold_h
18 #define vtkToDax_Threshold_h
28 #include <dax/cont/DispatcherGenerateTopology.h>
29 #include <dax/cont/DispatcherMapCell.h>
30 #include <dax/worklet/Threshold.h>
34 template <
typename T>
struct ThresholdOuputType
38 template <>
struct ThresholdOuputType<
dax::CellTagVoxel >
40 typedef dax::CellTagHexahedron
type;
50 template<
class InGridType,
61 const dax::cont::ArrayHandle<ValueType,Container,Adapter> &)
63 vtkGenericWarningMacro(
64 <<
"Not calling Dax, GridType-CellType combination not supported");
71 template<
class InGridType,
77 const InGridType &inDaxGrid,
79 OutGridType &outDaxGeom,
81 ValueType thresholdMin,
82 ValueType thresholdMax,
83 const dax::cont::ArrayHandle<ValueType,Container,Adapter> &thresholdHandle)
88 typedef dax::worklet::ThresholdCount<ValueType> ThresholdCountType;
90 typedef dax::cont::DispatcherGenerateTopology<
91 dax::worklet::ThresholdTopology,
92 dax::cont::ArrayHandle< dax::Id >,
95 typedef typename DispatchGT::CountHandleType CountHandleType;
97 ThresholdCountType countWorklet(thresholdMin,thresholdMax);
98 dax::cont::DispatcherMapCell<ThresholdCountType,Adapter>
99 dispatchCount( countWorklet );
101 CountHandleType count;
102 dispatchCount.Invoke(inDaxGrid, thresholdHandle, count);
104 DispatchGT resolveTopology(count);
105 resolveTopology.Invoke(inDaxGrid,outDaxGeom);
121 for (
int arrayIndex = 0;
122 arrayIndex < pd->GetNumberOfArrays();
126 if (array == NULL) {
continue; }
128 compactDispatcher.
Go(array);
132 for (
int attributeType = 0;
136 vtkDataArray *attribute = pd->GetAttribute(attributeType);
137 if (attribute == NULL) {
continue; }
142 catch(
const dax::cont::ErrorControlOutOfMemory& error)
144 std::cerr <<
"Ran out of memory trying to use the GPU" << std::endl;
145 std::cerr << error.GetMessage() << std::endl;
148 catch(
const dax::cont::ErrorExecution& error)
150 std::cerr <<
"Got ErrorExecution from Dax." << std::endl;
151 std::cerr << error.GetMessage() << std::endl;
158 template<
typename FieldType_>
164 typedef typename FieldType::ValueType
T;
185 template<
typename LHS,
typename RHS>
193 typedef typename ThresholdOuputType< typename VTKCellTypeStruct::DaxCellType >::type OutCellType;
196 typedef typename DataSetTypeToTypeStruct::DaxDataSetType InputDataSetType;
203 dax::cont::UnstructuredGrid<OutCellType,
208 DataSetTypeToTypeStruct());
211 int result = threshold(inputDaxData,
232 #endif //vtkToDax_Threshold_h