From 8e57362a236d62638ef850a5704fdc533beee3cb Mon Sep 17 00:00:00 2001 From: Tushar Athawale Date: Mon, 14 Feb 2022 13:11:30 -0500 Subject: [PATCH] tutorial example fixes to resolve warnings --- tutorial/extract_edges.cxx | 17 +++++++++++++++-- tutorial/point_to_cell.cxx | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tutorial/extract_edges.cxx b/tutorial/extract_edges.cxx index 0159e7685..f2ddda9b0 100644 --- a/tutorial/extract_edges.cxx +++ b/tutorial/extract_edges.cxx @@ -88,10 +88,23 @@ struct EdgeIndicesWorklet : vtkm::worklet::WorkletReduceByKey vtkm::IdComponent edgeIndex = originEdges[0]; auto cellShape = cellSet.GetCellShape(originCells[0]); + vtkm::ErrorCode error; vtkm::IdComponent pointInCellIndex0; - vtkm::exec::CellEdgeLocalIndex(numPointsInCell, 0, edgeIndex, cellShape, pointInCellIndex0); + error = + vtkm::exec::CellEdgeLocalIndex(numPointsInCell, 0, edgeIndex, cellShape, pointInCellIndex0); + if (error != vtkm::ErrorCode::Success) + { + this->RaiseError(vtkm::ErrorString(error); + return; + } vtkm::IdComponent pointInCellIndex1; - vtkm::exec::CellEdgeLocalIndex(numPointsInCell, 1, edgeIndex, cellShape, pointInCellIndex1); + error = + vtkm::exec::CellEdgeLocalIndex(numPointsInCell, 1, edgeIndex, cellShape, pointInCellIndex1); + if (error != vtkm::ErrorCode::Success) + { + this->RaiseError(vtkm::ErrorString(error); + return; + } auto globalPointIndicesForCell = cellSet.GetIndices(originCells[0]); connectivityOut[0] = globalPointIndicesForCell[pointInCellIndex0]; diff --git a/tutorial/point_to_cell.cxx b/tutorial/point_to_cell.cxx index 2fb037720..7062adef4 100644 --- a/tutorial/point_to_cell.cxx +++ b/tutorial/point_to_cell.cxx @@ -38,7 +38,7 @@ struct ConvertPointFieldToCells : vtkm::worklet::WorkletVisitCellsWithPoints { outCellField = outCellField + inPointFieldVec[pointIndex]; } - outCellField = outCellField / static_cast(numPoints); + outCellField = outCellField / static_cast(numPoints); } };