Skip to content

Commit

Permalink
Update for GeometricBase v0.10 and GeometricEquations v0.16.
Browse files Browse the repository at this point in the history
  • Loading branch information
michakraus committed Feb 27, 2024
1 parent af84915 commit 0f89fc6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
GeometricBase = "0.9, 0.10"
GeometricEquations = "0.12, 0.13, 0.14, 0.15, 0.16"
GeometricBase = "0.10"
GeometricEquations = "0.16"
RuntimeGeneratedFunctions = "0.5"
Symbolics = "5"
julia = "1.6"
Expand Down
2 changes: 1 addition & 1 deletion src/EulerLagrange.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module EulerLagrange

using GeometricBase: NullParameters, StateVariable
using GeometricBase: NullParameters, StateVariable, AlgebraicVariable
using LinearAlgebra
using RuntimeGeneratedFunctions
using Symbolics
Expand Down
6 changes: 6 additions & 0 deletions src/hamiltonian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,9 @@ function HODEProblem(lsys::HamiltonianSystem, tspan::Tuple, tstep::Real, q₀::S
ics = (q = q₀, p = p₀)
HODEProblem(lsys, tspan, tstep, ics; kwargs...)
end

function HODEProblem(lsys::HamiltonianSystem, tspan::Tuple, tstep::Real, q₀::AbstractArray, p₀::AbstractArray; kwargs...)
_q₀ = StateVariable(q₀)
_p₀ = StateVariable(p₀)
HODEProblem(lsys, tspan, tstep, _q₀, _p₀; kwargs...)
end
9 changes: 8 additions & 1 deletion src/lagrangian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,14 @@ function LODEProblem(lsys::LagrangianSystem, tspan::Tuple, tstep::Real, ics::Nam
LODEProblem(eqs.ϑ, eqs.f, eqs.g, eqs.ω, eqs.L, tspan, tstep, ics; v̄ = v̄, f̄ = f̄, kwargs...)
end

function LODEProblem(lsys::LagrangianSystem, tspan::Tuple, tstep::Real, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable = zero(q₀); kwargs...)
function LODEProblem(lsys::LagrangianSystem, tspan::Tuple, tstep::Real, q₀::StateVariable, p₀::StateVariable, λ₀::AlgebraicVariable; kwargs...)
ics = (q = q₀, p = p₀, λ = λ₀)
LODEProblem(lsys, tspan, tstep, ics; kwargs...)
end

function LODEProblem(lsys::LagrangianSystem, tspan::Tuple, tstep::Real, q₀::AbstractArray, p₀::AbstractArray, λ₀::AbstractArray = zero(q₀); kwargs...)
_q₀ = StateVariable(q₀)
_p₀ = StateVariable(p₀)
_λ₀ = AlgebraicVariable(λ₀)
LODEProblem(lsys, tspan, tstep, _q₀, _p₀, _λ₀; kwargs...)
end
9 changes: 8 additions & 1 deletion src/lagrangian_degenerate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ function LODEProblem(lsys::DegenerateLagrangianSystem, tspan::Tuple, tstep::Real
LODEProblem(eqs.ϑ, eqs.f, eqs.g, eqs.ω, eqs.L, tspan, tstep, ics; v̄ = v̄, f̄ = f̄, kwargs...)
end

function LODEProblem(lsys::DegenerateLagrangianSystem, tspan::Tuple, tstep::Real, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable = zero(q₀); kwargs...)
function LODEProblem(lsys::DegenerateLagrangianSystem, tspan::Tuple, tstep::Real, q₀::StateVariable, p₀::StateVariable, λ₀::AlgebraicVariable; kwargs...)

Check warning on line 117 in src/lagrangian_degenerate.jl

View check run for this annotation

Codecov / codecov/patch

src/lagrangian_degenerate.jl#L117

Added line #L117 was not covered by tests
ics = (q = q₀, p = p₀, λ = λ₀)
LODEProblem(lsys, tspan, tstep, ics; kwargs...)
end

function LODEProblem(lsys::DegenerateLagrangianSystem, tspan::Tuple, tstep::Real, q₀::AbstractArray, p₀::AbstractArray, λ₀::AbstractArray = zero(q₀); kwargs...)
_q₀ = StateVariable(q₀)
_p₀ = StateVariable(p₀)
_λ₀ = AlgebraicVariable(λ₀)
LODEProblem(lsys, tspan, tstep, _q₀, _p₀, _λ₀; kwargs...)

Check warning on line 126 in src/lagrangian_degenerate.jl

View check run for this annotation

Codecov / codecov/patch

src/lagrangian_degenerate.jl#L122-L126

Added lines #L122 - L126 were not covered by tests
end
2 changes: 1 addition & 1 deletion test/lagrangian_particle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ f₁, f₂ = zero(p₀), zero(p₀)
ntime = 1000
tstep = 0.01
tspan = (0.0, ntime * tstep)
ics = (q = q₀, p = p₀, λ = zero(q₀))
ics = (q = StateVariable(q₀), p = StateVariable(p₀), λ = AlgebraicVariable(zero(q₀)))


# Test without parameters
Expand Down

0 comments on commit 0f89fc6

Please sign in to comment.