]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Optimized simulation result read: Fixing results saving bug (refs #3709)
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 10 Dec 2012 09:07:47 +0000 (09:07 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 10 Dec 2012 09:07:47 +0000 (09:07 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26515 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynResult.java

index 355378778601e36b02e6125d91f0acedb934dd79..33846537d432090c2f45fa64b306cb62fad33203 100644 (file)
@@ -453,6 +453,30 @@ public class SimulationResult {
             variables.add(ds);\r
         }\r
     }\r
+    \r
+    /**\r
+     * Read a all missing variable from the result file\r
+     * \r
+     * @param file result file\r
+     * @throws FileNotFoundException\r
+     * @throws IOException\r
+     */\r
+    public void readMissingVariables(File file) throws FileNotFoundException, IOException {\r
+        List<String> names = resultFileReader.getNames();\r
+        for (String variable : names) {\r
+            boolean matchFound = false; \r
+            for (DataSet tempDs : variables) {\r
+                if (tempDs.name.equals(variable)) {\r
+                    matchFound = true;\r
+                    break;\r
+                }\r
+            }\r
+            if (matchFound) {\r
+                continue;\r
+            }\r
+            readVariable(variable, file);\r
+        }\r
+    }\r
 \r
     /**\r
      * Read time array from result file\r
index 7a1b29c94d12e555c7b7c9ef81286600a465f9e0..6dc7ee8627e8a0fac1ea6ea7f7de3fed4f75f702 100644 (file)
@@ -256,6 +256,9 @@ public class SysdynResult {
                                binding = Bindings.getBinding( accessor.type() );\r
                                value = accessor.getValue(binding);\r
                        }\r
+            // Read the missing variables one by one.\r
+            simulationResult.readMissingVariables(this.resultFile);\r
+\r
                        addAllDataSets(progressMonitor);\r
                        // Write to file\r
                        if (progressMonitor != null) {\r