mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2024-10-11 20:34:22 +00:00
Fix debug memory leaks
This commit is contained in:
parent
7bade826e0
commit
18a2f7267a
1 changed files with 26 additions and 15 deletions
|
@ -15,7 +15,7 @@ function animate(sol::Solution, args, name_part::String; framerate::Int64=10)
|
|||
Colorbar(
|
||||
fig[1, 2];
|
||||
limits=(0, 2),
|
||||
colormap=ColorSchemes.rainbow,
|
||||
colormap=ColorSchemes.cyclic_mrybm_35_75_c68_n256_s25,
|
||||
label=L"\frac{\varphi}{\pi}",
|
||||
)
|
||||
|
||||
|
@ -26,14 +26,14 @@ function animate(sol::Solution, args, name_part::String; framerate::Int64=10)
|
|||
colors = Observable(Vector{RGBAf}(undef, args.N))
|
||||
|
||||
if args.debug
|
||||
segments_x = zeros(2 * args.N)
|
||||
segments_y = zeros(2 * args.N)
|
||||
segments_x = Observable(zeros(2 * args.N))
|
||||
segments_y = Observable(zeros(2 * args.N))
|
||||
|
||||
interaction_circles = Vector{Circle}(undef, args.N)
|
||||
skin_circles = Vector{Circle}(undef, args.N)
|
||||
interaction_circles = Observable(Vector{Circle}(undef, args.N))
|
||||
skin_circles = Observable(Vector{Circle}(undef, args.N))
|
||||
|
||||
interaction_colors = Vector{RGBAf}(undef, args.N)
|
||||
skin_colors = Vector{RGBAf}(undef, args.N)
|
||||
interaction_colors = Observable(Vector{RGBAf}(undef, args.N))
|
||||
skin_colors = Observable(Vector{RGBAf}(undef, args.N))
|
||||
end
|
||||
|
||||
@showprogress 0.5 for frame in 1:(args.n_frames)
|
||||
|
@ -48,24 +48,24 @@ function animate(sol::Solution, args, name_part::String; framerate::Int64=10)
|
|||
colors[][i] = RGBAf(color)
|
||||
|
||||
if args.debug
|
||||
interaction_circles[i] = Circle(
|
||||
interaction_circles[][i] = Circle(
|
||||
Point2(sol.center[i, frame]), args.interaction_r
|
||||
)
|
||||
skin_circles[i] = Circle(Point2(sol.center[i, frame]), args.skin_r)
|
||||
skin_circles[][i] = Circle(Point2(sol.center[i, frame]), args.skin_r)
|
||||
|
||||
interaction_colors[i] = RGBAf(color, 0.12)
|
||||
skin_colors[i] = RGBAf(color, 0.06)
|
||||
interaction_colors[][i] = RGBAf(color, 0.12)
|
||||
skin_colors[][i] = RGBAf(color, 0.06)
|
||||
end
|
||||
end
|
||||
|
||||
if frame > 1
|
||||
if args.debug
|
||||
@simd for i in 1:(args.N)
|
||||
segments_x[2 * i - 1] = sol.center[i, frame - 1][1]
|
||||
segments_x[2 * i] = sol.center[i, frame][1]
|
||||
segments_x[][2 * i - 1] = sol.center[i, frame - 1][1]
|
||||
segments_x[][2 * i] = sol.center[i, frame][1]
|
||||
|
||||
segments_y[2 * i - 1] = sol.center[i, frame - 1][2]
|
||||
segments_y[2 * i] = sol.center[i, frame][2]
|
||||
segments_y[][2 * i - 1] = sol.center[i, frame - 1][2]
|
||||
segments_y[][2 * i] = sol.center[i, frame][2]
|
||||
end
|
||||
|
||||
if frame == 2
|
||||
|
@ -86,6 +86,17 @@ function animate(sol::Solution, args, name_part::String; framerate::Int64=10)
|
|||
notify(circles)
|
||||
notify(colors)
|
||||
|
||||
if args.debug
|
||||
notify(interaction_circles)
|
||||
notify(interaction_colors)
|
||||
|
||||
notify(skin_circles)
|
||||
notify(skin_colors)
|
||||
|
||||
notify(segments_x)
|
||||
notify(segments_y)
|
||||
end
|
||||
|
||||
ax.title = "t = $(round(sol.t[frame], digits=3))"
|
||||
|
||||
recordframe!(io)
|
||||
|
|
Loading…
Reference in a new issue