Commit 79afe2a1 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Simplify make_ArrayHandleSwizzle

Create a form that allows you to enumerate the indices as arguments
rather than having to construct a Vec.
parent ae8d994d
......@@ -386,6 +386,15 @@ VTKM_CONT ArrayHandleSwizzle<ArrayHandleType, OutSize> make_ArrayHandleSwizzle(
{
return ArrayHandleSwizzle<ArrayHandleType, OutSize>(array, map);
}
template <typename ArrayHandleType, typename... SwizzleIndexTypes>
VTKM_CONT ArrayHandleSwizzle<ArrayHandleType, sizeof...(SwizzleIndexTypes) + 1>
make_ArrayHandleSwizzle(const ArrayHandleType& array,
vtkm::IdComponent swizzleIndex0,
SwizzleIndexTypes... swizzleIndices)
{
return make_ArrayHandleSwizzle(array, vtkm::make_Vec(swizzleIndex0, swizzleIndices...));
}
}
} // namespace vtkm::cont
......
......@@ -327,7 +327,7 @@ void TestComponentMapValidator()
bool error = false;
try
{
vtkm::cont::make_ArrayHandleSwizzle(dummy, vtkm::make_Vec(0, 1, 2, 1));
vtkm::cont::make_ArrayHandleSwizzle(dummy, 0, 1, 2, 1);
error = true;
}
catch (vtkm::cont::ErrorBadValue& e)
......@@ -338,7 +338,7 @@ void TestComponentMapValidator()
try
{
vtkm::cont::make_ArrayHandleSwizzle(dummy, vtkm::make_Vec(0, 1, 2, -1));
vtkm::cont::make_ArrayHandleSwizzle(dummy, 0, 1, 2, -1);
error = true;
}
catch (vtkm::cont::ErrorBadValue& e)
......@@ -349,7 +349,7 @@ void TestComponentMapValidator()
try
{
vtkm::cont::make_ArrayHandleSwizzle(dummy, vtkm::make_Vec(0, 1, 2, 5));
vtkm::cont::make_ArrayHandleSwizzle(dummy, 0, 1, 2, 5);
error = true;
}
catch (vtkm::cont::ErrorBadValue& e)
......
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