how to add new functions

Asked by ceguo on 2012-02-20

Hi,

I want to add a function very similar to util.stressTensorOfPeriodicCell in C++ level and wrap it to python code so I can return its value (what I want to extract is tangent operator actually). What is the main procedure to do this work? Could anyone refer me a doc or something?

Ning

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
ceguo
Solved:
2012-03-05
Last query:
2012-03-05
Last reply:
2012-02-20
Anton Gladky (gladky-anton) said : #1

Hi,

please, have a look at similar functions at shop.cpp, for example.
Most of them are wrapped to python.

Anton

2012/2/20 ceguo <email address hidden>:
> New question #188259 on Yade:
> https://answers.launchpad.net/yade/+question/188259
>
> Hi,
>
> I want to add a function very similar to util.stressTensorOfPeriodicCell in C++ level and wrap it to python code so I can return its value (what I want to extract is tangent operator actually). What is the main procedure to do this work? Could anyone refer me a doc or something?
>
> Ning
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp

There are too many functions for getting stress already... It could
(should) be simplified. I just created a blueprint for that
https://blueprints.launchpad.net/yade/+spec/stressgetters.
If "tangent" means the stress corresponding to tangential forces, then
you can have a look at
https://www.yade-dem.org/doc/yade.utils.html?highlight=normalshearstresstensors#yade.utils.normalShearStressTensors
Else tell us what you have in mind and we will see if it needs an
additional feature.

Bruno

Jan Stránský (honzik) said : #3

Hi Ning,

find e.g. stressTensorOfPeriodicCell function in files:
pkg/dem/Shop.hpp
pkg/dem/Shop.cpp
py/_utils.cpp

you should know from it how to continue :-)

Jan

ceguo píše v Po 20. 02. 2012 v 06:30 +0000:
> New question #188259 on Yade:
> https://answers.launchpad.net/yade/+question/188259
>
> Hi,
>
> I want to add a function very similar to util.stressTensorOfPeriodicCell in C++ level and wrap it to python code so I can return its value (what I want to extract is tangent operator actually). What is the main procedure to do this work? Could anyone refer me a doc or something?
>
> Ning
>

ceguo (hhh-guo) said : #4

Hi,

Sorry for the late reply. The tangent operator is actually the formula (35) in [Kuhl et al. 2001]. And the formula (34) is what you referred to for stress tensor calculation. Now I have time to read the code and implement myself.
Thanks for your help!

Ning