← Back to team overview

yade-users team mailing list archive

Re: Storing variables with python

 

2010/7/20 Václav Šmilauer <eudoxos@xxxxxxxx>

> > Say that I am storing variables with python. So I make use of
> > PeriodicEngine. But I want to start storing some of them only after
> > that a certain condition is satisfied. How would you do that once
> > using plot.addData() function?
> You want to start storing history of some variables for plotting only
> after satisfying some condition, is that what you ask?
>
Exactly! Thanks for suggestions! I will do as you say. Chiara

>
> If so, just add a global variable for storing the condition test (see in
> examples/concrete/uniax.py how mode is used: it must be declared "global
> mode" at the beginning of the function where it is being used). Now if
> your condition has not yet been satisfied, you check for that
> contidition; is not satisfied, then return without storing any values.
> If it is satisfied, modify that that global variable and store data.
> Something like this:
>
> global conditionOk
> conditionOk=False
>
> def funcThatYouCallPeriodically:
>        global conditionOk
>        if not conditionOk:
>                if (check what you need here): conditionOk=True
>        if conditionOk:
>                # store data here
>
> HTH, Vaclav
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users<https://launchpad.net/%7Eyade-users>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References