public ISimulationSettings CreateFor(Simulation simulation) { //was already defined..nothing to do if (simulation.SimulationSettings != null) { return(simulation.SimulationSettings); } var settings = _objectBaseFactory.Create <ISimulationSettings>(); settings.OutputSchema = _outputSchemaFactory.CreateFor(simulation); settings.Solver = _solverSettingsFactory.CreateDefault(); return(settings); }
public override Task <ModelSolverSettings> MapToModel(SnapshotSolverSettings snapshot, SnapshotContext snapshotContext) { var solverSettings = _solverSettingsFactory.CreateDefault(); if (snapshot == null) { return(Task.FromResult(solverSettings)); } solverSettings.AbsTol = ModelValueFor(snapshot.AbsTol, _defaultSolverSettings.AbsTol); solverSettings.RelTol = ModelValueFor(snapshot.RelTol, _defaultSolverSettings.RelTol); solverSettings.UseJacobian = ModelValueFor(snapshot.UseJacobian, _defaultSolverSettings.UseJacobian); solverSettings.H0 = ModelValueFor(snapshot.H0, _defaultSolverSettings.H0); solverSettings.HMin = ModelValueFor(snapshot.HMin, _defaultSolverSettings.HMin); solverSettings.HMax = ModelValueFor(snapshot.HMax, _defaultSolverSettings.HMax); solverSettings.MxStep = ModelValueFor(snapshot.MxStep, _defaultSolverSettings.MxStep); return(Task.FromResult(solverSettings)); }
public SolverSettingsMapper(ISolverSettingsFactory solverSettingsFactory) { _solverSettingsFactory = solverSettingsFactory; _defaultSolverSettings = _solverSettingsFactory.CreateDefault(); }