]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Reshuffle a couple lines of code.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 15 Nov 2010 00:29:28 +0000 (00:29 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 15 Nov 2010 00:29:28 +0000 (00:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@22730 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-40/step-40.cc

index 1f02fe139cdd95f83ac26e7c8f76bfae866e93e3..c561a2c902d4044b100e65410e85914f775b8e29 100644 (file)
@@ -388,20 +388,26 @@ void LaplaceProblem<dim>::assemble_system ()
        fe_values.reinit (cell);
 
        for (unsigned int q_point=0; q_point<n_q_points; ++q_point)
-         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_point) *
-                                    fe_values.shape_grad(j,q_point) *
-                                    fe_values.JxW(q_point));
-
-             cell_rhs(i) += (fe_values.shape_value(i,q_point) *
-                             (fe_values.quadrature_point(q_point)[1]
-                              >
-                              0.5+0.25*sin(4.0*numbers::PI*fe_values.quadrature_point(q_point)[0])
-                              ? 1 : -1) *
-                             fe_values.JxW(q_point));
-           }
+         {
+           const double
+             rhs_value
+             = (fe_values.quadrature_point(q_point)[1]
+                >
+                0.5+0.25*sin(4.0*numbers::PI*fe_values.quadrature_point(q_point)[0])
+                ? 1 : -1);
+
+           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_point) *
+                                      fe_values.shape_grad(j,q_point) *
+                                      fe_values.JxW(q_point));
+
+               cell_rhs(i) += (rhs_value *
+                               fe_values.shape_value(i,q_point) *
+                               fe_values.JxW(q_point));
+             }
+         }
 
        cell->get_dof_indices (local_dof_indices);
        constraints.distribute_local_to_global (cell_matrix,

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.