From f044679980be6dd64a8995aeb3284034d8e2fe9c Mon Sep 17 00:00:00 2001 From: "jussi.koskela" Date: Wed, 4 Jun 2014 13:48:26 +0000 Subject: [PATCH] refs #4856 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29589 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/fi/semantum/sysdyn/solver/Environment.java | 2 +- .../src/fi/semantum/sysdyn/solver/Solver.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Environment.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Environment.java index 45a81b76..01df0c3a 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Environment.java +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Environment.java @@ -66,7 +66,7 @@ final public class Environment implements IEnvironment, ISystem { final Map named = new HashMap(); public Model model; - public final double step; + public double step; public double time; public boolean initial = true; public int size; diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java index 54606980..26dd674e 100644 --- a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java @@ -37,13 +37,13 @@ public class Solver { private Object[] newValues; private Object[] derivatives; - private double step; + private double defaultStep; private double start; private NodeCache cache; private boolean ready; public Solver() { - step = 0.1; + defaultStep = 0.1; start = 0; // is it okay to store the cache with the solver instance? cache = new NodeCache(); @@ -51,7 +51,8 @@ public class Solver { } public void setStep(double step) { - this.step = step; + this.defaultStep = step; + if(env != null) env.step = step; } public void setStart(double start) { @@ -121,7 +122,7 @@ public class Solver { model = new Model(new Globals(), "", false); parser.walk(n, 0, model); - env = new Environment(model, step, start); + env = new Environment(model, defaultStep, start); int size = model.prepare(); env.setSize(size); -- 2.47.1