Skip to content

Commit 9cc76fb

Browse files
committed
Generalized to check all variables.
1 parent ab2caef commit 9cc76fb

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/systems/diffeqs/odesystem.jl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,14 @@ struct ODESystem <: AbstractODESystem
7575
connection_type::Any
7676

7777
function ODESystem(deqs, iv, dvs, ps, observed, tgrad, jac, Wfact, Wfact_t, name, systems, defaults, structure, connection_type)
78-
check_differentials(deqs,iv)
78+
check_dependence(dvs,iv)
7979
new(deqs, iv, dvs, ps, observed, tgrad, jac, Wfact, Wfact_t, name, systems, defaults, structure, connection_type)
8080
end
8181
end
8282

83-
function check_differentials(eqs,iv)
84-
diffvars = OrderedSet()
85-
for eq in eqs
86-
if isdiffeq(eq)
87-
lhs = eq.lhs
88-
diffvar, _ = var_from_nested_derivative(eq.lhs)
89-
isequal(iv, iv_from_nested_derivative(lhs)) || throw(ArgumentError("Differential variable $diffvar is not a function of independent variable $iv."))
90-
diffvar in diffvars && throw(ArgumentError("The differential variable $diffvar is not unique in the system of equations."))
91-
push!(diffvars, diffvar)
92-
end
83+
function check_dependence(dvs,iv)
84+
for dv in dvs
85+
isequal(iv, iv_from_nested_derivative(dv)) || throw(ArgumentError("Variable $dv is not a function of independent variable $iv."))
9386
end
9487
end
9588

0 commit comments

Comments
 (0)