Granular.jl

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

commit 6cae14d2d556f2ffca3af96ea249e1aac632ce7d
parent bee49459645cf53bd8d1d8871bd8098178ecb368
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Mon,  1 May 2017 11:35:50 -0400

add function to remove output files associated with a simulation

Diffstat:
Mexamples/nares_strait.jl | 3+++
Msrc/io.jl | 13+++++++++++++
Mtest/vtk.jl | 3+--
3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/examples/nares_strait.jl b/examples/nares_strait.jl @@ -105,6 +105,9 @@ end n = length(sim.ice_floes) - n_walls info("added $(n) ice floes") +# Remove old simulation files +SeaIce.removeSimulationFiles(sim) + # Set temporal parameters SeaIce.setTotalTime!(sim, 24.*60.*60.) SeaIce.setOutputFileInterval!(sim, 60.) diff --git a/src/io.jl b/src/io.jl @@ -157,3 +157,16 @@ function writeOceanVTK(ocean::Ocean, return nothing end end + +export removeSimulationFiles +""" + removeSimulationFiles(simulation[, folder, verbose]) + +Remove all simulation output files from the specified folder. +""" +function removeSimulationFiles(simulation::Simulation; + folder::String=".") + + run(`bash -c "rm -rf $(folder)/$(simulation.id).*.vtu"`) + run(`bash -c "rm -rf $(folder)/$(simulation.id).*.vts"`) +end diff --git a/test/vtk.jl b/test/vtk.jl @@ -21,5 +21,4 @@ end @test readstring(`$(cmd) test.icefloes.1.vtu`) == "72f4e4b854d7e92afd8cde0b79a4af6a29e49714b751ffc30a4ff3867f44b505 test.icefloes.1.vtu\n" @test readstring(`$(cmd) test.ocean.1.vts`) == "f0117e414c4e71a0c55980f63865eb03b6c597fa2546983258b8a57eb4ff2a25 test.ocean.1.vts\n" -rm("test.icefloes.1.vtu") -rm("test.ocean.1.vts") +SeaIce.removeSimulationFiles(sim)