18 #ifndef viskores_exec_cuda_internal_TaskStrided_h
19 #define viskores_exec_cuda_internal_TaskStrided_h
37 template <
typename WType>
38 void TaskStridedSetErrorBuffer(
void* w,
const viskores::exec::internal::ErrorMessageBuffer& buffer)
40 using WorkletType =
typename std::remove_cv<WType>::type;
41 WorkletType*
const worklet =
static_cast<WorkletType*
>(w);
42 worklet->SetErrorMessageBuffer(buffer);
48 void SetErrorMessageBuffer(
const viskores::exec::internal::ErrorMessageBuffer& buffer)
51 this->SetErrorBufferFunction(this->WPtr, buffer);
57 using SetErrorBufferSignature = void (*)(
void*,
58 const viskores::exec::internal::ErrorMessageBuffer&);
59 SetErrorBufferSignature SetErrorBufferFunction =
nullptr;
62 template <
typename WType,
typename IType,
typename H
ints>
63 class TaskStrided1D :
public TaskStrided
68 TaskStrided1D(
const WType& worklet,
const IType& invocation)
71 , Invocation(invocation)
73 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
75 this->WPtr = (
void*)&this->Worklet;
81 for (
viskores::Id index = start; index < end; index += inc)
84 viskores::exec::internal::detail::DoWorkletInvokeFunctor(
87 this->Worklet.GetThreadIndices(index,
88 this->Invocation.OutputToInputMap,
89 this->Invocation.VisitArray,
90 this->Invocation.ThreadToOutputMap,
91 this->Invocation.GetInputDomain()));
96 typename std::remove_const<WType>::type Worklet;
101 const IType Invocation;
104 template <
typename WType,
typename H
ints>
105 class TaskStrided1D<WType,
viskores::internal::NullType, Hints> :
public TaskStrided
110 TaskStrided1D(WType& worklet)
114 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
116 this->WPtr = (
void*)&this->Worklet;
122 for (
viskores::Id index = start; index < end; index += inc)
124 this->Worklet(index);
129 typename std::remove_const<WType>::type Worklet;
132 template <
typename WType,
typename IType,
typename H
ints>
133 class TaskStrided3D :
public TaskStrided
138 TaskStrided3D(
const WType& worklet,
const IType& invocation)
141 , Invocation(invocation)
143 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
145 this->WPtr = (
void*)&this->Worklet;
157 auto threadIndex1D = index[0] + size[0] * (index[1] + size[1] * index[2]);
158 for (
viskores::Id i = start; i < end; i += inc, threadIndex1D += inc)
162 viskores::exec::internal::detail::DoWorkletInvokeFunctor(
165 this->Worklet.GetThreadIndices(threadIndex1D,
167 this->Invocation.OutputToInputMap,
168 this->Invocation.VisitArray,
169 this->Invocation.ThreadToOutputMap,
170 this->Invocation.GetInputDomain()));
175 typename std::remove_const<WType>::type Worklet;
180 const IType Invocation;
183 template <
typename WType,
typename H
ints>
184 class TaskStrided3D<WType,
viskores::internal::NullType, Hints> :
public TaskStrided
189 TaskStrided3D(WType& worklet)
193 this->SetErrorBufferFunction = &TaskStridedSetErrorBuffer<WType>;
195 this->WPtr = (
void*)&this->Worklet;
210 this->Worklet(index);
215 typename std::remove_const<WType>::type Worklet;
222 #endif //viskores_exec_cuda_internal_TaskStrided_h