yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #00843
Re: Iteration number stored in the xml : how to fix broken conditionals?
>
> I realised that the iteration number feature (keeping the current
> iteration number after save/load) has broken some procedures (even
> though this feature was a good idea).
>
> I have some if(iteration==1) in a few places, but they mean in fact
> if("simulation was just loaded") (then do special operations on some
> members that are not registered parameters but need to be initialised).
>
> Is there a way to write those tests correctly now that I can't rely on
> iteration number?
You can have a data member in some class that will not be registered as
serializable, and can reset it to the default value in the class'
constructor. See UniaxialStrainer::needsInit.
> Alternatively, is there a way to get the old behaviour back optionaly
> (setting iteration=0 at loading time), it would also help me to find
> the history of a sample, when the outputs of different consecutive
> simulations on one single sample are appended to one unique file.
If you think it is reasonable, O.iter can be made writable, then it
would be possible:
O.load('simulation.xml'); O.iter=0;
References