From: Wolfgang Bangerth Date: Tue, 20 Mar 2018 23:18:14 +0000 (-0600) Subject: Do not make a variable 'static' in the elastoplastic code gallery. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=addcd5fcc8330acbaec4cf3851ed31f329f43595;p=code-gallery.git Do not make a variable 'static' in the elastoplastic code gallery. 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. --- diff --git a/goal_oriented_elastoplasticity/elastoplastic.cc b/goal_oriented_elastoplasticity/elastoplastic.cc index ad0c270..dc497b7 100644 --- a/goal_oriented_elastoplasticity/elastoplastic.cc +++ b/goal_oriented_elastoplasticity/elastoplastic.cc @@ -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; }