]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use constrain_dof_to_zero() in tests. 16176/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 23 Oct 2023 17:08:11 +0000 (11:08 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 23 Oct 2023 17:13:16 +0000 (11:13 -0600)
13 files changed:
tests/multigrid/step-16-02.cc
tests/multigrid/step-16-03.cc
tests/multigrid/step-16-04.cc
tests/multigrid/step-16-05.cc
tests/multigrid/step-16-06.cc
tests/multigrid/step-16-07.cc
tests/multigrid/step-16-08.cc
tests/multigrid/step-16-50-mpi-linear-operator.cc
tests/multigrid/step-16-50-mpi-smoother.cc
tests/multigrid/step-16-50-mpi.cc
tests/multigrid/step-16-50-serial.cc
tests/multigrid/step-16-bdry1.cc
tests/multigrid/step-16.cc

index f4553acb7c885e885c35a4f8711edde888f8a1aa..734407342daa409208b57e3c4da77fb1c83c6561 100644 (file)
@@ -412,17 +412,20 @@ LaplaceProblem<dim>::assemble_multigrid(const bool &use_mw)
         triangulation.n_levels());
       for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
         {
-          boundary_constraints[level].add_lines(
-            mg_constrained_dofs.get_refinement_edge_indices(level));
-          boundary_constraints[level].add_lines(
-            mg_constrained_dofs.get_boundary_indices(level));
-          boundary_constraints[level].close();
-
-          IndexSet idx =
+          for (const types::global_dof_index dof_index :
+               mg_constrained_dofs.get_refinement_edge_indices(level))
+            boundary_constraints[level].constrain_dof_to_zero(dof_index);
+          for (const types::global_dof_index dof_index :
+               mg_constrained_dofs.get_boundary_indices(level))
+            boundary_constraints[level].constrain_dof_to_zero(dof_index);
+
+          const IndexSet idx =
             mg_constrained_dofs.get_refinement_edge_indices(level) &
             mg_constrained_dofs.get_boundary_indices(level);
 
-          boundary_interface_constraints[level].add_lines(idx);
+          for (const types::global_dof_index idx :
+               mg_constrained_dofs.get_boundary_indices(level))
+            boundary_constraints[level].constrain_dof_to_zero(idx);
           boundary_interface_constraints[level].close();
         }
 
index ecc685648176b2fd2a91f82a04ce0eadc6a8bdfd..d5625b7af7de6b3b2fc9c5838e3dae5e1eb0a907 100644 (file)
@@ -293,10 +293,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   for (unsigned int level = min_level; level < triangulation.n_levels();
        ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 
index 40d7f4c28156cab4a549d93cab623cf420fefe87..8bc1c8d45b64c06e74577fe52a36bb87765480b5 100644 (file)
@@ -302,10 +302,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   for (unsigned int level = min_level; level < triangulation.n_levels();
        ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 
index 3b78a566d7f9c13ed2023bf5c073df90978facc9..fa7a1770357efa69da9c68f247d8dc8b61588d47 100644 (file)
@@ -303,10 +303,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   for (unsigned int level = min_level; level < triangulation.n_levels();
        ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 
index 3af78834c6dff9201b62a47f0fee1f6ad62a8082..3540c34e4945f5ca7c7cf4c70c3e4373676a8cb2 100644 (file)
@@ -303,10 +303,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   for (unsigned int level = min_level; level < triangulation.n_levels();
        ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 
index c7fbba2a6c129ebed5a8f6eebdd6eddcc954c088..55dda5ca020f4720bf0b8d307fb6bfb43ce075f3 100644 (file)
@@ -298,10 +298,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   AffineConstraints<double> empty_constraints;
   for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 
index 0beff131988dd3f1c905e4711aae27d01ff67ae9..c7f6d6a80422b10802ff00296a05b77aad96568e 100644 (file)
@@ -273,10 +273,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   AffineConstraints<double> empty_constraints;
   for (unsigned int level = 0; level < n_levels; ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
 
       DynamicSparsityPattern csp;
index 5575a1dfe38910774c24c18ebd92dd0ff3f9ef20..65130a8a91c070db70ad801f4387a9146523667c 100644 (file)
@@ -350,11 +350,13 @@ namespace Step50
         const IndexSet dofset =
           DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler, level);
         boundary_constraints[level].reinit(dofset);
-        boundary_constraints[level].add_lines(
-          mg_constrained_dofs.get_refinement_edge_indices(level));
-        boundary_constraints[level].add_lines(
-          mg_constrained_dofs.get_boundary_indices(level));
 
+        for (const types::global_dof_index dof_index :
+             mg_constrained_dofs.get_refinement_edge_indices(level))
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
+        for (const types::global_dof_index dof_index :
+             mg_constrained_dofs.get_boundary_indices(level))
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
         boundary_constraints[level].close();
       }
 
index be074f51002065d0fc9882fb0e8c5bfb69f072d0..0a94ace9db967439f85177b446e8b45dc049c2a7 100644 (file)
@@ -349,11 +349,13 @@ namespace Step50
         const IndexSet dofset =
           DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler, level);
         boundary_constraints[level].reinit(dofset);
-        boundary_constraints[level].add_lines(
-          mg_constrained_dofs.get_refinement_edge_indices(level));
-        boundary_constraints[level].add_lines(
-          mg_constrained_dofs.get_boundary_indices(level));
 
+        for (const types::global_dof_index dof_index :
+             mg_constrained_dofs.get_refinement_edge_indices(level))
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
+        for (const types::global_dof_index dof_index :
+             mg_constrained_dofs.get_boundary_indices(level))
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
         boundary_constraints[level].close();
       }
 
index 201dfd021277a785a05a822b3509d4bd36f61b22..a0bf09128f200eb58e80143a47e8aec0b1acff2d 100644 (file)
@@ -350,11 +350,12 @@ namespace Step50
         const IndexSet dofset =
           DoFTools::extract_locally_relevant_level_dofs(mg_dof_handler, level);
         boundary_constraints[level].reinit(dofset);
-        boundary_constraints[level].add_lines(
-          mg_constrained_dofs.get_refinement_edge_indices(level));
-        boundary_constraints[level].add_lines(
-          mg_constrained_dofs.get_boundary_indices(level));
-
+        for (const types::global_dof_index dof_index :
+             mg_constrained_dofs.get_refinement_edge_indices(level))
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
+        for (const types::global_dof_index dof_index :
+             mg_constrained_dofs.get_boundary_indices(level))
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
         boundary_constraints[level].close();
       }
 
index 3f1cc457c24128908b8c71c4ac088437784fa107..c3947881c49c4f3760549b2ef5830f11ba8d226f 100644 (file)
@@ -296,10 +296,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   AffineConstraints<double> empty_constraints;
   for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 
index 7812393609695a5faf04360f735838c00d29f6a0..f8ce45669770e2cbb0799400b5e952d14d8e1663 100644 (file)
@@ -418,10 +418,12 @@ LaplaceProblem<dim>::assemble_multigrid(bool use_mw)
 
       for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
         {
-          boundary_constraints[level].add_lines(
-            mg_constrained_dofs.get_refinement_edge_indices(level));
-          boundary_constraints[level].add_lines(
-            mg_constrained_dofs.get_boundary_indices(level));
+          for (const types::global_dof_index dof_index :
+               mg_constrained_dofs.get_refinement_edge_indices(level))
+            boundary_constraints[level].constrain_dof_to_zero(dof_index);
+          for (const types::global_dof_index dof_index :
+               mg_constrained_dofs.get_boundary_indices(level))
+            boundary_constraints[level].constrain_dof_to_zero(dof_index);
           boundary_constraints[level].close();
         }
 
index 9f1fe832a4c53c2061d529acadd0bbd8784b7b7c..7bd3d6c025823276c1bcd0a266765a32dc97d8dd 100644 (file)
@@ -298,10 +298,12 @@ LaplaceProblem<dim>::assemble_multigrid()
   AffineConstraints<double> empty_constraints;
   for (unsigned int level = 0; level < triangulation.n_levels(); ++level)
     {
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_refinement_edge_indices(level));
-      boundary_constraints[level].add_lines(
-        mg_constrained_dofs.get_boundary_indices(level));
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_refinement_edge_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
+      for (const types::global_dof_index dof_index :
+           mg_constrained_dofs.get_boundary_indices(level))
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 

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.