Commit 177b31f3 authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot
Browse files

Merge topic 'properly_compute_scatter_array_lengths'

85084f2c ScatterIdentity::GetVisitArray parameters are now named properly
86ecad65 ScatterIdentity::GetOutputToInputMap parameters are now named properly
40896e2b

 Allocate the scatter arrays to be proper length.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland's avatarKenneth Moreland <kmorel@sandia.gov>
Merge-request: !359
parents 2f352f90 85084f2c
...@@ -40,27 +40,27 @@ struct ScatterIdentity ...@@ -40,27 +40,27 @@ struct ScatterIdentity
{ {
typedef vtkm::cont::ArrayHandleIndex OutputToInputMapType; typedef vtkm::cont::ArrayHandleIndex OutputToInputMapType;
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
OutputToInputMapType GetOutputToInputMap(vtkm::Id outputRange) const OutputToInputMapType GetOutputToInputMap(vtkm::Id inputRange) const
{ {
return OutputToInputMapType(outputRange); return OutputToInputMapType(inputRange);
} }
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
OutputToInputMapType GetOutputToInputMap(vtkm::Id3 outputRange) const OutputToInputMapType GetOutputToInputMap(vtkm::Id3 inputRange) const
{ {
return this->GetOutputToInputMap( return this->GetOutputToInputMap(
outputRange[0]*outputRange[1]*outputRange[2]); inputRange[0]*inputRange[1]*inputRange[2]);
} }
typedef vtkm::cont::ArrayHandleConstant<vtkm::IdComponent> VisitArrayType; typedef vtkm::cont::ArrayHandleConstant<vtkm::IdComponent> VisitArrayType;
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
VisitArrayType GetVisitArray(vtkm::Id outputRange) const VisitArrayType GetVisitArray(vtkm::Id inputRange) const
{ {
return VisitArrayType(1, outputRange); return VisitArrayType(1, inputRange);
} }
VTKM_CONT_EXPORT VTKM_CONT_EXPORT
VisitArrayType GetVisitArray(vtkm::Id3 outputRange) const VisitArrayType GetVisitArray(vtkm::Id3 inputRange) const
{ {
return this->GetVisitArray(outputRange[0]*outputRange[1]*outputRange[2]); return this->GetVisitArray(inputRange[0]*inputRange[1]*inputRange[2]);
} }
template<typename RangeType> template<typename RangeType>
......
...@@ -445,6 +445,7 @@ protected: ...@@ -445,6 +445,7 @@ protected:
{ {
this->InvokeTransportParameters( this->InvokeTransportParameters(
invocation, invocation,
numInstances,
this->Worklet.GetScatter().GetOutputRange(numInstances), this->Worklet.GetScatter().GetOutputRange(numInstances),
device); device);
} }
...@@ -469,6 +470,7 @@ protected: ...@@ -469,6 +470,7 @@ protected:
{ {
this->InvokeTransportParameters( this->InvokeTransportParameters(
invocation, invocation,
dimensions,
this->Worklet.GetScatter().GetOutputRange(dimensions), this->Worklet.GetScatter().GetOutputRange(dimensions),
device); device);
} }
...@@ -480,10 +482,11 @@ private: ...@@ -480,10 +482,11 @@ private:
DispatcherBase(const MyType &); DispatcherBase(const MyType &);
void operator=(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 VTKM_CONT_EXPORT
void InvokeTransportParameters(const Invocation &invocation, void InvokeTransportParameters(const Invocation &invocation,
RangeType range, const InputRangeType& inputRange,
const OutputRangeType& outputRange,
DeviceAdapter device) const DeviceAdapter device) const
{ {
// The first step in invoking a worklet is to transport the arguments to // The first step in invoking a worklet is to transport the arguments to
...@@ -504,13 +507,13 @@ private: ...@@ -504,13 +507,13 @@ private:
TransportFunctorType>::type ExecObjectParameters; TransportFunctorType>::type ExecObjectParameters;
ExecObjectParameters execObjectParameters = ExecObjectParameters execObjectParameters =
parameters.StaticTransformCont(TransportFunctorType(range)); parameters.StaticTransformCont(TransportFunctorType(outputRange));
// Get the arrays used for scattering input to output. // Get the arrays used for scattering input to output.
typename WorkletType::ScatterType::OutputToInputMapType outputToInputMap = typename WorkletType::ScatterType::OutputToInputMapType outputToInputMap =
this->Worklet.GetScatter().GetOutputToInputMap(range); this->Worklet.GetScatter().GetOutputToInputMap(inputRange);
typename WorkletType::ScatterType::VisitArrayType visitArray = 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 // Replace the parameters in the invocation with the execution object and
// pass to next step of Invoke. Also add the scatter information. // pass to next step of Invoke. Also add the scatter information.
...@@ -519,7 +522,7 @@ private: ...@@ -519,7 +522,7 @@ private:
.ChangeParameters(execObjectParameters) .ChangeParameters(execObjectParameters)
.ChangeOutputToInputMap(outputToInputMap.PrepareForInput(device)) .ChangeOutputToInputMap(outputToInputMap.PrepareForInput(device))
.ChangeVisitArray(visitArray.PrepareForInput(device)), .ChangeVisitArray(visitArray.PrepareForInput(device)),
range, outputRange,
device); 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