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
void dataSetConverter(const dax::cont::UniformGrid<> &grid, vtkImageData *output)
represent and manipulate point attribute data
void Add(Functor fun)
Add in a functor that is mapped to the template SomeLhs parameter.
abstract class to specify dataset behavior
dynamic, self-adjusting array of float
void setFieldName(const char *name)
int operator()(LHS &dataSet, const RHS &) const
Threshold(const FieldType &f, T min, T max)
dynamic, self-adjusting array of double
vtkPointData * GetPointData()
Return a pointer to this dataset's point data.
dynamic, self-adjusting array of int
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
virtual char * GetName()
Set/get array's name.
Dispatch to functor based on a pointer type.
dynamic, self-adjusting array of unsigned char
void setOutputGrid(vtkUnstructuredGrid *grid)
ReturnType Go(BaseLhs *lhs)
Given a pointer to an object that derives from the BaseLhs we find the matching functor that was adde...
int SetActiveAttribute(const char *name, int attributeType)
Make the array with the given name the active attribute.
VTKDataSetType::DaxDataSetType dataSetConverter(vtkImageData *input, VTKDataSetType)
int operator()(const InGridType &inDaxGrid, vtkDataSet *inVTKGrid, OutGridType &outDaxGeom, vtkUnstructuredGrid *outVTKGrid, ValueType thresholdMin, ValueType thresholdMax, const dax::cont::ArrayHandle< ValueType, Container, Adapter > &thresholdHandle)
int operator()(const InGridType &, vtkDataSet *, OutGridType &, vtkUnstructuredGrid *, ValueType, ValueType, const dax::cont::ArrayHandle< ValueType, Container, Adapter > &)