Skip to content

Commit d53cee2

Browse files
authored
Version 2.0.5.
2 parents 80522ab + ed0cbc5 commit d53cee2

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@abi-software/simulationvuer",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"private": false,
55
"scripts": {
66
"serve": "vite serve --host",

src/App.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export default {
4444
{ id: 308, label: "308", description: "Kember Cardiac Nerve Model" },
4545
{ id: 318, label: "318", description: "Multi-scale rabbit cardiac electrophysiology models" },
4646
{ id: 320, label: "320", description: "Multi-scale human cardiac electrophysiology models" },
47-
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/135.omex", label: "ISAN-135", description: "COMBINE archive from PMR" },
48-
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/157.omex", label: "ISAN-157", description: "COMBINE archive from PMR" },
49-
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/lorenz.omex", label: "ISAN-Lorenz", description: "COMBINE archive from PMR" },
50-
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/tt04.omex", label: "ISAN-TT04", description: "COMBINE archive from PMR" },
51-
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/geewhiz.omex", label: "ISAN-GeeWhiz", description: "COMBINE archive from PMR" },
47+
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/135.omex", label: "ISAN-135", description: "COMBINE archive from PMR" },
48+
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/157.omex", label: "ISAN-157", description: "COMBINE archive from PMR" },
49+
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/lorenz.omex", label: "ISAN-Lorenz", description: "COMBINE archive from PMR" },
50+
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/tt04.omex", label: "ISAN-TT04", description: "COMBINE archive from PMR" },
51+
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/Gee_whiz_Exported.cellml.omex", label: "ISAN-GeeWhiz", description: "COMBINE archive from PMR" },
5252
],
5353
id: 0,
5454
ready: [],

src/components/SimulationVuer.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<p v-if="!hasValidSimulationUiInfo && !showUserMessage" class="default error"><span class="error">Error:</span> an unknown or invalid model was provided.</p>
44
<div class="main" v-if="hasValidSimulationUiInfo">
55
<div class="main-left">
6-
<p class="default name" v-if="libopencor === undefined">{{name}}</p>
7-
<el-divider v-if="libopencor === undefined"></el-divider>
6+
<p class="default name" v-if="!libopencorSet">{{name}}</p>
7+
<el-divider v-if="!libopencorSet"></el-divider>
88
<p class="default input-parameters">Input parameters</p>
99
<div class="input scrollbar">
1010
<SimulationVuerInput v-for="(input, index) in simulationUiInfo.input"
@@ -19,16 +19,16 @@
1919
/>
2020
</div>
2121
<div class="primary-button">
22-
<el-button type="primary" size="small" @click="startSimulation()" v-if="libopencor === undefined">Run Simulation</el-button>
22+
<el-button type="primary" size="small" @click="startSimulation()" v-if="!libopencorSet">Run Simulation</el-button>
2323
</div>
2424
<div class="secondary-button" v-if="uuid">
2525
<el-button size="small" @click="runOnOsparc()">Run on oSPARC</el-button>
2626
</div>
2727
<div class="secondary-button">
28-
<el-button size="small" @click="viewDataset()" v-if="libopencor === undefined">View Dataset</el-button>
28+
<el-button size="small" @click="viewDataset()" v-if="!libopencorSet">View Dataset</el-button>
2929
</div>
3030
<div class="secondary-button">
31-
<el-button size="small" @click="viewWorkspace()" v-if="libopencor !== undefined">View Workspace</el-button>
31+
<el-button size="small" @click="viewWorkspace()" v-if="libopencorSet">View Workspace</el-button>
3232
</div>
3333
<p class="default note" v-if="uuid">Additional parameters are available on oSPARC</p>
3434
</div>
@@ -57,7 +57,7 @@ import { ElButton, ElDivider, ElLoading } from "element-plus";
5757
import { evaluateValue, finaliseUi, OPENCOR_SOLVER_NAME } from "./common.js";
5858
import { validJson } from "./json.js";
5959
import libOpenCOR from "./libopencor.js";
60-
import { toRaw } from "vue";
60+
import { markRaw } from "vue";
6161
import { create, all } from "mathjs";
6262
6363
const LIBOPENCOR_SOLVER = "libOpenCOR";
@@ -126,6 +126,7 @@ export default {
126126
isSimulationValid: true,
127127
layout: [],
128128
libopencor: undefined,
129+
libopencorSet: false,
129130
name: null,
130131
opencorBasedSimulation: true,
131132
output: undefined,
@@ -188,7 +189,7 @@ export default {
188189
* @arg `fileContents`
189190
*/
190191
manageFile(url, fileContents) {
191-
let file = toRaw(this.fileManager).file(url);
192+
let file = this.fileManager.file(url);
192193
193194
if (file === null) {
194195
file = new this.libopencor.File(url);
@@ -213,29 +214,27 @@ export default {
213214
if (this.instance === undefined) {
214215
// Retrieve an instance of the model.
215216
216-
const document = new this.libopencor.SedDocument(toRaw(this.fileManager).file(PMR_URL + this.id));
217+
const document = new this.libopencor.SedDocument(this.fileManager.file(PMR_URL + this.id));
217218
218-
this.instance = document.instantiate();
219+
this.instance = markRaw(document.instantiate());
219220
220221
document.delete();
221222
}
222223
223224
// Run the simulation after passing some initial conditions to it, if any.
224225
225-
const instance = toRaw(this.instance);
226-
227-
instance.removeAllInitialConditions();
226+
this.instance.removeAllInitialConditions();
228227
229228
for (const [parameter, value] of Object.entries(this.parametersData())) {
230-
instance.addInitialCondition(parameter, value);
229+
this.instance.addInitialCondition(parameter, value);
231230
}
232231
233-
instance.run();
232+
this.instance.run();
234233
235234
// Retrieve the simulation results.
236235
237236
const res = {};
238-
const instanceTask = instance.tasks().get(0);
237+
const instanceTask = this.instance.tasks().get(0);
239238
240239
for (const output of this.outputData()) {
241240
if (output === instanceTask.voiName()) {
@@ -663,8 +662,9 @@ export default {
663662
if (xmlhttp.readyState === 4) {
664663
if (xmlhttp.status === 200) {
665664
libOpenCOR().then((libopencor) => {
666-
this.libopencor = libopencor;
667-
this.fileManager = this.libopencor.FileManager.instance();
665+
this.libopencor = markRaw(libopencor);
666+
this.libopencorSet = true;
667+
this.fileManager = markRaw(this.libopencor.FileManager.instance());
668668
669669
const fileContents = Uint8Array.from(atob(xmlhttp.response), (c) => c.charCodeAt(0));
670670
const file = this.manageFile(PMR_URL + this.id, fileContents);

0 commit comments

Comments
 (0)