mirror of
https://gitlab.rlp.net/mobitar/ReCo.jl.git
synced 2024-12-21 00:51:21 +00:00
turbo
This commit is contained in:
parent
7abfb6e868
commit
7abb864cba
5 changed files with 8 additions and 4 deletions
|
@ -7,6 +7,7 @@ JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
|
||||||
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
|
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
|
||||||
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
|
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
|
||||||
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
|
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
|
||||||
|
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
|
||||||
ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
|
ProfileView = "c46f51b8-102a-5cf2-8d2c-8597cb0e0da7"
|
||||||
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
|
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
|
||||||
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
|
||||||
|
|
|
@ -55,7 +55,9 @@ function are_overlapping(p1::Particle, p2::Particle, overlapping_r²::Float64, l
|
||||||
end
|
end
|
||||||
|
|
||||||
function update!(p::Particle)
|
function update!(p::Particle)
|
||||||
@simd for i in 1:2
|
@turbo for i in 1:2
|
||||||
p.c[i] = p.tmp_c[i]
|
p.c[i] = p.tmp_c[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return nothing
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Random, Distributions
|
||||||
using ProgressMeter
|
using ProgressMeter
|
||||||
using GLMakie, ColorSchemes, LaTeXStrings
|
using GLMakie, ColorSchemes, LaTeXStrings
|
||||||
using StaticArrays
|
using StaticArrays
|
||||||
|
using LoopVectorization: @turbo, @tturbo
|
||||||
using JLD2: JLD2
|
using JLD2: JLD2
|
||||||
using JSON3: JSON3
|
using JSON3: JSON3
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ function save_frame!(sol, frame, t, particles)
|
||||||
|
|
||||||
pre_pos = sol.center[p_id, frame]
|
pre_pos = sol.center[p_id, frame]
|
||||||
|
|
||||||
@simd for i in 1:2
|
@turbo for i in 1:2
|
||||||
pre_pos[i] = p.c[i]
|
pre_pos[i] = p.c[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ function euler!(args)
|
||||||
if overlapping
|
if overlapping
|
||||||
c = args.c₁ / (distance²^4) * (args.c₂ / (distance²^3) - 1)
|
c = args.c₁ / (distance²^4) * (args.c₂ / (distance²^3) - 1)
|
||||||
|
|
||||||
@simd for k in 1:2
|
@turbo for k in 1:2
|
||||||
dck = c * r⃗₁₂[k]
|
dck = c * r⃗₁₂[k]
|
||||||
|
|
||||||
p.tmp_c[k] -= dck
|
p.tmp_c[k] -= dck
|
||||||
|
@ -49,7 +49,7 @@ function euler!(args)
|
||||||
@simd for p in args.particles
|
@simd for p in args.particles
|
||||||
e = SVector(cos(p.φ), sin(p.φ))
|
e = SVector(cos(p.φ), sin(p.φ))
|
||||||
|
|
||||||
@simd for i in 1:2
|
@turbo for i in 1:2
|
||||||
p.tmp_c[i] += args.vδt * e[i] + args.c₃ * rand_normal01()
|
p.tmp_c[i] += args.vδt * e[i] + args.c₃ * rand_normal01()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue