@opencor/opencor 0.20250826.0 → 0.20250827.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/opencor.es.js +1 -1
- package/package.json +5 -6
- package/src/App.vue +0 -7
- package/src/ContainerApp.vue +0 -21
- package/src/assets/app.css +0 -14
- package/src/assets/base.css +0 -31
- package/src/assets/logo.svg +0 -17
- package/src/common/common.ts +0 -86
- package/src/common/constants.ts +0 -12
- package/src/common/electron.ts +0 -23
- package/src/common/electronApi.ts +0 -63
- package/src/common/locCommon.ts +0 -170
- package/src/common/settings.ts +0 -95
- package/src/common/vueCommon.ts +0 -69
- package/src/components/BackgroundComponent.vue +0 -26
- package/src/components/BlockingMessageComponent.vue +0 -34
- package/src/components/ContentsComponent.vue +0 -277
- package/src/components/DragNDropComponent.vue +0 -35
- package/src/components/MainMenu.vue +0 -225
- package/src/components/OpenCOR.vue +0 -624
- package/src/components/dialogs/AboutDialog.vue +0 -51
- package/src/components/dialogs/BaseDialog.vue +0 -58
- package/src/components/dialogs/OpenRemoteDialog.vue +0 -37
- package/src/components/dialogs/ResetAllDialog.vue +0 -13
- package/src/components/dialogs/SettingsDialog.vue +0 -42
- package/src/components/dialogs/UpdateAvailableDialog.vue +0 -16
- package/src/components/dialogs/UpdateDownloadProgressDialog.vue +0 -11
- package/src/components/dialogs/UpdateErrorDialog.vue +0 -18
- package/src/components/dialogs/UpdateNotAvailableDialog.vue +0 -12
- package/src/components/propertyEditors/GraphsPropertyEditor.vue +0 -3
- package/src/components/propertyEditors/ParametersPropertyEditor.vue +0 -3
- package/src/components/propertyEditors/PropertyEditor.vue +0 -60
- package/src/components/propertyEditors/SimulationPropertyEditor.vue +0 -45
- package/src/components/propertyEditors/SolversPropertyEditor.vue +0 -3
- package/src/components/views/IssuesView.vue +0 -50
- package/src/components/views/SimulationExperimentUiView.vue +0 -154
- package/src/components/views/SimulationExperimentView.vue +0 -218
- package/src/components/widgets/GraphPanelWidget.vue +0 -140
- package/src/components/widgets/InputWidget.vue +0 -128
- package/src/libopencor/locApi.ts +0 -167
- package/src/libopencor/locFileApi.ts +0 -263
- package/src/libopencor/locLoggerApi.ts +0 -36
- package/src/libopencor/locSedApi.ts +0 -486
- package/src/libopencor/locUiJsonApi.ts +0 -485
- package/src/libopencor/locVersionApi.ts +0 -17
- package/src/libopencor/src/common.cpp +0 -67
- package/src/libopencor/src/common.h +0 -27
- package/src/libopencor/src/file.cpp +0 -72
- package/src/libopencor/src/file.h +0 -15
- package/src/libopencor/src/main.cpp +0 -78
- package/src/libopencor/src/sed.cpp +0 -348
- package/src/libopencor/src/sed.h +0 -53
- package/src/libopencor/src/version.cpp +0 -8
- package/src/libopencor/src/version.h +0 -5
- package/src/main.ts +0 -6
- package/src/types/types.d.ts +0 -9
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import * as vue from 'vue'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
_cppLocApi,
|
|
5
|
-
_wasmLocApi,
|
|
6
|
-
cppVersion,
|
|
7
|
-
EIssueType,
|
|
8
|
-
ESedSimulationType,
|
|
9
|
-
SedDocument,
|
|
10
|
-
SedInstance,
|
|
11
|
-
SedSimulationUniformTimeCourse,
|
|
12
|
-
wasmIssuesToIssues,
|
|
13
|
-
type IIssue,
|
|
14
|
-
type IUiJson,
|
|
15
|
-
type IWasmIssues
|
|
16
|
-
} from './locApi.js'
|
|
17
|
-
|
|
18
|
-
// FileManager API.
|
|
19
|
-
|
|
20
|
-
interface IWasmFileManagerInstance {
|
|
21
|
-
files: {
|
|
22
|
-
size(): number
|
|
23
|
-
get(index: number): { fileName: string }
|
|
24
|
-
}
|
|
25
|
-
unmanage(file: unknown): void
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface IWasmFileManager {
|
|
29
|
-
instance(): IWasmFileManagerInstance
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
class FileManager {
|
|
33
|
-
private _fileManager: IWasmFileManagerInstance | undefined = undefined
|
|
34
|
-
|
|
35
|
-
private fileManager() {
|
|
36
|
-
if (this._fileManager === undefined && !cppVersion()) {
|
|
37
|
-
this._fileManager = _wasmLocApi.FileManager.instance()
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return this._fileManager
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
unmanage(path: string): void {
|
|
44
|
-
if (cppVersion()) {
|
|
45
|
-
_cppLocApi.fileManagerUnmanage(path)
|
|
46
|
-
} else {
|
|
47
|
-
const fileManager = this.fileManager()
|
|
48
|
-
|
|
49
|
-
if (fileManager !== undefined) {
|
|
50
|
-
const files = fileManager.files
|
|
51
|
-
|
|
52
|
-
for (let i = 0; i < files.size(); ++i) {
|
|
53
|
-
const file = files.get(i)
|
|
54
|
-
|
|
55
|
-
if (file.fileName === path) {
|
|
56
|
-
fileManager.unmanage(file)
|
|
57
|
-
|
|
58
|
-
break
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export const fileManager = new FileManager()
|
|
67
|
-
|
|
68
|
-
// File API.
|
|
69
|
-
|
|
70
|
-
export enum EFileType {
|
|
71
|
-
UNKNOWN_FILE,
|
|
72
|
-
CELLML_FILE,
|
|
73
|
-
SEDML_FILE,
|
|
74
|
-
COMBINE_ARCHIVE,
|
|
75
|
-
IRRETRIEVABLE_FILE
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface IWasmFile {
|
|
79
|
-
type: { value: EFileType }
|
|
80
|
-
issues: IWasmIssues
|
|
81
|
-
contents(): Uint8Array
|
|
82
|
-
setContents(ptr: number, length: number): void
|
|
83
|
-
childFileFromFileName(fileName: string): File | null
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export class File {
|
|
87
|
-
private _path: string
|
|
88
|
-
private _wasmFile: IWasmFile = {} as IWasmFile
|
|
89
|
-
private _document: SedDocument = {} as SedDocument
|
|
90
|
-
private _instance: SedInstance = {} as SedInstance
|
|
91
|
-
private _issues: IIssue[] = []
|
|
92
|
-
|
|
93
|
-
constructor(path: string, contents: Uint8Array | undefined = undefined) {
|
|
94
|
-
this._path = path
|
|
95
|
-
|
|
96
|
-
if (cppVersion()) {
|
|
97
|
-
_cppLocApi.fileCreate(path, contents)
|
|
98
|
-
|
|
99
|
-
this._issues = _cppLocApi.fileIssues(path)
|
|
100
|
-
} else if (contents !== undefined) {
|
|
101
|
-
this._wasmFile = new _wasmLocApi.File(path)
|
|
102
|
-
|
|
103
|
-
const heapContentsPtr = _wasmLocApi._malloc(contents.length)
|
|
104
|
-
const heapContents = new Uint8Array(_wasmLocApi.HEAPU8.buffer, heapContentsPtr, contents.length)
|
|
105
|
-
|
|
106
|
-
heapContents.set(contents)
|
|
107
|
-
|
|
108
|
-
this._wasmFile.setContents(heapContentsPtr, contents.length)
|
|
109
|
-
|
|
110
|
-
this._issues = wasmIssuesToIssues(this._wasmFile.issues)
|
|
111
|
-
} else {
|
|
112
|
-
// Note: we should never reach this point since we should always provide some file contents when using the WASM
|
|
113
|
-
// version of libOpenCOR.
|
|
114
|
-
|
|
115
|
-
console.error(`No contents provided for file '${path}'.`)
|
|
116
|
-
|
|
117
|
-
return
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (this._issues.length !== 0) {
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Retrieve the SED-ML file associated with this file.
|
|
125
|
-
|
|
126
|
-
this._document = vue.markRaw(new SedDocument(this._path, this._wasmFile))
|
|
127
|
-
this._issues = this._document.issues()
|
|
128
|
-
|
|
129
|
-
if (this._issues.length !== 0) {
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
//---OPENCOR---
|
|
134
|
-
// We only support a limited subset of SED-ML for now, so we need to check a few more things. Might wnat to check
|
|
135
|
-
// https://github.com/opencor/opencor/blob/master/src/plugins/support/SEDMLSupport/src/sedmlfile.cpp#L579-L1492.
|
|
136
|
-
|
|
137
|
-
// Make sure that there is only one model.
|
|
138
|
-
|
|
139
|
-
const modelCount = this._document.modelCount()
|
|
140
|
-
|
|
141
|
-
if (modelCount !== 1) {
|
|
142
|
-
this._issues.push({
|
|
143
|
-
type: EIssueType.WARNING,
|
|
144
|
-
description: 'Only SED-ML files with one model are currently supported.'
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Make sure that the SED-ML file has only one simulation.
|
|
151
|
-
|
|
152
|
-
const simulationCount = this._document.simulationCount()
|
|
153
|
-
|
|
154
|
-
if (simulationCount !== 1) {
|
|
155
|
-
this._issues.push({
|
|
156
|
-
type: EIssueType.WARNING,
|
|
157
|
-
description: 'Only SED-ML files with one simulation are currently supported.'
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Make sure that the simulation is a uniform time course simulation.
|
|
164
|
-
|
|
165
|
-
const simulation = this._document.simulation(0) as SedSimulationUniformTimeCourse
|
|
166
|
-
|
|
167
|
-
if (simulation.type() !== ESedSimulationType.UNIFORM_TIME_COURSE) {
|
|
168
|
-
this._issues.push({
|
|
169
|
-
type: EIssueType.WARNING,
|
|
170
|
-
description: 'Only uniform time course simulations are currently supported.'
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Make sure that the initial time and output start time are the same, that the output start time and output end
|
|
177
|
-
// time are different, and that the number of steps is greater than zero.
|
|
178
|
-
|
|
179
|
-
const initialTime = simulation.initialTime()
|
|
180
|
-
const outputStartTime = simulation.outputStartTime()
|
|
181
|
-
const outputEndTime = simulation.outputEndTime()
|
|
182
|
-
const numberOfSteps = simulation.numberOfSteps()
|
|
183
|
-
|
|
184
|
-
if (initialTime !== outputStartTime) {
|
|
185
|
-
this._issues.push({
|
|
186
|
-
type: EIssueType.WARNING,
|
|
187
|
-
description: `Only uniform time course simulations with the same values for 'initialTime' (${String(initialTime)}) and 'outputStartTime' (${String(outputStartTime)}) are currently supported.`
|
|
188
|
-
})
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (outputStartTime === outputEndTime) {
|
|
192
|
-
this._issues.push({
|
|
193
|
-
type: EIssueType.ERROR,
|
|
194
|
-
description: `The uniform time course simulation must have different values for 'outputStartTime' (${String(outputStartTime)}) and 'outputEndTime' (${String(outputEndTime)}).`
|
|
195
|
-
})
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (numberOfSteps <= 0) {
|
|
199
|
-
this._issues.push({
|
|
200
|
-
type: EIssueType.ERROR,
|
|
201
|
-
description: `The uniform time course simulation must have a positive value for 'numberOfSteps' (${String(numberOfSteps)}).`
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
206
|
-
if (this._issues.length !== 0) {
|
|
207
|
-
return
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Retrieve an instance of the model.
|
|
211
|
-
|
|
212
|
-
this._instance = this._document.instantiate()
|
|
213
|
-
this._issues = this._instance.issues()
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
type(): EFileType {
|
|
217
|
-
return cppVersion() ? _cppLocApi.fileType(this._path) : this._wasmFile.type.value
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
path(): string {
|
|
221
|
-
return this._path
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
issues(): IIssue[] {
|
|
225
|
-
return this._issues
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
contents(): Uint8Array {
|
|
229
|
-
return cppVersion() ? _cppLocApi.fileContents(this._path) : this._wasmFile.contents()
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
document(): SedDocument {
|
|
233
|
-
return this._document
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
instance(): SedInstance {
|
|
237
|
-
return this._instance
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
uiJson(): IUiJson | undefined {
|
|
241
|
-
let uiJsonContents: Uint8Array | undefined
|
|
242
|
-
|
|
243
|
-
if (cppVersion()) {
|
|
244
|
-
uiJsonContents = _cppLocApi.fileUiJson(this._path)
|
|
245
|
-
|
|
246
|
-
if (uiJsonContents === undefined) {
|
|
247
|
-
return undefined
|
|
248
|
-
}
|
|
249
|
-
} else {
|
|
250
|
-
const uiJson = this._wasmFile.childFileFromFileName('simulation.json')
|
|
251
|
-
|
|
252
|
-
if (uiJson === null) {
|
|
253
|
-
return undefined
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
uiJsonContents = uiJson.contents()
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const decoder = new TextDecoder()
|
|
260
|
-
|
|
261
|
-
return JSON.parse(decoder.decode(uiJsonContents))
|
|
262
|
-
}
|
|
263
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// Logger API.
|
|
2
|
-
|
|
3
|
-
export enum EIssueType {
|
|
4
|
-
ERROR,
|
|
5
|
-
WARNING
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface IIssue {
|
|
9
|
-
type: EIssueType
|
|
10
|
-
description: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface IWasmIssue {
|
|
14
|
-
type: { value: EIssueType }
|
|
15
|
-
description: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface IWasmIssues {
|
|
19
|
-
size(): number
|
|
20
|
-
get(index: number): IWasmIssue
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function wasmIssuesToIssues(wasmIssues: IWasmIssues): IIssue[] {
|
|
24
|
-
const res = []
|
|
25
|
-
|
|
26
|
-
for (let i = 0; i < wasmIssues.size(); ++i) {
|
|
27
|
-
const issue = wasmIssues.get(i)
|
|
28
|
-
|
|
29
|
-
res.push({
|
|
30
|
-
type: issue.type.value,
|
|
31
|
-
description: issue.description
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return res
|
|
36
|
-
}
|