Skip to content

Commit

Permalink
Version 2.0.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny authored Jul 18, 2024
2 parents 80522ab + ed0cbc5 commit d53cee2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abi-software/simulationvuer",
"version": "2.0.4",
"version": "2.0.5",
"private": false,
"scripts": {
"serve": "vite serve --host",
Expand Down
10 changes: 5 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export default {
{ id: 308, label: "308", description: "Kember Cardiac Nerve Model" },
{ id: 318, label: "318", description: "Multi-scale rabbit cardiac electrophysiology models" },
{ id: 320, label: "320", description: "Multi-scale human cardiac electrophysiology models" },
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/135.omex", label: "ISAN-135", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/157.omex", label: "ISAN-157", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/lorenz.omex", label: "ISAN-Lorenz", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/tt04.omex", label: "ISAN-TT04", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/ed9eae1a37735b18c19b77f7d60f65fa1edbae18/geewhiz.omex", label: "ISAN-GeeWhiz", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/135.omex", label: "ISAN-135", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/157.omex", label: "ISAN-157", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/lorenz.omex", label: "ISAN-Lorenz", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/tt04.omex", label: "ISAN-TT04", description: "COMBINE archive from PMR" },
{ id: "workspace/b7c/rawfile/01e2df76bf5e8d5ad7c00c3a4e7876879259edd6/Gee_whiz_Exported.cellml.omex", label: "ISAN-GeeWhiz", description: "COMBINE archive from PMR" },
],
id: 0,
ready: [],
Expand Down
34 changes: 17 additions & 17 deletions src/components/SimulationVuer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<p v-if="!hasValidSimulationUiInfo && !showUserMessage" class="default error"><span class="error">Error:</span> an unknown or invalid model was provided.</p>
<div class="main" v-if="hasValidSimulationUiInfo">
<div class="main-left">
<p class="default name" v-if="libopencor === undefined">{{name}}</p>
<el-divider v-if="libopencor === undefined"></el-divider>
<p class="default name" v-if="!libopencorSet">{{name}}</p>
<el-divider v-if="!libopencorSet"></el-divider>
<p class="default input-parameters">Input parameters</p>
<div class="input scrollbar">
<SimulationVuerInput v-for="(input, index) in simulationUiInfo.input"
Expand All @@ -19,16 +19,16 @@
/>
</div>
<div class="primary-button">
<el-button type="primary" size="small" @click="startSimulation()" v-if="libopencor === undefined">Run Simulation</el-button>
<el-button type="primary" size="small" @click="startSimulation()" v-if="!libopencorSet">Run Simulation</el-button>
</div>
<div class="secondary-button" v-if="uuid">
<el-button size="small" @click="runOnOsparc()">Run on oSPARC</el-button>
</div>
<div class="secondary-button">
<el-button size="small" @click="viewDataset()" v-if="libopencor === undefined">View Dataset</el-button>
<el-button size="small" @click="viewDataset()" v-if="!libopencorSet">View Dataset</el-button>
</div>
<div class="secondary-button">
<el-button size="small" @click="viewWorkspace()" v-if="libopencor !== undefined">View Workspace</el-button>
<el-button size="small" @click="viewWorkspace()" v-if="libopencorSet">View Workspace</el-button>
</div>
<p class="default note" v-if="uuid">Additional parameters are available on oSPARC</p>
</div>
Expand Down Expand Up @@ -57,7 +57,7 @@ import { ElButton, ElDivider, ElLoading } from "element-plus";
import { evaluateValue, finaliseUi, OPENCOR_SOLVER_NAME } from "./common.js";
import { validJson } from "./json.js";
import libOpenCOR from "./libopencor.js";
import { toRaw } from "vue";
import { markRaw } from "vue";
import { create, all } from "mathjs";
const LIBOPENCOR_SOLVER = "libOpenCOR";
Expand Down Expand Up @@ -126,6 +126,7 @@ export default {
isSimulationValid: true,
layout: [],
libopencor: undefined,
libopencorSet: false,
name: null,
opencorBasedSimulation: true,
output: undefined,
Expand Down Expand Up @@ -188,7 +189,7 @@ export default {
* @arg `fileContents`
*/
manageFile(url, fileContents) {
let file = toRaw(this.fileManager).file(url);
let file = this.fileManager.file(url);
if (file === null) {
file = new this.libopencor.File(url);
Expand All @@ -213,29 +214,27 @@ export default {
if (this.instance === undefined) {
// Retrieve an instance of the model.
const document = new this.libopencor.SedDocument(toRaw(this.fileManager).file(PMR_URL + this.id));
const document = new this.libopencor.SedDocument(this.fileManager.file(PMR_URL + this.id));
this.instance = document.instantiate();
this.instance = markRaw(document.instantiate());
document.delete();
}
// Run the simulation after passing some initial conditions to it, if any.
const instance = toRaw(this.instance);
instance.removeAllInitialConditions();
this.instance.removeAllInitialConditions();
for (const [parameter, value] of Object.entries(this.parametersData())) {
instance.addInitialCondition(parameter, value);
this.instance.addInitialCondition(parameter, value);
}
instance.run();
this.instance.run();
// Retrieve the simulation results.
const res = {};
const instanceTask = instance.tasks().get(0);
const instanceTask = this.instance.tasks().get(0);
for (const output of this.outputData()) {
if (output === instanceTask.voiName()) {
Expand Down Expand Up @@ -663,8 +662,9 @@ export default {
if (xmlhttp.readyState === 4) {
if (xmlhttp.status === 200) {
libOpenCOR().then((libopencor) => {
this.libopencor = libopencor;
this.fileManager = this.libopencor.FileManager.instance();
this.libopencor = markRaw(libopencor);
this.libopencorSet = true;
this.fileManager = markRaw(this.libopencor.FileManager.instance());
const fileContents = Uint8Array.from(atob(xmlhttp.response), (c) => c.charCodeAt(0));
const file = this.manageFile(PMR_URL + this.id, fileContents);
Expand Down

0 comments on commit d53cee2

Please sign in to comment.