]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Do not make a variable in step-35 static. 6083/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Mar 2018 23:11:51 +0000 (17:11 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Mar 2018 23:11:51 +0000 (17:11 -0600)
Static variables are only initialized once at the beginning of the run. Here,
we have a vector that is marked as 'static' but this really only works because
we never do mesh refinement in this program and consequently (i) the originally
set size continues to be correct, and (ii) the code below sets every vector
element, rather than add to it.

examples/step-35/step-35.cc

index 99558bb7ad5d1f975ab8f1aca66e31613e0cae0d..7b7f08cff994366c24651b48a91920d2330adcd0 100644 (file)
@@ -1298,7 +1298,7 @@ namespace Step35
             ((dim + 1)*dof_handler_velocity.n_dofs() +
              dof_handler_pressure.n_dofs()),
             ExcInternalError());
-    static Vector<double> joint_solution (joint_dof_handler.n_dofs());
+    Vector<double> joint_solution (joint_dof_handler.n_dofs());
     std::vector<types::global_dof_index> loc_joint_dof_indices (joint_fe.dofs_per_cell),
         loc_vel_dof_indices (fe_velocity.dofs_per_cell),
         loc_pres_dof_indices (fe_pressure.dofs_per_cell);

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.