Commit 5225eb58 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

trick to parse ODE files with p as functor and as parameter name

parent 35c05b57
......@@ -53,7 +53,6 @@
:- op(1010, fx, init). % comma is 1000
:- op(1010, fx, par).
:- op(1010, fx, p).
:- op(1010, fx, num).
:- op(1010, fx, func).
......@@ -909,6 +908,11 @@ remove_single_secondary_notations(String, Codes) :-
->
split_string(String, "=", "\s\t", L),
atomics_to_string(L, " = ", NewString)
;
sub_string(String, 0, 2, After, "p "),
sub_string(String, 2, After, 0, Rest)
->
atomics_to_string(['par ', Rest], NewString)
;
NewString = String
),
......
......@@ -16,7 +16,9 @@ test('ode_system', [ODEs == [d(b)/dt = a, d(a)/dt = -a]]) :-
test(
'import_ode',
[true(ODEs == [init(a = 0), init(b = 0), d(a)/dt = -a, par(k = -2), d(b)/dt = k*a])]
[true(
ODEs == [init(a = 0), init(b = 0), d(a)/dt = -a, par(k = -2),
par(kk = 1.0), d(b)/dt = k*a])]
) :-
setup_call_cleanup(
open('test.ode', write, TestOde),
......@@ -27,6 +29,7 @@ B(0) = 0
wiener q
da/dt = -a
par k =-2
p kk = 1.0
B''= k*a
@ meth=cvode
done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment