Skip to content

Commit ad274ad

Browse files
authored
fix ambiguity in flow methods (#51)
1 parent ec51025 commit ad274ad

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "CoherentStructures"
22
uuid = "0c1513b4-3a13-56f1-9cd2-8312eaec88c4"
3-
version = "0.3.2"
3+
version = "0.3.3"
44

55
[deps]
66
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"

src/ellipticLCS.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,12 @@ end
16301630
16311631
### Some convenience functions
16321632
1633-
function flow(odefun, u::EllipticBarrier{T}, tspan; kwargs...) where {T<:Real}
1633+
function flow(odefun::ODE.ODEFunction, u::EllipticBarrier{T}, tspan; kwargs...) where {T<:Real}
16341634
nt = length(tspan)
16351635
nc = length(u.curve)
16361636
newcurves = map(
16371637
let odefun = odefun, tspan = tspan, kwargs = kwargs
1638-
x -> flow(odefun, SVector{2}(x[1], x[2]), tspan; kwargs...)
1638+
x -> flow(odefun, (x[1], x[2]), tspan; kwargs...)
16391639
end,
16401640
u.curve,
16411641
)
@@ -1653,13 +1653,13 @@ function flow(odefun, u::EllipticBarrier{T}, tspan; kwargs...) where {T<:Real}
16531653
]
16541654
end
16551655
1656-
function flow(odefun, u::Singularity, tspan; kwargs...)
1656+
function flow(odefun::ODE.ODEFunction, u::Singularity, tspan; kwargs...)
16571657
nt = length(tspan)
16581658
newcoords = flow(odefun, u.coords, tspan; kwargs...)
16591659
return [Singuarity(newcoords[i], u.index) for i in 1:nt]
16601660
end
16611661
1662-
function flow(odefun, u::EllipticVortex{T}, tspan; kwargs...) where {T}
1662+
function flow(odefun::ODE.ODEFunction, u::EllipticVortex{T}, tspan; kwargs...) where {T}
16631663
newbarriers = [flow(odefun, b, tspan; kwargs...) for b in u.barriers]
16641664
newbarriers2 = Vector{EllipticBarrier{T}}[]
16651665
nt = length(tspan)

src/pullbacktensors.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ julia> f = u -> flow((u, p, t) -> vf(u, p, t), u, range(0., stop=100, length=21)
3030
@inline function flow(odefun, u0, tspan; kwargs...)
3131
return flow(ODE.ODEFunction(odefun), u0, tspan; kwargs...)
3232
end
33-
@inline function flow(odefun::ODE.ODEFunction{true}, u0, tspan; kwargs...)
33+
@inline function flow(odefun::ODE.ODEFunction{true}, u0::Union{Tuple{Vararg{T}},AbstractVecOrMat{T}}, tspan; kwargs...) where {T<:Real}
3434
return _flow(odefun, convert(Vector, u0), tspan; kwargs...)
3535
end
36-
@inline function flow(odefun::ODE.ODEFunction{false}, u0, tspan; kwargs...)
36+
@inline function flow(odefun::ODE.ODEFunction{false}, u0::Union{Tuple{Vararg{T}},AbstractVecOrMat{T}}, tspan; kwargs...) where {T<:Real}
3737
return _flow(odefun, convert(SVector{length(u0)}, u0), tspan; kwargs...)
3838
end
3939
@inline function _flow(

test/test_elliptic.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ end
103103
vortices32 = @inferred getvortices(T, [Singularity((Float32(0.25), Float32(0.5)), 1)], p; verbose=false)
104104
@test length(vortices32) == length(vortices)
105105
vortices, singularities = @inferred ellipticLCS(T, p; outermost=true, verbose=false)
106+
vortex = vortices[1]
107+
flowvortex = flow(rot_double_gyre, vortex, tspan)
108+
@test flowvortex isa Vector{<:EllipticVortex}
109+
@test length(flowvortex) == length(tspan)
110+
flowbarrier = flow(rot_double_gyre, vortex.barriers[1], tspan)
111+
@test flowbarrier isa Vector{<:EllipticBarrier}
112+
@test length(flowbarrier) == length(tspan)
106113
@test sum(map(v -> length(v.barriers), vortices)) == 2
107114
@test singularities isa Vector{Singularity{Float64}}
108115
@test length(singularities) > 5

0 commit comments

Comments
 (0)