Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
50805643
Commit
50805643
authored
Oct 16, 2015
by
SOLIMAN Sylvain
Browse files
use annotations to store compiled form of conservations
parent
3754983f
Changes
2
Hide whitespace changes
Inline
Side-by-side
conservation_laws.pl
View file @
50805643
...
...
@@ -31,15 +31,16 @@ add_conservation(Conservation) :-
a warning.'
),
solution_to_conservation
(
Conservation
,
C
),
add_item
(
conservation
,
C
).
add_item
(
conservation
,
[],
Conservation
,
Id
),
set_annotation
(
Id
,
conservation_list
,
C
).
delete_conservation
(
Conservation
)
:-
biocham_command
,
type
(
Conservation
,
solution
),
doc
(
'removes the given mass conservation law.'
),
solution_to_conservation
(
Conservation
,
C
),
find_item
(
[
model
:
current_model
,
id
:
Id
,
type
:
conservation
,
item
:
C
]),
find_item
(
[
model
:
current_model
,
id
:
Id
,
type
:
conservation
,
item
:
C
onservation
]),
delete_item
(
Id
).
...
...
@@ -65,7 +66,10 @@ check_conservations :-
(see also \\command{add_conservation/1}).'
),
forall
(
item
([
model
:
current_model
,
kind
:
conservation
,
item
:
C
]),
(
item
([
model
:
current_model
,
kind
:
conservation
,
id
:
Id
]),
get_annotation
(
Id
,
conservation_list
,
C
)
),
check_conservation
(
C
)
).
...
...
conservation_laws.plt
View file @
50805643
...
...
@@ -9,10 +9,11 @@ test(
[
setup(models:clear_model),
cleanup(models:clear_model),
true(Conservations == [[1*'a-a', 2*'a']])
forall(member(Input, ['a-a' + 2*'a', 'b', 'a' + 'b'])),
true(Conservations == [Input])
]
) :-
command(add_conservation(
a-a + 2*a
)),
command(add_conservation(
Input
)),
all_items([model: current_model, kind: conservation], Conservations).
%%% FIXME should test that conservations are properly used for numerical
...
...
@@ -23,7 +24,7 @@ test(
[
setup(set_some_conservations),
cleanup(models:clear_model),
true(Conservations == [
[1*
'a-a'
, 2*'a'], [1*'c-c', 2*'c']
])
true(Conservations == ['a-a'
+2*a,'c-c'+2*c
])
]
) :-
command(delete_conservation(b-b + 2*b)),
...
...
@@ -48,7 +49,7 @@ test(
setup(set_some_conservations),
cleanup(models:clear_model),
true(Conservations ==
'[0]
[1*
a-a
,
2*a
]
\n[1]
[1*
b-b
,
2*b
]
\n[2]
[1*
c-c
,
2*c
]
\n')
'[0] a-a
+
2*a\n[1] b-b
+
2*b\n[2] c-c
+
2*c\n')
]
) :-
with_output_to(atom(Conservations), command(list_conservations)).
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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