]> https://gitweb.dealii.org/ - code-gallery.git/commitdiff
Do not make a variable 'static' in the elastoplastic code gallery. 41/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Mar 2018 23:18:14 +0000 (17:18 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 20 Mar 2018 23:18:14 +0000 (17:18 -0600)
Static variables are only initialized once at the beginning of the run.
Here, the value of a variable depends on a function argument, and so
it will only be computed based on the argument passed to the function
*the first time around*, and will never be updated again in later calls.
This is almost certainly not the desired behavior.

goal_oriented_elastoplasticity/elastoplastic.cc

index ad0c270df12f43c6e4d1cbfd8d5fc98819bb6d87..dc497b7196e3ab1d197cd4b809ec992d5dfa4dc4 100644 (file)
@@ -662,7 +662,7 @@ namespace ElastoPlastic
       {
         static const double rotation[3][3]
         = {{ 1, 0, 0}, { 0, 1, 0 }, { 0, 0, 1 } };
-        static const Tensor<2,3> rot(rotation);
+        const Tensor<2,3> rot(rotation);
         return rot;
       }
 

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.