Learn R Programming

SpaDES.core (version 3.2.1)

.restartRestoreEventObjs: Restore one recovered event's object state on restart (shared rewind core)

Description

Shared by restartSpades() and restartSimInit(). For a single recovered event, rewinds the simList's objects to their pre-event state: (a) any object the event creates (its outputObjects) that is absent from the snapshot did not exist when the event began, so it is removed; (b) the snapshotted objects are copied back into sim@.xData; (c) the module's mod objects are restored. Mutates sim@.xData by side effect. The two restart paths previously each had their own (slightly divergent) copy of this; sharing it means a fix in one benefits both.

Usage

.restartRestoreEventObjs(sim, snapshot, modSnapshot, module, label = module)

Value

sim, invisibly.

Arguments

sim

A simList.

snapshot

Named list of the event's objects at its start (sim$.recoverableObjs[[i]]).

modSnapshot

Named list of the module's mod objects at the event's start, or NULL.

module

The module name whose objects are being rewound.

label

Text used in the "Setting all changed objects ..." message (defaults to module).