Granular.jl

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

commit 16941e6bdbc0bf4e555617da7db0b2a3efa820a8
parent 48271f6efda6a8ef3755618f89f0ee309c07e353
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Tue,  7 Nov 2017 11:56:38 -0500

attempt to install and use imagemagick via Homebrew.jl

Diffstat:
MREQUIRE | 2++
Adeps/build.jl | 13+++++++++++++
Mdocs/src/man/installation.md | 25+++++++++++++++++++++++--
Msrc/io.jl | 15++++++++++++---
4 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/REQUIRE b/REQUIRE @@ -2,3 +2,5 @@ julia 0.6 WriteVTK NetCDF Documenter +@osx Homebrew +BinDeps diff --git a/deps/build.jl b/deps/build.jl @@ -0,0 +1,13 @@ +#!/usr/bin/env julia +using BinDeps + +@BinDeps.setup + +imagemagick = library_dependency("imagemagick") + +if is_apple() + using Homebrew + provides(Homebrew.HB, "imagemagick", imagemagick, os = :Darwin) +end + +@BinDeps.install Dict(:imagemagick => :imagemagick) diff --git a/docs/src/man/installation.md b/docs/src/man/installation.md @@ -1,6 +1,25 @@ # Installation -Julia includes a very useful package manager which makes it easy to install -packages and their requirements, as well as convenient updating features. + +## Prerequisites +Granular.jl is written as a package for the [Julia programming +language](https://julialang.org), which is a computationally efficient, yet +high-level language. Julia also includes a very useful package manager which +makes it easy to install packages and their requirements, as well as convenient +updating features. + +### Installing Julia +If you do not have Julia installed, download the current release from the +[official Julia download page](https://julialang.org/downloads), or using your +system package manager (e.g. `brew cask install julia` on macOS with the +[Homebrew package manager](https://brew.sh)). Afterwards, the program `julia` +can be launched from the terminal. + +### Installing Paraview +The core visualization functionality of Granular.jl is based on VTK and +ParaView. The most recent stable release can be downloaded from the [ParaView +downloads page](https://www.paraview.org/download/). Alternatively, on macOS +with Homebrew, Paraview can be installed from the terminal with `brew cask +install paraview`. ## Stable installation (recommended) The latest stable release of Granular.jl can be installed directly from the @@ -51,3 +70,5 @@ julia> Pkg.test("Granular") In case any of these tests fail, please open a [Github Issue](https://github.com/anders-dc/Granular.jl/issues) describing the problems so further investigation and diagnosis can follow. + + diff --git a/src/io.jl b/src/io.jl @@ -943,19 +943,28 @@ function render(simulation::Simulation; pvpython::String="pvpython", if trim trim_string = "-trim" end - run(`convert $trim_string +repage -delay 10 + + # use ImageMagick installed with Homebrew.jl if available, + # otherwise search for convert in $PATH + convert = "convert" + if is_apple() + import Homebrew + convert = Homebrew.prefix() * "/bin/convert" + end + + run(`$convert $trim_string +repage -delay 10 -transparent-color white -loop 0 $(simulation.id)/$(simulation.id).'*'.png $(simulation.id)/$(simulation.id).gif`) if reverse - run(`convert -trim +repage -delay 10 -transparent-color white + run(`$convert -trim +repage -delay 10 -transparent-color white -loop 0 -reverse $(simulation.id)/$(simulation.id).'*'.png $(simulation.id)/$(simulation.id)-reverse.gif`) end catch return_signal if isa(return_signal, Base.UVError) - info("Skipping gif merge since `convert` was not found.") + info("Skipping gif merge since `$convert` was not found.") end end end