Skip to content

Commit

Permalink
Merge pull request #220 from simeonschaub/fix_219
Browse files Browse the repository at this point in the history
correct ordering of sys.dvs in ode_order_lowering
  • Loading branch information
ChrisRackauckas committed Jan 3, 2020
2 parents ca3dbfa + 317a1cc commit dca5f38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/systems/diffeqs/first_order_transform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function lower_varname(var::Variable, idv, order)
end

function ode_order_lowering(sys::ODESystem)
(eqs_lowered, new_vars) = ode_order_lowering(sys.eqs, sys.iv)
ODESystem(eqs_lowered, sys.iv, [sys.dvs; new_vars], sys.ps)
eqs_lowered, _ = ode_order_lowering(sys.eqs, sys.iv)
ODESystem(eqs_lowered, sys.iv, [eq.x for eq in eqs_lowered], sys.ps)
end
function ode_order_lowering(eqs, iv)
var_order = Dict{Variable,Int}()
Expand Down
4 changes: 4 additions & 0 deletions test/system_construction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ lowered_eqs = [D(u_tt) ~ 2u_tt + u_t + x_t + 1
D(u) ~ u_t
D(x) ~ x_t]
@test de1 == ODESystem(lowered_eqs)

# issue #219
@test de1.dvs == [eq.x for eq in de1.eqs] == ODESystem(lowered_eqs).dvs

test_diffeq_inference("first-order transform", de1, t, [u_tt, x_t, u_t, u, x], [])
du = zeros(5)
ODEFunction(de1, [u_tt, x_t, u_t, u, x], [])(du, ones(5), nothing, 0.1)
Expand Down

0 comments on commit dca5f38

Please sign in to comment.