18 #ifndef viskores_internal_Invocation_h
19 #define viskores_internal_Invocation_h
35 template <
typename ParameterInterface_,
36 typename ControlInterface_,
37 typename ExecutionInterface_,
39 typename OutputToInputMapType_ = viskores::internal::NullType,
40 typename VisitArrayType_ = viskores::internal::NullType,
41 typename ThreadToOutputMapType_ = viskores::internal::NullType,
42 typename DeviceAdapterTag_ = viskores::internal::NullType>
50 using ParameterInterface = ParameterInterface_;
58 using ControlInterface = ControlInterface_;
66 using ExecutionInterface = ExecutionInterface_;
83 using OutputToInputMapType = OutputToInputMapType_;
92 using VisitArrayType = VisitArrayType_;
100 using ThreadToOutputMapType = ThreadToOutputMapType_;
107 using DeviceAdapterTag = DeviceAdapterTag_;
112 Invocation(
const ParameterInterface& parameters,
113 OutputToInputMapType outputToInputMap = OutputToInputMapType(),
114 VisitArrayType visitArray = VisitArrayType(),
115 ThreadToOutputMapType threadToOutputMap = ThreadToOutputMapType())
116 : Parameters(parameters)
117 , OutputToInputMap(outputToInputMap)
118 , VisitArray(visitArray)
119 , ThreadToOutputMap(threadToOutputMap)
123 Invocation(
const Invocation&) =
default;
128 template <
typename NewParameterInterface>
129 struct ChangeParametersType
131 using type = Invocation<NewParameterInterface,
135 OutputToInputMapType,
137 ThreadToOutputMapType,
144 template <
typename NewParameterInterface>
145 VISKORES_CONT typename ChangeParametersType<NewParameterInterface>::type ChangeParameters(
146 const NewParameterInterface& newParameters)
const
148 return typename ChangeParametersType<NewParameterInterface>::type(
149 newParameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
155 template <
typename NewControlInterface>
156 struct ChangeControlInterfaceType
158 using type = Invocation<ParameterInterface,
162 OutputToInputMapType,
164 ThreadToOutputMapType,
171 template <
typename NewControlInterface>
172 typename ChangeControlInterfaceType<NewControlInterface>::type ChangeControlInterface(
173 NewControlInterface)
const
175 return typename ChangeControlInterfaceType<NewControlInterface>::type(
176 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
182 template <
typename NewExecutionInterface>
183 struct ChangeExecutionInterfaceType
185 using type = Invocation<ParameterInterface,
186 NewExecutionInterface,
189 OutputToInputMapType,
191 ThreadToOutputMapType,
198 template <
typename NewExecutionInterface>
199 typename ChangeExecutionInterfaceType<NewExecutionInterface>::type ChangeExecutionInterface(
200 NewExecutionInterface)
const
202 return typename ChangeExecutionInterfaceType<NewExecutionInterface>::type(
203 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
209 template <viskores::IdComponent NewInputDomainIndex>
210 struct ChangeInputDomainIndexType
212 using type = Invocation<ParameterInterface,
216 OutputToInputMapType,
218 ThreadToOutputMapType,
225 template <viskores::IdComponent NewInputDomainIndex>
227 ChangeInputDomainIndex()
const
229 return typename ChangeInputDomainIndexType<NewInputDomainIndex>::type(
230 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
236 template <
typename NewOutputToInputMapType>
237 struct ChangeOutputToInputMapType
239 using type = Invocation<ParameterInterface,
243 NewOutputToInputMapType,
245 ThreadToOutputMapType,
252 template <
typename NewOutputToInputMapType>
253 VISKORES_CONT typename ChangeOutputToInputMapType<NewOutputToInputMapType>::type
254 ChangeOutputToInputMap(NewOutputToInputMapType newOutputToInputMap)
const
256 return typename ChangeOutputToInputMapType<NewOutputToInputMapType>::type(
257 this->Parameters, newOutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
263 template <
typename NewVisitArrayType>
264 struct ChangeVisitArrayType
266 using type = Invocation<ParameterInterface,
270 OutputToInputMapType,
272 ThreadToOutputMapType,
279 template <
typename NewVisitArrayType>
280 VISKORES_CONT typename ChangeVisitArrayType<NewVisitArrayType>::type ChangeVisitArray(
281 NewVisitArrayType newVisitArray)
const
283 return typename ChangeVisitArrayType<NewVisitArrayType>::type(
284 this->Parameters, this->OutputToInputMap, newVisitArray, this->ThreadToOutputMap);
290 template <
typename NewThreadToOutputMapType>
291 struct ChangeThreadToOutputMapType
293 using type = Invocation<ParameterInterface,
297 OutputToInputMapType,
299 NewThreadToOutputMapType,
306 template <
typename NewThreadToOutputMapType>
307 VISKORES_CONT typename ChangeThreadToOutputMapType<NewThreadToOutputMapType>::type
308 ChangeThreadToOutputMap(NewThreadToOutputMapType newThreadToOutputMap)
const
310 return typename ChangeThreadToOutputMapType<NewThreadToOutputMapType>::type(
311 this->Parameters, this->OutputToInputMap, this->VisitArray, newThreadToOutputMap);
317 template <
typename NewDeviceAdapterTag>
318 struct ChangeDeviceAdapterTagType
320 using type = Invocation<ParameterInterface,
324 OutputToInputMapType,
326 ThreadToOutputMapType,
327 NewDeviceAdapterTag>;
333 template <
typename NewDeviceAdapterTag>
334 VISKORES_CONT typename ChangeDeviceAdapterTagType<NewDeviceAdapterTag>::type
335 ChangeDeviceAdapterTag(NewDeviceAdapterTag)
const
337 return typename ChangeDeviceAdapterTagType<NewDeviceAdapterTag>::type(
338 this->Parameters, this->OutputToInputMap, this->VisitArray, this->ThreadToOutputMap);
343 using InputDomainType =
344 typename ParameterInterface::template ParameterType<InputDomainIndex>::type;
348 using InputDomainTag =
typename ControlInterface::template ParameterType<InputDomainIndex>::type;
354 const InputDomainType& GetInputDomain()
const
356 return viskores::internal::ParameterGet<InputDomainIndex>(this->Parameters);
366 ParameterInterface Parameters;
367 OutputToInputMapType OutputToInputMap;
368 VisitArrayType VisitArray;
369 ThreadToOutputMapType ThreadToOutputMap;
373 void operator=(
const Invocation<ParameterInterface,
377 OutputToInputMapType,
379 ThreadToOutputMapType,
380 DeviceAdapterTag>&) =
delete;
386 typename ControlInterface,
387 typename ExecutionInterface,
388 typename ParameterInterface,
389 typename OutputToInputMapType,
390 typename VisitArrayType,
391 typename ThreadToOutputMapType>
392 VISKORES_CONT viskores::internal::Invocation<ParameterInterface,
396 OutputToInputMapType,
398 ThreadToOutputMapType>
399 make_Invocation(
const ParameterInterface& params,
402 OutputToInputMapType outputToInputMap,
403 VisitArrayType visitArray,
404 ThreadToOutputMapType threadToOutputMap)
406 return viskores::internal::Invocation<ParameterInterface,
410 OutputToInputMapType,
412 ThreadToOutputMapType>(
413 params, outputToInputMap, visitArray, threadToOutputMap);
416 typename ControlInterface,
417 typename ExecutionInterface,
418 typename ParameterInterface>
420 Invocation<ParameterInterface, ControlInterface, ExecutionInterface, InputDomainIndex>
421 make_Invocation(
const ParameterInterface& params,
422 ControlInterface = ControlInterface(),
423 ExecutionInterface = ExecutionInterface())
425 return viskores::internal::make_Invocation<InputDomainIndex>(params,
427 ExecutionInterface(),
428 viskores::internal::NullType(),
429 viskores::internal::NullType(),
430 viskores::internal::NullType());
435 #endif //viskores_internal_Invocation_h