Skip to content

Commit

Permalink
feat: add `ODEProblem(::DIfferentialEquation) (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
oameye authored Oct 29, 2024
1 parent 9ef6995 commit 641fd64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions ext/ModelingToolkitExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function ModelingToolkit.ODESystem(eom::HarmonicEquation)
end

function ModelingToolkit.ODESystem(diff_eq::DifferentialEquation)
diff_eq = deepcopy(diff_eq)
if !is_rearranged_standard(diff_eq)
rearrange_standard!(diff_eq)
end
Expand Down
7 changes: 4 additions & 3 deletions test/ModelingToolkitExt.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using HarmonicBalance
using ModelingToolkit

ModelingToolkitExt = Base.get_extension(HarmonicBalance, :ModelingToolkitExt)

using Test

@testset "Utilities" begin
ModelingToolkitExt = Base.get_extension(HarmonicBalance, :ModelingToolkitExt)
@variables α
check = ModelingToolkitExt.declare_parameter(α)
@test ModelingToolkit.PARAMETER values(check.val.metadata)
Expand All @@ -25,6 +23,9 @@ end
for p in string.([α, ω, ω0, F, γ])
@test p string.(parameters(sys))
end

# can run a second time without error; diff_eq unmutated
ODESystem(diff_eq)
end
@testset "ODEProblem" begin
@variables α ω ω0 F γ t x(t)
Expand Down

0 comments on commit 641fd64

Please sign in to comment.