Skip to content

Commit e1b053d

Browse files
authored
Make EllipticBarrier's curve field contain SVectors, allow to override saveat (#52)
1 parent ad274ad commit e1b053d

File tree

5 files changed

+161
-184
lines changed

5 files changed

+161
-184
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.3"
3+
version = "0.3.4"
44

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

src/ellipticLCS.jl

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ This is a container for coherent vortex boundaries. An object `vortex` of type
5454
field ``\\eta_{\\lambda}^{\\pm}`` via the formula ``(-1)^s``.
5555
"""
5656
struct EllipticBarrier{T<:Real}
57-
curve::Vector{Tuple{T,T}}
57+
curve::Vector{SVector{2,T}}
5858
core::SVector{2,T}
5959
p::Float64
6060
s::Bool
@@ -822,15 +822,7 @@ function compute_closed_orbits(
822822
closed &&
823823
uniform && in_well_defined_squares && contains_singularity
824824
)
825-
push!(
826-
vortices,
827-
EllipticBarrier(
828-
[qs.data for qs in orbit],
829-
ps[1],
830-
λ⁰,
831-
σ,
832-
),
833-
)
825+
push!(vortices, EllipticBarrier(orbit, ps[1], λ⁰, σ))
834826
rev && break
835827
end
836828
end
@@ -1635,21 +1627,23 @@ function flow(odefun::ODE.ODEFunction, u::EllipticBarrier{T}, tspan; kwargs...)
16351627
nc = length(u.curve)
16361628
newcurves = map(
16371629
let odefun = odefun, tspan = tspan, kwargs = kwargs
1638-
x -> flow(odefun, (x[1], x[2]), tspan; kwargs...)
1630+
x -> flow(odefun, x, tspan; kwargs...)
16391631
end,
16401632
u.curve,
16411633
)
1642-
newcurves2 = Vector{Tuple{T,T}}[]
1643-
for i in 1:nt
1644-
curcurve = Tuple{T,T}[]
1645-
for j in 1:nc
1646-
push!(curcurve, (newcurves[j][i][1], newcurves[j][i][2]))
1647-
end
1634+
newcurves2 = Vector{SVector{2,T}}[]
1635+
timeindices = eachindex(newcurves[1])
1636+
for i in timeindices
1637+
curcurve = [convert(SVector{2,T}, n[i]) for n in newcurves]
1638+
# SVector{2,T}[]
1639+
# for j in 1:nc
1640+
# push!(curcurve, convert(SVector{2,T}, newcurves[j][i]))
1641+
# end
16481642
push!(newcurves2, curcurve)
16491643
end
16501644
newcores = flow(odefun, u.core, tspan; kwargs...)
16511645
return [
1652-
EllipticBarrier{T}(newcurves2[i], newcores[i], u.p, u.s) for i in 1:nt
1646+
EllipticBarrier{T}(newcurves2[i], newcores[i], u.p, u.s) for i in timeindices
16531647
]
16541648
end
16551649

0 commit comments

Comments
 (0)