Commit 40896e2b authored by Robert Maynard's avatar Robert Maynard

Allocate the scatter arrays to be proper length.

The previous code would over allocate all the scatter arrays since
it was computing the output range, than using that as the input range.
parent e9040745
......@@ -445,6 +445,7 @@ protected:
{
this->InvokeTransportParameters(
invocation,
numInstances,
this->Worklet.GetScatter().GetOutputRange(numInstances),
device);
}
......@@ -469,6 +470,7 @@ protected:
{
this->InvokeTransportParameters(
invocation,
dimensions,
this->Worklet.GetScatter().GetOutputRange(dimensions),
device);
}
......@@ -480,10 +482,11 @@ private:
DispatcherBase(const MyType &);
void operator=(const MyType &);
template<typename Invocation, typename RangeType, typename DeviceAdapter>
template<typename Invocation, typename InputRangeType, typename OutputRangeType, typename DeviceAdapter>
VTKM_CONT_EXPORT
void InvokeTransportParameters(const Invocation &invocation,
RangeType range,
const InputRangeType& inputRange,
const OutputRangeType& outputRange,
DeviceAdapter device) const
{
// The first step in invoking a worklet is to transport the arguments to
......@@ -504,13 +507,13 @@ private:
TransportFunctorType>::type ExecObjectParameters;
ExecObjectParameters execObjectParameters =
parameters.StaticTransformCont(TransportFunctorType(range));
parameters.StaticTransformCont(TransportFunctorType(outputRange));
// Get the arrays used for scattering input to output.
typename WorkletType::ScatterType::OutputToInputMapType outputToInputMap =
this->Worklet.GetScatter().GetOutputToInputMap(range);
this->Worklet.GetScatter().GetOutputToInputMap(inputRange);
typename WorkletType::ScatterType::VisitArrayType visitArray =
this->Worklet.GetScatter().GetVisitArray(range);
this->Worklet.GetScatter().GetVisitArray(inputRange);
// Replace the parameters in the invocation with the execution object and
// pass to next step of Invoke. Also add the scatter information.
......@@ -519,7 +522,7 @@ private:
.ChangeParameters(execObjectParameters)
.ChangeOutputToInputMap(outputToInputMap.PrepareForInput(device))
.ChangeVisitArray(visitArray.PrepareForInput(device)),
range,
outputRange,
device);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment