Granular.jl

Julia package for granular dynamics simulation
git clone git://src.adamsgaard.dk/Granular.jl
Log | Files | Refs | README | LICENSE

commit da0c7ed57ed9892a46635cc656cd2f6ad2af4c74
parent 9495c57886dda23d395891e710658ab151dd14e4
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Tue,  2 Jan 2018 13:52:12 -0500

Improve visualization during poisson-disk sampling

Diffstat:
Msrc/io.jl | 7+++++--
Msrc/packing.jl | 8+++++++-
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/io.jl b/src/io.jl @@ -1352,8 +1352,11 @@ function plotGrains(sim::Simulation; write(f, "set yrange [$(minimum(y - r)):$(maximum(y + r))]\n") end - # light gray to black - write(f, "set palette defined ( 1 '#d3d3d3', 2 '#000000')\n") + # light gray to black to red + #write(f, "set palette defined ( 1 '#d3d3d3', 2 '#000000')\n") + + # light gray to black to red + write(f, "set palette defined ( 1 '#d3d3d3', 2 '#000000', 3 '#993333')\n") if !isnan(cbrange[1]) write(f, "set cbrange [$(cbrange[1]):$(cbrange[2])]\n") diff --git a/src/packing.jl b/src/packing.jl @@ -181,11 +181,13 @@ function irregularPacking!(simulation::Simulation; r_active = 0.; r_candidate = 0.; T = 0. n = 0 neighbor_found = false + i_last_active = 0 while !isempty(active_list) # Draw a random grain from the list of active grains i = active_list[rand(1:length(active_list))] + i_last_active = i x_active = simulation.grains[i].lin_pos r_active = simulation.grains[i].contact_radius @@ -272,6 +274,7 @@ function irregularPacking!(simulation::Simulation; thickness, color=1, verbose=false) sortGrainsInGrid!(simulation, grid) push!(active_list, length(simulation.grains)) + simulation.grains[i].color = 1 break end @@ -289,9 +292,12 @@ function irregularPacking!(simulation::Simulation; if plot_during_packing n += 1 + color = simulation.grains[i_last_active].color + simulation.grains[i_last_active].color = 2 filepostfix = @sprintf("packing.%05d.png", n) plotGrains(simulation, filetype=filepostfix, show_figure=false, - palette_scalar="color", cbrange=[0.,1.]) + palette_scalar="color", cbrange=[0.,2.]) + simulation.grains[i_last_active].color = color end end # end while !isempty(active_list)