From ca3f46ea65b5eda6a7e23ef65d5fc3eef2a3e442 Mon Sep 17 00:00:00 2001 From: Johannes Holke Date: Tue, 16 Jul 2024 16:09:09 +0200 Subject: [PATCH 1/4] Add abort message if all elements of a tree are removed --- src/t8_forest/t8_forest_adapt.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/t8_forest/t8_forest_adapt.cxx b/src/t8_forest/t8_forest_adapt.cxx index d157502ae8..3a6df6f397 100644 --- a/src/t8_forest/t8_forest_adapt.cxx +++ b/src/t8_forest/t8_forest_adapt.cxx @@ -630,6 +630,12 @@ t8_forest_adapt (t8_forest_t forest) /* Possibly shrink the telements array to the correct size */ t8_element_array_resize (telements, el_inserted); + /* It is not supported to delete all elements from a tree. + * In this case, we will abort. */ + SC_CHECK_ABORTF (el_inserted == 0, "ERROR: All elements of tree %i were removed. Removing all elements of a tree " + "is currently not supported. See also https://github.com/DLR-AMR/t8code/issues/1137.", ltree_id); + + /* clean up */ T8_FREE (elements); T8_FREE (elements_from); From 9c3a1e16bad216b04eea3de00213a73b8f674c09 Mon Sep 17 00:00:00 2001 From: "Dreyer, Lukas" Date: Tue, 16 Jul 2024 17:26:28 +0200 Subject: [PATCH 2/4] fix abort call --- src/t8_forest/t8_forest_adapt.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_forest/t8_forest_adapt.cxx b/src/t8_forest/t8_forest_adapt.cxx index 3a6df6f397..698864d47e 100644 --- a/src/t8_forest/t8_forest_adapt.cxx +++ b/src/t8_forest/t8_forest_adapt.cxx @@ -632,7 +632,7 @@ t8_forest_adapt (t8_forest_t forest) /* It is not supported to delete all elements from a tree. * In this case, we will abort. */ - SC_CHECK_ABORTF (el_inserted == 0, "ERROR: All elements of tree %i were removed. Removing all elements of a tree " + SC_CHECK_ABORTF (el_inserted != 0, "ERROR: All elements of tree %i were removed. Removing all elements of a tree " "is currently not supported. See also https://github.com/DLR-AMR/t8code/issues/1137.", ltree_id); From 53004e81969523c2d1570dd2d2ad9fd01b6872b1 Mon Sep 17 00:00:00 2001 From: "Dreyer, Lukas" Date: Tue, 16 Jul 2024 17:27:30 +0200 Subject: [PATCH 3/4] Indent --- src/t8_forest/t8_forest_adapt.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/t8_forest/t8_forest_adapt.cxx b/src/t8_forest/t8_forest_adapt.cxx index 698864d47e..5b8e2caf9f 100644 --- a/src/t8_forest/t8_forest_adapt.cxx +++ b/src/t8_forest/t8_forest_adapt.cxx @@ -632,9 +632,10 @@ t8_forest_adapt (t8_forest_t forest) /* It is not supported to delete all elements from a tree. * In this case, we will abort. */ - SC_CHECK_ABORTF (el_inserted != 0, "ERROR: All elements of tree %i were removed. Removing all elements of a tree " - "is currently not supported. See also https://github.com/DLR-AMR/t8code/issues/1137.", ltree_id); - + SC_CHECK_ABORTF (el_inserted != 0, + "ERROR: All elements of tree %i were removed. Removing all elements of a tree " + "is currently not supported. See also https://github.com/DLR-AMR/t8code/issues/1137.", + ltree_id); /* clean up */ T8_FREE (elements); From f1aa82470db9169511e1f83f0d04d5221f67c100 Mon Sep 17 00:00:00 2001 From: "Dreyer, Lukas" Date: Wed, 17 Jul 2024 10:11:55 +0200 Subject: [PATCH 4/4] Disable test --- .../t8_gtest_empty_local_tree.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/t8_forest_incomplete/t8_gtest_empty_local_tree.cxx b/test/t8_forest_incomplete/t8_gtest_empty_local_tree.cxx index 63584309b6..5c5e9af2d0 100644 --- a/test/t8_forest_incomplete/t8_gtest_empty_local_tree.cxx +++ b/test/t8_forest_incomplete/t8_gtest_empty_local_tree.cxx @@ -54,7 +54,9 @@ * The two resulting forests must be equal. */ -class local_tree: public testing::TestWithParam { +/** This test covers the functionality described in Issue: https://github.com/DLR-AMR/t8code/issues/1137 + * Remove `DISABLED_` from the name of the Test(suite) or use `--gtest_also_run_disabled_tests` when you start working on the issue. */ +class DISABLED_local_tree: public testing::TestWithParam { protected: void SetUp () override @@ -64,6 +66,7 @@ class local_tree: public testing::TestWithParam { forest = t8_forest_new_uniform (t8_cmesh_new_from_class (eclass, sc_MPI_COMM_WORLD), t8_scheme_new_default_cxx (), MPI_size, 0, sc_MPI_COMM_WORLD); + /* TODO: The level does not need to be as big as MPI_SIZE, only as big so that each process has at least one element */ if (MPI_size == 1 || MPI_size > MAX_NUM_RANKS) { GTEST_SKIP (); @@ -123,7 +126,7 @@ t8_adapt_forest (t8_forest_t forest_from, t8_forest_adapt_t adapt_fn, int do_ada return forest_new; } -TEST_P (local_tree, test_empty_local_tree) +TEST_P (DISABLED_local_tree, test_empty_local_tree) { /* Number of instances/testcases */ const uint32_t num_instances = 1 << MPI_size; @@ -157,5 +160,5 @@ TEST_P (local_tree, test_empty_local_tree) } } -INSTANTIATE_TEST_SUITE_P (t8_gtest_empty_local_tree, local_tree, testing::Range (T8_ECLASS_LINE, T8_ECLASS_COUNT), - print_eclass); +INSTANTIATE_TEST_SUITE_P (t8_gtest_empty_local_tree, DISABLED_local_tree, + testing::Range (T8_ECLASS_LINE, T8_ECLASS_COUNT), print_eclass);