From 8ddcad824c7cb114ff9a35189b7e3883a928cfa2 Mon Sep 17 00:00:00 2001 From: Abhishek Yenpure Date: Wed, 2 Feb 2022 16:15:12 +0530 Subject: [PATCH] Fixing dashboard warnings --- vtkm/exec/CellMeasure.h | 19 ++++---- vtkm/worklet/MIR.h | 2 +- .../cellmetrics/CellAspectRatioMetric.h | 10 ++-- .../worklet/cellmetrics/CellConditionMetric.h | 10 ++-- .../worklet/cellmetrics/CellDimensionMetric.h | 48 +++++++++---------- 5 files changed, 46 insertions(+), 43 deletions(-) diff --git a/vtkm/exec/CellMeasure.h b/vtkm/exec/CellMeasure.h index b1ea80c53..27ca467fd 100644 --- a/vtkm/exec/CellMeasure.h +++ b/vtkm/exec/CellMeasure.h @@ -126,8 +126,9 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts, Normalize(unitCenterNormal); OutType area = - (Dot(unitCenterNormal, cornerNormals[0]) + Dot(unitCenterNormal, cornerNormals[1]) + - Dot(unitCenterNormal, cornerNormals[2]) + Dot(unitCenterNormal, cornerNormals[3])) * + static_cast( + (Dot(unitCenterNormal, cornerNormals[0]) + Dot(unitCenterNormal, cornerNormals[1]) + + Dot(unitCenterNormal, cornerNormals[2]) + Dot(unitCenterNormal, cornerNormals[3]))) * OutType(0.25); return area; } @@ -160,7 +161,7 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts, typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0]; typename PointCoordVecType::ComponentType v2 = pts[2] - pts[0]; typename PointCoordVecType::ComponentType v3 = pts[3] - pts[0]; - OutType volume = Dot(Cross(v1, v2), v3) / OutType(6.0); + OutType volume = static_cast(Dot(Cross(v1, v2), v3)) / OutType(6.0); return volume; } @@ -204,7 +205,7 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts, efg3 -= pts[2]; efg3 -= pts[3]; - OutType volume = Dot(Cross(efg2, efg3), efg1) / OutType(64.0); + OutType volume = static_cast(Dot(Cross(efg2, efg3), efg1)) / OutType(64.0); return volume; } @@ -224,17 +225,17 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts, typename PointCoordVecType::ComponentType v0 = pts[1] - pts[0]; typename PointCoordVecType::ComponentType v1 = pts[2] - pts[0]; typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0]; - OutType volume = Dot(Cross(v0, v1), v2) / OutType(6.0); + OutType volume = static_cast(Dot(Cross(v0, v1), v2)) / OutType(6.0); typename PointCoordVecType::ComponentType v3 = pts[4] - pts[1]; typename PointCoordVecType::ComponentType v4 = pts[5] - pts[1]; typename PointCoordVecType::ComponentType v5 = pts[3] - pts[1]; - volume += Dot(Cross(v3, v4), v5) / OutType(6.0); + volume += static_cast(Dot(Cross(v3, v4), v5)) / OutType(6.0); typename PointCoordVecType::ComponentType v6 = pts[5] - pts[1]; typename PointCoordVecType::ComponentType v7 = pts[2] - pts[1]; typename PointCoordVecType::ComponentType v8 = pts[3] - pts[1]; - volume += Dot(Cross(v6, v7), v8) / OutType(6.0); + volume += static_cast(Dot(Cross(v6, v7), v8)) / OutType(6.0); return volume; } @@ -255,12 +256,12 @@ VTKM_EXEC OutType CellMeasure(const vtkm::IdComponent& numPts, typename PointCoordVecType::ComponentType v1 = pts[1] - pts[0]; typename PointCoordVecType::ComponentType v2 = pts[3] - pts[0]; typename PointCoordVecType::ComponentType v3 = pts[4] - pts[0]; - OutType volume = Dot(Cross(v1, v2), v3) / OutType(6.0); + OutType volume = static_cast(Dot(Cross(v1, v2), v3)) / OutType(6.0); typename PointCoordVecType::ComponentType v4 = pts[1] - pts[2]; typename PointCoordVecType::ComponentType v5 = pts[3] - pts[2]; typename PointCoordVecType::ComponentType v6 = pts[4] - pts[2]; - volume += Dot(Cross(v5, v4), v6) / OutType(6.0); + volume += static_cast(Dot(Cross(v5, v4), v6)) / OutType(6.0); return volume; } diff --git a/vtkm/worklet/MIR.h b/vtkm/worklet/MIR.h index a07d8194a..33946e3cc 100644 --- a/vtkm/worklet/MIR.h +++ b/vtkm/worklet/MIR.h @@ -2316,7 +2316,7 @@ public: prevLowest = lowest; lowest = largest; } - totalErrorOut = totalError; + totalErrorOut = TEO(totalError); } }; struct CheckFor2D : public vtkm::worklet::WorkletVisitCellsWithPoints diff --git a/vtkm/worklet/cellmetrics/CellAspectRatioMetric.h b/vtkm/worklet/cellmetrics/CellAspectRatioMetric.h index 15854ca67..67a1472b0 100644 --- a/vtkm/worklet/cellmetrics/CellAspectRatioMetric.h +++ b/vtkm/worklet/cellmetrics/CellAspectRatioMetric.h @@ -110,8 +110,8 @@ VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts, const Vector X1 = GetQuadX0(pts); const Vector X2 = GetQuadX1(pts); - const Scalar x1 = vtkm::Sqrt(vtkm::MagnitudeSquared(X1)); - const Scalar x2 = vtkm::Sqrt(vtkm::MagnitudeSquared(X2)); + const Scalar x1 = static_cast(vtkm::Sqrt(vtkm::MagnitudeSquared(X1))); + const Scalar x2 = static_cast(vtkm::Sqrt(vtkm::MagnitudeSquared(X2))); if (x1 <= Scalar(0.0) || x2 <= Scalar(0.0)) { return vtkm::Infinity(); @@ -142,9 +142,9 @@ VTKM_EXEC OutType CellAspectRatioMetric(const vtkm::IdComponent& numPts, const Vector X2 = GetHexX2(pts); const Vector X3 = GetHexX3(pts); - const Scalar x1 = vtkm::Sqrt(vtkm::MagnitudeSquared(X1)); - const Scalar x2 = vtkm::Sqrt(vtkm::MagnitudeSquared(X2)); - const Scalar x3 = vtkm::Sqrt(vtkm::MagnitudeSquared(X3)); + const Scalar x1 = static_cast(vtkm::Sqrt(vtkm::MagnitudeSquared(X1))); + const Scalar x2 = static_cast(vtkm::Sqrt(vtkm::MagnitudeSquared(X2))); + const Scalar x3 = static_cast(vtkm::Sqrt(vtkm::MagnitudeSquared(X3))); if (x1 <= Scalar(0.0) || x2 <= Scalar(0.0) || x3 <= Scalar(0.0)) { diff --git a/vtkm/worklet/cellmetrics/CellConditionMetric.h b/vtkm/worklet/cellmetrics/CellConditionMetric.h index 79848b912..3f2394f4a 100644 --- a/vtkm/worklet/cellmetrics/CellConditionMetric.h +++ b/vtkm/worklet/cellmetrics/CellConditionMetric.h @@ -93,7 +93,8 @@ VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts, const Vector L2 = GetTriangleL2(pts); const Scalar q = - (vtkm::Dot(L2, L2) + vtkm::Dot(L1, L1) + vtkm::Dot(L1, L2)) / (two * area * rootThree); + static_cast((vtkm::Dot(L2, L2) + vtkm::Dot(L1, L1) + vtkm::Dot(L1, L2))) / + (two * area * rootThree); return q; } @@ -164,7 +165,7 @@ VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts, const Vector C2 = ((negTwo * L2) - L0) / root3; const Vector C3 = ((three * L3) + L2 - L0) / root6; - const Scalar cDet = vtkm::Dot(C1, vtkm::Cross(C2, C3)); + const Scalar cDet = static_cast(vtkm::Dot(C1, vtkm::Cross(C2, C3))); if (cDet <= Scalar(0.0)) { @@ -175,8 +176,9 @@ VTKM_EXEC OutType CellConditionMetric(const vtkm::IdComponent& numPts, const Vector C2xC3 = vtkm::Cross(C2, C3); const Vector C1xC3 = vtkm::Cross(C1, C3); - const Scalar t1 = vtkm::Dot(C1, C1) + vtkm::Dot(C2, C2) + vtkm::Dot(C3, C3); - const Scalar t2 = vtkm::Dot(C1xC2, C1xC2) + vtkm::Dot(C2xC3, C2xC3) + vtkm::Dot(C1xC3, C1xC3); + const Scalar t1 = static_cast(vtkm::Dot(C1, C1) + vtkm::Dot(C2, C2) + vtkm::Dot(C3, C3)); + const Scalar t2 = static_cast(vtkm::Dot(C1xC2, C1xC2) + vtkm::Dot(C2xC3, C2xC3) + + vtkm::Dot(C1xC3, C1xC3)); const Scalar q = vtkm::Sqrt(t1 * t2) / (three * cDet); return q; diff --git a/vtkm/worklet/cellmetrics/CellDimensionMetric.h b/vtkm/worklet/cellmetrics/CellDimensionMetric.h index b7b1ca786..032af2ad3 100644 --- a/vtkm/worklet/cellmetrics/CellDimensionMetric.h +++ b/vtkm/worklet/cellmetrics/CellDimensionMetric.h @@ -80,32 +80,32 @@ VTKM_EXEC OutType CellDimensionMetric(const vtkm::IdComponent& numPts, UNUSED(ec); OutType gradop[8][3]; - OutType x1 = pts[0][0]; - OutType x2 = pts[1][0]; - OutType x3 = pts[2][0]; - OutType x4 = pts[3][0]; - OutType x5 = pts[4][0]; - OutType x6 = pts[5][0]; - OutType x7 = pts[6][0]; - OutType x8 = pts[7][0]; + OutType x1 = static_cast(pts[0][0]); + OutType x2 = static_cast(pts[1][0]); + OutType x3 = static_cast(pts[2][0]); + OutType x4 = static_cast(pts[3][0]); + OutType x5 = static_cast(pts[4][0]); + OutType x6 = static_cast(pts[5][0]); + OutType x7 = static_cast(pts[6][0]); + OutType x8 = static_cast(pts[7][0]); - OutType y1 = pts[0][1]; - OutType y2 = pts[1][1]; - OutType y3 = pts[2][1]; - OutType y4 = pts[3][1]; - OutType y5 = pts[4][1]; - OutType y6 = pts[5][1]; - OutType y7 = pts[6][1]; - OutType y8 = pts[7][1]; + OutType y1 = static_cast(pts[0][1]); + OutType y2 = static_cast(pts[1][1]); + OutType y3 = static_cast(pts[2][1]); + OutType y4 = static_cast(pts[3][1]); + OutType y5 = static_cast(pts[4][1]); + OutType y6 = static_cast(pts[5][1]); + OutType y7 = static_cast(pts[6][1]); + OutType y8 = static_cast(pts[7][1]); - OutType z1 = pts[0][2]; - OutType z2 = pts[1][2]; - OutType z3 = pts[2][2]; - OutType z4 = pts[3][2]; - OutType z5 = pts[4][2]; - OutType z6 = pts[5][2]; - OutType z7 = pts[6][2]; - OutType z8 = pts[7][2]; + OutType z1 = static_cast(pts[0][2]); + OutType z2 = static_cast(pts[1][2]); + OutType z3 = static_cast(pts[2][2]); + OutType z4 = static_cast(pts[3][2]); + OutType z5 = static_cast(pts[4][2]); + OutType z6 = static_cast(pts[5][2]); + OutType z7 = static_cast(pts[6][2]); + OutType z8 = static_cast(pts[7][2]); OutType z24 = z2 - z4; OutType z52 = z5 - z2;