tadd function to remove output files associated with a simulation - Granular.jl - Julia package for granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/Granular.jl
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 6cae14d2d556f2ffca3af96ea249e1aac632ce7d
(DIR) parent bee49459645cf53bd8d1d8871bd8098178ecb368
(HTM) 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:
M examples/nares_strait.jl | 3 +++
M src/io.jl | 13 +++++++++++++
M test/vtk.jl | 3 +--
3 files changed, 17 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/examples/nares_strait.jl b/examples/nares_strait.jl
t@@ -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.)
(DIR) diff --git a/src/io.jl b/src/io.jl
t@@ -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
(DIR) diff --git a/test/vtk.jl b/test/vtk.jl
t@@ -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)