Commit 91b474f0 authored by Mathieu Hemery's avatar Mathieu Hemery

Add the compile_from_ode, do not test it for now

parent 0c5b055e
......@@ -34,6 +34,7 @@ Rq: The distinction between pivp_string and pivp_list is not always obvious.
compile_from_expression/3,
compile_from_pivp/2,
compile_from_pivp/3,
compile_from_ode/2,
%Grammar
polynomial/1,
monomial/1,
......@@ -375,6 +376,28 @@ compile_from_pivp(PIVP, Input, Output) :-
main_compiler(P, Name_list, Input).
%! compile_from_ode(+Input, +Output)
%
% Same as compile_from_pivp but load ODE from the current ode system
compile_from_ode(Input, Output) :-
biocham_command,
type(Input, name),
type(Output, name),
doc(''),
option(
binomial_reduction,
reduction_methods,
_Reduction,
'Determines if the binomial reduction has to be performed'
),
read_ode_system(PIVP),
sort_output(PIVP, Output, PIVP_sorted),
format_pivp(PIVP_sorted, P, Name_list),
main_compiler(P, Name_list, Input).
:- doc('
\\begin{example} Compilation of the Hill function of order 2 as a function of an input $h(x)=x^2/(1+x^2)$.
This time \\texttt{sat_species} is used (minimizing the number of variables as is the case for \\texttt{native}) and then
......@@ -607,6 +630,36 @@ separate_monomial(X^N, L, [], [], [X^N]) :-
separate_monomial(X, _L, [X], [], []) :- !.
%! read_ode_system(-PIVP)
%
% read the current ode_system and return it as a formated PIVP_string
read_ode_system(PIVP) :-
with_current_ode_system((
get_current_ode_system(Id),
findall(
Stuff,
(
item([parent: Id, kind: ode, item: Item_Der]),
Item_Der = d( Var )/dt = _Deriv,
item([parent: Id, kind: initial_concentration, item: Item_Init]),
Item_Init = init(Var = Num),
Stuff = (Num, Item_Der)
),
PIVP_unf
)
)),
derivative_list_to_pivp(PIVP_unf, PIVP).
% derivative_list_to_pivp(+List, -PIVP)
derivative_list_to_pivp([Head|[]], Head) :- !.
derivative_list_to_pivp([Head|Tail], Head;MTail) :-
!,
derivative_list_to_pivp(Tail, MTail).
%! make_exponent(+Var, +List_var, -Expo)
%
% from the variable present in a monomial, construct the exponent
......
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