← Back to team overview

yade-users team mailing list archive

Re: [Question #700022]: where shearForce in Law2_ScGeom_FrictPhys_CundallStrack is updated?

 

Question #700022 on Yade changed:
https://answers.launchpad.net/yade/+question/700022

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,

please link the source as a link to our gitlab repository, like [1].

shearForce is not updated the same way as normalForce (from code point of view), becase shearForce is at [2] declared as a reference (see e.g. [3] on the topic what c++ reference is or google "c++ pointer reference" or something like that).
So shearForce here is alias / is equivalent to phys->shearForce. It is modified "in place".
Therefore every time shearForce is "computed", phys->shearForce is actually updated in place.

Cheers
Jan

[1] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/ElasticContactLaw.cpp#L70
[2] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/ElasticContactLaw.cpp#L72
[3] https://www.geeksforgeeks.org/pointers-vs-references-cpp/

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.