← Back to team overview

yade-dev team mailing list archive

Re: Reloading simulations

 

Jerome Duriez said:     (by the date of Wed, 06 Apr 2011 18:47:08 +0200)

> Hello Chiara,
> 
> our kind of problem can occur for example when some variables disappear 
> from code or change of name. 

boost::serialization has built-in system for class version management.
Exactly for this purpose. Upon loading the loaded version is checked,
and if different a proper conversion can be done. Problem is that we
never started using this class versioning in yade.

Maybe it's time to start using it? :)

http://www.boost.org/doc/libs/1_46_1/libs/serialization/doc/index.html
http://www.boost.org/doc/libs/1_46_1/libs/serialization/doc/tutorial.html#versioning

    void serialize(Archive & ar, const unsigned int version)
    {
        // only save/load this for newer classes, when friction was introduced
        if(version > 0)
            ar & friction;
        ar & stiffness;
    }

However, I didn't even look at how Vaclav integrated
boost::serialization with existing serialization framework. Maybe
introducing class versioning into yade could be done a simply as
adding to those nifty macros additional parameter saying in which
version the variable was introduced.

best regards
-- 
Janek Kozicki                               http://janek.kozicki.pl/



References