Question #295301 on Yade changed: https://answers.launchpad.net/yade/+question/295301
Jan Stránský proposed the following answer: Hi Jabrane, you came to c++ variables and scopes [2]. to get correct behavior, one option is to change the declaration of dAX [1]. Currently (Real dAX=....) it creates a new variable, unrelated to strainer.dAX. Just delete Real (i.e. assign directly dAX=...) and then dAX refers to the class member strainer.dAX. Another option is leave it as it is and add this->dAX = dAX; somewhere after dAX is computed. cheers Jan [1] https://github.com/yade/trunk/blob/master/pkg/dem/UniaxialStrainer.cpp#L95 [2] http://stackoverflow.com/questions/30494407/declaring-a-local-variable-within-class-scope-with-same-name-as-a-class-attribut 2016-06-14 17:37 GMT+02:00 Yor1 <question295...@answers.launchpad.net>: > New question #295301 on Yade: > https://answers.launchpad.net/yade/+question/295301 > > Hello Yade users ! > > I try to calculate the external work on a sample in tensile test. > In fact, i calculate the external work with this simple formulate > "Wext_incremental=AppliedForce*displacement_incremental". > I want to integrate this formulate in the sources UniaxialStrainer.cpp > In uniaxialStrainer.cpp the incremental displacement is calculated and > named "dAX". > In order to verify the behavior of incremental displacement, i define > "dAX" in uniaxialStrainer.hpp like this > ((Real,dAX,0,,"Current incremental displacement")) in the line 43 of > UniaxialStrainer.hpp > > My problem is that in the simulation of tensile test , dAX=0 during the > simulation. > I call dAX in the python script strainer.dAX > I don't understand where is the problem. > > https://github.com/yade/trunk/blob/master/pkg/dem/UniaxialStrainer.hpp > https://github.com/yade/trunk/blob/master/pkg/dem/UniaxialStrainer.cpp > > Best regards. > Jabrane. > > > -- > You received this question notification because your team yade-users is > an answer contact for Yade. > > _______________________________________________ > Mailing list: https://launchpad.net/~yade-users > Post to : yade-users@lists.launchpad.net > Unsubscribe : https://launchpad.net/~yade-users > More help : https://help.launchpad.net/ListHelp > -- You received this question notification because your team yade-users is an answer contact for Yade. _______________________________________________ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp