restore_object_state: Restore the state of simulation objects.

View source: R/simulation.R

restore_object_stateR Documentation

Restore the state of simulation objects.

Description

Restore the state of one or more simulation objects. The specified objects are paired up with the relevant part of the state object, and the restore_state method of each object is called.

If the list of object is named, more objects may be specified than were originally present in the saved simulation, allowing a simulation to be extended with more features upon resuming. In this case, the restore_state method of the new objects is called with a NULL argument. Conversly, the list of objects may omit certain entries, in which case their state to be restored is ignored.

Usage

restore_object_state(timesteps, objects, state)

Arguments

timesteps

the number of time steps that have already been simulated

objects

a simulation object (eg. a variable or event) or an arbitrarily nested list structure of such objects.

state

a saved simulation state for the given objects, as returned by save_object_state. This should have the same shape as the objects argument: if a list of objects is given, then state should be a list of corresponding states. If NULL is passed, then each object's restore_state method is called with NULL as its argument.


mrc-ide/individual documentation built on Aug. 17, 2024, 2:10 p.m.