]> https://gitweb.dealii.org/ - dealii.git/commitdiff
distributed_grids/3d_refinement_09: refactor test
authorMatthias Maier <tamiko@43-1.org>
Wed, 8 Jun 2022 21:38:10 +0000 (16:38 -0500)
committerMatthias Maier <tamiko@43-1.org>
Wed, 8 Jun 2022 21:40:15 +0000 (16:40 -0500)
 - print maximal refinement level and add a comment to the logic

tests/distributed_grids/3d_refinement_09.cc
tests/distributed_grids/3d_refinement_09.debug.output

index 79c2435efa591adad5e2c69ccd3d4ba0369f59c1..44333f89716aab5dfb293ae8c53030d612bbb325 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <deal.II/base/tensor.h>
 
+#include <deal.II/distributed/p4est_wrappers.h>
 #include <deal.II/distributed/tria.h>
 
 #include <deal.II/grid/grid_generator.h>
@@ -37,10 +38,17 @@ template <int dim>
 void
 test(std::ostream & /*out*/)
 {
+  const unsigned int max_level = internal::p4est::functions<dim>::max_level;
+
+  deallog << "The maximal level of p4est refinements is " << max_level
+          << std::endl;
+
   parallel::distributed::Triangulation<dim> 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<int>(i))
         ++it;
-
-
       it->set_refine_flag();
+
       try
         {
           tr.execute_coarsening_and_refinement();
index eb291e12252c33667c68494a10849db3726c85e2..3eba6ab7d94a63c7332e2c29b80888c9bb9dc184 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.