tfix domain dimensionality - Granular.jl - Julia package for granular dynamics … | |
git clone git://src.adamsgaard.dk/Granular.jl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 2ec4ebdc7253186e0faa49fb48f042393bd2dfcd | |
parent a19e2a8c201bda48eafc46a2080e19f0a532c429 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 12 Sep 2017 22:49:15 -0400 | |
fix domain dimensionality | |
Diffstat: | |
M examples/logo.jl | 11 +++++++++-- | |
1 file changed, 9 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/examples/logo.jl b/examples/logo.jl | |
t@@ -29,9 +29,16 @@ logo_string = readstring(`figlet -f pebbles "$text"`) | |
const dx = 1. | |
const dy = dx | |
-const nx = search(logo_string, '\n') - 1 + 2 | |
const logo_string_split = split(logo_string, '\n') | |
-const ny = length(logo_string_split) + 1 | |
+ | |
+const ny = length(logo_string_split) | |
+maxwidth = 0 | |
+for i=1:ny | |
+ if maxwidth < length(logo_string_split[i]) | |
+ maxwidth = length(logo_string_split[i]) | |
+ end | |
+end | |
+const nx = maxwidth + 1 | |
const Lx = nx*dx | |
const Ly = ny*dy |