diff-grok 1.2.0 → 1.3.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 +39 -8
- package/dist/index.d.ts +6 -0
- package/{index.js → dist/index.js} +1 -0
- package/dist/index.js.map +1 -0
- package/dist/src/examples/basic-use.d.ts +10 -0
- package/dist/src/examples/basic-use.js.map +1 -0
- package/dist/src/examples/check-methods.d.ts +1 -0
- package/dist/src/examples/check-methods.js.map +1 -0
- package/dist/src/examples/corr-probs.d.ts +15 -0
- package/{src → dist/src}/examples/corr-probs.js +2 -2
- package/dist/src/examples/corr-probs.js.map +1 -0
- package/dist/src/examples/cyclic-model.d.ts +6 -0
- package/dist/src/examples/cyclic-model.js.map +1 -0
- package/dist/src/examples/e5.d.ts +15 -0
- package/dist/src/examples/e5.js.map +1 -0
- package/dist/src/examples/hires.d.ts +15 -0
- package/dist/src/examples/hires.js.map +1 -0
- package/dist/src/examples/index.d.ts +22 -0
- package/dist/src/examples/index.js.map +1 -0
- package/dist/src/examples/model-updates.d.ts +6 -0
- package/dist/src/examples/model-updates.js.map +1 -0
- package/dist/src/examples/orego.d.ts +15 -0
- package/dist/src/examples/orego.js.map +1 -0
- package/dist/src/examples/pipeline-use.d.ts +6 -0
- package/dist/src/examples/pipeline-use.js.map +1 -0
- package/dist/src/examples/pollution.d.ts +15 -0
- package/dist/src/examples/pollution.js.map +1 -0
- package/{src/examples/print-benchmark.ts → dist/src/examples/print-benchmark.d.ts} +8 -58
- package/dist/src/examples/print-benchmark.js.map +1 -0
- package/dist/src/examples/robertson.d.ts +15 -0
- package/{docs/media → dist/src/examples}/robertson.js +2 -2
- package/dist/src/examples/robertson.js.map +1 -0
- package/dist/src/examples/scripting.d.ts +1 -0
- package/dist/src/examples/scripting.js.map +1 -0
- package/dist/src/examples/vdpol.d.ts +15 -0
- package/dist/src/examples/vdpol.js.map +1 -0
- package/dist/src/latex-export/examples/advanced-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/advanced-to-latex.js +41 -0
- package/dist/src/latex-export/examples/advanced-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/basic-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/basic-to-latex.js +17 -0
- package/dist/src/latex-export/examples/basic-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/bioreactor-to-latex-selective.d.ts +2 -0
- package/dist/src/latex-export/examples/bioreactor-to-latex-selective.js +145 -0
- package/dist/src/latex-export/examples/bioreactor-to-latex-selective.js.map +1 -0
- package/dist/src/latex-export/examples/chem-react-to-latex-no-cdot.d.ts +2 -0
- package/dist/src/latex-export/examples/chem-react-to-latex-no-cdot.js +41 -0
- package/dist/src/latex-export/examples/chem-react-to-latex-no-cdot.js.map +1 -0
- package/dist/src/latex-export/examples/energy-n-control-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/energy-n-control-to-markdown.js +58 -0
- package/dist/src/latex-export/examples/energy-n-control-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/extended-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/extended-to-markdown.js +37 -0
- package/dist/src/latex-export/examples/extended-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/fermentation-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/fermentation-to-latex.js +32 -0
- package/dist/src/latex-export/examples/fermentation-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/ga-production-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/ga-production-to-markdown.js +58 -0
- package/dist/src/latex-export/examples/ga-production-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/nimotuzumab-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/nimotuzumab-to-latex.js +53 -0
- package/dist/src/latex-export/examples/nimotuzumab-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/pk-pd-to-markdown-minimal.d.ts +2 -0
- package/dist/src/latex-export/examples/pk-pd-to-markdown-minimal.js +50 -0
- package/dist/src/latex-export/examples/pk-pd-to-markdown-minimal.js.map +1 -0
- package/dist/src/latex-export/examples/pk-to-markdown.d.ts +2 -0
- package/dist/src/latex-export/examples/pk-to-markdown.js +35 -0
- package/dist/src/latex-export/examples/pk-to-markdown.js.map +1 -0
- package/dist/src/latex-export/examples/pollution-to-latex.d.ts +2 -0
- package/dist/src/latex-export/examples/pollution-to-latex.js +141 -0
- package/dist/src/latex-export/examples/pollution-to-latex.js.map +1 -0
- package/dist/src/latex-export/examples/robertson-to-latex-no-meta.d.ts +2 -0
- package/dist/src/latex-export/examples/robertson-to-latex-no-meta.js +25 -0
- package/dist/src/latex-export/examples/robertson-to-latex-no-meta.js.map +1 -0
- package/dist/src/latex-export/generator/bracket-manager.d.ts +19 -0
- package/dist/src/latex-export/generator/bracket-manager.js +58 -0
- package/dist/src/latex-export/generator/bracket-manager.js.map +1 -0
- package/dist/src/latex-export/generator/document-builder.d.ts +13 -0
- package/dist/src/latex-export/generator/document-builder.js +433 -0
- package/dist/src/latex-export/generator/document-builder.js.map +1 -0
- package/dist/src/latex-export/generator/latex-generator.d.ts +23 -0
- package/dist/src/latex-export/generator/latex-generator.js +176 -0
- package/dist/src/latex-export/generator/latex-generator.js.map +1 -0
- package/dist/src/latex-export/index.d.ts +8 -0
- package/dist/src/latex-export/index.js +25 -0
- package/dist/src/latex-export/index.js.map +1 -0
- package/dist/src/latex-export/output/md-formatter.d.ts +16 -0
- package/dist/src/latex-export/output/md-formatter.js +27 -0
- package/dist/src/latex-export/output/md-formatter.js.map +1 -0
- package/dist/src/latex-export/output/tex-formatter.d.ts +5 -0
- package/dist/src/latex-export/output/tex-formatter.js +20 -0
- package/dist/src/latex-export/output/tex-formatter.js.map +1 -0
- package/dist/src/latex-export/parser/ast-parser.d.ts +7 -0
- package/dist/src/latex-export/parser/ast-parser.js +153 -0
- package/dist/src/latex-export/parser/ast-parser.js.map +1 -0
- package/dist/src/latex-export/parser/ivp-parser.d.ts +6 -0
- package/dist/src/latex-export/parser/ivp-parser.js +219 -0
- package/dist/src/latex-export/parser/ivp-parser.js.map +1 -0
- package/dist/src/latex-export/parser/line-joiner.d.ts +25 -0
- package/dist/src/latex-export/parser/line-joiner.js +80 -0
- package/dist/src/latex-export/parser/line-joiner.js.map +1 -0
- package/dist/src/latex-export/parser/tokenizer.d.ts +7 -0
- package/dist/src/latex-export/parser/tokenizer.js +143 -0
- package/dist/src/latex-export/parser/tokenizer.js.map +1 -0
- package/dist/src/latex-export/transformer/functions.d.ts +12 -0
- package/dist/src/latex-export/transformer/functions.js +47 -0
- package/dist/src/latex-export/transformer/functions.js.map +1 -0
- package/dist/src/latex-export/transformer/identifier.d.ts +23 -0
- package/dist/src/latex-export/transformer/identifier.js +194 -0
- package/dist/src/latex-export/transformer/identifier.js.map +1 -0
- package/dist/src/latex-export/transformer/operators.d.ts +9 -0
- package/dist/src/latex-export/transformer/operators.js +41 -0
- package/dist/src/latex-export/transformer/operators.js.map +1 -0
- package/dist/src/latex-export/types.d.ts +122 -0
- package/dist/src/latex-export/types.js +10 -0
- package/dist/src/latex-export/types.js.map +1 -0
- package/{src/pipeline/basic-pipeline-creator.ts → dist/src/pipeline/basic-pipeline-creator.d.ts} +11 -28
- package/dist/src/pipeline/basic-pipeline-creator.js.map +1 -0
- package/dist/src/pipeline/constants.d.ts +14 -0
- package/dist/src/pipeline/constants.js.map +1 -0
- package/dist/src/pipeline/index.d.ts +7 -0
- package/dist/src/pipeline/index.js.map +1 -0
- package/dist/src/pipeline/input.d.ts +3 -0
- package/dist/src/pipeline/input.js.map +1 -0
- package/dist/src/pipeline/loops-pipeline-creator.d.ts +124 -0
- package/dist/src/pipeline/loops-pipeline-creator.js.map +1 -0
- package/dist/src/pipeline/output.d.ts +10 -0
- package/{src → dist/src}/pipeline/output.js +1 -1
- package/dist/src/pipeline/output.js.map +1 -0
- package/dist/src/pipeline/pipeline-creator.d.ts +12 -0
- package/{src → dist/src}/pipeline/pipeline-creator.js +2 -0
- package/dist/src/pipeline/pipeline-creator.js.map +1 -0
- package/{src/pipeline/pipeline.ts → dist/src/pipeline/pipeline.d.ts} +10 -97
- package/dist/src/pipeline/pipeline.js.map +1 -0
- package/{src/pipeline/updates-pipeline-creator.ts → dist/src/pipeline/updates-pipeline-creator.d.ts} +15 -131
- package/dist/src/pipeline/updates-pipeline-creator.js.map +1 -0
- package/dist/src/scripting-tools/constants.d.ts +59 -0
- package/dist/src/scripting-tools/constants.js.map +1 -0
- package/dist/src/scripting-tools/index.d.ts +3 -0
- package/dist/src/scripting-tools/index.js.map +1 -0
- package/dist/src/scripting-tools/model-error.d.ts +10 -0
- package/{src → dist/src}/scripting-tools/model-error.js +2 -1
- package/dist/src/scripting-tools/model-error.js.map +1 -0
- package/dist/src/scripting-tools/scripting-tools.d.ts +277 -0
- package/{src → dist/src}/scripting-tools/scripting-tools.js +2 -4
- package/dist/src/scripting-tools/scripting-tools.js.map +1 -0
- package/dist/src/solver-tools/ab4-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ab4-method.js +3 -3
- package/dist/src/solver-tools/ab4-method.js.map +1 -0
- package/dist/src/solver-tools/ab5-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ab5-method.js +3 -3
- package/dist/src/solver-tools/ab5-method.js.map +1 -0
- package/dist/src/solver-tools/callbacks/callback-base.d.ts +8 -0
- package/dist/src/solver-tools/callbacks/callback-base.js.map +1 -0
- package/dist/src/solver-tools/callbacks/callback-tools.d.ts +6 -0
- package/dist/src/solver-tools/callbacks/callback-tools.js.map +1 -0
- package/dist/src/solver-tools/callbacks/iter-checker-callback.d.ts +12 -0
- package/{src → dist/src}/solver-tools/callbacks/iter-checker-callback.js +2 -0
- package/dist/src/solver-tools/callbacks/iter-checker-callback.js.map +1 -0
- package/dist/src/solver-tools/callbacks/time-checker-callback.d.ts +12 -0
- package/{src → dist/src}/solver-tools/callbacks/time-checker-callback.js +2 -2
- package/dist/src/solver-tools/callbacks/time-checker-callback.js.map +1 -0
- package/dist/src/solver-tools/cvode/common.d.ts +395 -0
- package/dist/src/solver-tools/cvode/common.js +483 -0
- package/dist/src/solver-tools/cvode/common.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode.d.ts +23 -0
- package/dist/src/solver-tools/cvode/cvode.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_adams.d.ts +22 -0
- package/dist/src/solver-tools/cvode/cvode_adams.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_bdf.d.ts +37 -0
- package/dist/src/solver-tools/cvode/cvode_bdf.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_class.d.ts +116 -0
- package/{src → dist/src}/solver-tools/cvode/cvode_class.js +9 -4
- package/dist/src/solver-tools/cvode/cvode_class.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_hin.d.ts +24 -0
- package/dist/src/solver-tools/cvode/cvode_hin.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_io.d.ts +98 -0
- package/{src → dist/src}/solver-tools/cvode/cvode_io.js +1 -2
- package/dist/src/solver-tools/cvode/cvode_io.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_ls.d.ts +23 -0
- package/dist/src/solver-tools/cvode/cvode_ls.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_nls.d.ts +25 -0
- package/dist/src/solver-tools/cvode/cvode_nls.js.map +1 -0
- package/dist/src/solver-tools/cvode/cvode_root.d.ts +64 -0
- package/dist/src/solver-tools/cvode/cvode_root.js.map +1 -0
- package/dist/src/solver-tools/cvode/dense_linalg.d.ts +50 -0
- package/dist/src/solver-tools/cvode/dense_linalg.js.map +1 -0
- package/dist/src/solver-tools/cvode/index.d.ts +24 -0
- package/dist/src/solver-tools/cvode/index.js.map +1 -0
- package/dist/src/solver-tools/cvode-method.d.ts +47 -0
- package/dist/src/solver-tools/cvode-method.js.map +1 -0
- package/dist/src/solver-tools/index.d.ts +16 -0
- package/dist/src/solver-tools/index.js.map +1 -0
- package/dist/src/solver-tools/lin-alg-tools.d.ts +6 -0
- package/dist/src/solver-tools/lin-alg-tools.js.map +1 -0
- package/dist/src/solver-tools/lsoda/blas.d.ts +59 -0
- package/dist/src/solver-tools/lsoda/blas.js.map +1 -0
- package/{src/solver-tools/lsoda/index.ts → dist/src/solver-tools/lsoda/cfode.d.ts} +7 -6
- package/dist/src/solver-tools/lsoda/cfode.js.map +1 -0
- package/dist/src/solver-tools/lsoda/common.d.ts +85 -0
- package/dist/src/solver-tools/lsoda/common.js +96 -0
- package/dist/src/solver-tools/lsoda/common.js.map +1 -0
- package/{src/solver-tools/lsoda/corfailure.ts → dist/src/solver-tools/lsoda/corfailure.d.ts} +2 -26
- package/dist/src/solver-tools/lsoda/corfailure.js.map +1 -0
- package/dist/src/solver-tools/lsoda/correction.d.ts +23 -0
- package/dist/src/solver-tools/lsoda/correction.js.map +1 -0
- package/dist/src/solver-tools/lsoda/dense.d.ts +47 -0
- package/{src → dist/src}/solver-tools/lsoda/dense.js +2 -0
- package/dist/src/solver-tools/lsoda/dense.js.map +1 -0
- package/dist/src/solver-tools/lsoda/index.d.ts +16 -0
- package/dist/src/solver-tools/lsoda/index.js.map +1 -0
- package/dist/src/solver-tools/lsoda/intdy.d.ts +19 -0
- package/dist/src/solver-tools/lsoda/intdy.js.map +1 -0
- package/dist/src/solver-tools/lsoda/lsoda.d.ts +66 -0
- package/{src → dist/src}/solver-tools/lsoda/lsoda.js +13 -5
- package/dist/src/solver-tools/lsoda/lsoda.js.map +1 -0
- package/dist/src/solver-tools/lsoda/methodswitch.d.ts +21 -0
- package/dist/src/solver-tools/lsoda/methodswitch.js.map +1 -0
- package/dist/src/solver-tools/lsoda/orderswitch.d.ts +21 -0
- package/dist/src/solver-tools/lsoda/orderswitch.js.map +1 -0
- package/dist/src/solver-tools/lsoda/prja.d.ts +18 -0
- package/dist/src/solver-tools/lsoda/prja.js.map +1 -0
- package/dist/src/solver-tools/lsoda/scaleh.d.ts +16 -0
- package/dist/src/solver-tools/lsoda/scaleh.js.map +1 -0
- package/{src/solver-tools/lsoda/solsy.ts → dist/src/solver-tools/lsoda/solsy.d.ts} +2 -15
- package/dist/src/solver-tools/lsoda/solsy.js.map +1 -0
- package/dist/src/solver-tools/lsoda/stoda.d.ts +19 -0
- package/dist/src/solver-tools/lsoda/stoda.js.map +1 -0
- package/dist/src/solver-tools/lsoda-method.d.ts +46 -0
- package/dist/src/solver-tools/lsoda-method.js.map +1 -0
- package/dist/src/solver-tools/mrt-method.d.ts +47 -0
- package/{src → dist/src}/solver-tools/mrt-method.js +2 -2
- package/dist/src/solver-tools/mrt-method.js.map +1 -0
- package/dist/src/solver-tools/rk3-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/rk3-method.js +2 -2
- package/dist/src/solver-tools/rk3-method.js.map +1 -0
- package/dist/src/solver-tools/rk4-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/rk4-method.js +2 -2
- package/dist/src/solver-tools/rk4-method.js.map +1 -0
- package/dist/src/solver-tools/rkdp-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/rkdp-method.js +2 -2
- package/dist/src/solver-tools/rkdp-method.js.map +1 -0
- package/dist/src/solver-tools/ros34prw-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ros34prw-method.js +2 -2
- package/dist/src/solver-tools/ros34prw-method.js.map +1 -0
- package/dist/src/solver-tools/ros3prw-method.d.ts +46 -0
- package/{src → dist/src}/solver-tools/ros3prw-method.js +2 -2
- package/dist/src/solver-tools/ros3prw-method.js.map +1 -0
- package/{src/solver-tools/solver-defs.ts → dist/src/solver-tools/solver-defs.d.ts} +45 -85
- package/dist/src/solver-tools/solver-defs.js.map +1 -0
- package/dist/src/worker-tools/index.d.ts +2 -0
- package/dist/src/worker-tools/index.js.map +1 -0
- package/{src/worker-tools/scripting.ts → dist/src/worker-tools/scripting.d.ts} +9 -91
- package/dist/src/worker-tools/scripting.js.map +1 -0
- package/dist/src/worker-tools/solving.d.ts +7 -0
- package/dist/src/worker-tools/solving.js.map +1 -0
- package/package.json +10 -11
- package/.claude/settings.local.json +0 -11
- package/.claude/skills/license-updater/SKILL.md +0 -149
- package/.claude/skills/license-updater/references/compatibility.md +0 -68
- package/.claude/skills/license-updater/references/templates.md +0 -151
- package/.claude/skills/license-updater/scripts/generate_license_files.py +0 -467
- package/.eslintrc.json +0 -45
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -22
- package/.github/scripts/bump-js-api-version.sh +0 -106
- package/.github/scripts/check-output.sh +0 -20
- package/.github/scripts/iac-cfn-deploy.sh +0 -90
- package/.github/scripts/slack_api_request.sh +0 -65
- package/.github/scripts/test_package.sh +0 -270
- package/.github/workflows/deploy-docs.yml +0 -15
- package/.github/workflows/libraries.yaml +0 -305
- package/.github/workflows/test.yaml +0 -19
- package/CLAUDE.md +0 -104
- package/CONTRIBUTING.md +0 -74
- package/THIRD_PARTY_LICENSES +0 -135
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -99
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1633
- package/docs/classes/BasicModelPipelineCreator.html +0 -10
- package/docs/classes/Callback.html +0 -7
- package/docs/classes/CyclicModelPipelineCreator.html +0 -10
- package/docs/classes/IterCheckerCallback.html +0 -8
- package/docs/classes/PipelineCreator.html +0 -6
- package/docs/classes/TimeCheckerCallback.html +0 -8
- package/docs/classes/UpdatesModelPipelineCreator.html +0 -10
- package/docs/functions/ab4.html +0 -8
- package/docs/functions/ab5.html +0 -8
- package/docs/functions/applyPipeline.html +0 -9
- package/docs/functions/getCallback.html +0 -3
- package/docs/functions/getIVP.html +0 -6
- package/docs/functions/getInputVector.html +0 -2
- package/docs/functions/getIvp2WebWorker.html +0 -6
- package/docs/functions/getJScode.html +0 -6
- package/docs/functions/getOutputNames.html +0 -4
- package/docs/functions/getPipelineCreator.html +0 -7
- package/docs/functions/lsoda.html +0 -8
- package/docs/functions/mrt.html +0 -11
- package/docs/functions/printE5.html +0 -76
- package/docs/functions/printHires.html +0 -76
- package/docs/functions/printOrego.html +0 -66
- package/docs/functions/printPollution.html +0 -163
- package/docs/functions/printRobertson.html +0 -60
- package/docs/functions/printVdpol.html +0 -66
- package/docs/functions/rk3.html +0 -8
- package/docs/functions/rk4.html +0 -8
- package/docs/functions/rkdp.html +0 -8
- package/docs/functions/ros34prw.html +0 -8
- package/docs/functions/ros3prw.html +0 -8
- package/docs/functions/solveIvp.html +0 -5
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -768
- package/docs/media/CONTRIBUTING.md +0 -74
- package/docs/media/E5.png +0 -0
- package/docs/media/HIRES.png +0 -0
- package/docs/media/OREGO.png +0 -0
- package/docs/media/POLL-full.png +0 -0
- package/docs/media/POLL.png +0 -0
- package/docs/media/ROBER.png +0 -0
- package/docs/media/VDP0L.png +0 -0
- package/docs/media/VDPOL.png +0 -0
- package/docs/media/acid-prod.gif +0 -0
- package/docs/media/basic-use.js.map +0 -1
- package/docs/media/basic-use.ts +0 -44
- package/docs/media/check-methods.js +0 -59
- package/docs/media/check-methods.js.map +0 -1
- package/docs/media/check-methods.ts +0 -81
- package/docs/media/corr-probs.js +0 -132
- package/docs/media/corr-probs.js.map +0 -1
- package/docs/media/corr-probs.ts +0 -155
- package/docs/media/cyclic-model.js.map +0 -1
- package/docs/media/cyclic-model.ts +0 -112
- package/docs/media/e5.js.map +0 -1
- package/docs/media/e5.ts +0 -36
- package/docs/media/hires.js.map +0 -1
- package/docs/media/hires.ts +0 -40
- package/docs/media/model-updates.js.map +0 -1
- package/docs/media/model-updates.ts +0 -122
- package/docs/media/orego.js.map +0 -1
- package/docs/media/orego.ts +0 -25
- package/docs/media/pipeline-use.js.map +0 -1
- package/docs/media/pipeline-use.ts +0 -98
- package/docs/media/pollution.js.map +0 -1
- package/docs/media/pollution.ts +0 -133
- package/docs/media/print-benchmark.js.map +0 -1
- package/docs/media/print-benchmark.ts +0 -594
- package/docs/media/robertson.js.map +0 -1
- package/docs/media/robertson.ts +0 -19
- package/docs/media/scripting.js.map +0 -1
- package/docs/media/scripting.ts +0 -35
- package/docs/media/vdpol.js.map +0 -1
- package/docs/media/vdpol.ts +0 -17
- package/docs/modules.html +0 -1
- package/docs/types/Arg.html +0 -12
- package/docs/types/DifEqs.html +0 -8
- package/docs/types/Func.html +0 -7
- package/docs/types/IVP.html +0 -40
- package/docs/types/IVP2WebWorker.html +0 -12
- package/docs/types/Input.html +0 -8
- package/docs/types/Loop.html +0 -7
- package/docs/types/ODEs.html +0 -31
- package/docs/types/Output.html +0 -6
- package/docs/types/Pipeline.html +0 -6
- package/docs/types/SolverOptions.html +0 -8
- package/docs/types/Update.html +0 -9
- package/docs/types/Wrapper.html +0 -8
- package/eslintrc.json +0 -45
- package/images/E5.png +0 -0
- package/images/HIRES.png +0 -0
- package/images/OREGO.png +0 -0
- package/images/POLL-full.png +0 -0
- package/images/POLL.png +0 -0
- package/images/ROBER.png +0 -0
- package/images/VDP0L.png +0 -0
- package/images/VDPOL.png +0 -0
- package/images/acid-prod.gif +0 -0
- package/index.js.map +0 -1
- package/index.ts +0 -17
- package/jest.config.js +0 -13
- package/src/examples/basic-use.js +0 -40
- package/src/examples/basic-use.js.map +0 -1
- package/src/examples/basic-use.ts +0 -44
- package/src/examples/check-methods.js.map +0 -1
- package/src/examples/check-methods.ts +0 -96
- package/src/examples/corr-probs.js.map +0 -1
- package/src/examples/corr-probs.ts +0 -155
- package/src/examples/cyclic-model.js +0 -102
- package/src/examples/cyclic-model.js.map +0 -1
- package/src/examples/cyclic-model.ts +0 -112
- package/src/examples/e5.js +0 -36
- package/src/examples/e5.js.map +0 -1
- package/src/examples/e5.ts +0 -36
- package/src/examples/hires.js +0 -39
- package/src/examples/hires.js.map +0 -1
- package/src/examples/hires.ts +0 -40
- package/src/examples/index.js.map +0 -1
- package/src/examples/index.ts +0 -34
- package/src/examples/model-updates.js +0 -112
- package/src/examples/model-updates.js.map +0 -1
- package/src/examples/model-updates.ts +0 -122
- package/src/examples/orego.js +0 -24
- package/src/examples/orego.js.map +0 -1
- package/src/examples/orego.ts +0 -25
- package/src/examples/pipeline-use.js +0 -87
- package/src/examples/pipeline-use.js.map +0 -1
- package/src/examples/pipeline-use.ts +0 -98
- package/src/examples/pollution.js +0 -132
- package/src/examples/pollution.js.map +0 -1
- package/src/examples/pollution.ts +0 -133
- package/src/examples/print-benchmark.js +0 -581
- package/src/examples/print-benchmark.js.map +0 -1
- package/src/examples/robertson.js +0 -19
- package/src/examples/robertson.js.map +0 -1
- package/src/examples/robertson.ts +0 -19
- package/src/examples/scripting.js +0 -30
- package/src/examples/scripting.js.map +0 -1
- package/src/examples/scripting.ts +0 -35
- package/src/examples/vdpol.js +0 -17
- package/src/examples/vdpol.js.map +0 -1
- package/src/examples/vdpol.ts +0 -17
- package/src/pipeline/basic-pipeline-creator.js.map +0 -1
- package/src/pipeline/constants.js.map +0 -1
- package/src/pipeline/constants.ts +0 -21
- package/src/pipeline/index.js.map +0 -1
- package/src/pipeline/index.ts +0 -7
- package/src/pipeline/input.js.map +0 -1
- package/src/pipeline/input.ts +0 -55
- package/src/pipeline/loops-pipeline-creator.js.map +0 -1
- package/src/pipeline/loops-pipeline-creator.ts +0 -252
- package/src/pipeline/output.js.map +0 -1
- package/src/pipeline/output.ts +0 -201
- package/src/pipeline/pipeline-creator.js.map +0 -1
- package/src/pipeline/pipeline-creator.ts +0 -20
- package/src/pipeline/pipeline.js.map +0 -1
- package/src/pipeline/updates-pipeline-creator.js.map +0 -1
- package/src/scripting-tools/constants.js.map +0 -1
- package/src/scripting-tools/constants.ts +0 -69
- package/src/scripting-tools/index.js.map +0 -1
- package/src/scripting-tools/index.ts +0 -8
- package/src/scripting-tools/model-error.js.map +0 -1
- package/src/scripting-tools/model-error.ts +0 -21
- package/src/scripting-tools/scripting-tools.js.map +0 -1
- package/src/scripting-tools/scripting-tools.ts +0 -1582
- package/src/solver-tools/ab4-method.js.map +0 -1
- package/src/solver-tools/ab4-method.ts +0 -395
- package/src/solver-tools/ab5-method.js.map +0 -1
- package/src/solver-tools/ab5-method.ts +0 -397
- package/src/solver-tools/callbacks/callback-base.js.map +0 -1
- package/src/solver-tools/callbacks/callback-base.ts +0 -12
- package/src/solver-tools/callbacks/callback-tools.js.map +0 -1
- package/src/solver-tools/callbacks/callback-tools.ts +0 -22
- package/src/solver-tools/callbacks/iter-checker-callback.js.map +0 -1
- package/src/solver-tools/callbacks/iter-checker-callback.ts +0 -25
- package/src/solver-tools/callbacks/time-checker-callback.js.map +0 -1
- package/src/solver-tools/callbacks/time-checker-callback.ts +0 -23
- package/src/solver-tools/cvode/common.js +0 -487
- package/src/solver-tools/cvode/common.js.map +0 -1
- package/src/solver-tools/cvode/common.ts +0 -549
- package/src/solver-tools/cvode/cvode.js.map +0 -1
- package/src/solver-tools/cvode/cvode.ts +0 -1226
- package/src/solver-tools/cvode/cvode_adams.js.map +0 -1
- package/src/solver-tools/cvode/cvode_adams.ts +0 -142
- package/src/solver-tools/cvode/cvode_bdf.js.map +0 -1
- package/src/solver-tools/cvode/cvode_bdf.ts +0 -164
- package/src/solver-tools/cvode/cvode_class.js.map +0 -1
- package/src/solver-tools/cvode/cvode_class.ts +0 -271
- package/src/solver-tools/cvode/cvode_hin.js.map +0 -1
- package/src/solver-tools/cvode/cvode_hin.ts +0 -150
- package/src/solver-tools/cvode/cvode_io.js.map +0 -1
- package/src/solver-tools/cvode/cvode_io.ts +0 -258
- package/src/solver-tools/cvode/cvode_ls.js.map +0 -1
- package/src/solver-tools/cvode/cvode_ls.ts +0 -249
- package/src/solver-tools/cvode/cvode_nls.js.map +0 -1
- package/src/solver-tools/cvode/cvode_nls.ts +0 -259
- package/src/solver-tools/cvode/cvode_root.js.map +0 -1
- package/src/solver-tools/cvode/cvode_root.ts +0 -503
- package/src/solver-tools/cvode/dense_linalg.js.map +0 -1
- package/src/solver-tools/cvode/dense_linalg.ts +0 -144
- package/src/solver-tools/cvode/index.js.map +0 -1
- package/src/solver-tools/cvode/index.ts +0 -64
- package/src/solver-tools/cvode-method.js.map +0 -1
- package/src/solver-tools/cvode-method.ts +0 -129
- package/src/solver-tools/index.js.map +0 -1
- package/src/solver-tools/index.ts +0 -16
- package/src/solver-tools/lin-alg-tools.js.map +0 -1
- package/src/solver-tools/lin-alg-tools.ts +0 -75
- package/src/solver-tools/lsoda/blas.js.map +0 -1
- package/src/solver-tools/lsoda/blas.ts +0 -279
- package/src/solver-tools/lsoda/cfode.js.map +0 -1
- package/src/solver-tools/lsoda/cfode.ts +0 -95
- package/src/solver-tools/lsoda/common.js +0 -94
- package/src/solver-tools/lsoda/common.js.map +0 -1
- package/src/solver-tools/lsoda/common.ts +0 -135
- package/src/solver-tools/lsoda/corfailure.js.map +0 -1
- package/src/solver-tools/lsoda/correction.js.map +0 -1
- package/src/solver-tools/lsoda/correction.ts +0 -131
- package/src/solver-tools/lsoda/dense.js.map +0 -1
- package/src/solver-tools/lsoda/dense.ts +0 -141
- package/src/solver-tools/lsoda/index.js.map +0 -1
- package/src/solver-tools/lsoda/intdy.js.map +0 -1
- package/src/solver-tools/lsoda/intdy.ts +0 -62
- package/src/solver-tools/lsoda/lsoda.js.map +0 -1
- package/src/solver-tools/lsoda/lsoda.ts +0 -644
- package/src/solver-tools/lsoda/methodswitch.js.map +0 -1
- package/src/solver-tools/lsoda/methodswitch.ts +0 -119
- package/src/solver-tools/lsoda/orderswitch.js.map +0 -1
- package/src/solver-tools/lsoda/orderswitch.ts +0 -107
- package/src/solver-tools/lsoda/prja.js.map +0 -1
- package/src/solver-tools/lsoda/prja.ts +0 -61
- package/src/solver-tools/lsoda/scaleh.js.map +0 -1
- package/src/solver-tools/lsoda/scaleh.ts +0 -45
- package/src/solver-tools/lsoda/solsy.js.map +0 -1
- package/src/solver-tools/lsoda/stoda.js.map +0 -1
- package/src/solver-tools/lsoda/stoda.ts +0 -298
- package/src/solver-tools/lsoda-method.js.map +0 -1
- package/src/solver-tools/lsoda-method.ts +0 -154
- package/src/solver-tools/mrt-method.js.map +0 -1
- package/src/solver-tools/mrt-method.ts +0 -398
- package/src/solver-tools/rk3-method.js.map +0 -1
- package/src/solver-tools/rk3-method.ts +0 -257
- package/src/solver-tools/rk4-method.js.map +0 -1
- package/src/solver-tools/rk4-method.ts +0 -286
- package/src/solver-tools/rkdp-method.js.map +0 -1
- package/src/solver-tools/rkdp-method.ts +0 -300
- package/src/solver-tools/ros34prw-method.js.map +0 -1
- package/src/solver-tools/ros34prw-method.ts +0 -373
- package/src/solver-tools/ros3prw-method.js.map +0 -1
- package/src/solver-tools/ros3prw-method.ts +0 -342
- package/src/solver-tools/solver-defs.js.map +0 -1
- package/src/tests/correctness.test.js +0 -15
- package/src/tests/correctness.test.js.map +0 -1
- package/src/tests/correctness.test.ts +0 -16
- package/src/tests/cvode-lib-correctness.test.js +0 -404
- package/src/tests/cvode-lib-correctness.test.js.map +0 -1
- package/src/tests/cvode-lib-correctness.test.ts +0 -505
- package/src/tests/cvode-lib-performance.test.js +0 -103
- package/src/tests/cvode-lib-performance.test.js.map +0 -1
- package/src/tests/cvode-lib-performance.test.ts +0 -128
- package/src/tests/lsoda-lib-correctness.test.js +0 -223
- package/src/tests/lsoda-lib-correctness.test.js.map +0 -1
- package/src/tests/lsoda-lib-correctness.test.ts +0 -283
- package/src/tests/lsoda-lib-performance.test.js +0 -95
- package/src/tests/lsoda-lib-performance.test.js.map +0 -1
- package/src/tests/lsoda-lib-performance.test.ts +0 -126
- package/src/tests/performance.test.js +0 -18
- package/src/tests/performance.test.js.map +0 -1
- package/src/tests/performance.test.ts +0 -19
- package/src/tests/pipeline.test.js +0 -10
- package/src/tests/pipeline.test.js.map +0 -1
- package/src/tests/pipeline.test.ts +0 -11
- package/src/tests/test-defs.js +0 -213
- package/src/tests/test-defs.js.map +0 -1
- package/src/tests/test-defs.ts +0 -232
- package/src/tests/test-utils.js +0 -28
- package/src/tests/test-utils.js.map +0 -1
- package/src/tests/test-utils.ts +0 -37
- package/src/worker-tools/index.js.map +0 -1
- package/src/worker-tools/index.ts +0 -2
- package/src/worker-tools/scripting.js.map +0 -1
- package/src/worker-tools/solving.js.map +0 -1
- package/src/worker-tools/solving.ts +0 -86
- package/tsconfig.json +0 -71
- package/typedoc.json +0 -8
- /package/{docs/media → dist/src/examples}/basic-use.js +0 -0
- /package/{src → dist/src}/examples/check-methods.js +0 -0
- /package/{docs/media → dist/src/examples}/cyclic-model.js +0 -0
- /package/{docs/media → dist/src/examples}/e5.js +0 -0
- /package/{docs/media → dist/src/examples}/hires.js +0 -0
- /package/{src → dist/src}/examples/index.js +0 -0
- /package/{docs/media → dist/src/examples}/model-updates.js +0 -0
- /package/{docs/media → dist/src/examples}/orego.js +0 -0
- /package/{docs/media → dist/src/examples}/pipeline-use.js +0 -0
- /package/{docs/media → dist/src/examples}/pollution.js +0 -0
- /package/{docs/media → dist/src/examples}/print-benchmark.js +0 -0
- /package/{docs/media → dist/src/examples}/scripting.js +0 -0
- /package/{docs/media → dist/src/examples}/vdpol.js +0 -0
- /package/{src → dist/src}/pipeline/basic-pipeline-creator.js +0 -0
- /package/{src → dist/src}/pipeline/constants.js +0 -0
- /package/{src → dist/src}/pipeline/index.js +0 -0
- /package/{src → dist/src}/pipeline/input.js +0 -0
- /package/{src → dist/src}/pipeline/loops-pipeline-creator.js +0 -0
- /package/{src → dist/src}/pipeline/pipeline.js +0 -0
- /package/{src → dist/src}/pipeline/updates-pipeline-creator.js +0 -0
- /package/{src → dist/src}/scripting-tools/constants.js +0 -0
- /package/{src → dist/src}/scripting-tools/index.js +0 -0
- /package/{src → dist/src}/solver-tools/callbacks/callback-base.js +0 -0
- /package/{src → dist/src}/solver-tools/callbacks/callback-tools.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/cvode.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/cvode_adams.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/cvode_bdf.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/cvode_hin.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/cvode_ls.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/cvode_nls.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/cvode_root.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/dense_linalg.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode/index.js +0 -0
- /package/{src → dist/src}/solver-tools/cvode-method.js +0 -0
- /package/{src → dist/src}/solver-tools/index.js +0 -0
- /package/{src → dist/src}/solver-tools/lin-alg-tools.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/blas.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/cfode.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/corfailure.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/correction.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/index.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/intdy.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/methodswitch.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/orderswitch.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/prja.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/scaleh.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/solsy.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda/stoda.js +0 -0
- /package/{src → dist/src}/solver-tools/lsoda-method.js +0 -0
- /package/{src → dist/src}/solver-tools/solver-defs.js +0 -0
- /package/{src → dist/src}/worker-tools/index.js +0 -0
- /package/{src → dist/src}/worker-tools/scripting.js +0 -0
- /package/{src → dist/src}/worker-tools/solving.js +0 -0
package/{src/pipeline/updates-pipeline-creator.ts → dist/src/pipeline/updates-pipeline-creator.d.ts}
RENAMED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {MATH_CONSTS, MATH_FUNCS, POW_IDX} from '../scripting-tools/scripting-tools';
|
|
5
|
-
import {getOutputCode} from './output';
|
|
6
|
-
import {Pipeline, Wrapper} from './pipeline';
|
|
7
|
-
import {PipelineCreator} from './pipeline-creator';
|
|
8
|
-
|
|
9
|
-
import {argName2IdxMap, ARG, ARG_COL_IDX, CORRECTION_FACTOR, DEFAULT_CORRECTION} from './constants';
|
|
10
|
-
|
|
1
|
+
import { IVP } from '../scripting-tools';
|
|
2
|
+
import { Pipeline } from './pipeline';
|
|
3
|
+
import { PipelineCreator } from './pipeline-creator';
|
|
11
4
|
/** Pipeline creator for model with updates
|
|
12
5
|
* @example
|
|
13
6
|
* // This example shows how to apply pipelines and models with updates.
|
|
@@ -131,124 +124,15 @@ import {argName2IdxMap, ARG, ARG_COL_IDX, CORRECTION_FACTOR, DEFAULT_CORRECTION}
|
|
|
131
124
|
* console.log('Simulation failed: ', err instanceof Error ? err.message : 'Unknown problem!');
|
|
132
125
|
* }
|
|
133
126
|
*/
|
|
134
|
-
export class UpdatesModelPipelineCreator extends PipelineCreator {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
* @param inputs - input vector of the model
|
|
147
|
-
*/
|
|
148
|
-
public getPipeline(inputs: Float64Array): Pipeline {
|
|
149
|
-
if (this.ivp.updates === null)
|
|
150
|
-
throw new Error('Incorrect use of UpdatesModelPipelineCreator: model has no updates');
|
|
151
|
-
|
|
152
|
-
const wrappers: Wrapper[] = [{
|
|
153
|
-
preproc: null,
|
|
154
|
-
out: null,
|
|
155
|
-
postproc: null,
|
|
156
|
-
}];
|
|
157
|
-
|
|
158
|
-
this.ivp.updates.forEach((update) => {
|
|
159
|
-
const lines: string[] = [];
|
|
160
|
-
|
|
161
|
-
// Used math funcs
|
|
162
|
-
this.ivp.usedMathFuncs.forEach((idx) => {
|
|
163
|
-
if (idx !== POW_IDX)
|
|
164
|
-
lines.push(`const ${MATH_FUNCS[idx]} = (x) => Math.${MATH_FUNCS[idx]}(x);`);
|
|
165
|
-
else
|
|
166
|
-
lines.push(`const pow = (x, y) => Math.pow(x, y);`);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// Used math consts
|
|
170
|
-
this.ivp.usedMathConsts.forEach((idx) => lines.push(`const ${MATH_CONSTS[idx]} = Math.${MATH_CONSTS[idx]};`));
|
|
171
|
-
|
|
172
|
-
// Model constants
|
|
173
|
-
if (this.ivp.consts !== null)
|
|
174
|
-
this.ivp.consts.forEach((input, name) => lines.push(`const ${name} = ${input.value};`));
|
|
175
|
-
|
|
176
|
-
lines.push('const inputs = new Float64Array(arguments[1]);');
|
|
177
|
-
lines.push('const solution = arguments[0];');
|
|
178
|
-
|
|
179
|
-
// Arguments
|
|
180
|
-
argName2IdxMap.forEach((idx, name) => lines.push(`let ${name} = inputs[${idx}];`));
|
|
181
|
-
|
|
182
|
-
// Functions
|
|
183
|
-
lines.push('const lastIdx = solution[0].length - 1;');
|
|
184
|
-
|
|
185
|
-
this.ivp.deqs.solutionNames.forEach((name, idx) => {
|
|
186
|
-
lines.push(`let ${name} = solution[${idx + 1}][lastIdx];`);
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// Parameters
|
|
190
|
-
if (this.ivp.params !== null) {
|
|
191
|
-
const shift = argName2IdxMap.size + this.ivp.deqs.solutionNames.length;
|
|
192
|
-
let idx = 0;
|
|
193
|
-
|
|
194
|
-
this.ivp.params.forEach((_, name) => {
|
|
195
|
-
lines.push(`let ${name} = inputs[${idx + shift}];`);
|
|
196
|
-
++idx;
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Updates
|
|
201
|
-
update.updates.forEach((expr) => lines.push(`${expr};`));
|
|
202
|
-
|
|
203
|
-
// Argument update
|
|
204
|
-
lines.push(`const duration = ${update.durationFormula};`);
|
|
205
|
-
lines.push(`${ARG.START} = ${ARG.FINISH};`);
|
|
206
|
-
lines.push(`${ARG.FINISH} += duration;`);
|
|
207
|
-
|
|
208
|
-
// Input vector update
|
|
209
|
-
argName2IdxMap.forEach((idx, name) => lines.push(`inputs[${idx}] = ${name};`));
|
|
210
|
-
|
|
211
|
-
this.ivp.deqs.solutionNames.forEach((name, idx) => {
|
|
212
|
-
lines.push(`inputs[${idx + argName2IdxMap.size}] = ${name};`);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
if (this.ivp.params !== null) {
|
|
216
|
-
const shift = argName2IdxMap.size + this.ivp.deqs.solutionNames.length;
|
|
217
|
-
let idx = 0;
|
|
218
|
-
|
|
219
|
-
this.ivp.params.forEach((_, name) => {
|
|
220
|
-
lines.push(`inputs[${idx + shift}] = ${name};`);
|
|
221
|
-
++idx;
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
lines.push('return inputs;');
|
|
226
|
-
|
|
227
|
-
wrappers.push({
|
|
228
|
-
preproc: lines.join('\n'),
|
|
229
|
-
out: null,
|
|
230
|
-
postproc: null,
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
wrappers[wrappers.length - 1].postproc = this.getArgumentCorrectionCode();
|
|
235
|
-
|
|
236
|
-
return {
|
|
237
|
-
wrappers: wrappers,
|
|
238
|
-
out: getOutputCode(this.ivp),
|
|
239
|
-
};
|
|
240
|
-
} // getPipeline
|
|
241
|
-
|
|
242
|
-
/** Return code for correction of an argument */
|
|
243
|
-
private getArgumentCorrectionCode(): string {
|
|
244
|
-
return `const arg = arguments[0][${ARG_COL_IDX}];
|
|
245
|
-
const length = arg.length;
|
|
246
|
-
const step = arg[1] - arg[0];
|
|
247
|
-
const correction = Math.min(step * ${CORRECTION_FACTOR}, ${DEFAULT_CORRECTION});
|
|
248
|
-
for (let i = 0; i < length - 1; ++i) {
|
|
249
|
-
if (arg[i + 1] - arg[i] < step)
|
|
250
|
-
arg[i] -= correction;
|
|
251
|
-
}
|
|
252
|
-
return arguments[0];`;
|
|
253
|
-
} // getArgumentCorrectionCode
|
|
254
|
-
} // UpdatesModelPipelineCreator
|
|
127
|
+
export declare class UpdatesModelPipelineCreator extends PipelineCreator {
|
|
128
|
+
/**
|
|
129
|
+
* @param ivp - initial value problem to be solved
|
|
130
|
+
*/
|
|
131
|
+
constructor(ivp: IVP);
|
|
132
|
+
/** Return computations pipeline corresponding to the given input vector
|
|
133
|
+
* @param inputs - input vector of the model
|
|
134
|
+
*/
|
|
135
|
+
getPipeline(inputs: Float64Array): Pipeline;
|
|
136
|
+
/** Return code for correction of an argument */
|
|
137
|
+
private getArgumentCorrectionCode;
|
|
138
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updates-pipeline-creator.js","sourceRoot":"","sources":["../../../src/pipeline/updates-pipeline-creator.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export declare const CONTROL_TAG = "#";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare const CONTROL_TAG_LEN: number;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const DF_NAME = "df";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare const MAX_LINE_CHART = 4;
|
|
9
|
+
/** Control expressions for the problem specifying
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare enum CONTROL_EXPR {
|
|
13
|
+
NAME = "#name",
|
|
14
|
+
TAGS = "#tags",
|
|
15
|
+
DESCR = "#description",
|
|
16
|
+
DIF_EQ = "#equations",
|
|
17
|
+
EXPR = "#expressions",
|
|
18
|
+
ARG = "#argument",
|
|
19
|
+
INITS = "#inits",
|
|
20
|
+
CONSTS = "#constants",
|
|
21
|
+
PARAMS = "#parameters",
|
|
22
|
+
TOL = "#tolerance",
|
|
23
|
+
LOOP = "#loop",
|
|
24
|
+
UPDATE = "#update",
|
|
25
|
+
RUN_ON_OPEN = "#meta.runOnOpen",
|
|
26
|
+
RUN_ON_INPUT = "#meta.runOnInput",
|
|
27
|
+
OUTPUT = "#output",
|
|
28
|
+
COMMENT = "#comment",
|
|
29
|
+
SOLVER = "#meta.solver",
|
|
30
|
+
INPUTS = "#meta.inputs"
|
|
31
|
+
}
|
|
32
|
+
/** Loop consts
|
|
33
|
+
* @internal
|
|
34
|
+
* */
|
|
35
|
+
export declare enum LOOP {
|
|
36
|
+
MIN_LINES_COUNT = 1,
|
|
37
|
+
COUNT_IDX = 0,
|
|
38
|
+
COUNT_NAME = "_count",
|
|
39
|
+
MIN_COUNT = 1
|
|
40
|
+
}
|
|
41
|
+
/** UPDATE consts
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export declare enum UPDATE {
|
|
45
|
+
MIN_LINES_COUNT = 1,
|
|
46
|
+
DURATION_IDX = 0,
|
|
47
|
+
DURATION = "_duration"
|
|
48
|
+
}
|
|
49
|
+
/** Ranges of the solver options
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare const SOLVER_OPTIONS_RANGES: Map<string, {
|
|
53
|
+
min: number;
|
|
54
|
+
max: number;
|
|
55
|
+
}>;
|
|
56
|
+
/** @internal */
|
|
57
|
+
export declare const TINY = 0.0001;
|
|
58
|
+
/** @internal */
|
|
59
|
+
export declare const STEP_RATIO = 0.5;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/scripting-tools/constants.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,gBAAgB;AAChB,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,CAAC;AAElD,gBAAgB;AAChB,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC;AAE5B,gBAAgB;AAChB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;EAEE;AACF,MAAM,CAAN,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACpB,8BAAc,CAAA;IACd,8BAAc,CAAA;IACd,sCAAsB,CAAA;IACtB,qCAAqB,CAAA;IACrB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;IACjB,gCAAgB,CAAA;IAChB,qCAAqB,CAAA;IACrB,sCAAsB,CAAA;IACtB,kCAAkB,CAAA;IAClB,8BAAc,CAAA;IACd,kCAAkB,CAAA;IAClB,+CAA+B,CAAA;IAC/B,iDAAiC,CAAA;IACjC,kCAAkB,CAAA;IAClB,oCAAoB,CAAA;IACpB,uCAAuB,CAAA;IACvB,uCAAuB,CAAA;AAC3B,CAAC,EAnBW,YAAY,KAAZ,YAAY,QAmBvB;AAAA,CAAC;AAEF;;KAEK;AACL,MAAM,CAAN,IAAY,IAKX;AALD,WAAY,IAAI;IACd,qDAAmB,CAAA;IACnB,yCAAa,CAAA;IACb,6BAAqB,CAAA;IACrB,yCAAa,CAAA;AACf,CAAC,EALW,IAAI,KAAJ,IAAI,QAKf;AAAA,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,MAIX;AAJD,WAAY,MAAM;IAChB,yDAAmB,CAAA;IACnB,mDAAgB,CAAA;IAChB,gCAAsB,CAAA;AACxB,CAAC,EAJW,MAAM,KAAN,MAAM,QAIjB;AAAA,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IAC3C,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAC,CAAC;IACjC,CAAC,OAAO,EAAE,EAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;CAC9B,CAAC,CAAC;AAEH,gBAAgB;AAChB,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC;AAE3B,gBAAgB;AAChB,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { DF_NAME, CONTROL_EXPR, MAX_LINE_CHART } from './constants';
|
|
2
|
+
export { DifEqs, getIVP, getScriptLines, getScriptParams, getJScode, IVP, Input, SCRIPTING, BRACE_OPEN, BRACE_CLOSE, BRACKET_OPEN, BRACKET_CLOSE, ANNOT_SEPAR, CONTROL_SEP, STAGE_COL_NAME, ARG_INPUT_KEYS, DEFAULT_SOLVER_SETTINGS, getFunc4worker, Loop, Update, Output, Arg } from './scripting-tools';
|
|
3
|
+
export { ModelError } from './model-error';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/scripting-tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAC,MAAM,aAAa,CAAC;AAElE,OAAO,EAAS,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAc,SAAS,EACvF,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAC9E,cAAc,EAAE,cAAc,EAAE,uBAAuB,EAAE,cAAc,EAC3D,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Diff Studio model error
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export declare class ModelError extends Error {
|
|
5
|
+
private helpUrl;
|
|
6
|
+
private toHighlight;
|
|
7
|
+
constructor(message: string, helpUrl: string, toHighlight?: string);
|
|
8
|
+
getHelpUrl(): string;
|
|
9
|
+
getToHighlight(): string | undefined;
|
|
10
|
+
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* @internal
|
|
3
3
|
*/
|
|
4
4
|
export class ModelError extends Error {
|
|
5
|
+
helpUrl;
|
|
6
|
+
toHighlight = undefined;
|
|
5
7
|
constructor(message, helpUrl, toHighlight) {
|
|
6
8
|
super(message);
|
|
7
|
-
this.toHighlight = undefined;
|
|
8
9
|
this.helpUrl = helpUrl;
|
|
9
10
|
this.toHighlight = toHighlight;
|
|
10
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-error.js","sourceRoot":"","sources":["../../../src/scripting-tools/model-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC3B,OAAO,CAAS;IAChB,WAAW,GAAuB,SAAS,CAAC;IAEpD,YAAY,OAAe,EAAE,OAAe,EAAE,WAAoB;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AAAA,CAAC,CAAC,aAAa"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export declare const CONTROL_SEP = ":";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare const BRACE_OPEN = "{";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const BRACE_CLOSE = "}";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare const BRACKET_OPEN = "[";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const BRACKET_CLOSE = "]";
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const ANNOT_SEPAR = ";";
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const DEFAULT_SOLVER_SETTINGS: string;
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const STAGE_COL_NAME = "_Stage";
|
|
17
|
+
/** Elementary math tools
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare const MATH_FUNCS: string[];
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const POW_IDX: number;
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare const MATH_CONSTS: string[];
|
|
25
|
+
/**
|
|
26
|
+
* Represents a numeric user input.
|
|
27
|
+
*
|
|
28
|
+
* @property value - The numeric value provided by the user.
|
|
29
|
+
* @property annot - An optional annotation associated with the input.
|
|
30
|
+
* See more details in the UI options documentation:
|
|
31
|
+
* https://datagrok.ai/help/compute/diff-studio#user-interface-options
|
|
32
|
+
*/
|
|
33
|
+
export type Input = {
|
|
34
|
+
value: number;
|
|
35
|
+
annot: string | null;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Specifies an independent variable for a simulation model.
|
|
39
|
+
*
|
|
40
|
+
* @property name - The name of the variable.
|
|
41
|
+
* @property initial - The initial value of the variable.
|
|
42
|
+
* @property final - The final value of the variable.
|
|
43
|
+
* @property step - The step size for the variable's grid.
|
|
44
|
+
* @property updateName - The name of the stage in a multi-stage model, if applicable.
|
|
45
|
+
*/
|
|
46
|
+
export type Arg = {
|
|
47
|
+
name: string;
|
|
48
|
+
initial: Input;
|
|
49
|
+
final: Input;
|
|
50
|
+
step: Input;
|
|
51
|
+
updateName: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
/** Input keys of Arg
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare const ARG_INPUT_KEYS: string[];
|
|
57
|
+
/** Scripting specific constants
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
export declare enum SCRIPTING {
|
|
61
|
+
ARG_NAME = "name",
|
|
62
|
+
COUNT = "count",
|
|
63
|
+
DURATION = "duration"
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Represents a system of differential equations.
|
|
67
|
+
*
|
|
68
|
+
* @property equations - A mapping where each key is the name of a function
|
|
69
|
+
* and each value is the right-hand side of its differential equation.
|
|
70
|
+
*
|
|
71
|
+
* @property solutionNames - Names of the functions that form the solution
|
|
72
|
+
* of the system.
|
|
73
|
+
*/
|
|
74
|
+
export type DifEqs = {
|
|
75
|
+
equations: Map<string, string>;
|
|
76
|
+
solutionNames: string[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Specifies a looped stage in a simulation model.
|
|
80
|
+
*
|
|
81
|
+
* @property count - The number of repetitions for the loop.
|
|
82
|
+
* @property updates - An array of formulas or specifications that modify
|
|
83
|
+
* the model's parameters during each iteration.
|
|
84
|
+
*/
|
|
85
|
+
export type Loop = {
|
|
86
|
+
count: Input;
|
|
87
|
+
updates: string[];
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Represents an update of model parameters for a multi-stage simulation.
|
|
91
|
+
*
|
|
92
|
+
* @property name - The name of the simulation step.
|
|
93
|
+
* @property durationFormula - A formula defining the duration of the step.
|
|
94
|
+
* @property updates - An array of formulas that modify the model's parameters
|
|
95
|
+
* during this update step.
|
|
96
|
+
*/
|
|
97
|
+
export type Update = {
|
|
98
|
+
name: string;
|
|
99
|
+
durationFormula: string;
|
|
100
|
+
updates: string[];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Specifies an output of a simulation.
|
|
104
|
+
*
|
|
105
|
+
* @property caption - The title or label of the output.
|
|
106
|
+
* @property formula - An optional formula used to compute the output.
|
|
107
|
+
*/
|
|
108
|
+
export type Output = {
|
|
109
|
+
caption: string;
|
|
110
|
+
formula: string | null;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Represents a fully parsed model defined declaratively.
|
|
114
|
+
*
|
|
115
|
+
* @property arg - Specification of the independent variable.
|
|
116
|
+
* @property name - The name of the model.
|
|
117
|
+
* @property tags - Tags associated with the model. See:
|
|
118
|
+
* https://datagrok.ai/help/datagrok/concepts/functions/func-params-annotation
|
|
119
|
+
* @property descr - Optional description of the model.
|
|
120
|
+
* @property deqs - The specification of the ODE system.
|
|
121
|
+
* @property exprs - Optional specification of auxiliary calculations.
|
|
122
|
+
* @property inits - Specification of initial conditions.
|
|
123
|
+
* @property consts - Specification of model constants.
|
|
124
|
+
* @property params - Specification of model parameters.
|
|
125
|
+
* @property tolerance - Tolerance for the numerical solver.
|
|
126
|
+
* @property usedMathFuncs - Indices of used mathematical functions.
|
|
127
|
+
* @property usedMathConsts - Indices of used mathematical constants.
|
|
128
|
+
* @property loop - Optional specification of loops in the model.
|
|
129
|
+
* @property updates - Optional specification of multi-stage simulation updates.
|
|
130
|
+
* @property metas - Specification of meta-options for the model.
|
|
131
|
+
* @property outputs - Optional specification of model outputs.
|
|
132
|
+
* @property solverSettings - String representation of the numerical solver settings.
|
|
133
|
+
* @property inputsLookup - Optional specification of lookup tables. See:
|
|
134
|
+
* https://datagrok.ai/help/datagrok/concepts/functions/func-params-annotation#lookup-tables
|
|
135
|
+
*/
|
|
136
|
+
export type IVP = {
|
|
137
|
+
name: string;
|
|
138
|
+
tags: string | null;
|
|
139
|
+
descr: string | null;
|
|
140
|
+
deqs: DifEqs;
|
|
141
|
+
exprs: Map<string, string> | null;
|
|
142
|
+
arg: Arg;
|
|
143
|
+
inits: Map<string, Input>;
|
|
144
|
+
consts: Map<string, Input> | null;
|
|
145
|
+
params: Map<string, Input> | null;
|
|
146
|
+
tolerance: string;
|
|
147
|
+
usedMathFuncs: number[];
|
|
148
|
+
usedMathConsts: number[];
|
|
149
|
+
loop: Loop | null;
|
|
150
|
+
updates: Update[] | null;
|
|
151
|
+
metas: string[];
|
|
152
|
+
outputs: Map<string, Output> | null;
|
|
153
|
+
solverSettings: string;
|
|
154
|
+
inputsLookup: string | null;
|
|
155
|
+
};
|
|
156
|
+
/** Return initial value problem specification given in the text
|
|
157
|
+
* @param text - declarative specification of initial value problem
|
|
158
|
+
* @example
|
|
159
|
+
* // Here, we consider modeling queues: https://en.wikipedia.org/wiki/M/M/c_queue
|
|
160
|
+
* import * as DGL from 'diff-grok';
|
|
161
|
+
*
|
|
162
|
+
* // 1. Model specification: the M|M|2|2 model
|
|
163
|
+
* const model = `#name: M|M|2|2
|
|
164
|
+
* #description: Modelling the system with two servers & two waiting places (EXPLAINED)
|
|
165
|
+
*
|
|
166
|
+
* #equations:
|
|
167
|
+
* dp0/dt = -la * p0 + mu * p1
|
|
168
|
+
* dp1/dt = la * p0 - (la + mu) * p1 + 2 * mu * p2
|
|
169
|
+
* dp2/dt = la * p1 - (la + 2 * mu) * p2 + 2 * mu * p3
|
|
170
|
+
* dp3/dt = la * p2 - (la + 2 * mu) * p3 + 2 * mu * p4
|
|
171
|
+
*
|
|
172
|
+
* #expressions:
|
|
173
|
+
* la = 1 / arrival
|
|
174
|
+
* mu = 1 / service
|
|
175
|
+
* p4 = 1 - p0 - p1 - p2 - p3
|
|
176
|
+
* busy = 1 - p0 - p1
|
|
177
|
+
* queue = p3 + 2 * p4
|
|
178
|
+
*
|
|
179
|
+
* #argument: t
|
|
180
|
+
* _t0 = 0 {min: 0; max: 10; caption: start; category: Time; units: min} [Initial time of simulation]
|
|
181
|
+
* _t1 = 60 {min: 20; max: 100; caption: finish; category: Time; units: min} [Final time of simulation]
|
|
182
|
+
* _h = 1 {min: 0.01; max: 0.1; caption: step; category: Time; units: min} [Time step of simulation]
|
|
183
|
+
*
|
|
184
|
+
* #inits:
|
|
185
|
+
* p0 = 1 {min: 0; max: 1; category: Initial state; caption: empty} [Probability that initially there are NO customers]
|
|
186
|
+
* p1 = 0 {min: 0; max: 1; category: Initial state; caption: single} [Probability that initially there is ONE customer]
|
|
187
|
+
* p2 = 0 {min: 0; max: 1; category: Initial state; caption: two} [Probability that initially there are TWO customers]
|
|
188
|
+
* p3 = 0 {min: 0; max: 1; category: Initial state; caption: three} [Probability that initially there are THREE customers]
|
|
189
|
+
*
|
|
190
|
+
* #output:
|
|
191
|
+
* t {caption: Time, min}
|
|
192
|
+
* p0 {caption: P(Empty)}
|
|
193
|
+
* busy {caption: P(Full load)}
|
|
194
|
+
* queue {caption: E(Queue)}
|
|
195
|
+
*
|
|
196
|
+
* #parameters:
|
|
197
|
+
* arrival = 10 {min: 1; max: 100; category: Means; caption: arrival; units: min} [Mean arrival time]
|
|
198
|
+
* service = 100 {min: 1; max: 100; category: Means; caption: service; units: min} [Mean service time]`;
|
|
199
|
+
*
|
|
200
|
+
* // 2. Generate IVP-objects: for the main thread & for computations in webworkers
|
|
201
|
+
* const ivp = DGL.getIVP(model);
|
|
202
|
+
* const ivpWW = DGL.getIvp2WebWorker(ivp);
|
|
203
|
+
*
|
|
204
|
+
* // 3. Perform computations
|
|
205
|
+
* try {
|
|
206
|
+
* // 3.1) Extract names of outputs
|
|
207
|
+
* const outputNames = DGL.getOutputNames(ivp);
|
|
208
|
+
* const outSize = outputNames.length;
|
|
209
|
+
*
|
|
210
|
+
* // 3.2) Set model inputs
|
|
211
|
+
* const inputs = {
|
|
212
|
+
* _t0: 0, // Initial time of simulation
|
|
213
|
+
* _t1: 60, // Final time of simulation
|
|
214
|
+
* _h: 1, // Time step of simulation
|
|
215
|
+
* p0: 1, // Probability that initially there are NO customers
|
|
216
|
+
* p1: 0, // Probability that initially there is ONE customer
|
|
217
|
+
* p2: 0, // Probability that initially there are TWO customers
|
|
218
|
+
* p3: 0, // Probability that initially there are THREE customers
|
|
219
|
+
* arrival: 10, // Mean arrival time
|
|
220
|
+
* service: 100, // Mean service time
|
|
221
|
+
* };
|
|
222
|
+
* const inputVector = DGL.getInputVector(inputs, ivp);
|
|
223
|
+
*
|
|
224
|
+
* // 3.3) Create a pipeline
|
|
225
|
+
* const creator = DGL.getPipelineCreator(ivp);
|
|
226
|
+
* const pipeline = creator.getPipeline(inputVector);
|
|
227
|
+
*
|
|
228
|
+
* // 3.4) Apply pipeline to perform computations
|
|
229
|
+
* const solution = DGL.applyPipeline(pipeline, ivpWW, inputVector);
|
|
230
|
+
* // 3.5) Print results
|
|
231
|
+
*
|
|
232
|
+
* // 3.5.1) Table header
|
|
233
|
+
* let line = '';
|
|
234
|
+
* outputNames.forEach((name) => line += name + ' ');
|
|
235
|
+
* console.log(line);
|
|
236
|
+
*
|
|
237
|
+
* // 3.5.2) Table with solution
|
|
238
|
+
* const length = solution[0].length;
|
|
239
|
+
* for (let i = 0; i < length; ++i) {
|
|
240
|
+
* line = '';
|
|
241
|
+
*
|
|
242
|
+
* for (let j = 0; j < outSize; ++j)
|
|
243
|
+
* line += solution[j][i].toFixed(8) + ' ';
|
|
244
|
+
* console.log(line);
|
|
245
|
+
* }
|
|
246
|
+
* } catch (err) {
|
|
247
|
+
* console.log('Simulation failed: ', err instanceof Error ? err.message : 'Unknown problem!');
|
|
248
|
+
* }
|
|
249
|
+
*/
|
|
250
|
+
export declare function getIVP(text: string): IVP;
|
|
251
|
+
/** Return JS-script lines
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
export declare function getScriptLines(ivp: IVP, toAddViewers?: boolean, toAddEditor?: boolean): string[];
|
|
255
|
+
/** Return parameters of JS-script
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
258
|
+
export declare function getScriptParams(ivp: IVP): Record<string, number>;
|
|
259
|
+
/** Return JavaScript code that solves the given initial value problem
|
|
260
|
+
* @param ivp - initial value problem to be solved
|
|
261
|
+
* @example
|
|
262
|
+
* import {getIVP, getJScode} from 'diff-grok';
|
|
263
|
+
*
|
|
264
|
+
* const model = `
|
|
265
|
+
* #name: Example
|
|
266
|
+
* #equations:
|
|
267
|
+
* dx/dt = x + y - cos(t)
|
|
268
|
+
* dy/dt = x - y + sin(t)
|
|
269
|
+
* ...
|
|
270
|
+
* `;
|
|
271
|
+
*
|
|
272
|
+
* const ivp = getIVP(model);
|
|
273
|
+
* const lines = getJScode(ivp);
|
|
274
|
+
*/
|
|
275
|
+
export declare function getJScode(ivp: IVP): string[];
|
|
276
|
+
/** @internal */
|
|
277
|
+
export declare function getFunc4worker(ivp: IVP): void;
|
|
@@ -729,10 +729,9 @@ function getCustomOutputLinesWithExpressions(ivp) {
|
|
|
729
729
|
} // getCustomOutputLinesWithExpressions
|
|
730
730
|
/** Return custom output lines */
|
|
731
731
|
function getCustomOutputLines(ivp) {
|
|
732
|
-
var _a;
|
|
733
732
|
if (ivp.exprs !== null) {
|
|
734
733
|
for (const key of ivp.exprs.keys()) {
|
|
735
|
-
if (
|
|
734
|
+
if (ivp.outputs?.has(key))
|
|
736
735
|
return getCustomOutputLinesWithExpressions(ivp);
|
|
737
736
|
}
|
|
738
737
|
}
|
|
@@ -904,7 +903,6 @@ function getScriptMainBodyLoopCase(ivp) {
|
|
|
904
903
|
} // getScriptMainBodyLoopCase
|
|
905
904
|
/** Return main body of JS-script: update case */
|
|
906
905
|
function getScriptMainBodyUpdateCase(ivp) {
|
|
907
|
-
var _a;
|
|
908
906
|
const funcParamsNames = getFuncParamsNames(ivp);
|
|
909
907
|
const res = getScriptFunc(ivp, funcParamsNames);
|
|
910
908
|
res.push('');
|
|
@@ -914,7 +912,7 @@ function getScriptMainBodyUpdateCase(ivp) {
|
|
|
914
912
|
res.push('');
|
|
915
913
|
res.push(SCRIPT.SEGMENT_COM);
|
|
916
914
|
// eslint-disable-next-line max-len
|
|
917
|
-
res.push(`df.columns.add(DG.Column.fromList('string', '${STAGE_COL_NAME}', new Array(df.rowCount).fill('${
|
|
915
|
+
res.push(`df.columns.add(DG.Column.fromList('string', '${STAGE_COL_NAME}', new Array(df.rowCount).fill('${ivp.arg.updateName ?? INCEPTION}')));`);
|
|
918
916
|
res.push('');
|
|
919
917
|
res.push(`let ${SCRIPT.LAST_IDX} = 0;`);
|
|
920
918
|
ivp.updates.forEach((upd, idx) => {
|