| 219 | |
| 220 | |
| 221 | void TemporalControlWindow::applySnapshot(Snapshot const& snapshot) |
| 222 | { |
| 223 | auto parameters = _simulationFacade->getSimulationParameters(); |
| 224 | auto const& origParameters = snapshot.parameters; |
| 225 | |
| 226 | if (origParameters.numRadiationSources == parameters.numRadiationSources) { |
| 227 | for (int i = 0; i < parameters.numRadiationSources; ++i) { |
| 228 | restorePosition(parameters.radiationSource[i], origParameters.radiationSource[i], snapshot.timestep); |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | if (origParameters.numZones == parameters.numZones) { |
| 233 | for (int i = 0; i < parameters.numZones; ++i) { |
| 234 | restorePosition(parameters.zone[i], origParameters.zone[i], snapshot.timestep); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | parameters.externalEnergy = origParameters.externalEnergy; |
| 239 | if (parameters.cellMaxAgeBalancer || origParameters.cellMaxAgeBalancer) { |
| 240 | for (int i = 0; i < MAX_COLORS; ++i) { |
| 241 | parameters.cellMaxAge[i] = origParameters.cellMaxAge[i]; |
| 242 | } |
| 243 | } |
| 244 | _simulationFacade->setCurrentTimestep(snapshot.timestep); |
| 245 | _simulationFacade->setRealTime(snapshot.realTime); |
| 246 | _simulationFacade->clear(); |
| 247 | _simulationFacade->setSimulationData(snapshot.data); |
| 248 | _simulationFacade->setSimulationParameters(parameters); |
| 249 | } |
| 250 | |
| 251 | template <typename MovedObjectType> |
| 252 | void TemporalControlWindow::restorePosition(MovedObjectType& movedObject, MovedObjectType const& origMovedObject, uint64_t origTimestep) |
nothing calls this directly
no test coverage detected