Add Scatter parameters to Invocation.

We are passing in execution objects with the Invocation when the Worklet
is scheduled, but we are not using it yet.
This commit is contained in:
Kenneth Moreland 2015-09-21 22:35:13 -06:00
parent e48e3d8086
commit b0c5a32611
14 changed files with 409 additions and 125 deletions

@ -175,6 +175,12 @@ namespace internal {
//-----------------------------------------------------------------------------
/// Placeholder class for when a type is not applicable.
///
struct NullType { };
//-----------------------------------------------------------------------------
template<vtkm::IdComponent Size>
struct VecEquals
{

@ -47,8 +47,6 @@ struct TestPortal
}
};
struct NullParam { };
template<vtkm::IdComponent ParamIndex, typename T>
struct FetchArrayDirectInTests
{
@ -90,14 +88,18 @@ struct FetchArrayDirectInTests
<< std::endl;
typedef vtkm::internal::FunctionInterface<
void(NullParam,NullParam,NullParam,NullParam,NullParam)>
void(vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType)>
BaseFunctionInterface;
this->TryInvocation(vtkm::internal::make_Invocation<1>(
BaseFunctionInterface().Replace<ParamIndex>(
TestPortal<T>()),
NullParam(),
NullParam()));
vtkm::internal::NullType(),
vtkm::internal::NullType()));
}
};

@ -59,8 +59,6 @@ struct TestPortal
}
};
struct NullParam { };
template<vtkm::IdComponent ParamIndex, typename T>
struct FetchArrayDirectInTests
{
@ -107,14 +105,18 @@ struct FetchArrayDirectInTests
<< std::endl;
typedef vtkm::internal::FunctionInterface<
void(NullParam,NullParam,NullParam,NullParam,NullParam)>
void(vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType)>
BaseFunctionInterface;
this->TryInvocation(vtkm::internal::make_Invocation<1>(
BaseFunctionInterface().Replace<ParamIndex>(
TestPortal<T>()),
NullParam(),
NullParam()));
vtkm::internal::NullType(),
vtkm::internal::NullType()));
}
};

@ -51,8 +51,6 @@ struct TestPortal
}
};
struct NullParam { };
template<vtkm::IdComponent ParamIndex, typename T>
struct FetchArrayDirectOutTests
{
@ -99,14 +97,18 @@ struct FetchArrayDirectOutTests
<< std::endl;
typedef vtkm::internal::FunctionInterface<
void(NullParam,NullParam,NullParam,NullParam,NullParam)>
void(vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType)>
BaseFunctionInterface;
this->TryInvocation(vtkm::internal::make_Invocation<1>(
BaseFunctionInterface().Replace<ParamIndex>(
TestPortal<T>()),
NullParam(),
NullParam()));
vtkm::internal::NullType(),
vtkm::internal::NullType()));
}
};

@ -47,8 +47,6 @@ struct TestPortal
}
};
struct NullParam { };
template<vtkm::IdComponent InputDomainIndex,
vtkm::IdComponent ParamIndex,
typename T>
@ -102,7 +100,11 @@ struct FetchArrayTopologyMapInTests
<< std::endl;
typedef vtkm::internal::FunctionInterface<
void(NullParam,NullParam,NullParam,NullParam,NullParam)>
void(vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType)>
BaseFunctionInterface;
vtkm::internal::ConnectivityStructuredInternals<3> connectivityInternals;
@ -115,8 +117,8 @@ struct FetchArrayTopologyMapInTests
BaseFunctionInterface()
.Replace<InputDomainIndex>(connectivity)
.template Replace<ParamIndex>(TestPortal<T>()),
NullParam(),
NullParam()));
vtkm::internal::NullType(),
vtkm::internal::NullType()));
}
};
@ -175,7 +177,11 @@ void TryStructuredPointCoordinates(
const vtkm::internal::ArrayPortalUniformPointCoordinates &coordinates)
{
typedef vtkm::internal::FunctionInterface<
void(NullParam,NullParam,NullParam,NullParam,NullParam)>
void(vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType)>
BaseFunctionInterface;
// Try with topology in argument 1 and point coordinates in argument 2
@ -184,8 +190,8 @@ void TryStructuredPointCoordinates(
BaseFunctionInterface()
.Replace<1>(connectivity)
.template Replace<2>(coordinates),
NullParam(),
NullParam())
vtkm::internal::NullType(),
vtkm::internal::NullType())
);
// Try again with topology in argument 3 and point coordinates in argument 1
TryStructuredPointCoordinatesInvocation<NumDimensions,1>(
@ -193,8 +199,8 @@ void TryStructuredPointCoordinates(
BaseFunctionInterface()
.Replace<3>(connectivity)
.template Replace<1>(coordinates),
NullParam(),
NullParam())
vtkm::internal::NullType(),
vtkm::internal::NullType())
);
}

@ -40,8 +40,6 @@ struct TestExecutionObject : public vtkm::exec::ExecutionObjectBase
vtkm::Int32 Number;
};
struct NullParam { };
template<vtkm::IdComponent ParamIndex, typename Invocation>
void TryInvocation(const Invocation &invocation)
{
@ -81,14 +79,18 @@ void TryParamIndex()
<< std::endl;
typedef vtkm::internal::FunctionInterface<
void(NullParam,NullParam,NullParam,NullParam,NullParam)>
void(vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType)>
BaseFunctionInterface;
TryInvocation<ParamIndex>(vtkm::internal::make_Invocation<1>(
BaseFunctionInterface().Replace<ParamIndex>(
TestExecutionObject(EXPECTED_NUMBER)),
NullParam(),
NullParam()));
vtkm::internal::NullType(),
vtkm::internal::NullType()));
}
void TestExecObjectFetch()

@ -31,8 +31,6 @@
namespace {
struct NullParam { };
template<typename Invocation>
void TryInvocation(const Invocation &invocation)
{
@ -40,7 +38,7 @@ void TryInvocation(const Invocation &invocation)
vtkm::exec::arg::FetchTagArrayDirectIn, // Not used but probably common.
vtkm::exec::arg::AspectTagWorkIndex,
vtkm::exec::arg::ThreadIndicesBasic,
NullParam> FetchType;
vtkm::internal::NullType> FetchType;
FetchType fetch;
@ -48,14 +46,14 @@ void TryInvocation(const Invocation &invocation)
{
vtkm::exec::arg::ThreadIndicesBasic indices(index, invocation);
vtkm::Id value = fetch.Load(indices, NullParam());
vtkm::Id value = fetch.Load(indices, vtkm::internal::NullType());
VTKM_TEST_ASSERT(value == index,
"Fetch did not give correct work index.");
value++;
// This should be a no-op.
fetch.Store(indices, NullParam(), value);
fetch.Store(indices, vtkm::internal::NullType(), value);
}
}
@ -64,12 +62,16 @@ void TestWorkIndexFetch()
std::cout << "Trying WorkIndex fetch." << std::endl;
typedef vtkm::internal::FunctionInterface<
void(NullParam,NullParam,NullParam,NullParam,NullParam)>
void(vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType,
vtkm::internal::NullType)>
BaseFunctionInterface;
TryInvocation(vtkm::internal::make_Invocation<1>(BaseFunctionInterface(),
NullParam(),
NullParam()));
vtkm::internal::NullType(),
vtkm::internal::NullType()));
}
} // anonymous namespace

@ -84,6 +84,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1>
@ -94,14 +96,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -136,6 +142,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1>
VTKM_EXEC_EXPORT
@ -145,14 +153,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -180,6 +192,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -191,14 +205,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -242,6 +260,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2>
@ -252,14 +272,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -296,6 +320,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -308,14 +334,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -368,6 +398,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -379,14 +411,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -432,6 +468,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -445,14 +483,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -514,6 +556,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -526,14 +570,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -588,6 +636,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -602,14 +652,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -680,6 +734,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -693,14 +749,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -764,6 +824,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -779,14 +841,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5,P6)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5,P6)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -866,6 +932,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -880,14 +948,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5,P6)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5,P6)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -960,6 +1032,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -976,14 +1050,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -1072,6 +1150,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -1087,14 +1167,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5,P6,P7)>,
InputDomainIndex> &invocation,
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> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -1176,6 +1260,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -1193,14 +1279,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8)>,
InputDomainIndex> &invocation,
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> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -1298,6 +1388,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -1314,14 +1406,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5,P6,P7,P8)>,
InputDomainIndex> &invocation,
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> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -1412,6 +1508,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -1430,14 +1528,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9)>,
InputDomainIndex> &invocation,
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> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -1544,6 +1646,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -1561,14 +1665,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5,P6,P7,P8,P9)>,
InputDomainIndex> &invocation,
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> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -1668,6 +1776,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename R,
typename P1,
@ -1687,14 +1797,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<R(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)>,
InputDomainIndex> &invocation,
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> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;
@ -1810,6 +1924,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
typename P1,
typename P2,
@ -1828,14 +1944,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<void(P1,P2,P3,P4,P5,P6,P7,P8,P9,P10)>,
InputDomainIndex> &invocation,
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> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
typedef InvocationToFetch<ThreadIndicesType,Invocation,1> FetchInfo1;
typedef typename FetchInfo1::type FetchType1;

@ -146,6 +146,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
$template_params(num_params)>
VTKM_EXEC_EXPORT
@ -155,14 +157,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params)>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params)>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
$for(param_index in range(1, num_params+1))\
typedef InvocationToFetch<ThreadIndicesType,Invocation,$(param_index)> FetchInfo$(param_index);
@ -201,6 +207,8 @@ template<typename WorkletType,
typename ParameterInterface,
typename ControlInterface,
vtkm::IdComponent InputDomainIndex,
typename OutputToInputMapType,
typename VisitArrayType,
typename ThreadIndicesType,
$template_params(num_params, start=1)>
VTKM_EXEC_EXPORT
@ -210,14 +218,18 @@ void DoWorkletInvokeFunctor(
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params, return_type='void')>,
InputDomainIndex> &invocation,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> &invocation,
const ThreadIndicesType &threadIndices)
{
typedef vtkm::internal::Invocation<
ParameterInterface,
ControlInterface,
vtkm::internal::FunctionInterface<$signature(num_params, return_type='void')>,
InputDomainIndex> Invocation;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> Invocation;
$for(param_index in range(1, num_params+1))\
typedef InvocationToFetch<ThreadIndicesType,Invocation,$(param_index)> FetchInfo$(param_index);

@ -34,7 +34,9 @@ namespace internal {
template<typename _ParameterInterface,
typename _ControlInterface,
typename _ExecutionInterface,
vtkm::IdComponent _InputDomainIndex>
vtkm::IdComponent _InputDomainIndex,
typename _OutputToInputMapType = vtkm::internal::NullType,
typename _VisitArrayType = vtkm::internal::NullType>
struct Invocation
{
/// \brief The types of the parameters
@ -68,8 +70,32 @@ struct Invocation
///
static const vtkm::IdComponent InputDomainIndex = _InputDomainIndex;
/// \brief An array representing the output to input map.
///
/// When a worklet is invoked, there is an optional scatter operation that
/// allows you to vary the number of outputs each input affects. This is
/// represented with a map where each output points to an input that creates
/// it.
///
typedef _OutputToInputMapType OutputToInputMapType;
/// \brief An array containing visit indices.
///
/// When a worklet is invoked, there is an optinonal scatter operation that
/// allows you to vary the number of outputs each input affects. Thus,
/// multiple outputs may point to the same input. The visit index uniquely
/// identifies which instance each is.
///
typedef _VisitArrayType VisitArrayType;
VTKM_CONT_EXPORT
Invocation(ParameterInterface parameters) : Parameters(parameters) { }
Invocation(ParameterInterface parameters,
OutputToInputMapType outputToInputMap = OutputToInputMapType(),
VisitArrayType visitArray = VisitArrayType())
: Parameters(parameters),
OutputToInputMap(outputToInputMap),
VisitArray(visitArray)
{ }
/// Defines a new \c Invocation type that is the same as this type except
/// with the \c Parameters replaced.
@ -79,7 +105,9 @@ struct Invocation
typedef Invocation<NewParameterInterface,
ControlInterface,
ExecutionInterface,
InputDomainIndex> type;
InputDomainIndex,
OutputToInputMapType,
VisitArrayType> type;
};
/// Returns a new \c Invocation that is the same as this one except that the
@ -90,7 +118,7 @@ struct Invocation
typename ChangeParametersType<NewParameterInterface>::type
ChangeParameters(NewParameterInterface newParameters) const {
return typename ChangeParametersType<NewParameterInterface>::type(
newParameters);
newParameters, this->OutputToInputMap, this->VisitArray);
}
/// Defines a new \c Invocation type that is the same as this type except
@ -111,7 +139,7 @@ struct Invocation
typename ChangeControlInterfaceType<NewControlInterface>::type
ChangeControlInterface(NewControlInterface) const {
return typename ChangeControlInterfaceType<NewControlInterface>::type(
this->Parameters);
this->Parameters, this->OutputToInputMap, this->VisitArray);
}
/// Defines a new \c Invocation type that is the same as this type except
@ -132,7 +160,7 @@ struct Invocation
typename ChangeExecutionInterfaceType<NewExecutionInterface>::type
ChangeExecutionInterface(NewExecutionInterface) const {
return typename ChangeExecutionInterfaceType<NewExecutionInterface>::type(
this->Parameters);
this->Parameters, this->OutputToInputMap, this->VisitArray);
}
/// Defines a new \c Invocation type that is the same as this type except
@ -154,7 +182,55 @@ struct Invocation
typename ChangeInputDomainIndexType<NewInputDomainIndex>::type
ChangeInputDomainIndex() const {
return typename ChangeInputDomainIndexType<NewInputDomainIndex>::type(
this->Parameters);
this->Parameters, this->OutputToInputMap, this->VisitArray);
}
/// Defines a new \c Invocation type that is the same as this type except
/// with the \c OutputToInputMapType replaced.
///
template<typename NewOutputToInputMapType>
struct ChangeOutputToInputMapType {
typedef Invocation<ParameterInterface,
ControlInterface,
ExecutionInterface,
InputDomainIndex,
NewOutputToInputMapType,
VisitArrayType> type;
};
/// Returns a new \c Invocation that is the same as this one except that the
/// \c OutputToInputMap is replaced with that provided.
///
template<typename NewOutputToInputMapType>
VTKM_CONT_EXPORT
typename ChangeOutputToInputMapType<NewOutputToInputMapType>::type
ChangeOutputToInputMap(NewOutputToInputMapType newOutputToInputMap) const {
return typename ChangeOutputToInputMapType<NewOutputToInputMapType>::type(
this->Parameters, newOutputToInputMap, this->VisitArray);
}
/// Defines a new \c Invocation type that is the same as this type except
/// with the \c VisitArrayType replaced.
///
template<typename NewVisitArrayType>
struct ChangeVisitArrayType {
typedef Invocation<ParameterInterface,
ControlInterface,
ExecutionInterface,
InputDomainIndex,
OutputToInputMapType,
NewVisitArrayType> type;
};
/// Returns a new \c Invocation that is the same as this one except that the
/// \c VisitArray is replaced with that provided.
///
template<typename NewVisitArrayType>
VTKM_CONT_EXPORT
typename ChangeVisitArrayType<NewVisitArrayType>::type
ChangeVisitArray(NewVisitArrayType newVisitArray) const {
return typename ChangeVisitArrayType<NewVisitArrayType>::type(
this->Parameters, this->OutputToInputMap, newVisitArray);
}
/// A convenience typedef for the input domain type.
@ -172,13 +248,43 @@ struct Invocation
}
/// The state of an \c Invocation object holds the parameters of the
/// invocation.
/// invocation. As well as the output to input map and the visit array.
///
ParameterInterface Parameters;
OutputToInputMapType OutputToInputMap;
VisitArrayType VisitArray;
};
/// Convenience function for creating an Invocation object.
///
template<vtkm::IdComponent InputDomainIndex,
typename ControlInterface,
typename ExecutionInterface,
typename ParameterInterface,
typename OutputToInputMapType,
typename VisitArrayType>
VTKM_CONT_EXPORT
vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
ExecutionInterface,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>
make_Invocation(const ParameterInterface &params,
ControlInterface,
ExecutionInterface,
OutputToInputMapType outputToInputMap,
VisitArrayType visitArray)
{
return vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
ExecutionInterface,
InputDomainIndex,
OutputToInputMapType,
VisitArrayType>(params,
outputToInputMap,
visitArray);
}
template<vtkm::IdComponent InputDomainIndex,
typename ControlInterface,
typename ExecutionInterface,
@ -192,10 +298,12 @@ make_Invocation(const ParameterInterface &params,
ControlInterface = ControlInterface(),
ExecutionInterface = ExecutionInterface())
{
return vtkm::internal::Invocation<ParameterInterface,
ControlInterface,
ExecutionInterface,
InputDomainIndex>(params);
return vtkm::internal::make_Invocation<InputDomainIndex>(
params,
ControlInterface(),
ExecutionInterface(),
vtkm::internal::NullType(),
vtkm::internal::NullType());
}
}

@ -46,8 +46,6 @@ struct ListRoot { };
template<typename signature>
struct ListBase { };
struct ListParamNull { };
//-----------------------------------------------------------------------------
template<typename Functor>
@ -1151,21 +1149,21 @@ struct ListContainsImpl<ListBase<void(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13
/// A basic tag for a list of typenames. This struct can be subclassed
/// and still behave like a list tag.
template<typename T1 = vtkm::detail::ListParamNull,
typename T2 = vtkm::detail::ListParamNull,
typename T3 = vtkm::detail::ListParamNull,
typename T4 = vtkm::detail::ListParamNull,
typename T5 = vtkm::detail::ListParamNull,
typename T6 = vtkm::detail::ListParamNull,
typename T7 = vtkm::detail::ListParamNull,
typename T8 = vtkm::detail::ListParamNull,
typename T9 = vtkm::detail::ListParamNull,
typename T10 = vtkm::detail::ListParamNull,
typename T11 = vtkm::detail::ListParamNull,
typename T12 = vtkm::detail::ListParamNull,
typename T13 = vtkm::detail::ListParamNull,
typename T14 = vtkm::detail::ListParamNull,
typename T15 = vtkm::detail::ListParamNull>
template<typename T1 = vtkm::internal::NullType,
typename T2 = vtkm::internal::NullType,
typename T3 = vtkm::internal::NullType,
typename T4 = vtkm::internal::NullType,
typename T5 = vtkm::internal::NullType,
typename T6 = vtkm::internal::NullType,
typename T7 = vtkm::internal::NullType,
typename T8 = vtkm::internal::NullType,
typename T9 = vtkm::internal::NullType,
typename T10 = vtkm::internal::NullType,
typename T11 = vtkm::internal::NullType,
typename T12 = vtkm::internal::NullType,
typename T13 = vtkm::internal::NullType,
typename T14 = vtkm::internal::NullType,
typename T15 = vtkm::internal::NullType>
struct ListTagBase : detail::ListRoot
{
typedef detail::ListBase<void(T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15)> List;

@ -94,8 +94,6 @@ struct ListRoot { };
template<typename signature>
struct ListBase { };
struct ListParamNull { };
//-----------------------------------------------------------------------------
template<typename Functor>
@ -172,7 +170,7 @@ $endfor\
/// A basic tag for a list of typenames. This struct can be subclassed
/// and still behave like a list tag.
template<$template_params(max_base_list, default=' = vtkm::detail::ListParamNull')>
template<$template_params(max_base_list, default=' = vtkm::internal::NullType')>
struct ListTagBase : detail::ListRoot
{
typedef detail::ListBase<void($param_list(max_base_list))> List;

@ -39,20 +39,36 @@ namespace worklet {
struct ScatterIdentity
{
typedef vtkm::cont::ArrayHandleIndex OutputToInputMapType;
OutputToInputMapType GetOutputToInputMap(vtkm::Id numInputElements) const
OutputToInputMapType GetOutputToInputMap(vtkm::Id inputRange) const
{
return OutputToInputMapType(numInputElements);
return OutputToInputMapType(inputRange);
}
OutputToInputMapType GetOutputToInputMap(vtkm::Id2 inputRange) const
{
return this->GetOutputToInputMap(inputRange[0]*inputRange[1]);
}
OutputToInputMapType GetOutputToInputMap(vtkm::Id3 inputRange) const
{
return this->GetOutputToInputMap(inputRange[0]*inputRange[1]*inputRange[2]);
}
typedef vtkm::cont::ArrayHandleConstant<vtkm::IdComponent> VisitArrayType;
VisitArrayType GetVisitArray(vtkm::Id numInputElements) const
VisitArrayType GetVisitArray(vtkm::Id inputRange) const
{
return VisitArrayType(1, numInputElements);
return VisitArrayType(1, inputRange);
}
VisitArrayType GetVisitArray(vtkm::Id2 inputRange) const
{
return this->GetVisitArray(inputRange[0]*inputRange[1]);
}
VisitArrayType GetVisitArray(vtkm::Id3 inputRange) const
{
return this->GetVisitArray(inputRange[0]*inputRange[1]*inputRange[2]);
}
vtkm::Id GetNumberOfOutputValues(vtkm::Id numInputElements) const
vtkm::Id GetOutputRange(vtkm::Id inputRange) const
{
return numInputElements;
return inputRange;
}
};

@ -477,7 +477,7 @@ private:
VTKM_CONT_EXPORT
void InvokeTransportParameters(const Invocation &invocation,
RangeType range,
DeviceAdapter tag) const
DeviceAdapter device) const
{
// The first step in invoking a worklet is to transport the arguments to
// the execution environment. The invocation object passed to this function
@ -499,11 +499,21 @@ private:
ExecObjectParameters execObjectParameters =
parameters.StaticTransformCont(TransportFunctorType(range));
// Get the arrays used for scattering input to output.
typename WorkletType::ScatterType::OutputToInputMapType outputToInputMap =
this->Worklet.GetScatter().GetOutputToInputMap(range);
typename WorkletType::ScatterType::VisitArrayType visitArray =
this->Worklet.GetScatter().GetVisitArray(range);
// Replace the parameters in the invocation with the execution object and
// pass to next step of Invoke.
this->InvokeSchedule(invocation.ChangeParameters(execObjectParameters),
range,
tag);
// pass to next step of Invoke. Also add the scatter information.
this->InvokeSchedule(
invocation
.ChangeParameters(execObjectParameters)
.ChangeOutputToInputMap(outputToInputMap.PrepareForInput(device))
.ChangeVisitArray(visitArray.PrepareForInput(device)),
range,
device);
}
template<typename Invocation, typename RangeType, typename DeviceAdapter>