]> https://gitweb.dealii.org/ - dealii.git/commitdiff
step-3: make bilinear forms more readable
authorMatthias Maier <tamiko@43-1.org>
Fri, 15 Jun 2018 23:01:27 +0000 (18:01 -0500)
committerMatthias Maier <tamiko@43-1.org>
Mon, 25 Jun 2018 22:39:54 +0000 (17:39 -0500)
examples/step-3/step-3.cc

index f3e64b939ba0f17f69310c40f34373a92bea8a87..99b38504515ee65d73484ca6b84f0ffc36212b57 100644 (file)
@@ -167,7 +167,8 @@ void Step3::make_grid()
   GridGenerator::hyper_cube(triangulation, -1, 1);
   triangulation.refine_global(5);
 
-  std::cout << "Number of active cells: " << triangulation.n_active_cells()
+  std::cout << "Number of active cells: "     //
+            << triangulation.n_active_cells() //
             << std::endl;
 }
 
@@ -196,7 +197,8 @@ void Step3::make_grid()
 void Step3::setup_system()
 {
   dof_handler.distribute_dofs(fe);
-  std::cout << "Number of degrees of freedom: " << dof_handler.n_dofs()
+  std::cout << "Number of degrees of freedom: " //
+            << dof_handler.n_dofs()             //
             << std::endl;
   // There should be one DoF for each vertex. Since we have a 32 times 32
   // grid, the number of DoFs should be 33 times 33, or 1089.
@@ -435,9 +437,9 @@ void Step3::assemble_system()
           // this is repeated for all shape functions $i$ and $j$:
           for (unsigned int i = 0; i < dofs_per_cell; ++i)
             for (unsigned int j = 0; j < dofs_per_cell; ++j)
-              cell_matrix(i, j) +=
-                (fe_values.shape_grad(i, q_index) *
-                 fe_values.shape_grad(j, q_index) * fe_values.JxW(q_index));
+              cell_matrix(i, j) += (fe_values.shape_grad(i, q_index) * //
+                                    fe_values.shape_grad(j, q_index) * //
+                                    fe_values.JxW(q_index));
 
           // We then do the same thing for the right hand side. Here,
           // the integral is over the shape function i times the right
@@ -445,8 +447,9 @@ void Step3::assemble_system()
           // with constant value one (more interesting examples will
           // be considered in the following programs).
           for (unsigned int i = 0; i < dofs_per_cell; ++i)
-            cell_rhs(i) +=
-              (fe_values.shape_value(i, q_index) * 1 * fe_values.JxW(q_index));
+            cell_rhs(i) += (fe_values.shape_value(i, q_index) * //
+                            1 *                                 //
+                            fe_values.JxW(q_index));
         }
       // Now that we have the contribution of this cell, we have to transfer
       // it to the global matrix and right hand side. To this end, we first

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.