]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use AffineConstraints::constrain_dof_to_zero(). 16163/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 19 Oct 2023 20:06:32 +0000 (14:06 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 19 Oct 2023 20:06:32 +0000 (14:06 -0600)
examples/step-16/step-16.cc
examples/step-37/step-37.cc
examples/step-46/doc/intro.dox
examples/step-46/step-46.cc
examples/step-50/step-50.cc
examples/step-56/step-56.cc
examples/step-63/step-63.cc
examples/step-66/step-66.cc
include/deal.II/multigrid/mg_constrained_dofs.h
source/dofs/dof_tools_constraints.cc

index a79e2f1fde5c0772b8f9a5c0b7f8fc18fd19920b..28491f00a2c55bc1b8ad79cf9fe92471fea75453 100644 (file)
@@ -439,10 +439,10 @@ namespace Step16
 
         for (const types::global_dof_index dof_index :
              mg_constrained_dofs.get_refinement_edge_indices(level))
-          boundary_constraints[level].add_constraint(dof_index, {}, 0.);
+          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].add_constraint(dof_index, {}, 0.);
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
         boundary_constraints[level].close();
       }
 
index a4e98ab431c0eeaaabacc07e0340d8fd73f8a292..5293e4dd78d11940726efd9346ad25be50a165c9 100644 (file)
@@ -854,7 +854,7 @@ namespace Step37
             DoFTools::extract_locally_relevant_level_dofs(dof_handler, level));
           for (const types::global_dof_index dof_index :
                mg_constrained_dofs.get_boundary_indices(level))
-            level_constraints.add_constraint(dof_index, {}, 0.);
+            level_constraints.constrain_dof_to_zero(dof_index);
           level_constraints.close();
 
           typename MatrixFree<dim, float>::AdditionalData additional_data;
index 7f0386ce2df93881ab74d491c571b44ef2ff987b..b76913b1df5c2f63c5643889cdf639527b2de432 100644 (file)
@@ -494,13 +494,12 @@ for (const auto &cell: dof_handler.active_cell_iterators())
              cell->face(f)->get_dof_indices (local_face_dof_indices, 0);
              for (unsigned int i=0; i<local_face_dof_indices.size(); ++i)
              if (stokes_fe.face_system_to_component_index(i).first < dim)
-               constraints.add_constraint (local_face_dof_indices[i], {}, 0.);
+               constraints.constrain_dof_to_zero (local_face_dof_indices[i]);
            }
         }
 @endcode
 
-The last line calls
-AffineConstraints::add_constraint() and adds the constraint
+The last line adds the constraint
 <i>x<sub>local_face_dof_indices[i]</sub>=0</i>, which is exactly
 what we need in the current context. The call to
 FiniteElement::face_system_to_component_index() makes sure that we only set
index 5cfc877bc7706d5f655e23a4f756687aaf91f2f9..1979ffd1806090623ef1c34dd0a5dd5cb99158bd 100644 (file)
@@ -385,9 +385,8 @@ namespace Step46
                          ++i)
                       if (stokes_fe.face_system_to_component_index(i).first <
                           dim)
-                        constraints.add_constraint(local_face_dof_indices[i],
-                                                   {},
-                                                   0.);
+                        constraints.constrain_dof_to_zero(
+                          local_face_dof_indices[i]);
                   }
               }
     }
index 30d0327651e92555c85a73f68e0cb3113097e9b5..7372929a3cb3492e27b295dd35dcb9d949ff23fd 100644 (file)
@@ -598,7 +598,7 @@ void LaplaceProblem<dim, degree>::setup_multigrid()
                                                               level));
               for (const types::global_dof_index dof_index :
                    mg_constrained_dofs.get_boundary_indices(level))
-                level_constraints.add_constraint(dof_index, {}, 0.);
+                level_constraints.constrain_dof_to_zero(dof_index);
               level_constraints.close();
 
               typename MatrixFree<dim, float>::AdditionalData additional_data;
@@ -830,10 +830,10 @@ void LaplaceProblem<dim, degree>::assemble_multigrid()
 
       for (const types::global_dof_index dof_index :
            mg_constrained_dofs.get_refinement_edge_indices(level))
-        boundary_constraints[level].add_constraint(dof_index, {}, 0.);
+        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].add_constraint(dof_index, {}, 0.);
+        boundary_constraints[level].constrain_dof_to_zero(dof_index);
       boundary_constraints[level].close();
     }
 
index 1dca4bc59e69f64c4321dcf62fa648e118db01a5..188f297e8d881a0eb48b258c21d7c66af4001fc3 100644 (file)
@@ -572,7 +572,7 @@ namespace Step56
       // this here by marking the first pressure dof, which has index n_u as a
       // constrained dof.
       if (solver_type == SolverType::UMFPACK)
-        constraints.add_constraint(n_u, {}, 0.);
+        constraints.constrain_dof_to_zero(n_u);
 
       constraints.close();
     }
@@ -734,10 +734,10 @@ namespace Step56
       {
         for (const types::global_dof_index dof_index :
              mg_constrained_dofs.get_refinement_edge_indices(level))
-          boundary_constraints[level].add_constraint(dof_index, {}, 0.);
+          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].add_constraint(dof_index, {}, 0.);
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
         boundary_constraints[level].close();
 
         const IndexSet idx =
index 81c59e9f64d1bebf7012fff0d61c643deef6b903..68c031789a60d1394cfe5d92fda4c3c012c49a04 100644 (file)
@@ -820,10 +820,10 @@ namespace Step63
 
         for (const types::global_dof_index dof_index :
              mg_constrained_dofs.get_refinement_edge_indices(level))
-          boundary_constraints[level].add_constraint(dof_index, {}, 0.);
+          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].add_constraint(dof_index, {}, 0.);
+          boundary_constraints[level].constrain_dof_to_zero(dof_index);
         boundary_constraints[level].close();
       }
 
index 504042a676753a039ca0e0980cc5129beb4fda56..a4558476bba09e6a67cb8c3a1d26bce25e0ea63e 100644 (file)
@@ -596,7 +596,7 @@ namespace Step66
 
         for (const types::global_dof_index dof_index :
              mg_constrained_dofs.get_boundary_indices(level))
-          level_constraints.add_constraint(dof_index, {}, 0.);
+          level_constraints.constrain_dof_to_zero(dof_index);
         level_constraints.close();
 
         typename MatrixFree<dim, float>::AdditionalData additional_data;
index 84e55e97818353cbb26b3d8cd2c3e589577c20c6..f96f72ecc32c96ec304224694f8a2c57b142ab19 100644 (file)
@@ -626,11 +626,11 @@ MGConstrainedDoFs::merge_constraints(AffineConstraints<Number> &constraints,
   // merge constraints
   if (add_boundary_indices && this->have_boundary_indices())
     for (const auto i : this->get_boundary_indices(level))
-      constraints.add_constraint(i, {}, 0.);
+      constraints.constrain_dof_to_zero(i);
 
   if (add_refinement_edge_indices)
     for (const auto i : this->get_refinement_edge_indices(level))
-      constraints.add_constraint(i, {}, 0.);
+      constraints.constrain_dof_to_zero(i);
 
   if (add_level_constraints)
     constraints.merge(this->get_level_constraints(level),
index 635d4fb3e8e468a1c4ad1d292e290f32d9c8b421..b6a0cb52f09d9a01ffca750731db8325db1cc754 100644 (file)
@@ -2199,7 +2199,7 @@ namespace DoFTools
           if (constraints_are_cyclic)
             {
               if (std::abs(cycle_constraint_factor - number(1.)) > eps)
-                affine_constraints.add_constraint(dof_left, {}, 0.);
+                affine_constraints.constrain_dof_to_zero(dof_left);
             }
           else
             {
@@ -3594,9 +3594,8 @@ namespace DoFTools
                             // inhomogeneity is zero:
                             if (zero_boundary_constraints.is_constrained(
                                   face_dof) == false)
-                              zero_boundary_constraints.add_constraint(face_dof,
-                                                                       {},
-                                                                       0.);
+                              zero_boundary_constraints.constrain_dof_to_zero(
+                                face_dof);
                             else
                               Assert(zero_boundary_constraints
                                          .is_inhomogeneously_constrained(

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.