how to write a part of code of my script in c++ to improve the calculation efficiency?

Asked by xuelong14

Hello,

A part of my code is to search for specific spheres of my model to apply force to. However, the calculation efficiency of python is not that high compared with c++, and I want to write this part of searching in C++. I really don't know how to get the position of the spheres and how to apply force in C++, and how can I use this part of code only as a funtion in the rest of my python code.

Thank you very much.

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Hi,
You could have a look at some of the ForceEngine's and replicate what they do for your situation. See e.g. [1].
Bruno
[1] https://github.com/yade/trunk/blob/master/pkg/common/ForceEngine.cpp#L35

Can you help with this problem?

Provide an answer of your own, or ask xuelong14 for more information if necessary.

To post a message you must log in.