From d99bcb676e2941d09a525fccdf0c4b4377e47577 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Wed, 19 Feb 2025 23:59:50 +0100
Subject: [PATCH] Fix checkpointing tests

Test failed since mesh id is now incremented in sequential when mesh
dispatching is called. This change is done to force a consistent
behavior when load_balance is called in sequential or in parallel:
- a "new" mesh is returned in sequential (a shallow copy is performed
  and id is incremented)
- this allows to check that discrete functions are defined on the same
  "balanced" mesh even for sequential calculations (when preparing a
  calculation for instance)
---
 tests/test_checkpointing_Checkpoint.cpp       |   8 +-
 ...st_checkpointing_Checkpoint_sequential.cpp |  24 +--
 tests/test_checkpointing_Connectivity.cpp     |   6 +-
 tests/test_checkpointing_Resume.cpp           |  63 ++++----
 .../test_checkpointing_Resume_sequential.cpp  | 148 +++++++++---------
 5 files changed, 123 insertions(+), 126 deletions(-)

diff --git a/tests/test_checkpointing_Checkpoint.cpp b/tests/test_checkpointing_Checkpoint.cpp
index 317683b26..9436797a7 100644
--- a/tests/test_checkpointing_Checkpoint.cpp
+++ b/tests/test_checkpointing_Checkpoint.cpp
@@ -152,13 +152,13 @@ for(let i:N, i=0; i<3; ++i) {
 
     HighFive::Group m = embedded1.getGroup("m");
     REQUIRE(m.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+    REQUIRE(m.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
     HighFive::Group singleton        = checkpoint.getGroup("singleton");
     HighFive::Group global_variables = singleton.getGroup("global_variables");
     REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() ==
             initial_connectivity_id + 1 + (parallel::size() > 1));
-    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 1 + (parallel::size() > 1));
+    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 2);
     HighFive::Group execution_info = singleton.getGroup("execution_info");
     REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 1);
 
@@ -170,10 +170,10 @@ for(let i:N, i=0; i<3; ++i) {
     REQUIRE(connectivity0.getAttribute("type").read<std::string>() == "unstructured");
 
     HighFive::Group mesh  = checkpoint.getGroup("mesh");
-    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + (parallel::size() > 1)));
+    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
     REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + (parallel::size() > 1));
     REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
     HighFive::Group functions = checkpoint.getGroup("functions");
diff --git a/tests/test_checkpointing_Checkpoint_sequential.cpp b/tests/test_checkpointing_Checkpoint_sequential.cpp
index 160404f88..825138fab 100644
--- a/tests/test_checkpointing_Checkpoint_sequential.cpp
+++ b/tests/test_checkpointing_Checkpoint_sequential.cpp
@@ -158,19 +158,19 @@ for(let i:N, i=0; i<3; ++i) {
     REQUIRE(duals.getAttribute("type").read<std::string>() == "(mesh)");
     HighFive::Group duals_0 = duals.getGroup("0");
     REQUIRE(duals_0.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
+    REQUIRE(duals_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
     HighFive::Group duals_1 = duals.getGroup("1");
     REQUIRE(duals_1.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(duals_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
 
     HighFive::Group m = embedded1.getGroup("m");
     REQUIRE(m.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(m.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
     HighFive::Group singleton        = checkpoint.getGroup("singleton");
     HighFive::Group global_variables = singleton.getGroup("global_variables");
     REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() == initial_connectivity_id + 3);
-    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 4);
     HighFive::Group execution_info = singleton.getGroup("execution_info");
     REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 1);
 
@@ -193,21 +193,21 @@ for(let i:N, i=0; i<3; ++i) {
     REQUIRE(connectivity2.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Median);
 
     HighFive::Group mesh  = checkpoint.getGroup("mesh");
-    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id));
+    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
     REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id);
     REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
-    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
-    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
+    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh1.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh1.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
-    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
-    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
-    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
+    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh2.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh2.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Median);
 
diff --git a/tests/test_checkpointing_Connectivity.cpp b/tests/test_checkpointing_Connectivity.cpp
index dcb6bb146..01c4a6b70 100644
--- a/tests/test_checkpointing_Connectivity.cpp
+++ b/tests/test_checkpointing_Connectivity.cpp
@@ -57,7 +57,7 @@ TEST_CASE("checkpointing_Connectivity", "[utils/checkpointing]")
         auto new_connectivity_1d = test_only::duplicateConnectivity(mesh_1d->connectivity());
         checkpointing::writeConnectivity(*new_connectivity_1d, file, checkpoint_group_0);
         checkpointing::writeConnectivity(*new_connectivity_1d, file, checkpoint_group_1);
-        connectivity_id_map[mesh_1d->id()] = new_connectivity_1d->id();
+        connectivity_id_map[mesh_1d->connectivity().id()] = new_connectivity_1d->id();
 
         auto mesh_2d = MeshDataBaseForTests::get().hybrid2DMesh()->get<Mesh<2>>();
 
@@ -69,7 +69,7 @@ TEST_CASE("checkpointing_Connectivity", "[utils/checkpointing]")
 
         checkpointing::writeConnectivity(*new_connectivity_2d, file, checkpoint_group_0);
         checkpointing::writeConnectivity(*new_connectivity_2d, file, checkpoint_group_1);
-        connectivity_id_map[mesh_2d->id()] = new_connectivity_2d->id();
+        connectivity_id_map[mesh_2d->connectivity().id()] = new_connectivity_2d->id();
 
         HighFive::Group global_variables_group_0 = checkpoint_group_0.createGroup("singleton/global_variables");
         global_variables_group_0.createAttribute("connectivity_id",
@@ -83,7 +83,7 @@ TEST_CASE("checkpointing_Connectivity", "[utils/checkpointing]")
 
         auto new_connectivity_3d = test_only::duplicateConnectivity(mesh_3d->connectivity());
         checkpointing::writeConnectivity(*new_connectivity_3d, file, checkpoint_group_1);
-        connectivity_id_map[mesh_3d->id()] = new_connectivity_3d->id();
+        connectivity_id_map[mesh_3d->connectivity().id()] = new_connectivity_3d->id();
 
         // creates artificially holes in numbering
         test_only::duplicateConnectivity(mesh_3d->connectivity());
diff --git a/tests/test_checkpointing_Resume.cpp b/tests/test_checkpointing_Resume.cpp
index 82ea9202b..13f1b341e 100644
--- a/tests/test_checkpointing_Resume.cpp
+++ b/tests/test_checkpointing_Resume.cpp
@@ -229,22 +229,21 @@ for(let i:N, i=0; i<3; ++i) {
 
       HighFive::Group m1d = embedded1.getGroup("m1d");
       REQUIRE(m1d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (1 + 2 * (parallel::size() > 1)));
+      REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
 
       HighFive::Group m2d = embedded1.getGroup("m2d");
       REQUIRE(m2d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+      REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
       HighFive::Group m3d = embedded1.getGroup("m3d");
       REQUIRE(m3d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (2 + 3 * (parallel::size() > 1)));
+      REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
 
       HighFive::Group singleton        = checkpoint.getGroup("singleton");
       HighFive::Group global_variables = singleton.getGroup("global_variables");
       REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() ==
               initial_connectivity_id + 3 * (1 + (parallel::size() > 1)));
-      REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() ==
-              initial_mesh_id + 3 * (1 + (parallel::size() > 1)));
+      REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 6);
       HighFive::Group execution_info = singleton.getGroup("execution_info");
       REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 1);
 
@@ -270,24 +269,24 @@ for(let i:N, i=0; i<3; ++i) {
       REQUIRE(connectivity2.getAttribute("type").read<std::string>() == "unstructured");
 
       HighFive::Group mesh  = checkpoint.getGroup("mesh");
-      HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + (parallel::size() > 1)));
+      HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
       REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + (parallel::size() > 1));
       REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-      REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+      REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
       REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
-      HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + (1 + 2 * (parallel::size() > 1))));
+      HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
       REQUIRE(mesh1.getAttribute("connectivity").read<uint64_t>() ==
               initial_connectivity_id + (1 + 2 * (parallel::size() > 1)));
       REQUIRE(mesh1.getAttribute("dimension").read<uint64_t>() == 1);
-      REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + (1 + 2 * (parallel::size() > 1)));
+      REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
       REQUIRE(mesh1.getAttribute("type").read<std::string>() == "polygonal");
 
-      HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + (2 + 3 * (parallel::size() > 1))));
+      HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
       REQUIRE(mesh2.getAttribute("connectivity").read<uint64_t>() ==
               initial_connectivity_id + (2 + 3 * (parallel::size() > 1)));
       REQUIRE(mesh2.getAttribute("dimension").read<uint64_t>() == 3);
-      REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + (2 + 3 * (parallel::size() > 1)));
+      REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
       REQUIRE(mesh2.getAttribute("type").read<std::string>() == "polygonal");
 
       HighFive::Group functions = checkpoint.getGroup("functions");
@@ -357,22 +356,21 @@ for(let i:N, i=0; i<3; ++i) {
 
       HighFive::Group m1d = embedded1.getGroup("m1d");
       REQUIRE(m1d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (1 + 2 * (parallel::size() > 1)));
+      REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
 
       HighFive::Group m2d = embedded1.getGroup("m2d");
       REQUIRE(m2d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+      REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
       HighFive::Group m3d = embedded1.getGroup("m3d");
       REQUIRE(m3d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (2 + 3 * (parallel::size() > 1)));
+      REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
 
       HighFive::Group singleton        = checkpoint.getGroup("singleton");
       HighFive::Group global_variables = singleton.getGroup("global_variables");
       REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() ==
               initial_connectivity_id + 3 * (1 + (parallel::size() > 1)));
-      REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() ==
-              initial_mesh_id + 3 * (1 + (parallel::size() > 1)));
+      REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 6);
       HighFive::Group execution_info = singleton.getGroup("execution_info");
       REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 1);
 
@@ -398,24 +396,24 @@ for(let i:N, i=0; i<3; ++i) {
       REQUIRE(connectivity2.getAttribute("type").read<std::string>() == "unstructured");
 
       HighFive::Group mesh  = checkpoint.getGroup("mesh");
-      HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + (parallel::size() > 1)));
+      HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
       REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + (parallel::size() > 1));
       REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-      REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+      REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
       REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
-      HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + (1 + 2 * (parallel::size() > 1))));
+      HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
       REQUIRE(mesh1.getAttribute("connectivity").read<uint64_t>() ==
               initial_connectivity_id + (1 + 2 * (parallel::size() > 1)));
       REQUIRE(mesh1.getAttribute("dimension").read<uint64_t>() == 1);
-      REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + (1 + 2 * (parallel::size() > 1)));
+      REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
       REQUIRE(mesh1.getAttribute("type").read<std::string>() == "polygonal");
 
-      HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + (2 + 3 * (parallel::size() > 1))));
+      HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
       REQUIRE(mesh2.getAttribute("connectivity").read<uint64_t>() ==
               initial_connectivity_id + (2 + 3 * (parallel::size() > 1)));
       REQUIRE(mesh2.getAttribute("dimension").read<uint64_t>() == 3);
-      REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + (2 + 3 * (parallel::size() > 1)));
+      REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
       REQUIRE(mesh2.getAttribute("type").read<std::string>() == "polygonal");
 
       HighFive::Group functions = checkpoint.getGroup("functions");
@@ -488,22 +486,21 @@ for(let i:N, i=0; i<3; ++i) {
 
       HighFive::Group m1d = embedded1.getGroup("m1d");
       REQUIRE(m1d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (1 + 2 * (parallel::size() > 1)));
+      REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
 
       HighFive::Group m2d = embedded1.getGroup("m2d");
       REQUIRE(m2d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+      REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
       HighFive::Group m3d = embedded1.getGroup("m3d");
       REQUIRE(m3d.getAttribute("type").read<std::string>() == "mesh");
-      REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + (2 + 3 * (parallel::size() > 1)));
+      REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
 
       HighFive::Group singleton        = checkpoint.getGroup("singleton");
       HighFive::Group global_variables = singleton.getGroup("global_variables");
       REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() ==
               initial_connectivity_id + 3 * (1 + (parallel::size() > 1)));
-      REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() ==
-              initial_mesh_id + 3 * (1 + (parallel::size() > 1)));
+      REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 6);
       HighFive::Group execution_info = singleton.getGroup("execution_info");
       REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 2);
 
@@ -529,24 +526,24 @@ for(let i:N, i=0; i<3; ++i) {
       REQUIRE(connectivity2.getAttribute("type").read<std::string>() == "unstructured");
 
       HighFive::Group mesh  = checkpoint.getGroup("mesh");
-      HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + (parallel::size() > 1)));
+      HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
       REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + (parallel::size() > 1));
       REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-      REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + (parallel::size() > 1));
+      REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
       REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
-      HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + (1 + 2 * (parallel::size() > 1))));
+      HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
       REQUIRE(mesh1.getAttribute("connectivity").read<uint64_t>() ==
               initial_connectivity_id + (1 + 2 * (parallel::size() > 1)));
       REQUIRE(mesh1.getAttribute("dimension").read<uint64_t>() == 1);
-      REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + (1 + 2 * (parallel::size() > 1)));
+      REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
       REQUIRE(mesh1.getAttribute("type").read<std::string>() == "polygonal");
 
-      HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + (2 + 3 * (parallel::size() > 1))));
+      HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
       REQUIRE(mesh2.getAttribute("connectivity").read<uint64_t>() ==
               initial_connectivity_id + (2 + 3 * (parallel::size() > 1)));
       REQUIRE(mesh2.getAttribute("dimension").read<uint64_t>() == 3);
-      REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + (2 + 3 * (parallel::size() > 1)));
+      REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
       REQUIRE(mesh2.getAttribute("type").read<std::string>() == "polygonal");
 
       HighFive::Group functions = checkpoint.getGroup("functions");
diff --git a/tests/test_checkpointing_Resume_sequential.cpp b/tests/test_checkpointing_Resume_sequential.cpp
index e8a3aa103..f2ea03bbe 100644
--- a/tests/test_checkpointing_Resume_sequential.cpp
+++ b/tests/test_checkpointing_Resume_sequential.cpp
@@ -233,37 +233,37 @@ for(let i:N, i=0; i<3; ++i) {
 
     HighFive::Group m1d = embedded1.getGroup("m1d");
     REQUIRE(m1d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(m1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
 
     HighFive::Group dual_1d = embedded1.getGroup("dual_1d");
     REQUIRE(dual_1d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(dual_1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 4);
+    REQUIRE(dual_1d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
 
     HighFive::Group m2d = embedded1.getGroup("m2d");
     REQUIRE(m2d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
     HighFive::Group duals_2d = embedded1.getGroup("duals_2d");
     REQUIRE(duals_2d.getAttribute("type").read<std::string>() == "(mesh)");
     HighFive::Group duals_2d_0 = duals_2d.getGroup("0");
     REQUIRE(duals_2d_0.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_2d_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
+    REQUIRE(duals_2d_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
     HighFive::Group duals_2d_1 = duals_2d.getGroup("1");
     REQUIRE(duals_2d_1.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_2d_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(duals_2d_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
 
     HighFive::Group m3d = embedded1.getGroup("m3d");
     REQUIRE(m3d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
+    REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 8);
 
     HighFive::Group dual_3d = embedded1.getGroup("dual_3d");
     REQUIRE(dual_3d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(dual_3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
+    REQUIRE(dual_3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 9);
 
     HighFive::Group singleton        = checkpoint.getGroup("singleton");
     HighFive::Group global_variables = singleton.getGroup("global_variables");
     REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() == initial_connectivity_id + 7);
-    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 7);
+    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 10);
     HighFive::Group execution_info = singleton.getGroup("execution_info");
     REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 1);
 
@@ -308,45 +308,45 @@ for(let i:N, i=0; i<3; ++i) {
     REQUIRE(connectivity6.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
     HighFive::Group mesh  = checkpoint.getGroup("mesh");
-    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id));
+    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
     REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id);
     REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
-    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
-    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
+    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh1.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh1.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
-    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
-    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
-    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
+    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh2.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh2.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Median);
 
-    HighFive::Group mesh3 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
+    HighFive::Group mesh3 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
     REQUIRE(mesh3.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + 3);
     REQUIRE(mesh3.getAttribute("dimension").read<uint64_t>() == 1);
-    REQUIRE(mesh3.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(mesh3.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
     REQUIRE(mesh3.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh4 = mesh.getGroup(std::to_string(initial_mesh_id + 4));
-    REQUIRE(mesh4.getAttribute("id").read<uint64_t>() == initial_mesh_id + 4);
-    REQUIRE(mesh4.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 3);
+    HighFive::Group mesh4 = mesh.getGroup(std::to_string(initial_mesh_id + 6));
+    REQUIRE(mesh4.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
+    REQUIRE(mesh4.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 5);
     REQUIRE(mesh4.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh4.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Dual1D);
 
-    HighFive::Group mesh5 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
+    HighFive::Group mesh5 = mesh.getGroup(std::to_string(initial_mesh_id + 8));
     REQUIRE(mesh5.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + 5);
     REQUIRE(mesh5.getAttribute("dimension").read<uint64_t>() == 3);
-    REQUIRE(mesh5.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
+    REQUIRE(mesh5.getAttribute("id").read<uint64_t>() == initial_mesh_id + 8);
     REQUIRE(mesh5.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh6 = mesh.getGroup(std::to_string(initial_mesh_id + 6));
-    REQUIRE(mesh6.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
-    REQUIRE(mesh6.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 5);
+    HighFive::Group mesh6 = mesh.getGroup(std::to_string(initial_mesh_id + 9));
+    REQUIRE(mesh6.getAttribute("id").read<uint64_t>() == initial_mesh_id + 9);
+    REQUIRE(mesh6.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 8);
     REQUIRE(mesh6.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh6.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
@@ -417,29 +417,29 @@ for(let i:N, i=0; i<3; ++i) {
 
     HighFive::Group m2d = embedded1.getGroup("m2d");
     REQUIRE(m2d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
     HighFive::Group duals_2d = embedded1.getGroup("duals_2d");
     REQUIRE(duals_2d.getAttribute("type").read<std::string>() == "(mesh)");
     HighFive::Group duals_2d_0 = duals_2d.getGroup("0");
     REQUIRE(duals_2d_0.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_2d_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
+    REQUIRE(duals_2d_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
     HighFive::Group duals_2d_1 = duals_2d.getGroup("1");
     REQUIRE(duals_2d_1.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_2d_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(duals_2d_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
 
     HighFive::Group m3d = embedded1.getGroup("m3d");
     REQUIRE(m3d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
+    REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 8);
 
     HighFive::Group dual_3d = embedded1.getGroup("dual_3d");
     REQUIRE(dual_3d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(dual_3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
+    REQUIRE(dual_3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 9);
 
     HighFive::Group singleton        = checkpoint.getGroup("singleton");
     HighFive::Group global_variables = singleton.getGroup("global_variables");
     REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() == initial_connectivity_id + 7);
-    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 7);
+    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 10);
     HighFive::Group execution_info = singleton.getGroup("execution_info");
     REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 1);
 
@@ -484,45 +484,45 @@ for(let i:N, i=0; i<3; ++i) {
     REQUIRE(connectivity6.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
     HighFive::Group mesh  = checkpoint.getGroup("mesh");
-    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id));
+    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
     REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id);
     REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
-    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
-    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
+    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh1.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh1.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
-    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
-    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
-    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
+    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh2.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh2.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Median);
 
-    HighFive::Group mesh3 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
+    HighFive::Group mesh3 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
     REQUIRE(mesh3.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + 3);
     REQUIRE(mesh3.getAttribute("dimension").read<uint64_t>() == 1);
-    REQUIRE(mesh3.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(mesh3.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
     REQUIRE(mesh3.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh4 = mesh.getGroup(std::to_string(initial_mesh_id + 4));
-    REQUIRE(mesh4.getAttribute("id").read<uint64_t>() == initial_mesh_id + 4);
-    REQUIRE(mesh4.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 3);
+    HighFive::Group mesh4 = mesh.getGroup(std::to_string(initial_mesh_id + 6));
+    REQUIRE(mesh4.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
+    REQUIRE(mesh4.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 5);
     REQUIRE(mesh4.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh4.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Dual1D);
 
-    HighFive::Group mesh5 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
+    HighFive::Group mesh5 = mesh.getGroup(std::to_string(initial_mesh_id + 8));
     REQUIRE(mesh5.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + 5);
     REQUIRE(mesh5.getAttribute("dimension").read<uint64_t>() == 3);
-    REQUIRE(mesh5.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
+    REQUIRE(mesh5.getAttribute("id").read<uint64_t>() == initial_mesh_id + 8);
     REQUIRE(mesh5.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh6 = mesh.getGroup(std::to_string(initial_mesh_id + 6));
-    REQUIRE(mesh6.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
-    REQUIRE(mesh6.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 5);
+    HighFive::Group mesh6 = mesh.getGroup(std::to_string(initial_mesh_id + 9));
+    REQUIRE(mesh6.getAttribute("id").read<uint64_t>() == initial_mesh_id + 9);
+    REQUIRE(mesh6.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 8);
     REQUIRE(mesh6.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh6.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
@@ -596,29 +596,29 @@ for(let i:N, i=0; i<3; ++i) {
 
     HighFive::Group m2d = embedded1.getGroup("m2d");
     REQUIRE(m2d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(m2d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
 
     HighFive::Group duals_2d = embedded1.getGroup("duals_2d");
     REQUIRE(duals_2d.getAttribute("type").read<std::string>() == "(mesh)");
     HighFive::Group duals_2d_0 = duals_2d.getGroup("0");
     REQUIRE(duals_2d_0.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_2d_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
+    REQUIRE(duals_2d_0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
     HighFive::Group duals_2d_1 = duals_2d.getGroup("1");
     REQUIRE(duals_2d_1.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(duals_2d_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(duals_2d_1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
 
     HighFive::Group m3d = embedded1.getGroup("m3d");
     REQUIRE(m3d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
+    REQUIRE(m3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 8);
 
     HighFive::Group dual_3d = embedded1.getGroup("dual_3d");
     REQUIRE(dual_3d.getAttribute("type").read<std::string>() == "mesh");
-    REQUIRE(dual_3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
+    REQUIRE(dual_3d.getAttribute("id").read<uint64_t>() == initial_mesh_id + 9);
 
     HighFive::Group singleton        = checkpoint.getGroup("singleton");
     HighFive::Group global_variables = singleton.getGroup("global_variables");
     REQUIRE(global_variables.getAttribute("connectivity_id").read<uint64_t>() == initial_connectivity_id + 7);
-    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 7);
+    REQUIRE(global_variables.getAttribute("mesh_id").read<uint64_t>() == initial_mesh_id + 10);
     HighFive::Group execution_info = singleton.getGroup("execution_info");
     REQUIRE(execution_info.getAttribute("run_number").read<uint64_t>() == 2);
 
@@ -663,45 +663,45 @@ for(let i:N, i=0; i<3; ++i) {
     REQUIRE(connectivity6.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
     HighFive::Group mesh  = checkpoint.getGroup("mesh");
-    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id));
+    HighFive::Group mesh0 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
     REQUIRE(mesh0.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id);
     REQUIRE(mesh0.getAttribute("dimension").read<uint64_t>() == 2);
-    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id);
+    REQUIRE(mesh0.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh0.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 1));
-    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 1);
-    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh1 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
+    REQUIRE(mesh1.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
+    REQUIRE(mesh1.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh1.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh1.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
-    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 2));
-    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 2);
-    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id);
+    HighFive::Group mesh2 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
+    REQUIRE(mesh2.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(mesh2.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 1);
     REQUIRE(mesh2.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh2.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Median);
 
-    HighFive::Group mesh3 = mesh.getGroup(std::to_string(initial_mesh_id + 3));
+    HighFive::Group mesh3 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
     REQUIRE(mesh3.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + 3);
     REQUIRE(mesh3.getAttribute("dimension").read<uint64_t>() == 1);
-    REQUIRE(mesh3.getAttribute("id").read<uint64_t>() == initial_mesh_id + 3);
+    REQUIRE(mesh3.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
     REQUIRE(mesh3.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh4 = mesh.getGroup(std::to_string(initial_mesh_id + 4));
-    REQUIRE(mesh4.getAttribute("id").read<uint64_t>() == initial_mesh_id + 4);
-    REQUIRE(mesh4.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 3);
+    HighFive::Group mesh4 = mesh.getGroup(std::to_string(initial_mesh_id + 6));
+    REQUIRE(mesh4.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
+    REQUIRE(mesh4.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 5);
     REQUIRE(mesh4.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh4.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Dual1D);
 
-    HighFive::Group mesh5 = mesh.getGroup(std::to_string(initial_mesh_id + 5));
+    HighFive::Group mesh5 = mesh.getGroup(std::to_string(initial_mesh_id + 8));
     REQUIRE(mesh5.getAttribute("connectivity").read<uint64_t>() == initial_connectivity_id + 5);
     REQUIRE(mesh5.getAttribute("dimension").read<uint64_t>() == 3);
-    REQUIRE(mesh5.getAttribute("id").read<uint64_t>() == initial_mesh_id + 5);
+    REQUIRE(mesh5.getAttribute("id").read<uint64_t>() == initial_mesh_id + 8);
     REQUIRE(mesh5.getAttribute("type").read<std::string>() == "polygonal");
 
-    HighFive::Group mesh6 = mesh.getGroup(std::to_string(initial_mesh_id + 6));
-    REQUIRE(mesh6.getAttribute("id").read<uint64_t>() == initial_mesh_id + 6);
-    REQUIRE(mesh6.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 5);
+    HighFive::Group mesh6 = mesh.getGroup(std::to_string(initial_mesh_id + 9));
+    REQUIRE(mesh6.getAttribute("id").read<uint64_t>() == initial_mesh_id + 9);
+    REQUIRE(mesh6.getAttribute("primal_mesh_id").read<uint64_t>() == initial_mesh_id + 8);
     REQUIRE(mesh6.getAttribute("type").read<std::string>() == "dual_mesh");
     REQUIRE(mesh6.getAttribute("type_of_dual").read<DualMeshType>() == DualMeshType::Diamond);
 
-- 
GitLab