]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify step-15 with the new function. 11995/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 31 Mar 2021 03:32:39 +0000 (21:32 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 5 Apr 2021 16:20:22 +0000 (10:20 -0600)
examples/step-15/step-15.cc

index 5a8b673d115d84444aadda1e4f7aef6b09bf4381..fc9a07fcba51e6451e5c3657b40a1e48e7bf253f 100644 (file)
@@ -541,17 +541,15 @@ namespace Step15
     // thing on every cell and so we didn't not want to deal with the question
     // of whether a particular degree of freedom sits at the boundary in the
     // integration above. Rather, we will simply set to zero these entries
-    // after the fact. To this end, we first need to determine which degrees
+    // after the fact. To this end, we need to determine which degrees
     // of freedom do in fact belong to the boundary and then loop over all of
     // those and set the residual entry to zero. This happens in the following
-    // lines which we have already seen used in step-11:
+    // lines which we have already seen used in step-11, using the appropriate
+    // function from namespace DoFTools:
     hanging_node_constraints.condense(residual);
 
-    IndexSet boundary_dofs(dof_handler.n_dofs());
-    DoFTools::extract_boundary_dofs(dof_handler,
-                                    ComponentMask(),
-                                    boundary_dofs);
-    for (types::global_dof_index i : boundary_dofs)
+    for (types::global_dof_index i :
+         DoFTools::extract_boundary_dofs(dof_handler))
       residual(i) = 0;
 
     // At the end of the function, we return the norm of the residual:

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.