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>
54 class TaskStrided1D :
public TaskStrided
57 TaskStrided1D(
const WType& worklet,
const IType& invocation)
60 , Invocation(invocation)
62 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
64 this->WPtr = (
void*)&this->Worklet;
70 for (
vtkm::Id index = start; index < end; index += inc)
73 vtkm::exec::internal::detail::DoWorkletInvokeFunctor(
76 this->Worklet.GetThreadIndices(index,
77 this->Invocation.OutputToInputMap,
78 this->Invocation.VisitArray,
79 this->Invocation.ThreadToOutputMap,
80 this->Invocation.GetInputDomain()));
85 typename std::remove_const<WType>::type Worklet;
90 const IType Invocation;
93 template <
typename WType>
94 class TaskStrided1D<WType,
vtkm::internal::NullType> :
public TaskStrided
97 TaskStrided1D(WType& worklet)
101 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
103 this->WPtr = (
void*)&this->Worklet;
109 for (
vtkm::Id index = start; index < end; index += inc)
111 this->Worklet(index);
116 typename std::remove_const<WType>::type Worklet;
119 template <
typename WType,
typename IType>
120 class TaskStrided3D :
public TaskStrided
123 TaskStrided3D(
const WType& worklet,
const IType& invocation)
126 , Invocation(invocation)
128 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
130 this->WPtr = (
void*)&this->Worklet;
142 auto threadIndex1D = index[0] + size[0] * (index[1] + size[1] * index[2]);
143 for (
vtkm::Id i = start; i < end; i += inc, threadIndex1D += inc)
147 vtkm::exec::internal::detail::DoWorkletInvokeFunctor(
150 this->Worklet.GetThreadIndices(threadIndex1D,
152 this->Invocation.OutputToInputMap,
153 this->Invocation.VisitArray,
154 this->Invocation.ThreadToOutputMap,
155 this->Invocation.GetInputDomain()));
160 typename std::remove_const<WType>::type Worklet;
165 const IType Invocation;
168 template <
typename WType>
169 class TaskStrided3D<WType,
vtkm::internal::NullType> :
public TaskStrided
172 TaskStrided3D(WType& worklet)
176 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
178 this->WPtr = (
void*)&this->Worklet;
190 for (
vtkm::Id i = start; i < end; i += inc)
193 this->Worklet(index);
198 typename std::remove_const<WType>::type Worklet;
205 #endif //vtk_m_exec_cuda_internal_TaskStrided_h