Commit 6250f489 authored by Mathieu Hemery's avatar Mathieu Hemery

Adapt naming function to the case without lazy_negation

parent 6a845f8e
......@@ -315,23 +315,22 @@ pivp_compile(PIVP_input, Input, Output):-
;
PIVP_unsigned = PIVP_non_bin
),
PIVP_unsigned = [N,_PODE,_IV],
get_option(lazy_negation, Lazyness),
(
Lazyness = yes
->
PIVP_unsigned = [N,_PODE,_IV],
lng:rewrite_PIVP(PIVP_unsigned, PIVP, VarNeg),
affect_name(N,Output,VarNeg,Species_names),
(
\+(VarNeg = [])
->
set_parameter(fast, Fast)
;
true
)
lng:rewrite_PIVP(PIVP_unsigned, PIVP, VarNeg)
;
PIVP = PIVP_unsigned,
lng:rewrite_PIVP_all_negated(PIVP_unsigned, PIVP, VarNeg)
),
affect_name(N,Output,Input,VarNeg,Species_names),
(
\+(VarNeg = [])
->
set_parameter(fast, Fast)
;
true
),
compile_PIVP(PIVP, Species_names).
......@@ -1617,23 +1616,29 @@ exponant_to_solution([Exp|Tail_exp], [Name|Tail_name], Sol, Kin) :-
).
%! affect_name(+N,+Output,+Varneg,-Name_list)
%! affect_name(+N,+Output,+Input,+Varneg,-Name_list)
%
% Create the name of the species
affect_name(N,Output,Varneg,Name_list) :-
affect_name(N,0,Output,Varneg,Name_list).
affect_name(N,Output,Input,Varneg,Name_list) :-
affect_name(N,0,Output,Input,Varneg,Name_list).
affect_name(N,N,_Output,_Varneg,[]) :- !.
affect_name(N,N,_Output,_Input,_Varneg,[]) :- !.
affect_name(N,Nc,Output,Varneg,Name_list) :-
affect_name(N,Nc,Output,Input,Varneg,Name_list) :-
get_option(lazy_negation, Lazyness),
Nxt is Nc+1,
(
Nxt = 1
->
Name = Output
;
Nchar is Nxt+64,
Lazyness = no,
Nxt = N
->
Name = Input
;
Nchar is Nxt+63,
char_code(Name,Nchar)
),
(
......@@ -1645,7 +1650,7 @@ affect_name(N,Nc,Output,Varneg,Name_list) :-
;
Head = [Name]
),
affect_name(N,Nxt,Output,Varneg,Tail),
affect_name(N,Nxt,Output,Input,Varneg,Tail),
append(Head,Tail,Name_list).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
......@@ -33,6 +33,18 @@ rewrite_PIVP([N,ODE,Init], [NewN,NewODE,NewInit], VarNeg) :-
rewrite_initial_concentration(Init, VarNeg, NewInit),
length(VarNeg, NVN), NewN is N+NVN.
%! rewrite_PIVP_all_negated(+PIVP_list, -PIVP_rewrited, -VarNeg)
%
% rewrite the ode set with all variables negated
rewrite_PIVP_all_negated([N,ODE,Init], [NewN,NewODE,NewInit], VarNeg) :-
numlist(1,N,VarNeg), %VarNeg contains all the variables
rewrite_derivative_main(ODE, VarNeg, ODE_Tempo),
clean_ODE(ODE_Tempo,VarNeg,NewODE),
rewrite_initial_concentration(Init, VarNeg, NewInit),
NewN is 2*N.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Detection part %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
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