Skip to content

Commit

Permalink
GRIDEDIT-1360
Browse files Browse the repository at this point in the history
Fixed several sonar cloud warnings
  • Loading branch information
BillSenior committed Oct 14, 2024
1 parent 2457929 commit 94bc6ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ namespace meshkernel
/// @brief Compute maximum allowable grid layer growth time
void ComputeMaximumTimeStep(const UInt layerIndex,
const lin_alg::RowVector<Point>& activeLayerPoints,
// const std::vector<Point>& activeLayerPoints,
const std::vector<Point>& velocityVectorAtGridPoints,
const std::vector<Point>& frontGridPoints,
const std::vector<Point>& frontVelocities,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,10 @@ namespace meshkernel

for (UInt i = 0; i < 4; ++i)
{
// Extend limits by a relatively small amount
const double lowerLimit = -8.0 * std::numeric_limits<double>::epsilon();
const double upperLimit = 1.0 + 8.0 * std::numeric_limits<double>::epsilon();

// TODO need to check that this is valid. (-1.0e-10 and 1.00001)
if (beta[i] >= lowerLimit && beta[i] <= upperLimit && roots[i] >= 0.0 && roots[i] != constants::missing::doubleValue)
{
time = std::min(time, roots[i]);
Expand Down Expand Up @@ -911,7 +911,7 @@ namespace meshkernel
double vv3 = std::sqrt(length(v4 - v1));
double vv4 = std::sqrt(length(v4 - v2));

double maxvv = std::max(std::max(vv1, vv2), std::max(vv3, vv4));
const double maxvv = std::max(std::max(vv1, vv2), std::max(vv3, vv4));

if (std::sqrt(hlow2) > maxvv * std::min(tmax[i], tmax[i + 1]))
{
Expand Down Expand Up @@ -1087,8 +1087,7 @@ namespace meshkernel
}
}

// TODO check layerindex - 1 or - 0
std::tie(frontVelocities, newFrontPoints, gridPointIndices) = CopyVelocitiesToFront(layerIndex - 0, velocityVectorAtGridPoints);
std::tie(frontVelocities, newFrontPoints, gridPointIndices) = CopyVelocitiesToFront(layerIndex, velocityVectorAtGridPoints);
}
}

Expand Down Expand Up @@ -1204,7 +1203,8 @@ namespace meshkernel

ll = ll || (previousIndices[0] == gridPointsIndices(p, 0) &&
(previousIndices[1] == constants::missing::uintValue || previousIndices[1] < gridPointsIndices(p, 1)));
lr = lr || (nextIndices[0] == gridPointsIndices(p, 0) && (nextIndices[1] == constants::missing::uintValue || nextIndices[1] < gridPointsIndices(p, 1)));
lr = lr || (nextIndices[0] == gridPointsIndices(p, 0) &&
(nextIndices[1] == constants::missing::uintValue || nextIndices[1] < gridPointsIndices(p, 1)));

if (ll || lr)
{
Expand Down Expand Up @@ -1432,10 +1432,9 @@ namespace meshkernel
}
const auto leftVelocity = normalVectorLeft * m_edgeVelocities[currentLeftIndex];
const auto rightVelocity = normalVectorRight * m_edgeVelocities[currentRightIndex - 1];
double rightLeftVelocityRatio = m_edgeVelocities[currentRightIndex - 1] / m_edgeVelocities[currentLeftIndex];
const double rightLeftVelocityRatio = m_edgeVelocities[currentRightIndex - 1] / m_edgeVelocities[currentLeftIndex];

// TODO Probably should be : std::abs(cosphi) <= cosTolerance
if ((rightLeftVelocityRatio - cosphi > eps && 1.0 / rightLeftVelocityRatio - cosphi > eps)) // || std::abs(cosphi) <= cosTolerance)
if (rightLeftVelocityRatio - cosphi > eps && 1.0 / rightLeftVelocityRatio - cosphi > eps)
{
velocityVector[m] = (leftVelocity * (1.0 - rightLeftVelocityRatio * cosphi) +
rightVelocity * (1.0 - 1.0 / rightLeftVelocityRatio * cosphi)) /
Expand Down

0 comments on commit 94bc6ff

Please sign in to comment.