sbmlsim-core 0.9.0 → 0.11.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # sbmlsim-core
2
2
 
3
- Simulate SBML models in browsers and in Node. [sbmlsim-core](https://matthiaskoenig.github.io/sbmlsim-core/) compiles an SBML model into a WebAssembly module (`model.wasm` with its description `model.json`) and simulates it with its engine (`engine.wasm`: CVODE of SUNDIALS with the sparse solver KLU), with the semantics of [sbmlsim](https://matthiaskoenig.github.io/sbmlsim/) and bitwise the same results on every host. This package is its JavaScript host: plain ES modules without dependencies, the engine and its math library included.
3
+ Simulate SBML models in browsers and in Node. [sbmlsim-core](https://matthiaskoenig.github.io/sbmlsim-core/) compiles an SBML model into a WebAssembly module (`model.wasm` with its description `model.json`) and simulates it with its engine (`engine.wasm`: CVODE and IDA of SUNDIALS with the sparse solver KLU), with the semantics of [sbmlsim](https://matthiaskoenig.github.io/sbmlsim/) and bitwise the same results on every host. This package is its JavaScript host: plain ES modules without dependencies, the engine and its math library included.
4
4
 
5
5
  | module | import | what it is |
6
6
  |---|---|---|
@@ -20,7 +20,7 @@ npm install sbmlsim-core
20
20
  or import the modules from a CDN, which serves them with the headers every origin may read:
21
21
 
22
22
  ```js
23
- import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.9.0/panels.mjs";
23
+ import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.11.0/panels.mjs";
24
24
  ```
25
25
 
26
26
  A pool started from a module of another origin starts its workers through a module of the page's own origin, so the CDN works for the workers as well. The engine needs fixed-width SIMD of WebAssembly: Chrome 91, Firefox 89, Safari 16.4 or newer, Node 20 or newer.
@@ -86,7 +86,7 @@ pool.close();
86
86
  <!-- the IIFE build of sbmlsim-web, a release with registerEndpoint -->
87
87
  <script src="sbmlsim-web.iife.js"></script>
88
88
  <script type="module">
89
- import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.9.0/panels.mjs";
89
+ import { createPanelEndpoint } from "https://cdn.jsdelivr.net/npm/sbmlsim-core@0.11.0/panels.mjs";
90
90
 
91
91
  sbmlsimWeb.registerEndpoint(
92
92
  "local:glimepiride",
package/loader.mjs CHANGED
@@ -49,7 +49,7 @@ export const MAX_MEMORY_PAGES = 32768;
49
49
  export const ENGINE_SECTION = "sbmlsim.engine";
50
50
 
51
51
  /** The version of the output of `engine.wasm` this loader reads (`ENGINE_OUTPUT_FORMAT`). */
52
- export const ENGINE_OUTPUT_FORMAT = 1;
52
+ export const ENGINE_OUTPUT_FORMAT = 2;
53
53
 
54
54
  const WASI = "wasi_snapshot_preview1";
55
55
 
@@ -81,6 +81,11 @@ export const STATS_NAMES = [
81
81
  "integrations",
82
82
  "probe_rhs_evals",
83
83
  "steady_state_rhs_evals",
84
+ "linear_iterations",
85
+ "linear_convergence_failures",
86
+ "jacobian_vector_evals",
87
+ "preconditioner_evals",
88
+ "preconditioner_solves",
84
89
  ];
85
90
 
86
91
  const LITTLE_ENDIAN = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
@@ -380,6 +385,17 @@ export async function createRuntime({
380
385
  }
381
386
  if (!(modelWasm instanceof WebAssembly.Module)) validateModelBytes(modelWasm);
382
387
  const modelModule = await toModule(modelWasm, "model.wasm");
388
+ const history = WebAssembly.Module.customSections(modelModule, "sbmlsim.history");
389
+ const nDelays = desc.n_delays ?? 0;
390
+ if (history.length > 1 || (history.length === 0 && nDelays !== 0)) {
391
+ throw new Error("model.wasm history sites differ from its description");
392
+ }
393
+ if (history.length === 1) {
394
+ const info = new DataView(history[0]);
395
+ if (info.byteLength !== 8 || info.getUint32(0, true) !== 1 || info.getUint32(4, true) !== nDelays) {
396
+ throw new Error("model.wasm history metadata differs from its description");
397
+ }
398
+ }
383
399
  checkModel(modelModule, mathlibModule);
384
400
  const memory = new WebAssembly.Memory({ initial: minimum, maximum: maxMemoryPages });
385
401
  const wasi = wasiImports(engineModule, () => memory, out);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbmlsim-core",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Simulate SBML models compiled to WebAssembly in browsers and Node: the JavaScript host of sbmlsim-core with its engine (CVODE, KLU), a pool of workers and the panel endpoint of sbmlsim",
5
5
  "keywords": [
6
6
  "sbml",
package/panels.mjs CHANGED
@@ -58,7 +58,7 @@ import { EngineError } from "./loader.mjs";
58
58
  import { createPool, defaultWorkers } from "./pool.mjs";
59
59
 
60
60
  /** The version of sbmlsim-core (`js/package.json`), which the provenance of a run names. */
61
- export const CORE_VERSION = "0.9.0";
61
+ export const CORE_VERSION = "0.11.0";
62
62
 
63
63
  /** The engine a provenance names. */
64
64
  export const ENGINE = `sbmlsim-core ${CORE_VERSION}`;
@@ -4,7 +4,7 @@ The code of sbmlsim-core is MIT licensed (`LICENSE`). `engine.wasm`, which `sbml
4
4
 
5
5
  | Library | Version | Submodule and commit | License |
6
6
  |---|---|---|---|
7
- | SUNDIALS (CVODE and its vectors, matrices and linear solvers) | 7.9.0 | `third_party/sundials`, tag v7.9.0, commit 312fc0f3684f27209ca9dc9249d194436eb41a7a | BSD-3-Clause |
7
+ | SUNDIALS (CVODE, IDA and their vectors, matrices and linear solvers) | 7.9.0 | `third_party/sundials`, tag v7.9.0, commit 312fc0f3684f27209ca9dc9249d194436eb41a7a | BSD-3-Clause |
8
8
  | KLU (SuiteSparse) | 2.3.6 | `third_party/SuiteSparse`, tag v7.14.1, commit e202a5bcef55f5a780c26830ebd6ff13af193baf | LGPL-2.1-or-later |
9
9
  | BTF (SuiteSparse) | 2.3.3 | the same | LGPL-2.1-or-later |
10
10
  | AMD (SuiteSparse) | 3.3.4 | the same | BSD-3-Clause |
Binary file
Binary file