Question about saving sphere pack into a file in .py script

Asked by Lin Zhang

Hi all,

I wanna save the generated pack information into a file in .py script. I can do it in .cpp file. But I found there is no corresponding functions in pack.py while fromFile() and toFile() are available in SpherePack.hpp and .cpp.

How can I save the pack into a file in .py? and how to launch the C++ functions in the .py file? need to put it into the macro YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(saying create a interface for python)?

Thank you!

--
Lin Zhang

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
Anton Gladky (gladky-anton) said :
#1

Hi,

please, have a look at import and export yade modules:

https://www.yade-dem.org/doc/yade.ymport.html
https://www.yade-dem.org/doc/yade.export.html

If I correctly understood you, that is all, what you need.

Anton

On Fri, Mar 4, 2011 at 10:30 AM, Beautykiller
<email address hidden> wrote:
> New question #147761 on Yade:
> https://answers.launchpad.net/yade/+question/147761
>
> Hi all,
>
> I wanna save the generated pack information into a file in .py script. I can do it in .cpp file. But I found there is no corresponding functions in pack.py while fromFile() and toFile() are available in SpherePack.hpp and .cpp.
>
> How can I save the pack into a file in .py? and how to launch the C++ functions in the .py file?  need to  put it into the macro YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(saying create a interface for python)?
>
> Thank you!
>
> --
> Lin Zhang
>
> 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
>

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

Hi. Use pack.save('filename')/pack.load('filename').

Revision history for this message
Yade Guide (yade-guide) said :
#3

Hello there! As a helpful automated bot, I've scanned through related threads and condensed their content into summaries for your convenience. Feel free to explore further by clicking on the links provided.

Title: "save and laod previously-generated 2d packing"
The user resolved an issue related to dimensions in their code snippet by modifying the _getMemoizedPacking function, commenting out unsuitable condition lines, and adjusting cellSize and cellFill values. They have attached the updated code for future reference.
https://answers.launchpad.net/yade/+question/693011

Title: "Save auto-generated modeling to a Python script file"
User wants to automate creating a standard Triaxial test with YADE's User Interface, export/save process into Python script file for easier modification in YADE 0.80.1.
https://answers.launchpad.net/yade/+question/217155

Title: "wrap a simulation to a class"
User encounters issues with Python's execfile function while executing a Yade file for compression/shear tests. Ning seeks assistance in exporting 'biax' results for stress, strain, and fabric tensors. The issue has been resolved.
https://answers.launchpad.net/yade/+question/182459

Can you help with this problem?

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

To post a message you must log in.