10 #ifndef vtk_m_internal_Invocation_h
11 #define vtk_m_internal_Invocation_h
27 template <
typename ParameterInterface_,
28 typename ControlInterface_,
29 typename ExecutionInterface_,
31 typename OutputToInputMapType_ = vtkm::internal::NullType,
32 typename VisitArrayType_ = vtkm::internal::NullType,
33 typename ThreadToOutputMapType_ = vtkm::internal::NullType,
34 typename DeviceAdapterTag_ = vtkm::internal::NullType>
42 using ParameterInterface = ParameterInterface_;
50 using ControlInterface = ControlInterface_;
58 using ExecutionInterface = ExecutionInterface_;
75 using OutputToInputMapType = OutputToInputMapType_;
84 using VisitArrayType = VisitArrayType_;
92 using ThreadToOutputMapType = ThreadToOutputMapType_;
99 using DeviceAdapterTag = DeviceAdapterTag_;
104 Invocation(
const ParameterInterface& parameters,
105 OutputToInputMapType outputToInputMap = OutputToInputMapType(),
106 VisitArrayType visitArray = VisitArrayType(),
107 ThreadToOutputMapType threadToOutputMap = ThreadToOutputMapType())
108 : Parameters(parameters)
109 , OutputToInputMap(outputToInputMap)
110 , VisitArray(visitArray)
111 , ThreadToOutputMap(threadToOutputMap)
115 Invocation(
const Invocation&) =
default;
120 template <
typename NewParameterInterface>
121 struct ChangeParametersType
123 using type = Invocation<NewParameterInterface,
127 OutputToInputMapType,
129 ThreadToOutputMapType,
136 template <
typename NewParameterInterface>
137 VTKM_CONT typename ChangeParametersType<NewParameterInterface>::type ChangeParameters(
138 const NewParameterInterface& newParameters)
const
140 return typename ChangeParametersType<NewParameterInterface>::type(
141 newParameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
147 template <
typename NewControlInterface>
148 struct ChangeControlInterfaceType
150 using type = Invocation<ParameterInterface,
154 OutputToInputMapType,
156 ThreadToOutputMapType,
163 template <
typename NewControlInterface>
164 typename ChangeControlInterfaceType<NewControlInterface>::type ChangeControlInterface(
165 NewControlInterface)
const
167 return typename ChangeControlInterfaceType<NewControlInterface>::type(
168 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
174 template <
typename NewExecutionInterface>
175 struct ChangeExecutionInterfaceType
177 using type = Invocation<ParameterInterface,
178 NewExecutionInterface,
181 OutputToInputMapType,
183 ThreadToOutputMapType,
190 template <
typename NewExecutionInterface>
191 typename ChangeExecutionInterfaceType<NewExecutionInterface>::type ChangeExecutionInterface(
192 NewExecutionInterface)
const
194 return typename ChangeExecutionInterfaceType<NewExecutionInterface>::type(
195 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
201 template <vtkm::IdComponent NewInputDomainIndex>
202 struct ChangeInputDomainIndexType
204 using type = Invocation<ParameterInterface,
208 OutputToInputMapType,
210 ThreadToOutputMapType,
217 template <vtkm::IdComponent NewInputDomainIndex>
218 VTKM_EXEC_CONT typename ChangeInputDomainIndexType<NewInputDomainIndex>::type
219 ChangeInputDomainIndex()
const
221 return typename ChangeInputDomainIndexType<NewInputDomainIndex>::type(
222 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
228 template <
typename NewOutputToInputMapType>
229 struct ChangeOutputToInputMapType
231 using type = Invocation<ParameterInterface,
235 NewOutputToInputMapType,
237 ThreadToOutputMapType,
244 template <
typename NewOutputToInputMapType>
245 VTKM_CONT typename ChangeOutputToInputMapType<NewOutputToInputMapType>::type
246 ChangeOutputToInputMap(NewOutputToInputMapType newOutputToInputMap)
const
248 return typename ChangeOutputToInputMapType<NewOutputToInputMapType>::type(
249 this->Parameters, newOutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
255 template <
typename NewVisitArrayType>
256 struct ChangeVisitArrayType
258 using type = Invocation<ParameterInterface,
262 OutputToInputMapType,
264 ThreadToOutputMapType,
271 template <
typename NewVisitArrayType>
272 VTKM_CONT typename ChangeVisitArrayType<NewVisitArrayType>::type ChangeVisitArray(
273 NewVisitArrayType newVisitArray)
const
275 return typename ChangeVisitArrayType<NewVisitArrayType>::type(
276 this->Parameters, this->OutputToInputMap, newVisitArray, this->ThreadToOutputMap);
282 template <
typename NewThreadToOutputMapType>
283 struct ChangeThreadToOutputMapType
285 using type = Invocation<ParameterInterface,
289 OutputToInputMapType,
291 NewThreadToOutputMapType,
298 template <
typename NewThreadToOutputMapType>
299 VTKM_CONT typename ChangeThreadToOutputMapType<NewThreadToOutputMapType>::type
300 ChangeThreadToOutputMap(NewThreadToOutputMapType newThreadToOutputMap)
const
302 return typename ChangeThreadToOutputMapType<NewThreadToOutputMapType>::type(
303 this->Parameters, this->OutputToInputMap, this->VisitArray, newThreadToOutputMap);
309 template <
typename NewDeviceAdapterTag>
310 struct ChangeDeviceAdapterTagType
312 using type = Invocation<ParameterInterface,
316 OutputToInputMapType,
318 ThreadToOutputMapType,
319 NewDeviceAdapterTag>;
325 template <
typename NewDeviceAdapterTag>
326 VTKM_CONT typename ChangeDeviceAdapterTagType<NewDeviceAdapterTag>::type ChangeDeviceAdapterTag(
327 NewDeviceAdapterTag)
const
329 return typename ChangeDeviceAdapterTagType<NewDeviceAdapterTag>::type(
330 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
335 using InputDomainType =
336 typename ParameterInterface::template ParameterType<InputDomainIndex>::type;
340 using InputDomainTag =
typename ControlInterface::template ParameterType<InputDomainIndex>::type;
346 const InputDomainType& GetInputDomain()
const
348 return vtkm::internal::ParameterGet<InputDomainIndex>(this->Parameters);
358 ParameterInterface Parameters;
359 OutputToInputMapType OutputToInputMap;
360 VisitArrayType VisitArray;
361 ThreadToOutputMapType ThreadToOutputMap;
365 void operator=(
const Invocation<ParameterInterface,
369 OutputToInputMapType,
371 ThreadToOutputMapType,
372 DeviceAdapterTag>&) =
delete;
378 typename ControlInterface,
379 typename ExecutionInterface,
380 typename ParameterInterface,
381 typename OutputToInputMapType,
382 typename VisitArrayType,
383 typename ThreadToOutputMapType>
384 VTKM_CONT vtkm::internal::Invocation<ParameterInterface,
388 OutputToInputMapType,
390 ThreadToOutputMapType>
391 make_Invocation(
const ParameterInterface& params,
394 OutputToInputMapType outputToInputMap,
395 VisitArrayType visitArray,
396 ThreadToOutputMapType threadToOutputMap)
398 return vtkm::internal::Invocation<ParameterInterface,
402 OutputToInputMapType,
404 ThreadToOutputMapType>(
405 params, outputToInputMap, visitArray, threadToOutputMap);
408 typename ControlInterface,
409 typename ExecutionInterface,
410 typename ParameterInterface>
412 Invocation<ParameterInterface, ControlInterface, ExecutionInterface, InputDomainIndex>
413 make_Invocation(
const ParameterInterface& params,
414 ControlInterface = ControlInterface(),
415 ExecutionInterface = ExecutionInterface())
417 return vtkm::internal::make_Invocation<InputDomainIndex>(params,
419 ExecutionInterface(),
420 vtkm::internal::NullType(),
421 vtkm::internal::NullType(),
422 vtkm::internal::NullType());
427 #endif //vtk_m_internal_Invocation_h