@@ -23,6 +23,11 @@ eqs = [D(x) ~ σ*(y-x),
23
23
```
24
24
"""
25
25
struct ODESystem <: AbstractODESystem
26
+ """
27
+ tag: a tag for the system. If two system have the same tag, then they are
28
+ structurally identical.
29
+ """
30
+ tag:: UInt
26
31
""" The ODEs defining the system."""
27
32
eqs:: Vector{Equation}
28
33
""" Independent variable."""
@@ -120,7 +125,7 @@ struct ODESystem <: AbstractODESystem
120
125
"""
121
126
complete:: Bool
122
127
123
- function ODESystem (deqs, iv, dvs, ps, var_to_name, ctrls, observed, tgrad,
128
+ function ODESystem (tag, deqs, iv, dvs, ps, var_to_name, ctrls, observed, tgrad,
124
129
jac, ctrl_jac, Wfact, Wfact_t, name, systems, defaults,
125
130
torn_matching, connector_type, preface, cevents,
126
131
devents, metadata = nothing , tearing_state = nothing ,
@@ -135,7 +140,7 @@ struct ODESystem <: AbstractODESystem
135
140
if checks == true || (checks & CheckUnits) > 0
136
141
all_dimensionless ([dvs; ps; iv]) || check_units (deqs)
137
142
end
138
- new (deqs, iv, dvs, ps, var_to_name, ctrls, observed, tgrad, jac,
143
+ new (tag, deqs, iv, dvs, ps, var_to_name, ctrls, observed, tgrad, jac,
139
144
ctrl_jac, Wfact, Wfact_t, name, systems, defaults, torn_matching,
140
145
connector_type, preface, cevents, devents, metadata, tearing_state,
141
146
substitutions, complete)
@@ -189,7 +194,8 @@ function ODESystem(deqs::AbstractVector{<:Equation}, iv, dvs, ps;
189
194
end
190
195
cont_callbacks = SymbolicContinuousCallbacks (continuous_events)
191
196
disc_callbacks = SymbolicDiscreteCallbacks (discrete_events)
192
- ODESystem (deqs, iv′, dvs′, ps′, var_to_name, ctrl′, observed, tgrad, jac,
197
+ ODESystem (Threads. atomic_add! (SYSTEM_COUNT, UInt (1 )),
198
+ deqs, iv′, dvs′, ps′, var_to_name, ctrl′, observed, tgrad, jac,
193
199
ctrl_jac, Wfact, Wfact_t, name, systems, defaults, nothing ,
194
200
connector_type, preface, cont_callbacks, disc_callbacks,
195
201
metadata, checks = checks)
0 commit comments