-
Notifications
You must be signed in to change notification settings - Fork 13
Pickling
jhshannon17 edited this page Jan 31, 2015
·
6 revisions
Pickling (also known as serialization) is saving the state of the simulation for later resumption (possibly under different controls)
- -w=x option pickles the simulation every x iterations
- Simulation is saved in the format driver.out-00000000-0.000000.xml
- Call XMLWriter::serialize_to_xml("filename", objects) where objects is a list of objects of type Base to serialize. In general, the only object you need to serialize is a pointer to the simulation (all objects it refers to are automatically serialized as well).
boost::shared_ptr<Moby::EventDrivenSimulator> sim(new Moby::EventDrivenSimulator);
//...set up simulation...
Moby::XMLWriter::serialize_to_xml("file", sim); //call at each stage you wish to serialize