← Back to team overview

yade-dev team mailing list archive

saving python globals?

 

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




Follow ups