From: Matthias Maier Date: Wed, 8 Jun 2022 21:38:10 +0000 (-0500) Subject: distributed_grids/3d_refinement_09: refactor test X-Git-Tag: v9.4.0-rc1~49^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9553d8ac2bcdfe1a0026aea80d45c980b7662e5f;p=dealii.git distributed_grids/3d_refinement_09: refactor test - print maximal refinement level and add a comment to the logic --- diff --git a/tests/distributed_grids/3d_refinement_09.cc b/tests/distributed_grids/3d_refinement_09.cc index 79c2435efa..44333f8971 100644 --- a/tests/distributed_grids/3d_refinement_09.cc +++ b/tests/distributed_grids/3d_refinement_09.cc @@ -19,6 +19,7 @@ #include +#include #include #include @@ -37,10 +38,17 @@ template void test(std::ostream & /*out*/) { + const unsigned int max_level = internal::p4est::functions::max_level; + + deallog << "The maximal level of p4est refinements is " << max_level + << std::endl; + parallel::distributed::Triangulation tr(MPI_COMM_WORLD); GridGenerator::hyper_cube(tr); - for (unsigned int i = 0; i < 19; ++i) + // The first refinement level is "1". So in order to refine past the + // limit we have to attempt to refine max_level times: + for (unsigned int i = 0; i < max_level; ++i) { deallog << "cells: " << tr.n_active_cells() << " level:" << tr.n_levels() << std::endl; @@ -49,9 +57,8 @@ test(std::ostream & /*out*/) it = tr.begin_active(); while (it->level() < static_cast(i)) ++it; - - it->set_refine_flag(); + try { tr.execute_coarsening_and_refinement(); diff --git a/tests/distributed_grids/3d_refinement_09.debug.output b/tests/distributed_grids/3d_refinement_09.debug.output index eb291e1225..3eba6ab7d9 100644 --- a/tests/distributed_grids/3d_refinement_09.debug.output +++ b/tests/distributed_grids/3d_refinement_09.debug.output @@ -1,4 +1,5 @@ +DEAL:3d::The maximal level of p4est refinements is 19 DEAL:3d::cells: 1 level:1 DEAL:3d::cells: 8 level:2 DEAL:3d::cells: 15 level:3