]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Indent step-45
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 16 Jun 2018 09:07:36 +0000 (11:07 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Tue, 19 Jun 2018 08:42:18 +0000 (10:42 +0200)
examples/step-45/doc/intro.dox
examples/step-45/step-45.cc

index ada974649c71ccf5f566e2d741b1a7ec0e88e354..8ac06e13fdcd0bc280576230236db1339717be94 100644 (file)
@@ -111,7 +111,7 @@ Here, again, the assignment of boundary indicators 0 and 1 stems from
 what GridGenerator::parallelogram() documents.
 
 The resulting @p matched_pairs can be used in
-DoFTools::make_periodicity_constraints for populating a ConstraintMatrix
+DoFTools::make_periodicity_constraints for populating a AffineConstraints
 with periodicity constraints:
 @code
 DoFTools::make_periodicity_constraints(matched_pairs, constraints);
index b46802807a10e8bcc1853f963f8300dc8ad6126b..364c353c8f16e6d014a110ed4c311ffe48ef1591 100644 (file)
 
 // In order to implement periodic boundary conditions only two functions
 // have to be modified:
-// - <code>StokesProblem<dim>::setup_dofs()</code>: To populate a
-// ConstraintMatrix
-//   object with periodicity constraints
-// - <code>StokesProblem<dim>::run()</code>: To supply a distributed
-// triangulation with
-//   periodicity information.
+// - <code>StokesProblem<dim>::setup_dofs()</code>:
+//   To populate a AffineConstraints object with periodicity constraints
+// - <code>StokesProblem<dim>::run()</code>:
+//   To supply a distributed triangulation with periodicity information.
 //
 // The rest of the program is identical to step-22, so let us skip this part
 // and only show these two functions in the following. (The full program can be
@@ -45,7 +43,7 @@
 #include <deal.II/distributed/grid_refinement.h>
 
 #include <deal.II/lac/solver_cg.h>
-#include <deal.II/lac/constraint_matrix.h>
+#include <deal.II/lac/affine_constraints.h>
 
 #include <deal.II/lac/trilinos_solver.h>
 #include <deal.II/lac/trilinos_precondition.h>
@@ -328,7 +326,7 @@ namespace Step45
     // \quad
     // b=\begin{pmatrix}0&0\end{pmatrix}.
     // @f}
-    // The data structure we are saving the reuslitng information into is here
+    // The data structure we are saving the resulting information into is here
     // based on the Triangulation.
     std::vector<GridTools::PeriodicFacePair<
       typename parallel::distributed::Triangulation<dim>::cell_iterator>>
@@ -435,9 +433,8 @@ namespace Step45
       // DoFHandler@<dim@>::cell_iterator@> </code>. The periodic boundaries
       // have the boundary indicators 2 (x=0) and 3 (y=0). All the other
       // parameters we have set up before. In this case the direction does not
-      // matter. Due to
-      // $\text{vertices}_2=R\cdot \text{vertices}_1+b$ this is exactly what we
-      // want.
+      // matter. Due to $\text{vertices}_2=R\cdot \text{vertices}_1+b$ this is
+      // exactly what we want.
       std::vector<
         GridTools::PeriodicFacePair<typename DoFHandler<dim>::cell_iterator>>
         periodicity_vector;
@@ -452,10 +449,10 @@ namespace Step45
                                         offset,
                                         rotation_matrix);
 
-      // Next we need to provide information on which vector valued components
+      // Next, we need to provide information on which vector valued components
       // of the solution should be rotated. Since we choose here to just
       // constraint the velocity and this starts at the first component of the
-      // solution vector we simply insert a 0:
+      // solution vector, we simply insert a 0:
       std::vector<unsigned int> first_vector_components;
       first_vector_components.push_back(0);
 
@@ -546,10 +543,7 @@ namespace Step45
     std::vector<double>                  div_phi_u(dofs_per_cell);
     std::vector<double>                  phi_p(dofs_per_cell);
 
-    typename DoFHandler<dim>::active_cell_iterator cell =
-                                                     dof_handler.begin_active(),
-                                                   endc = dof_handler.end();
-    for (; cell != endc; ++cell)
+    for (const auto &cell : dof_handler.active_cell_iterators())
       if (cell->is_locally_owned())
         {
           fe_values.reinit(cell);
@@ -574,16 +568,18 @@ namespace Step45
                   for (unsigned int j = 0; j <= i; ++j)
                     {
                       local_matrix(i, j) +=
-                        (symgrad_phi_u[i] * symgrad_phi_u[j] -
-                         div_phi_u[i] * phi_p[j] - phi_p[i] * div_phi_u[j] +
-                         phi_p[i] * phi_p[j]) *
-                        fe_values.JxW(q);
+                        (symgrad_phi_u[i] * symgrad_phi_u[j] // diffusion
+                         - div_phi_u[i] * phi_p[j]           // pressure force
+                         - phi_p[i] * div_phi_u[j]           // divergence
+                         + phi_p[i] * phi_p[j])              // pressure mass
+                        * fe_values.JxW(q);
                     }
 
                   const unsigned int component_i =
                     fe.system_to_component_index(i).first;
-                  local_rhs(i) += fe_values.shape_value(i, q) *
-                                  rhs_values[q](component_i) * fe_values.JxW(q);
+                  local_rhs(i) += fe_values.shape_value(i, q)  //
+                                  * rhs_values[q](component_i) //
+                                  * fe_values.JxW(q);
                 }
             }
 

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.