Skip to content

Commit

Permalink
defineFunction support in Julia
Browse files Browse the repository at this point in the history
  • Loading branch information
metelkin committed Jun 20, 2024
1 parent e68fce7 commit 60aefbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/julia-export/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class JuliaExport extends AbstractExport {
}
// skipVersionCode means that the version will not be printed in output
// this is required for autotests
makeText(skipVersionCode = false){
makeText(skipVersionCode = false) {
//let logger = this._container.logger;
// create image for multiple namespaces
let nsImages = this.selectedNamespaces()
Expand All @@ -46,7 +46,8 @@ class JuliaExport extends AbstractExport {
let image = {
builderVersion: skipVersionCode ? '*' : pkg.version,
options: this,
nsImages
nsImages,
functionDefArray: [...this._container.functionDefStorage.values()].filter((fd) => !fd.isCore)
};
let modelContent = this.getModelCode(image);
let runContent = this.getRunCode(image);
Expand Down
8 changes: 7 additions & 1 deletion src/templates/julia-model.jl.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
=#

__platform__ = (function()
{% for img in nsImages %}
{% for fd in functionDefArray %}
function {{ fd.id }}({% for a in fd.arguments %}{{ a }}, {% endfor %}__args__...)
return {{ fd.math.toJuliaString() }}
end
{%- endfor %}

{%- for img in nsImages %}
{%- set timeScales = img.namespace.selectByClassName('TimeScale') | exclude2('id', 't') -%}
{% set id = img.namespace.spaceName %}
### create default constants
Expand Down

0 comments on commit 60aefbd

Please sign in to comment.