add functionality to add concentration at clickend spots dynamically
parent
2fc80227ca
commit
f39c85a0ad
|
|
@ -76,6 +76,8 @@ function build_ui(U, V, Du, Dv, F, k, params_obs, heat_obs)
|
||||||
|
|
||||||
run_label = Observable{String}("Run")
|
run_label = Observable{String}("Run")
|
||||||
stepsize = Observable(30)
|
stepsize = Observable(30)
|
||||||
|
spoint = select_point(ax.scene)
|
||||||
|
|
||||||
# # Controls
|
# # Controls
|
||||||
fig[2, 1] = buttongrid = GridLayout(ax.scene, tellwidth=false)
|
fig[2, 1] = buttongrid = GridLayout(ax.scene, tellwidth=false)
|
||||||
btn_step = Button(buttongrid[1, 1], width=50, label="Step")
|
btn_step = Button(buttongrid[1, 1], width=50, label="Step")
|
||||||
|
|
@ -130,6 +132,27 @@ function build_ui(U, V, Du, Dv, F, k, params_obs, heat_obs)
|
||||||
reset!(U, V, heat_obs)
|
reset!(U, V, heat_obs)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
on(spoint) do pt
|
||||||
|
r = 5
|
||||||
|
if pt === nothing
|
||||||
|
return
|
||||||
|
end
|
||||||
|
x, y = pt
|
||||||
|
println("params_obs[].N, ", params_obs[].N)
|
||||||
|
i, j = coord_to_index(x, y, params_obs[].N)
|
||||||
|
|
||||||
|
# get corners of square that will get filled with concentration
|
||||||
|
imin = max(i - r, 1)
|
||||||
|
imax = min(i + r, params_obs[].N)
|
||||||
|
jmin = max(j - r, 1)
|
||||||
|
jmax = min(j + r, params_obs[].N)
|
||||||
|
|
||||||
|
# set disbalanced concentration of U and V
|
||||||
|
U[imin:imax, jmin:jmax] .= 0.5
|
||||||
|
V[imin:imax, jmin:jmax] .= 0.25
|
||||||
|
|
||||||
|
heat_obs[] = copy(U)
|
||||||
|
end
|
||||||
return fig
|
return fig
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue