Make .in files match new formatting

More corrections for the autoformatter and .in files.
This commit is contained in:
Kenneth Moreland 2017-05-31 09:37:29 -06:00
parent 32c7f0a8fd
commit 731bb64a0b
7 changed files with 1265 additions and 941 deletions

@ -517,8 +517,8 @@ static inline VTKM_EXEC_CONT T Max(const T& x, const T& y, vtkm::TypeTraitsVecto
T result;
for (vtkm::IdComponent index = 0; index < Traits::NUM_COMPONENTS; index++)
{
Traits::SetComponent(result, index,
vtkm::Max(Traits::GetComponent(x, index), Traits::GetComponent(y, index)));
Traits::SetComponent(
result, index, vtkm::Max(Traits::GetComponent(x, index), Traits::GetComponent(y, index)));
}
return result;
}
@ -536,8 +536,8 @@ static inline VTKM_EXEC_CONT T Min(const T& x, const T& y, vtkm::TypeTraitsVecto
T result;
for (vtkm::IdComponent index = 0; index < Traits::NUM_COMPONENTS; index++)
{
Traits::SetComponent(result, index,
vtkm::Min(Traits::GetComponent(x, index), Traits::GetComponent(y, index)));
Traits::SetComponent(
result, index, vtkm::Min(Traits::GetComponent(x, index), Traits::GetComponent(y, index)));
}
return result;
}

@ -42,6 +42,7 @@
#error Mismatch of maximum parameters between FunctionInterfaceDatailPre.h.in and WorkletInvokeFunctorDetail.h.in
#endif
namespace vtkm
{
namespace exec
@ -83,6 +84,8 @@ struct InvocationToFetch
typedef vtkm::exec::arg::Fetch<FetchTag, AspectTag, ThreadIndicesType, ExecObjectType> type;
};
// clang-format off
template <typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
@ -980,13 +983,12 @@ VTKM_EXEC void DoWorkletInvokeFunctor(
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1087,13 +1089,12 @@ VTKM_EXEC void DoWorkletInvokeFunctor(
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1204,22 +1205,20 @@ template <typename WorkletType,
typename P7>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1323,22 +1322,20 @@ template <typename WorkletType,
typename P8>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1460,22 +1457,20 @@ template <typename WorkletType,
typename P8>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1590,22 +1585,20 @@ template <typename WorkletType,
typename P9>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1738,22 +1731,20 @@ template <typename WorkletType,
typename P9>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1879,22 +1870,20 @@ template <typename WorkletType,
typename P10>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -1965,7 +1954,7 @@ VTKM_EXEC void DoWorkletInvokeFunctor(
FetchType10 fetch10;
typename FetchType10::ValueType p10 =
fetch10.Load(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>());
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>());
typedef InvocationToFetch<ThreadIndicesType, Invocation, 0> FetchInfo0;
typedef typename FetchInfo0::type ReturnFetchType;
@ -2015,8 +2004,8 @@ VTKM_EXEC void DoWorkletInvokeFunctor(
invocation.Parameters.template GetParameter<FetchInfo9::ControlParameterIndex>(),
p9);
fetch10.Store(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>(),
p10);
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>(),
p10);
}
template <typename WorkletType,
@ -2038,22 +2027,20 @@ template <typename WorkletType,
typename P10>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 1> FetchInfo1;
@ -2124,7 +2111,7 @@ VTKM_EXEC void DoWorkletInvokeFunctor(
FetchType10 fetch10;
typename FetchType10::ValueType p10 =
fetch10.Load(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>());
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>());
// If you got a compile error on the following line, it probably means that
// the operator() of a worklet does not match the definition expected. One
@ -2165,9 +2152,11 @@ VTKM_EXEC void DoWorkletInvokeFunctor(
invocation.Parameters.template GetParameter<FetchInfo9::ControlParameterIndex>(),
p9);
fetch10.Store(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>(),
p10);
invocation.Parameters.template GetParameter<FetchInfo10::ControlParameterIndex>(),
p10);
}
// clang-format on
}
}
}

@ -40,9 +40,8 @@ $# Ignore the following comment. It is meant for the generated file.
#ifndef vtk_m_exec_internal_WorkletInvokeFunctorDetail_h
#define vtk_m_exec_internal_WorkletInvokeFunctorDetail_h
#if !defined(vtk_m_exec_internal_TaskSingular_h) && \\
!defined(vtk_m_exec_internal_TaskTiling_h) && \\
!defined(VTKM_TEST_HEADER_BUILD)
#if !defined(vtk_m_exec_internal_TaskSingular_h) && !defined(vtk_m_exec_internal_TaskTiling_h) && \\
!defined(VTKM_TEST_HEADER_BUILD)
#error WorkletInvokeFunctorDetail.h must be included from TaskSingular.h or TaskTiling.h
#endif
@ -82,7 +81,7 @@ def template_params(num_params, start=0, name=''):
return ''
result = 'typename %s' % ptype(start, name)
for param in xrange(start+1, num_params+1):
result += ',\n typename %s' % ptype(param, name)
result += ',\n typename %s' % ptype(param, name)
return result
def signature(num_params, return_type=ptype(0), name=''):
@ -90,7 +89,7 @@ def signature(num_params, return_type=ptype(0), name=''):
if num_params > 0:
result += ptype(1, name)
for param in xrange(2, num_params+1):
result += ',%s' % ptype(param, name)
result += ', %s' % ptype(param, name)
result += ')'
return result
@ -99,89 +98,92 @@ def arg_list(num_params, name='', start=1):
return ''
result = pname(start, name)
for param in xrange(start+1, num_params+1):
result += ',%s' % pname(param, name)
result += ', %s' % pname(param, name)
return result
)\
$#
$extend(comma_if, ptype, pname, template_params, signature, arg_list)\
namespace vtkm {
namespace exec {
namespace internal {
namespace detail {
namespace vtkm
{
namespace exec
{
namespace internal
{
namespace detail
{
/// A helper class that takes an \c Invocation object and an index to a
/// parameter in the ExecutionSignature and finds the \c Fetch type valid for
/// that parameter.
template<typename ThreadIndicesType,
typename Invocation,
vtkm::IdComponent ExecutionParameterIndex>
template <typename ThreadIndicesType,
typename Invocation,
vtkm::IdComponent ExecutionParameterIndex>
struct InvocationToFetch
{
typedef typename Invocation::ExecutionInterface::
template ParameterType<ExecutionParameterIndex>::type
ExecutionSignatureTag;
typedef
typename Invocation::ExecutionInterface::template ParameterType<ExecutionParameterIndex>::type
ExecutionSignatureTag;
// Expected fields from ExecutionSignatureTag. If these do not exist in
// ExecutionSignatureTag, then something that is not really an execution
// signature tag was used in an ExecutionSignature.
static const vtkm::IdComponent ControlParameterIndex =
ExecutionSignatureTag::INDEX;
static const vtkm::IdComponent ControlParameterIndex = ExecutionSignatureTag::INDEX;
typedef typename ExecutionSignatureTag::AspectTag AspectTag;
// Find the fetch tag from the control signature tag pointed to by
// ParameterIndex.
typedef typename Invocation::ControlInterface ControlInterface;
typedef typename ControlInterface::
template ParameterType<ControlParameterIndex>::type ControlSignatureTag;
typedef typename ControlInterface::template ParameterType<ControlParameterIndex>::type
ControlSignatureTag;
typedef typename ControlSignatureTag::FetchTag FetchTag;
typedef typename Invocation::ParameterInterface::
template ParameterType<ControlParameterIndex>::type ExecObjectType;
typedef
typename Invocation::ParameterInterface::template ParameterType<ControlParameterIndex>::type
ExecObjectType;
typedef vtkm::exec::arg::Fetch<
FetchTag,AspectTag,ThreadIndicesType,ExecObjectType> type;
typedef vtkm::exec::arg::Fetch<FetchTag, AspectTag, ThreadIndicesType, ExecObjectType> type;
};
// clang-format off
$for(num_params in range(1, max_parameters+1))\
template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
$template_params(num_params)>
VTKM_EXEC
void DoWorkletInvokeFunctor(
const WorkletType &worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
template <typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
$template_params(num_params)>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params)>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
$for(param_index in range(1, num_params+1))\
typedef InvocationToFetch<ThreadIndicesType,Invocation,$(param_index)> FetchInfo$(param_index);
typedef InvocationToFetch<ThreadIndicesType, Invocation, $(param_index)> FetchInfo$(param_index);
typedef typename FetchInfo$(param_index)::type FetchType$(param_index);
FetchType$(param_index) fetch$(param_index);
typename FetchType$(param_index)::ValueType $pname(param_index) =
fetch$(param_index).Load(
threadIndices, invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>());
fetch$(param_index).Load(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>());
$endfor\
typedef InvocationToFetch<ThreadIndicesType,Invocation,0> FetchInfo0;
typedef InvocationToFetch<ThreadIndicesType, Invocation, 0> FetchInfo0;
typedef typename FetchInfo0::type ReturnFetchType;
typedef typename ReturnFetchType::ValueType ReturnValueType;
ReturnFetchType returnFetch;
@ -197,49 +199,50 @@ $endfor\
ReturnValueType $pname(0) = ReturnValueType(worklet($arg_list(num_params)));
returnFetch.Store(
threadIndices, invocation.Parameters.template GetParameter<FetchInfo0::ControlParameterIndex>(), $pname(0));
threadIndices,
invocation.Parameters.template GetParameter<FetchInfo0::ControlParameterIndex>(),
$pname(0));
$for(param_index in range(1, num_params+1))\
fetch$(param_index).Store(
threadIndices, invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>(), $pname(param_index));
fetch$(param_index).Store(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>(),
$pname(param_index));
$endfor\
}
template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
$template_params(num_params, start=1)>
VTKM_EXEC
void DoWorkletInvokeFunctor(
const WorkletType &worklet,
const vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params, return_type='void')>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
template <typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
$template_params(num_params, start=1)>
VTKM_EXEC void DoWorkletInvokeFunctor(
const WorkletType& worklet,
const vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params, return_type='void')>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>& invocation,
const ThreadIndicesType& threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params, return_type='void')>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params, return_type='void')>,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
Invocation;
$for(param_index in range(1, num_params+1))\
typedef InvocationToFetch<ThreadIndicesType,Invocation,$(param_index)> FetchInfo$(param_index);
typedef InvocationToFetch<ThreadIndicesType, Invocation, $(param_index)> FetchInfo$(param_index);
typedef typename FetchInfo$(param_index)::type FetchType$(param_index);
FetchType$(param_index) fetch$(param_index);
typename FetchType$(param_index)::ValueType $pname(param_index) =
fetch$(param_index).Load(
threadIndices, invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>());
fetch$(param_index).Load(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>());
$endfor\
// If you got a compile error on the following line, it probably means that
@ -254,13 +257,14 @@ $endfor\
worklet($arg_list(num_params));
$for(param_index in range(1, num_params+1))\
fetch$(param_index).Store(
threadIndices, invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>(), $pname(param_index));
fetch$(param_index).Store(threadIndices,
invocation.Parameters.template GetParameter<FetchInfo$(param_index)::ControlParameterIndex>(),
$pname(param_index));
$endfor\
}
$endfor\
// clang-format on
}
}
}

@ -33,6 +33,7 @@
#error Mismatch of maximum parameters between FunctionInterfaceDatailPre.h.in and FunctionInterfaceDetailPost.h.in
#endif
namespace vtkm
{
namespace internal
@ -43,172 +44,215 @@ namespace detail
//============================================================================
template <typename Transform, typename R>
// clang-format off
template<typename Transform,
typename R>
struct FunctionInterfaceStaticTransformType<R(), Transform>
{
typedef R(type)();
typedef R(type)(
);
};
template <typename Transform, typename R, typename P1>
template<typename Transform,
typename R,
typename P1>
struct FunctionInterfaceStaticTransformType<R(P1), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type
);
};
template <typename Transform, typename R, typename P1, typename P2>
struct FunctionInterfaceStaticTransformType<R(P1, P2), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2>
struct FunctionInterfaceStaticTransformType<R(P1,P2), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type
);
};
template <typename Transform, typename R, typename P1, typename P2, typename P3>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type
);
};
template <typename Transform, typename R, typename P1, typename P2, typename P3, typename P4>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3,P4), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type,
typename Transform::template ReturnType<P4, 4>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type,
typename Transform::template ReturnType<P4,4>::type
);
};
template <typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4, P5), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3,P4,P5), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type,
typename Transform::template ReturnType<P4, 4>::type,
typename Transform::template ReturnType<P5, 5>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type,
typename Transform::template ReturnType<P4,4>::type,
typename Transform::template ReturnType<P5,5>::type
);
};
template <typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4, P5, P6), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3,P4,P5,P6), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type,
typename Transform::template ReturnType<P4, 4>::type,
typename Transform::template ReturnType<P5, 5>::type,
typename Transform::template ReturnType<P6, 6>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type,
typename Transform::template ReturnType<P4,4>::type,
typename Transform::template ReturnType<P5,5>::type,
typename Transform::template ReturnType<P6,6>::type
);
};
template <typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4, P5, P6, P7), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3,P4,P5,P6,P7), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type,
typename Transform::template ReturnType<P4, 4>::type,
typename Transform::template ReturnType<P5, 5>::type,
typename Transform::template ReturnType<P6, 6>::type,
typename Transform::template ReturnType<P7, 7>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type,
typename Transform::template ReturnType<P4,4>::type,
typename Transform::template ReturnType<P5,5>::type,
typename Transform::template ReturnType<P6,6>::type,
typename Transform::template ReturnType<P7,7>::type
);
};
template <typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4, P5, P6, P7, P8), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3,P4,P5,P6,P7,P8), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type,
typename Transform::template ReturnType<P4, 4>::type,
typename Transform::template ReturnType<P5, 5>::type,
typename Transform::template ReturnType<P6, 6>::type,
typename Transform::template ReturnType<P7, 7>::type,
typename Transform::template ReturnType<P8, 8>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type,
typename Transform::template ReturnType<P4,4>::type,
typename Transform::template ReturnType<P5,5>::type,
typename Transform::template ReturnType<P6,6>::type,
typename Transform::template ReturnType<P7,7>::type,
typename Transform::template ReturnType<P8,8>::type
);
};
template <typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4, P5, P6, P7, P8, P9), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3,P4,P5,P6,P7,P8,P9), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type,
typename Transform::template ReturnType<P4, 4>::type,
typename Transform::template ReturnType<P5, 5>::type,
typename Transform::template ReturnType<P6, 6>::type,
typename Transform::template ReturnType<P7, 7>::type,
typename Transform::template ReturnType<P8, 8>::type,
typename Transform::template ReturnType<P9, 9>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type,
typename Transform::template ReturnType<P4,4>::type,
typename Transform::template ReturnType<P5,5>::type,
typename Transform::template ReturnType<P6,6>::type,
typename Transform::template ReturnType<P7,7>::type,
typename Transform::template ReturnType<P8,8>::type,
typename Transform::template ReturnType<P9,9>::type
);
};
template <typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9,
typename P10>
struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), Transform>
template<typename Transform,
typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9,
typename P10>
struct FunctionInterfaceStaticTransformType<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10), Transform>
{
typedef R(type)(typename Transform::template ReturnType<P1, 1>::type,
typename Transform::template ReturnType<P2, 2>::type,
typename Transform::template ReturnType<P3, 3>::type,
typename Transform::template ReturnType<P4, 4>::type,
typename Transform::template ReturnType<P5, 5>::type,
typename Transform::template ReturnType<P6, 6>::type,
typename Transform::template ReturnType<P7, 7>::type,
typename Transform::template ReturnType<P8, 8>::type,
typename Transform::template ReturnType<P9, 9>::type,
typename Transform::template ReturnType<P10, 10>::type);
typedef R(type)(
typename Transform::template ReturnType<P1,1>::type,
typename Transform::template ReturnType<P2,2>::type,
typename Transform::template ReturnType<P3,3>::type,
typename Transform::template ReturnType<P4,4>::type,
typename Transform::template ReturnType<P5,5>::type,
typename Transform::template ReturnType<P6,6>::type,
typename Transform::template ReturnType<P7,7>::type,
typename Transform::template ReturnType<P8,8>::type,
typename Transform::template ReturnType<P9,9>::type,
typename Transform::template ReturnType<P10,10>::type
);
};
// clang-format on
} // namespace detail
//============================================================================
// clang-format off
/// \brief Create a \c FunctionInterface
///
/// \c make_FunctionInterface is a function that takes a variable number of
@ -222,8 +266,11 @@ struct FunctionInterfaceStaticTransformType<R(P1, P2, P3, P4, P5, P6, P7, P8, P9
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R>
VTKM_EXEC_CONT FunctionInterface<R()> make_FunctionInterface()
template<typename R>
VTKM_EXEC_CONT
FunctionInterface<R()>
make_FunctionInterface(
)
{
FunctionInterface<R()> fi;
return fi;
@ -242,8 +289,13 @@ VTKM_EXEC_CONT FunctionInterface<R()> make_FunctionInterface()
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R, typename P1>
VTKM_EXEC_CONT FunctionInterface<R(P1)> make_FunctionInterface(const P1& p1)
template<typename R,
typename P1>
VTKM_EXEC_CONT
FunctionInterface<R(P1)>
make_FunctionInterface(
const P1& p1
)
{
FunctionInterface<R(P1)> fi;
fi.template SetParameter<1>(p1);
@ -263,10 +315,17 @@ VTKM_EXEC_CONT FunctionInterface<R(P1)> make_FunctionInterface(const P1& p1)
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R, typename P1, typename P2>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2)> make_FunctionInterface(const P1& p1, const P2& p2)
template<typename R,
typename P1,
typename P2>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2)>
make_FunctionInterface(
const P1& p1,
const P2& p2
)
{
FunctionInterface<R(P1, P2)> fi;
FunctionInterface<R(P1,P2)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
return fi;
@ -285,12 +344,19 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2)> make_FunctionInterface(const P1& p1,
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R, typename P1, typename P2, typename P3>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3)> make_FunctionInterface(const P1& p1,
const P2& p2,
const P3& p3)
template<typename R,
typename P1,
typename P2,
typename P3>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3
)
{
FunctionInterface<R(P1, P2, P3)> fi;
FunctionInterface<R(P1,P2,P3)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -310,13 +376,21 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3)> make_FunctionInterface(const P1&
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R, typename P1, typename P2, typename P3, typename P4>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4)> make_FunctionInterface(const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4)
template<typename R,
typename P1,
typename P2,
typename P3,
typename P4>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3,P4)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4
)
{
FunctionInterface<R(P1, P2, P3, P4)> fi;
FunctionInterface<R(P1,P2,P3,P4)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -337,14 +411,23 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4)> make_FunctionInterface(const
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5)> make_FunctionInterface(const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4,
const P5& p5)
template<typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3,P4,P5)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4,
const P5& p5
)
{
FunctionInterface<R(P1, P2, P3, P4, P5)> fi;
FunctionInterface<R(P1,P2,P3,P4,P5)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -366,15 +449,25 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5)> make_FunctionInterface(c
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6)> make_FunctionInterface(const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4,
const P5& p5,
const P6& p6)
template<typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3,P4,P5,P6)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4,
const P5& p5,
const P6& p6
)
{
FunctionInterface<R(P1, P2, P3, P4, P5, P6)> fi;
FunctionInterface<R(P1,P2,P3,P4,P5,P6)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -397,23 +490,27 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6)> make_FunctionInterfa
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7)> make_FunctionInterface(const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4,
const P5& p5,
const P6& p6,
const P7& p7)
template<typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3,
const P4& p4,
const P5& p5,
const P6& p6,
const P7& p7
)
{
FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7)> fi;
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -437,16 +534,18 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7)> make_FunctionInt
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)> make_FunctionInterface(
template<typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3,
@ -454,9 +553,10 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)> make_Functio
const P5& p5,
const P6& p6,
const P7& p7,
const P8& p8)
const P8& p8
)
{
FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)> fi;
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -481,17 +581,19 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8)> make_Functio
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)> make_FunctionInterface(
template<typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3,
@ -500,9 +602,10 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)> make_Fun
const P6& p6,
const P7& p7,
const P8& p8,
const P9& p9)
const P9& p9
)
{
FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)> fi;
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -528,18 +631,20 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9)> make_Fun
/// \endcode
///
VTKM_SUPPRESS_EXEC_WARNINGS
template <typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9,
typename P10>
VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)> make_FunctionInterface(
template<typename R,
typename P1,
typename P2,
typename P3,
typename P4,
typename P5,
typename P6,
typename P7,
typename P8,
typename P9,
typename P10>
VTKM_EXEC_CONT
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)>
make_FunctionInterface(
const P1& p1,
const P2& p2,
const P3& p3,
@ -549,9 +654,10 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)> mak
const P7& p7,
const P8& p8,
const P9& p9,
const P10& p10)
const P10& p10
)
{
FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)> fi;
FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)> fi;
fi.template SetParameter<1>(p1);
fi.template SetParameter<2>(p2);
fi.template SetParameter<3>(p3);
@ -564,6 +670,10 @@ VTKM_EXEC_CONT FunctionInterface<R(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10)> mak
fi.template SetParameter<10>(p10);
return fi;
}
// clang-format off
}
} // namespace vtkm::internal

@ -81,17 +81,23 @@ def signature(num_params, name=''):
$#
$extend(comma_if, ptype, template_params, signature)\
namespace vtkm {
namespace internal {
namespace vtkm
{
namespace internal
{
namespace detail {
namespace detail
{
//============================================================================
// clang-format off
$for(num_params in xrange(0, max_parameters+1))\
template<typename Transform,
$template_params(num_params)>
struct FunctionInterfaceStaticTransformType<$signature(num_params), Transform> {
struct FunctionInterfaceStaticTransformType<$signature(num_params), Transform>
{
typedef $ptype(0)(type)(
$for(param_index in xrange(1, num_params+1))\
typename Transform::template ReturnType<$ptype(param_index),$(param_index)>::type$comma_if(param_index<num_params)
@ -101,10 +107,14 @@ $endfor\
$endfor\
// clang-format on
} // namespace detail
//============================================================================
// clang-format off
$for(num_params in xrange(0, max_parameters+1))\
/// \brief Create a \c FunctionInterface
///
@ -124,9 +134,9 @@ VTKM_EXEC_CONT
FunctionInterface<$signature(num_params)>
make_FunctionInterface(
$for(param_index in xrange(1,num_params+1))\
const $ptype(param_index)& p$(param_index)$comma_if(param_index<num_params)
const $ptype(param_index)& p$(param_index)$comma_if(param_index<num_params)
$endfor\
)
)
{
FunctionInterface<$signature(num_params)> fi;
$for(param_index in xrange(1,num_params+1))\
@ -137,6 +147,8 @@ $endfor\
$endfor\
// clang-format off
}
} // namespace vtkm::internal

File diff suppressed because it is too large Load Diff

@ -68,7 +68,7 @@ def template_params(num_params, start=0, name=''):
return ''
result = 'typename %s' % ptype(start, name)
for param in xrange(start+1, num_params+1):
result += ',\n typename %s' % ptype(param, name)
result += ',\n typename %s' % ptype(param, name)
return result
def signature(num_params, return_type=ptype(0), name=''):
@ -76,131 +76,143 @@ def signature(num_params, return_type=ptype(0), name=''):
if num_params > 0:
result += ptype(1, name)
for param in xrange(2, num_params+1):
result += ',%s' % ptype(param, name)
result += ', %s' % ptype(param, name)
result += ')'
return result
)\
$#
$extend(comma_if, ptype, template_params, signature)\
namespace vtkm {
namespace internal {
namespace vtkm
{
namespace internal
{
/// This struct is used internally by FunctionInterface to store the return
/// value of a function. There is a special implementation for a return type of
/// void, which stores nothing.
///
template<typename T>
struct FunctionInterfaceReturnContainer {
template <typename T>
struct FunctionInterfaceReturnContainer
{
T Value;
static VTKM_CONSTEXPR bool VALID = true;
};
template<>
struct FunctionInterfaceReturnContainer<void> {
template <>
struct FunctionInterfaceReturnContainer<void>
{
// Nothing to store for void return.
static VTKM_CONSTEXPR bool VALID = false;
};
namespace detail {
namespace detail
{
//============================================================================
// This templated class contains the state of parameters. If you get a compiler
// error stating that this class is not specialized, that probably means that
// you are using FunctionInterface with an unsupported number of arguments.
template<typename FunctionSignature>
template <typename FunctionSignature>
struct ParameterContainer;
// clang-format off
$for(num_params in range(0, max_parameters+1))\
template<$template_params(num_params)>
struct ParameterContainer<$signature(num_params)> {
template <$template_params(num_params)>
struct ParameterContainer<$signature(num_params)>
{
$for(param_index in range(1, num_params+1))\
$ptype(param_index) Parameter$(param_index);
$endfor\
};
$endfor\
// clang-format on
//============================================================================
template<typename> struct FunctionSigInfo;
template<typename R, typename... ArgTypes>
template <typename>
struct FunctionSigInfo;
template <typename R, typename... ArgTypes>
struct FunctionSigInfo<R(ArgTypes...)>
{
static VTKM_CONSTEXPR std::size_t Arity = sizeof...(ArgTypes);
using ArityType = std::integral_constant<int, Arity>;
using ResultType = R;
using Components = brigand::list<R,ArgTypes...>;
using Components = brigand::list<R, ArgTypes...>;
using Parameters = brigand::list<ArgTypes...>;
};
template<int, typename> struct AtType;
template<int Index, typename R, typename... ArgTypes>
template <int, typename>
struct AtType;
template <int Index, typename R, typename... ArgTypes>
struct AtType<Index, R(ArgTypes...)>
{
using type = brigand::at_c< brigand::list<R,ArgTypes...>, Index>;
using type = brigand::at_c<brigand::list<R, ArgTypes...>, Index>;
};
template<typename Collection, typename NewType> struct AppendType;
template<template<typename...> class L, typename T, typename NT, typename... U>
template <typename Collection, typename NewType>
struct AppendType;
template <template <typename...> class L, typename T, typename NT, typename... U>
struct AppendType<L<T, U...>, NT>
{
typedef T type(U...,NT);
typedef T type(U..., NT);
};
template<typename Collection> struct AsSigType;
template<template<typename...> class L, typename T, typename... U>
struct AsSigType< L<T, U...> >
template <typename Collection>
struct AsSigType;
template <template <typename...> class L, typename T, typename... U>
struct AsSigType<L<T, U...>>
{
typedef T type(U...);
};
template< typename Components,
vtkm::IdComponent ParameterIndex,
typename NewType >
class ReplaceType {
typedef std::integral_constant<std::size_t, (std::size_t)ParameterIndex> Index;
template <typename Components, vtkm::IdComponent ParameterIndex, typename NewType>
class ReplaceType
{
using Index = std::integral_constant<std::size_t, (std::size_t)ParameterIndex>;
using split = brigand::split_at<Components, Index>;
using front = brigand::push_back< brigand::front<split>, NewType >;
using back = brigand::pop_front< brigand::back<split> >;
using front = brigand::push_back<brigand::front<split>, NewType>;
using back = brigand::pop_front<brigand::back<split>>;
using replaced = brigand::append<front, back>;
using replaced = brigand::append< front, back >;
public:
using type = typename AsSigType< replaced >::type;
using type = typename AsSigType<replaced>::type;
};
//============================================================================
template<int ParameterIndex>
template <int ParameterIndex>
struct ParameterContainerAccess;
$for(param_index in range(1, max_parameters+1))\
template<>
struct ParameterContainerAccess<$(param_index)> {
template <>
struct ParameterContainerAccess<$(param_index)>
{
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename FunctionSignature>
VTKM_EXEC_CONT
const typename AtType<$(param_index), FunctionSignature>::type &
Get(const ParameterContainer<FunctionSignature> &parameters) {
template <typename FunctionSignature>
VTKM_EXEC_CONT const typename AtType<$(param_index), FunctionSignature>::type& Get(
const ParameterContainer<FunctionSignature>& parameters)
{
return parameters.Parameter$(param_index);
}
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename FunctionSignature>
VTKM_EXEC_CONT
void Set(ParameterContainer<FunctionSignature> &parameters,
const typename AtType<$(param_index), FunctionSignature>::type &value) {
template <typename FunctionSignature>
VTKM_EXEC_CONT void Set(ParameterContainer<FunctionSignature>& parameters,
const typename AtType<$(param_index), FunctionSignature>::type& value)
{
parameters.Parameter$(param_index) = value;
}
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename FunctionSignatureDest, typename FunctionSignatureSrc>
VTKM_EXEC_CONT
void Move(ParameterContainer<FunctionSignatureDest> &dest,
const ParameterContainer<FunctionSignatureSrc> &src) {
template <typename FunctionSignatureDest, typename FunctionSignatureSrc>
VTKM_EXEC_CONT void Move(ParameterContainer<FunctionSignatureDest>& dest,
const ParameterContainer<FunctionSignatureSrc>& src)
{
dest.Parameter$(param_index) = std::move(src.Parameter$(param_index));
}
};
@ -208,36 +220,33 @@ struct ParameterContainerAccess<$(param_index)> {
$endfor\
//============================================================================
template<vtkm::IdComponent NumToCopy>
template <vtkm::IdComponent NumToCopy>
struct CopyAllParameters;
$for(num_params in range(1, max_parameters+1))\
template<>
struct CopyAllParameters<$(num_params)> {
template <>
struct CopyAllParameters<$(num_params)>
{
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename DestSignature, typename SrcSignature>
VTKM_EXEC_CONT
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &dest,
const vtkm::internal::detail::ParameterContainer<SrcSignature> &src)
template <typename DestSignature, typename SrcSignature>
VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer<DestSignature>& dest,
const vtkm::internal::detail::ParameterContainer<SrcSignature>& src)
{
$for(param_index in range(1, num_params+1))\
dest.Parameter$(param_index) = src.Parameter$(param_index);
$endfor\
}
};
$endfor\
template<>
struct CopyAllParameters<0> {
template <>
struct CopyAllParameters<0>
{
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename DestSignature, typename SrcSignature>
VTKM_EXEC_CONT
void Copy(vtkm::internal::detail::ParameterContainer<DestSignature> &,
const vtkm::internal::detail::ParameterContainer<SrcSignature> &)
template <typename DestSignature, typename SrcSignature>
VTKM_EXEC_CONT void Copy(vtkm::internal::detail::ParameterContainer<DestSignature>&,
const vtkm::internal::detail::ParameterContainer<SrcSignature>&)
{
// Nothing to copy.
}
@ -246,24 +255,24 @@ struct CopyAllParameters<0> {
//============================================================================
// clang-format off
$for(num_params in range(0, max_parameters+1))\
$# Invoke functions need both control and execution versions
$for(environment in ['Cont', 'Exec'])\
$# Invoke functions also need to accept const and non-const versions of the functor
$for(functor_const in ['const ', ''])\
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename Functor,
typename TransformFunctor,
$template_params(num_params)>
VTKM_$(environment.upper())
void DoInvoke$(environment)(
$(functor_const)Functor &f,
ParameterContainer<$signature(num_params)> &parameters,
FunctionInterfaceReturnContainer<$ptype(0)> &result,
const TransformFunctor &transform)
template <typename Functor,
typename TransformFunctor,
$template_params(num_params)>
VTKM_$(environment.upper()) void DoInvoke$(environment)($(functor_const)Functor& f,
ParameterContainer<$signature(num_params)>& parameters,
FunctionInterfaceReturnContainer<$ptype(0)>& result,
const TransformFunctor& transform)
{
$if(num_params < 1)\
(void) parameters;
(void)parameters;
result.Value = transform(f());
$else\
result.Value = transform(f(
@ -275,19 +284,17 @@ $endif\
}
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename Functor,
typename TransformFunctor$comma_if(num_params>0)
$template_params(num_params,1)>
VTKM_$(environment.upper())
void DoInvoke$(environment)(
$(functor_const)Functor &f,
ParameterContainer<$signature(num_params,'void')> &parameters,
FunctionInterfaceReturnContainer<void> &,
const TransformFunctor &transform)
template <typename Functor,
typename TransformFunctor$comma_if(num_params>0)
$template_params(num_params,1)>
VTKM_$(environment.upper()) void DoInvoke$(environment)($(functor_const)Functor& f,
ParameterContainer<$signature(num_params,'void')>& parameters,
FunctionInterfaceReturnContainer<void>&,
const TransformFunctor& transform)
{
$if(num_params < 1)\
(void) parameters;
(void) transform;
(void)parameters;
(void)transform;
f();
$else\
f(
@ -302,23 +309,26 @@ $endfor\
$endfor\
$endfor\
// clang-format on
//============================================================================
template<typename OriginalSignature, typename Transform>
template <typename OriginalSignature, typename Transform>
struct FunctionInterfaceStaticTransformType;
// clang-format off
$for(num_params in xrange(0, max_parameters))\
$# Transform functions need both control and execution versions
$for(environment in ['Cont', 'Exec'])\
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename Transform,
$template_params(num_params,0,'Original'),
$template_params(num_params,0,'Transformed')>
VTKM_$(environment.upper())
void DoStaticTransform$(environment)(
const Transform &transform,
const ParameterContainer<$signature(num_params,ptype(0,'Original'),'Original')> &originalParameters,
ParameterContainer<$signature(num_params,ptype(0,'Transformed'),'Transformed')> &transformedParameters)
template <typename Transform,
$template_params(num_params,0,'Original'),
$template_params(num_params,0,'Transformed')>
VTKM_$(environment.upper()) void DoStaticTransform$(environment)(
const Transform& transform,
const ParameterContainer<$signature(num_params,ptype(0,'Original'),'Original')>& originalParameters,
ParameterContainer<$signature(num_params,ptype(0,'Transformed'),'Transformed')>& transformedParameters)
{
$if(num_params < 1)\
(void)transform;
@ -334,21 +344,23 @@ $endif\
$endfor\
$endfor\
// clang-format on
//============================================================================
// clang-format off
$for(num_params in xrange(0, max_parameters))\
$# ForEach functions need both control and execution versions
$for(environment in ['Cont', 'Exec'])\
$# ForEach functions also need to accept const and non-const versions of the FunctionInterface
$for(function_interface_const in ['const ', ''])\
VTKM_SUPPRESS_EXEC_WARNINGS
template<typename Functor,
$template_params(num_params)>
VTKM_$(environment.upper())
void DoForEach$(environment)(
const Functor &f,
$(function_interface_const)ParameterContainer<$signature(num_params)> &parameters)
template <typename Functor,
$template_params(num_params)>
VTKM_$(environment.upper()) void DoForEach$(environment)(
const Functor& f,
$(function_interface_const)ParameterContainer<$signature(num_params)>& parameters)
{
$if(num_params < 1)\
(void)f;
@ -364,8 +376,9 @@ $endfor\
$endfor\
$endfor\
} // namespace detail
// clang-format on
} // namespace detail
}
} // namespace vtkm::internal