Skip to content

Commit

Permalink
GRIDEDIT-1566 Fixed a number of sonar cloud warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
BillSenior committed Jan 6, 2025
1 parent 53a8a76 commit 8acebc9
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions libs/MeshKernel/src/Mesh2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2485,26 +2485,37 @@ std::unique_ptr<meshkernel::Mesh2D> Mesh2D::Merge(const std::span<const Point>&
std::vector<Point> mergedNodes(mesh1Nodes.size() + mesh2Nodes.size());
std::vector<Edge> mergedEdges(mesh1Edges.size() + mesh2Edges.size());

if (mesh1Nodes.size() > 0)
if (!mesh1Nodes.empty())
{
// Merge node array from mesh1 nodes
std::copy(mesh1Nodes.begin(), mesh1Nodes.end(), mergedNodes.begin());
std::ranges::copy(mesh1Nodes, mergedNodes.begin());

// Merge edge array from mesh1 edges
std::copy(mesh1Edges.begin(), mesh1Edges.end(), mergedEdges.begin());
std::ranges::copy(mesh1Edges, mergedEdges.begin());

// std::copy(mesh1Nodes.begin(), mesh1Nodes.end(), mergedNodes.begin());

// // Merge edge array from mesh1 edges
// std::copy(mesh1Edges.begin(), mesh1Edges.end(), mergedEdges.begin());
}

if (mesh2Nodes.size() > 0)
if (!mesh2Nodes.empty())
{
// Merge node array from mesh2 nodes
std::copy(mesh2Nodes.begin(), mesh2Nodes.end(), mergedNodes.begin() + mesh1Nodes.size());
std::ranges::copy(mesh2Nodes, mergedNodes.begin() + mesh1Nodes.size());

// Merge edge array from mesh2 edges
std::copy(mesh2Edges.begin(), mesh2Edges.end(), mergedEdges.begin() + mesh1Edges.size());
std::ranges::copy(mesh2Edges, mergedEdges.begin() + mesh1Edges.size());

// // Merge node array from mesh2 nodes
// std::copy(mesh2Nodes.begin(), mesh2Nodes.end(), mergedNodes.begin() + mesh1Nodes.size());

// // Merge edge array from mesh2 edges
// std::copy(mesh2Edges.begin(), mesh2Edges.end(), mergedEdges.begin() + mesh1Edges.size());

if (mesh1Nodes.size() > 0)
if (!mesh1Nodes.empty())
{
const UInt nodeOffset = mesh1Nodes.size();
const UInt nodeOffset = static_cast<UInt>(mesh1Nodes.size());

// Re-assign the node ids for the second mesh data set
for (size_t i = mesh1Edges.size(); i < mergedEdges.size(); ++i)
Expand Down

0 comments on commit 8acebc9

Please sign in to comment.