diff --git a/src/t8_forest/t8_forest_adapt.cxx b/src/t8_forest/t8_forest_adapt.cxx index d157502ae8..5b8e2caf9f 100644 --- a/src/t8_forest/t8_forest_adapt.cxx +++ b/src/t8_forest/t8_forest_adapt.cxx @@ -630,6 +630,13 @@ 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); 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);