Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
b276ed48
Commit
b276ed48
authored
Jul 10, 2021
by
Miroslav Kratochvil
🚴
Browse files
fix argument order and count for piecewise function
Fixes #112
parent
00b48fb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/symbolics.jl
View file @
b276ed48
...
...
@@ -45,7 +45,7 @@ const default_symbolics_mapping = Dict{String,Any}(
"ln"
=>
:
log
,
"log"
=>
:
sbmlLog
,
"lt"
=>
:<
,
"piecewise"
=>
:
(
Core
.
ifel
se
),
"piecewise"
=>
:
(
sbmlPiecewi
se
),
"power"
=>
:^
,
"root"
=>
:
sbmlRoot
,
"sech"
=>
:
sech
,
...
...
@@ -56,6 +56,17 @@ const default_symbolics_mapping = Dict{String,Any}(
"tan"
=>
:
tan
,
)
function
sbmlPiecewise
(
args
...
)
if
length
(
args
)
==
1
args
[
1
]
elseif
length
(
args
)
>=
3
Core
.
ifelse
(
args
[
2
],
args
[
1
],
sbmlPiecewise
(
args
[
3
:
end
]
...
))
else
throw
(
AssertionError
(
"malformed piecewise SBML function"
))
end
end
sbmlLog
(
x
)
=
log
(
x
,
10
)
sbmlLog
(
base
,
x
)
=
log
(
base
,
x
)
...
...
test/symbolics.jl
View file @
b276ed48
...
...
@@ -30,8 +30,8 @@
test
=
SBML
.
MathApply
(
"piecewise"
,
SBML
.
Math
[
SBML
.
MathApply
(
"lt"
,
SBML
.
Math
[
SBML
.
MathVal
(
1
),
SBML
.
MathVal
(
0
)]),
SBML
.
MathVal
(
123
),
SBML
.
MathApply
(
"lt"
,
SBML
.
Math
[
SBML
.
MathVal
(
1
),
SBML
.
MathVal
(
0
)]),
SBML
.
MathVal
(
456
),
],
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment