]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update tests
authorDaniel Arndt <arndtd@ornl.gov>
Mon, 30 Mar 2020 16:29:40 +0000 (12:29 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Mon, 30 Mar 2020 16:31:24 +0000 (12:31 -0400)
tests/mpi/multigrid_adaptive.cc
tests/mpi/multigrid_uniform.cc
tests/multigrid/cycles.cc
tests/multigrid/cycles.output

index 264d6f54bda28dde9c65cbe2d4cbdebb02b422bd..c59943bd3d3fd0d970a03457b3e6dc048bcad9cd 100644 (file)
@@ -420,6 +420,37 @@ namespace Step50
     mg::Matrix<vector_t> mg_interface_up(mg_interface_matrices);
     mg::Matrix<vector_t> mg_interface_down(mg_interface_matrices);
 
+    auto print_coarse_solve = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "V-cycle entering level " << level << std::endl;
+          deallog << "Coarse level           " << level << std::endl;
+        }
+    };
+
+    auto print_restriction = [](const bool start, const unsigned int level) {
+      if (start)
+        deallog << "Residual on      level " << level << std::endl;
+    };
+
+    auto print_pre_smoother_step = [](const bool         start,
+                                      const unsigned int level) {
+      if (start)
+        {
+          deallog << "V-cycle entering level " << level << std::endl;
+          deallog << "Smoothing on     level " << level << std::endl;
+        }
+    };
+
+    auto print_post_smoother_step = [](const bool         start,
+                                       const unsigned int level) {
+      if (start)
+        {
+          deallog << "Smoothing on     level " << level << std::endl;
+          deallog << "V-cycle leaving  level " << level << std::endl;
+        }
+    };
+
     // Now, we are ready to set up the
     // V-cycle operator and the
     // multilevel preconditioner.
@@ -427,6 +458,11 @@ namespace Step50
       mg_matrix, coarse_grid_solver, mg_transfer, mg_smoother, mg_smoother);
     mg.set_edge_matrices(mg_interface_down, mg_interface_up);
 
+    mg.connect_coarse_solve(print_coarse_solve);
+    mg.connect_restriction(print_restriction);
+    mg.connect_pre_smoother_step(print_pre_smoother_step);
+    mg.connect_post_smoother_step(print_post_smoother_step);
+
     PreconditionMG<dim, vector_t, MGTransferPrebuilt<vector_t>> preconditioner(
       mg_dof_handler, mg, mg_transfer);
 
index 5b871d5718ad77e8e4e735ce74c7bfa358b48088..27d5897ec7302d413ddf34d753fbef5a25600757 100644 (file)
@@ -407,6 +407,37 @@ namespace Step50
     mg::Matrix<vector_t> mg_interface_up(mg_interface_matrices);
     mg::Matrix<vector_t> mg_interface_down(mg_interface_matrices);
 
+    auto print_coarse_solve = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "V-cycle entering level " << level << std::endl;
+          deallog << "Coarse level           " << level << std::endl;
+        }
+    };
+
+    auto print_restriction = [](const bool start, const unsigned int level) {
+      if (start)
+        deallog << "Residual on      level " << level << std::endl;
+    };
+
+    auto print_pre_smoother_step = [](const bool         start,
+                                      const unsigned int level) {
+      if (start)
+        {
+          deallog << "V-cycle entering level " << level << std::endl;
+          deallog << "Smoothing on     level " << level << std::endl;
+        }
+    };
+
+    auto print_post_smoother_step = [](const bool         start,
+                                       const unsigned int level) {
+      if (start)
+        {
+          deallog << "Smoothing on     level " << level << std::endl;
+          deallog << "V-cycle leaving  level " << level << std::endl;
+        }
+    };
+
     // Now, we are ready to set up the
     // V-cycle operator and the
     // multilevel preconditioner.
@@ -414,6 +445,11 @@ namespace Step50
       mg_matrix, coarse_grid_solver, mg_transfer, mg_smoother, mg_smoother);
     mg.set_edge_matrices(mg_interface_down, mg_interface_up);
 
+    mg.connect_coarse_solve(print_coarse_solve);
+    mg.connect_restriction(print_restriction);
+    mg.connect_pre_smoother_step(print_pre_smoother_step);
+    mg.connect_post_smoother_step(print_post_smoother_step);
+
     PreconditionMG<dim, vector_t, MGTransferPrebuilt<vector_t>> preconditioner(
       mg_dof_handler, mg, mg_transfer);
 
index 54ea6772be565e080b6f038e952b0a1c245e5816..75ae2a1d37fa8e90485fd909a077309d60649ec0 100644 (file)
@@ -81,18 +81,200 @@ test_cycles(unsigned int minlevel, unsigned int maxlevel)
                             minlevel,
                             maxlevel,
                             Multigrid<VectorType>::v_cycle);
-  mg1.set_debug(3);
+
   for (unsigned int i = minlevel; i <= maxlevel; ++i)
     mg1.defect[i].reinit(N);
-  mg1.cycle();
-  deallog << std::endl;
 
-  mg1.set_cycle(Multigrid<VectorType>::w_cycle);
-  mg1.cycle();
-  deallog << std::endl;
+  {
+    auto print_coarse_solve = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "V-cycle entering level " << level << std::endl;
+          deallog << "V-cycle  Defect norm   0" << std::endl;
+          deallog << "Coarse level           " << level << std::endl;
+        }
+    };
+
+    auto print_restriction = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "Residual on      level " << level << std::endl;
+          deallog << "Residual norm          0" << std::endl;
+        }
+    };
+
+    auto print_prolongation = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "Prolongate norm        0" << std::endl;
+          deallog << "V-cycle  Defect norm   0" << std::endl;
+        }
+    };
+
+    auto print_pre_smoother_step = [](const bool         start,
+                                      const unsigned int level) {
+      if (start)
+        {
+          deallog << "V-cycle entering level " << level << std::endl;
+          deallog << "V-cycle  Defect norm   0" << std::endl;
+          deallog << "Smoothing on     level " << level << std::endl;
+          deallog << "Solution norm          0" << std::endl;
+        }
+    };
+
+    auto print_post_smoother_step = [](const bool         start,
+                                       const unsigned int level) {
+      if (start)
+        {
+          deallog << "Smoothing on     level " << level << std::endl;
+          deallog << "Solution norm          0" << std::endl;
+          deallog << "V-cycle leaving  level " << level << std::endl;
+        }
+    };
+
+    const auto coarse_connection = mg1.connect_coarse_solve(print_coarse_solve);
+    const auto restriction_connection =
+      mg1.connect_restriction(print_restriction);
+    const auto prolongation_connection =
+      mg1.connect_prolongation(print_prolongation);
+    const auto pre_smoother_connection =
+      mg1.connect_pre_smoother_step(print_pre_smoother_step);
+    const auto post_smoother_connection =
+      mg1.connect_post_smoother_step(print_post_smoother_step);
+
+    mg1.cycle();
+    deallog << std::endl;
+
+    coarse_connection.disconnect();
+    restriction_connection.disconnect();
+    prolongation_connection.disconnect();
+    pre_smoother_connection.disconnect();
+    post_smoother_connection.disconnect();
+  }
+
+  {
+    auto print_coarse_solve_w = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "W-cycle entering level  " << level << std::endl;
+          deallog << "W-cycle defect norm     0" << std::endl;
+          deallog << "W-cycle coarse level    " << level << std::endl;
+        }
+    };
+
+    auto print_restriction_w = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "W-cycle residual level  " << level << std::endl;
+          deallog << "W-cycle residual norm   0" << std::endl;
+        }
+    };
+
+    auto print_prolongation_w = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "W-cycle  Defect norm    0" << std::endl;
+        }
+    };
+
+    auto print_pre_smoother_step_w = [](const bool         start,
+                                        const unsigned int level) {
+      if (start)
+        {
+          deallog << "W-cycle entering level  " << level << std::endl;
+          deallog << "W-cycle defect norm     0" << std::endl;
+          deallog << "W-cycle smoothing level " << level << std::endl;
+          deallog << "W-cycle solution norm   0" << std::endl;
+        }
+    };
+
+    auto print_post_smoother_step_w = [](const bool         start,
+                                         const unsigned int level) {
+      if (start)
+        {
+          deallog << "W-cycle smoothing level " << level << std::endl;
+          deallog << "W-cycle solution norm   0" << std::endl;
+          deallog << "W-cycle leaving level   " << level << std::endl;
+        }
+    };
+
+    const auto coarse_connection =
+      mg1.connect_coarse_solve(print_coarse_solve_w);
+    const auto restriction_connection =
+      mg1.connect_restriction(print_restriction_w);
+    const auto prolongation_connection =
+      mg1.connect_prolongation(print_prolongation_w);
+    const auto pre_smoother_connection =
+      mg1.connect_pre_smoother_step(print_pre_smoother_step_w);
+    const auto post_smoother_connection =
+      mg1.connect_post_smoother_step(print_post_smoother_step_w);
+
+    mg1.set_cycle(Multigrid<VectorType>::w_cycle);
+    mg1.cycle();
+    deallog << std::endl;
+
+    coarse_connection.disconnect();
+    restriction_connection.disconnect();
+    prolongation_connection.disconnect();
+    pre_smoother_connection.disconnect();
+    post_smoother_connection.disconnect();
+  }
+
+  {
+    auto print_coarse_solve_f = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "F-cycle entering level  " << level << std::endl;
+          deallog << "F-cycle defect norm     0" << std::endl;
+          deallog << "F-cycle coarse level    " << level << std::endl;
+        }
+    };
+
+    auto print_restriction_f = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "F-cycle residual level  " << level << std::endl;
+          deallog << "F-cycle residual norm   0" << std::endl;
+        }
+    };
+
+    auto print_prolongation_f = [](const bool start, const unsigned int level) {
+      if (start)
+        {
+          deallog << "F-cycle  Defect norm    0" << std::endl;
+        }
+    };
+
+    auto print_pre_smoother_step_f = [](const bool         start,
+                                        const unsigned int level) {
+      if (start)
+        {
+          deallog << "F-cycle entering level  " << level << std::endl;
+          deallog << "F-cycle defect norm     0" << std::endl;
+          deallog << "F-cycle smoothing level " << level << std::endl;
+          deallog << "F-cycle solution norm   0" << std::endl;
+        }
+    };
+
+    auto print_post_smoother_step_f = [](const bool         start,
+                                         const unsigned int level) {
+      if (start)
+        {
+          deallog << "F-cycle smoothing level " << level << std::endl;
+          deallog << "F-cycle solution norm   0" << std::endl;
+          deallog << "F-cycle leaving level   " << level << std::endl;
+        }
+    };
+
+    mg1.connect_coarse_solve(print_coarse_solve_f);
+    mg1.connect_restriction(print_restriction_f);
+    mg1.connect_prolongation(print_prolongation_f);
+    mg1.connect_pre_smoother_step(print_pre_smoother_step_f);
+    mg1.connect_post_smoother_step(print_post_smoother_step_f);
 
-  mg1.set_cycle(Multigrid<VectorType>::f_cycle);
-  mg1.cycle();
+    mg1.set_cycle(Multigrid<VectorType>::f_cycle);
+    mg1.cycle();
+  }
 }
 
 int
index fa9dab6bb5e5cc0df303e5930d7dddc7776ef7a0..12b14e07bcecf34d83c11300e53867a87faf83f6 100644 (file)
@@ -253,83 +253,83 @@ DEAL::F-cycle  Defect norm    0
 DEAL::F-cycle smoothing level 1
 DEAL::F-cycle solution norm   0
 DEAL::F-cycle leaving level   1
-DEAL::V-cycle entering level  1
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 1
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  1
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  0
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle coarse level    0
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 1
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   1
+DEAL::F-cycle entering level  1
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 1
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  1
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  0
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle coarse level    0
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 1
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   1
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 2
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   2
+DEAL::F-cycle entering level  2
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 2
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  2
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  1
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 1
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  1
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  0
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle coarse level    0
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 1
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   1
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 2
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   2
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 3
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   3
+DEAL::F-cycle entering level  3
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 3
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  3
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  2
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 2
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  2
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  1
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 1
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  1
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  0
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle coarse level    0
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 1
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   1
 DEAL::F-cycle  Defect norm    0
 DEAL::F-cycle smoothing level 2
 DEAL::F-cycle solution norm   0
 DEAL::F-cycle leaving level   2
-DEAL::V-cycle entering level  2
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 2
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  2
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  1
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 1
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  1
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  0
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle coarse level    0
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 1
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   1
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 2
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   2
 DEAL::F-cycle  Defect norm    0
 DEAL::F-cycle smoothing level 3
 DEAL::F-cycle solution norm   0
 DEAL::F-cycle leaving level   3
-DEAL::V-cycle entering level  3
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 3
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  3
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  2
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 2
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  2
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  1
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 1
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  1
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  0
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle coarse level    0
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 1
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   1
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 2
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   2
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 3
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   3
 DEAL::F-cycle  Defect norm    0
 DEAL::F-cycle smoothing level 4
 DEAL::F-cycle solution norm   0
@@ -479,46 +479,46 @@ DEAL::F-cycle  Defect norm    0
 DEAL::F-cycle smoothing level 3
 DEAL::F-cycle solution norm   0
 DEAL::F-cycle leaving level   3
-DEAL::V-cycle entering level  3
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 3
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  3
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  2
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle coarse level    2
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 3
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   3
+DEAL::F-cycle entering level  3
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 3
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  3
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  2
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle coarse level    2
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 3
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   3
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 4
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   4
+DEAL::F-cycle entering level  4
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 4
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  4
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  3
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle smoothing level 3
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle residual level  3
+DEAL::F-cycle residual norm   0
+DEAL::F-cycle entering level  2
+DEAL::F-cycle defect norm     0
+DEAL::F-cycle coarse level    2
+DEAL::F-cycle  Defect norm    0
+DEAL::F-cycle smoothing level 3
+DEAL::F-cycle solution norm   0
+DEAL::F-cycle leaving level   3
 DEAL::F-cycle  Defect norm    0
 DEAL::F-cycle smoothing level 4
 DEAL::F-cycle solution norm   0
 DEAL::F-cycle leaving level   4
-DEAL::V-cycle entering level  4
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 4
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  4
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  3
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle smoothing level 3
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle residual level  3
-DEAL::V-cycle residual norm   0
-DEAL::V-cycle entering level  2
-DEAL::V-cycle defect norm     0
-DEAL::V-cycle coarse level    2
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 3
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   3
-DEAL::V-cycle  Defect norm    0
-DEAL::V-cycle smoothing level 4
-DEAL::V-cycle solution norm   0
-DEAL::V-cycle leaving level   4
 DEAL::F-cycle  Defect norm    0
 DEAL::F-cycle smoothing level 5
 DEAL::F-cycle solution norm   0

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.