← Back to team overview

yade-dev team mailing list archive

Re: saving python globals?

 

Hi,

I think you can save all variables, what you need, with self-defined
function. It is about 10 strings of code.
Then you can load both files.

Anton


2010/6/4 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>

> Hi,
>
> The only annoying thing I found with python scripting (compared with
> complex routines in c++ engines) is that you can't really _save_ the
> simulation.
> By "save", I mean stop a simulation and write it to a file, and later
> restart Yade, reload it and continue as if it had never been stopped.
> It is not possible with most python scripts I have. Some variables are
> lost, and in the worst case (see peri-triax.py->doneHook), c++ is calling
> some python functions that will not be defined after reload. I found a few
> workarounds, but they are relatively painfull (namely emulate the previous
> context by redefining similar functions, but if you need python variables
> that are updated during the simulation you are toasted).
>
> So, I have been thinking to PFC, where user defined functions and global
> variables (PFC "fish" langage has ony globals anyway...) are saved at the
> same time as particles positions and forces. I googled "save python globals"
> or "save python context" a little but it didn't return anything relevant.
>
> Before I dive deeper into this question, do you think it is possible, at
> least theoreticaly, to save a full yade session somehow?
>
> Thanks.
>
> Bruno
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References