From 231e168907df72f285766ec5c62612d5910dc402 Mon Sep 17 00:00:00 2001 From: villberg Date: Wed, 15 Apr 2015 08:36:31 +0000 Subject: [PATCH] (fixes #5689) IC loading/saving does not work for indexed variables git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@31172 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../org/simantics/sysdyn/adapter/ValueIndexVariableBase.java | 3 +++ .../simantics/sysdyn/manager/SysdynGameExperimentBase.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java index 53db9ef8..b37aedb0 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ValueIndexVariableBase.java @@ -109,6 +109,8 @@ abstract public class ValueIndexVariableBase extends IndexVariable { String name = variableNames.get(i); solver.setRealValue(name, values[i]); + if(s != null) + s.setValue(i, values[i]); // Set value for all referred variables in modules SysdynResource sr = SysdynResource.getInstance(graph); @@ -121,6 +123,7 @@ abstract public class ValueIndexVariableBase extends IndexVariable { module = name.substring(0, name.lastIndexOf(".") + 1); String refName = module + NameUtils.getSafeName(graph, head) + "." + NameUtils.getSafeName(graph, ref); solver.setRealValue(refName, values[i]); + // NOTE: subscriptions for these references are not updated (but should be no problem since they are not read by set value) } } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java index 4a473bd9..02e78f9a 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynGameExperimentBase.java @@ -91,6 +91,11 @@ abstract public class SysdynGameExperimentBase extends OldSysdynExperiment { public void getValues(double[] data) { for(int i=0;i names) { -- 2.47.1