Skip to content

Commit

Permalink
GRIDEDIT-1546 Changes made after sonarcloud analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
BillSenior committed Nov 26, 2024
1 parent 16d10dc commit 4117309
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions libs/MeshKernelApi/src/MeshKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1524,9 +1524,7 @@ namespace meshkernelapi
throw meshkernel::MeshKernelError("The selected mesh kernel id does not exist.");
}

const auto& mesh2d = meshKernelState.at(meshKernelId).m_mesh2d;

if (!mesh2d || mesh2d->GetNumNodes() <= 0)
if (const auto& mesh2d = meshKernelState.at(meshKernelId).m_mesh2d; !mesh2d || mesh2d->GetNumNodes() <= 0)
{
return lastExitCode;
}
Expand Down Expand Up @@ -1559,9 +1557,7 @@ namespace meshkernelapi
throw meshkernel::MeshKernelError("The selected mesh kernel id does not exist.");
}

const auto& mesh2d = meshKernelState.at(meshKernelId).m_mesh2d;

if (!mesh2d || mesh2d->GetNumNodes() <= 0)
if (const auto& mesh2d = meshKernelState.at(meshKernelId).m_mesh2d; !mesh2d || mesh2d->GetNumNodes() <= 0)
{
return lastExitCode;
}
Expand Down Expand Up @@ -1599,7 +1595,7 @@ namespace meshkernelapi

const auto result = meshKernelState[meshKernelId].m_mesh2d->GetSmoothness();

std::copy(result.begin(), result.end(), geometryList.values);
std::ranges::copy(result, geometryList.values);
}
catch (...)
{
Expand Down
4 changes: 2 additions & 2 deletions libs/MeshKernelApi/src/PropertyCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void meshkernelapi::OrthogonalityPropertyCalculator::Calculate(const MeshKernelS
throw meshkernel::MeshKernelError("GeometryList with wrong dimensions");
}

std::copy(values.begin(), values.end(), geometryList.values);
std::ranges::copy(values, geometryList.values);
}

int meshkernelapi::OrthogonalityPropertyCalculator::Size(const MeshKernelState& state) const
Expand All @@ -29,7 +29,7 @@ void meshkernelapi::EdgeLengthPropertyCalculator::Calculate(const MeshKernelStat
throw meshkernel::MeshKernelError("GeometryList with wrong dimensions");
}

std::copy(values.begin(), values.end(), geometryList.values);
std::ranges::copy(values, geometryList.values);
}

int meshkernelapi::EdgeLengthPropertyCalculator::Size(const MeshKernelState& state) const
Expand Down

0 comments on commit 4117309

Please sign in to comment.