10 #ifndef vtk_m_exec_cuda_internal_TaskStrided_h
11 #define vtk_m_exec_cuda_internal_TaskStrided_h
29 template <
typename WType>
30 void TaskStridedSetErrorBuffer(
void* w,
const vtkm::exec::internal::ErrorMessageBuffer& buffer)
32 using WorkletType =
typename std::remove_cv<WType>::type;
33 WorkletType*
const worklet =
static_cast<WorkletType*
>(w);
34 worklet->SetErrorMessageBuffer(buffer);
40 void SetErrorMessageBuffer(
const vtkm::exec::internal::ErrorMessageBuffer& buffer)
43 this->SetErrorBufferFunction(this->WPtr, buffer);
49 using SetErrorBufferSignature = void (*)(
void*,
const vtkm::exec::internal::ErrorMessageBuffer&);
50 SetErrorBufferSignature SetErrorBufferFunction =
nullptr;
53 template <
typename WType,
typename IType,
typename H
ints>
54 class TaskStrided1D :
public TaskStrided
59 TaskStrided1D(
const WType& worklet,
const IType& invocation)
62 , Invocation(invocation)
64 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
66 this->WPtr = (
void*)&this->Worklet;
72 for (
vtkm::Id index = start; index < end; index += inc)
75 vtkm::exec::internal::detail::DoWorkletInvokeFunctor(
78 this->Worklet.GetThreadIndices(index,
79 this->Invocation.OutputToInputMap,
80 this->Invocation.VisitArray,
81 this->Invocation.ThreadToOutputMap,
82 this->Invocation.GetInputDomain()));
87 typename std::remove_const<WType>::type Worklet;
92 const IType Invocation;
95 template <
typename WType,
typename H
ints>
96 class TaskStrided1D<WType,
vtkm::internal::NullType, Hints> :
public TaskStrided
101 TaskStrided1D(WType& worklet)
105 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
107 this->WPtr = (
void*)&this->Worklet;
113 for (
vtkm::Id index = start; index < end; index += inc)
115 this->Worklet(index);
120 typename std::remove_const<WType>::type Worklet;
123 template <
typename WType,
typename IType,
typename H
ints>
124 class TaskStrided3D :
public TaskStrided
129 TaskStrided3D(
const WType& worklet,
const IType& invocation)
132 , Invocation(invocation)
134 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
136 this->WPtr = (
void*)&this->Worklet;
148 auto threadIndex1D = index[0] + size[0] * (index[1] + size[1] * index[2]);
149 for (
vtkm::Id i = start; i < end; i += inc, threadIndex1D += inc)
153 vtkm::exec::internal::detail::DoWorkletInvokeFunctor(
156 this->Worklet.GetThreadIndices(threadIndex1D,
158 this->Invocation.OutputToInputMap,
159 this->Invocation.VisitArray,
160 this->Invocation.ThreadToOutputMap,
161 this->Invocation.GetInputDomain()));
166 typename std::remove_const<WType>::type Worklet;
171 const IType Invocation;
174 template <
typename WType,
typename H
ints>
175 class TaskStrided3D<WType,
vtkm::internal::NullType, Hints> :
public TaskStrided
180 TaskStrided3D(WType& worklet)
184 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
186 this->WPtr = (
void*)&this->Worklet;
198 for (
vtkm::Id i = start; i < end; i += inc)
201 this->Worklet(index);
206 typename std::remove_const<WType>::type Worklet;
213 #endif //vtk_m_exec_cuda_internal_TaskStrided_h