Commit 002bd341 authored by Robert Maynard's avatar Robert Maynard

Improve the compile time of WorkletMap* unit tests

By restricting the possible variant types we can dramatically
improve compile time performance.
parent ef0054ee
......@@ -140,16 +140,29 @@ struct DoVariantTestWorklet
vtkm::cont::ArrayCopy(inputHandle, inoutHandle);
vtkm::cont::VariantArrayHandle outputVariant(outputHandle);
vtkm::cont::VariantArrayHandle inoutVariant(inoutHandle);
dispatcher.Invoke(inputVariant, outputVariant, inoutVariant);
dispatcher.Invoke(inputVariant.ResetTypes(vtkm::ListTagBase<T>{}),
outputVariant.ResetTypes(vtkm::ListTagBase<T>{}),
inoutVariant.ResetTypes(vtkm::ListTagBase<T>{}));
CheckPortal(outputHandle.GetPortalConstControl());
CheckPortal(inoutHandle.GetPortalConstControl());
}
{ //Verify we can pass by pointer
vtkm::cont::ArrayCopy(inputHandle, inoutHandle);
vtkm::cont::VariantArrayHandle outputVariant(outputHandle);
vtkm::cont::VariantArrayHandle inoutVariant(inoutHandle);
dispatcher.Invoke(&inputVariant, &outputVariant, &inoutVariant);
vtkm::cont::ArrayCopy(inputHandle, inoutHandle);
dispatcher.Invoke(&inputVariant, outputHandle, inoutHandle);
CheckPortal(outputHandle.GetPortalConstControl());
CheckPortal(inoutHandle.GetPortalConstControl());
vtkm::cont::ArrayCopy(inputHandle, inoutHandle);
dispatcher.Invoke(inputHandle, &outputVariant, inoutHandle);
CheckPortal(outputHandle.GetPortalConstControl());
CheckPortal(inoutHandle.GetPortalConstControl());
vtkm::cont::ArrayCopy(inputHandle, inoutHandle);
dispatcher.Invoke(inputHandle, outputHandle, &inoutVariant);
CheckPortal(outputHandle.GetPortalConstControl());
CheckPortal(inoutHandle.GetPortalConstControl());
}
......
......@@ -66,17 +66,6 @@ struct DoTestWholeArrayWorklet
{
using WorkletType = TestWholeArrayWorklet;
// This just demonstrates that the WholeArray tags support dynamic arrays.
VTKM_CONT
void CallWorklet(const vtkm::cont::VariantArrayHandle& inArray,
const vtkm::cont::VariantArrayHandle& inOutArray,
const vtkm::cont::VariantArrayHandle& outArray) const
{
std::cout << "Create and run dispatcher." << std::endl;
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
dispatcher.Invoke(inArray, inOutArray, outArray);
}
template <typename T>
VTKM_CONT void operator()(T) const
{
......@@ -96,9 +85,11 @@ struct DoTestWholeArrayWorklet
// Output arrays must be preallocated.
outHandle.Allocate(ARRAY_SIZE);
this->CallWorklet(vtkm::cont::VariantArrayHandle(inHandle),
vtkm::cont::VariantArrayHandle(inOutHandle),
vtkm::cont::VariantArrayHandle(outHandle));
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
dispatcher.Invoke(
vtkm::cont::VariantArrayHandle(inHandle).ResetTypes(vtkm::ListTagBase<T>{}),
vtkm::cont::VariantArrayHandle(inOutHandle).ResetTypes(vtkm::ListTagBase<T>{}),
vtkm::cont::VariantArrayHandle(outHandle).ResetTypes(vtkm::ListTagBase<T>{}));
std::cout << "Check result." << std::endl;
CheckPortal(inOutHandle.GetPortalConstControl());
......
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