@@ -34,7 +34,13 @@ Notes:
34
34
"""
35
35
function save_reactionsystem (filename:: String , rn:: ReactionSystem ;
36
36
annotate = true , safety_check = true )
37
+ # Error and warning checks.
37
38
reactionsystem_uptodate_check ()
39
+ if ! isempty (get_networkproperties (rn))
40
+ @warn " The serialised network has cached network properties (e.g. computed conservation laws). This will not be saved as part of the network, and must be recomputed when it is loaded."
41
+ end
42
+
43
+ # Write model to file and performs a safety check.
38
44
open (filename, " w" ) do file
39
45
write (file, get_full_system_string (rn, annotate, true ))
40
46
end
@@ -65,6 +71,7 @@ function get_full_system_string(rn::ReactionSystem, annotate::Bool, top_level::B
65
71
file_text, has_reactions = push_field (file_text, rn, annotate, top_level, REACTIONS_FS)
66
72
file_text, has_equations = push_field (file_text, rn, annotate, top_level, EQUATIONS_FS)
67
73
file_text, has_observed = push_field (file_text, rn, annotate, top_level, OBSERVED_FS)
74
+ file_text, has_defaults = push_field (file_text, rn, annotate, top_level, DEFAULTS_FS)
68
75
file_text, has_continuous_events = push_field (file_text, rn, annotate,
69
76
top_level, CONTINUOUS_EVENTS_FS)
70
77
file_text, has_discrete_events = push_field (file_text, rn, annotate,
@@ -78,7 +85,7 @@ function get_full_system_string(rn::ReactionSystem, annotate::Bool, top_level::B
78
85
rs_creation_code = make_reaction_system_call (
79
86
rn, annotate, top_level, has_sivs, has_species,
80
87
has_variables, has_parameters, has_reactions,
81
- has_equations, has_observed, has_continuous_events,
88
+ has_equations, has_observed, has_defaults, has_continuous_events,
82
89
has_discrete_events, has_systems, has_connection_type)
83
90
annotate || (@string_prepend! " \n " file_text)
84
91
@string_prepend! " let" file_text
92
99
function make_reaction_system_call (
93
100
rs:: ReactionSystem , annotate, top_level, has_sivs, has_species,
94
101
has_variables, has_parameters, has_reactions, has_equations,
95
- has_observed, has_continuous_events, has_discrete_events,
102
+ has_observed, has_defaults, has_continuous_events, has_discrete_events,
96
103
has_systems, has_connection_type)
97
104
98
105
# Gets the independent variable input.
@@ -141,6 +148,7 @@ function make_reaction_system_call(
141
148
# Goes through various fields that might exists, and if so, adds them to the string.
142
149
has_sivs && (@string_append! reaction_system_string " , spatial_ivs" )
143
150
has_observed && (@string_append! reaction_system_string " , observed" )
151
+ has_defaults && (@string_append! reaction_system_string " , defaults" )
144
152
has_continuous_events && (@string_append! reaction_system_string " , continuous_events" )
145
153
has_discrete_events && (@string_append! reaction_system_string " , discrete_events" )
146
154
has_systems && (@string_append! reaction_system_string " , systems" )
0 commit comments