]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Convert some of the tutorials. 16103/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 5 Oct 2023 22:30:22 +0000 (16:30 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 6 Oct 2023 16:56:43 +0000 (10:56 -0600)
examples/step-11/step-11.cc
examples/step-41/step-41.cc
examples/step-46/doc/intro.dox
examples/step-46/step-46.cc

index e29f3aa4d40cd34d00d5de1cadb1a2df76137dd6..f7a61397b7a97d28f6ca36575d9d88a4c9f29a40 100644 (file)
@@ -151,16 +151,17 @@ namespace Step11
 
     // Then generate a constraints object with just this one constraint. First
     // clear all previous content (which might reside there from the previous
-    // computation on a once coarser grid), then add this one line
+    // computation on a once coarser grid), then add this one constraint,
     // constraining the <code>first_boundary_dof</code> to the sum of other
     // boundary DoFs each with weight -1. Finally, close the constraints
     // object, i.e. do some internal bookkeeping on it for faster processing
     // of what is to come later:
     mean_value_constraints.clear();
-    mean_value_constraints.add_line(first_boundary_dof);
+    std::vector<std::pair<types::global_dof_index, double>> rhs;
     for (const types::global_dof_index i : boundary_dofs)
       if (i != first_boundary_dof)
-        mean_value_constraints.add_entry(first_boundary_dof, i, -1);
+        rhs.emplace_back(i, -1.);
+    mean_value_constraints.add_constraint(first_boundary_dof, rhs);
     mean_value_constraints.close();
 
     // Next task is to generate a sparsity pattern. This is indeed a tricky
index ea25fc378a490db0a1b41cb1c95b900267553abd..d3416259cf30ca959727df50c83497067d672b4c 100644 (file)
@@ -479,8 +479,7 @@ namespace Step41
               0)
             {
               active_set.add_index(dof_index);
-              constraints.add_line(dof_index);
-              constraints.set_inhomogeneity(dof_index, obstacle_value);
+              constraints.add_constraint(dof_index, {}, obstacle_value);
 
               solution(dof_index) = obstacle_value;
 
index 190677cc5df729c1ec50c4e19db457d04be4f87c..7f0386ce2df93881ab74d491c571b44ef2ff987b 100644 (file)
@@ -494,21 +494,16 @@ 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_line (local_face_dof_indices[i]);
+               constraints.add_constraint (local_face_dof_indices[i], {}, 0.);
            }
         }
 @endcode
 
-The call <code>constraints.add_line(t)</code> tells the
-AffineConstraints to start a new constraint for degree of freedom
-<code>t</code> of the form $x_t=\sum_{l=0}^{N-1} c_{tl} x_l +
-b_t$. Typically, one would then proceed to set individual coefficients
-$c_{tl}$ to nonzero values (using AffineConstraints::add_entry) or set
-$b_t$ to something nonzero (using
-AffineConstraints::set_inhomogeneity); doing nothing as above, funny as
-it looks, simply leaves the constraint to be $x_t=0$, which is exactly
+The last line calls
+AffineConstraints::add_constraint() and 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
+FiniteElement::face_system_to_component_index() makes sure that we only set
 boundary values to zero for velocity but not pressure components.
 
 Note that there are cases where this may yield incorrect results:
index 23b7aaa44a25a8115437c4648e3c5ae682ed6ca7..5cfc877bc7706d5f655e23a4f756687aaf91f2f9 100644 (file)
@@ -385,7 +385,9 @@ namespace Step46
                          ++i)
                       if (stokes_fe.face_system_to_component_index(i).first <
                           dim)
-                        constraints.add_line(local_face_dof_indices[i]);
+                        constraints.add_constraint(local_face_dof_indices[i],
+                                                   {},
+                                                   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.