diff --git a/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h b/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h index 4fb9edf08..d785f531b 100644 --- a/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h +++ b/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h @@ -95,15 +95,8 @@ public: } }; - template - vtkm::cont::CellSetSingleType<> Run( - const CellSetType& vtkmNotUsed(cellSet), - vtkm::cont::ArrayHandle& vtkmNotUsed(outCellsPerCell)) - { - return vtkm::cont::CellSetSingleType<>(); - } - - vtkm::cont::CellSetSingleType<> Run(const vtkm::cont::CellSetExplicit<>& cellSet, + template + vtkm::cont::CellSetSingleType<> Run(const vtkm::cont::CellSetExplicit& cellSet, vtkm::cont::ArrayHandle& outCellsPerCell) { vtkm::cont::CellSetSingleType<> outCellSet; diff --git a/vtkm/worklet/triangulate/TriangulateExplicit.h b/vtkm/worklet/triangulate/TriangulateExplicit.h index a963c27dd..557ce621d 100644 --- a/vtkm/worklet/triangulate/TriangulateExplicit.h +++ b/vtkm/worklet/triangulate/TriangulateExplicit.h @@ -97,47 +97,40 @@ public: connectivityOut[2] = connectivityIn[triIndices[2]]; } }; - template - vtkm::cont::CellSetSingleType<> Run( - const CellSetType& vtkmNotUsed(cellSet), - vtkm::cont::ArrayHandle& vtkmNotUsed(outCellsPerCell)) + template + vtkm::cont::CellSetSingleType<> Run(const vtkm::cont::CellSetExplicit& cellSet, + vtkm::cont::ArrayHandle& outCellsPerCell) { vtkm::cont::CellSetSingleType<> outCellSet; + + // Input topology + auto inShapes = + cellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); + auto inNumIndices = + cellSet.GetNumIndicesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); + + // Output topology + vtkm::cont::ArrayHandle outConnectivity; + + vtkm::worklet::internal::TriangulateTables tables; + + // Determine the number of output cells each input cell will generate + vtkm::worklet::DispatcherMapField triPerCellDispatcher; + triPerCellDispatcher.Invoke(inShapes, inNumIndices, tables.PrepareForInput(), outCellsPerCell); + + // Build new cells + vtkm::worklet::DispatcherMapTopology triangulateDispatcher( + TriangulateCell::MakeScatter(outCellsPerCell)); + triangulateDispatcher.Invoke( + cellSet, tables.PrepareForInput(), vtkm::cont::make_ArrayHandleGroupVec<3>(outConnectivity)); + + // Add cells to output cellset + outCellSet.Fill( + cellSet.GetNumberOfPoints(), vtkm::CellShapeTagTriangle::Id, 3, outConnectivity); return outCellSet; } }; -template <> -vtkm::cont::CellSetSingleType<> TriangulateExplicit::Run( - const vtkm::cont::CellSetExplicit<>& cellSet, - vtkm::cont::ArrayHandle& outCellsPerCell) -{ - vtkm::cont::CellSetSingleType<> outCellSet; - // Input topology - auto inShapes = - cellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); - auto inNumIndices = - cellSet.GetNumIndicesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); - - // Output topology - vtkm::cont::ArrayHandle outConnectivity; - - vtkm::worklet::internal::TriangulateTables tables; - - // Determine the number of output cells each input cell will generate - vtkm::worklet::DispatcherMapField triPerCellDispatcher; - triPerCellDispatcher.Invoke(inShapes, inNumIndices, tables.PrepareForInput(), outCellsPerCell); - - // Build new cells - vtkm::worklet::DispatcherMapTopology triangulateDispatcher( - TriangulateCell::MakeScatter(outCellsPerCell)); - triangulateDispatcher.Invoke( - cellSet, tables.PrepareForInput(), vtkm::cont::make_ArrayHandleGroupVec<3>(outConnectivity)); - - // Add cells to output cellset - outCellSet.Fill(cellSet.GetNumberOfPoints(), vtkm::CellShapeTagTriangle::Id, 3, outConnectivity); - return outCellSet; -} } } // namespace vtkm::worklet