From dc63328aa0540303ac19d9e043645b10c771367e Mon Sep 17 00:00:00 2001 From: Willem Deconinck Date: Thu, 18 Jan 2024 13:53:05 +0100 Subject: [PATCH] Fix for setting of nb_edges via BuildEdges action --- src/atlas/mesh/actions/BuildEdges.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/atlas/mesh/actions/BuildEdges.cc b/src/atlas/mesh/actions/BuildEdges.cc index eb6461e91..08a568a17 100644 --- a/src/atlas/mesh/actions/BuildEdges.cc +++ b/src/atlas/mesh/actions/BuildEdges.cc @@ -380,7 +380,9 @@ void build_edges(Mesh& mesh, const eckit::Configuration& config) { for (int halo = 0; halo <= mesh_halo; ++halo) { edge_start = edge_end; - edge_end += (edge_halo_offsets[halo + 1] - edge_halo_offsets[halo]); + if (halo+1 < edge_halo_offsets.size()) { + edge_end += (edge_halo_offsets[halo + 1] - edge_halo_offsets[halo]); + } if (/*sort edges based on lowest node local index = */ sort_edges) { if (sorted_edge_nodes_data.empty()) { @@ -552,6 +554,11 @@ void build_edges(Mesh& mesh, const eckit::Configuration& config) { ss << "nb_edges_including_halo[" << i << "]"; mesh.metadata().set(ss.str(), nb_edges_including_halo[i]); } + for (int i = max_halo + 1; i <= mesh_halo; ++i) { + std::stringstream ss; + ss << "nb_edges_including_halo[" << i << "]"; + mesh.metadata().set(ss.str(), nb_edges_including_halo.back()); + } mesh.metadata().set("built_edges_for_halo", mesh_halo);