-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrkJulia.sh
executable file
·147 lines (125 loc) · 3.41 KB
/
frkJulia.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
#------------------------------------------------------------------------
# Copyright (C) 2011 Luca Amore <luca.amore at gmail.com>
#
# frk is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# frk is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with frk. If not, see <http://www.gnu.org/licenses/>.
#------------------------------------------------------------------------
CMD=$(basename $0)
W=720
H=600
XMin=-1.8
XMax=1.8
YMin=-1.0
YMax=1.0
KRe=-0.835
KIm=0.2321
MaxIterations=150
N=$(grep -c 'model name' /proc/cpuinfo)
NameColorPalette='paletteblu'
ImgOutDir='save'
ImgOutFormat='png'
ConvertOutputOptions='-antialias'
Verbose=0
NoConvert=0
FileName="out"
usage()
{
cat << EOF
FRK: MANDELBROT GENERATOR
usage: ${CMD} options
frk Mandelbrot set generator
OPTIONS:
-W width ($W)
-H heigth ($H)
-N split into N concurrent processes ($N)
-r K re ($KRe)
-i K im ($KIm)
-I iterations ($MaxIterations)
-c name color palette ($NameColorPalette)
-f output filename ($FileName)
-N no convert to $ImgOutFormat ($NoConvert)
-x XMin ($XMin)
-X XMax ($XMax)
-y XMin ($YMin)
-Y YMax ($YMax)
-v Verbose ($Verbose)
-h this help
EOF
}
while getopts “hW:H:N:r:i:I:c:f:x:X:y:Y” OPTION
do
case $OPTION in
h)
usage
exit 1
;;
W)
W=$OPTARG
;;
H)
H=$OPTARG
;;
N)
N=$OPTARG
;;
r)
KRe=$OPTARG
;;
i)
KIm=$OPTARG
;;
I)
MaxIterations=$OPTARG
;;
c)
NameColorPalette=$OPTARG
;;
f)
FileName=$OPTARG
;;
d)
MakeDescription=1
;;
x)
XMin=$OPTARG
;;
X)
XMax=$OPTARG
;;
y)
YMin=$OPTARG
;;
Y)
YMax=$OPTARG
;;
?)
usage
exit
;;
esac
done
FullFileName="${ImgOutDir}/${FileName}"
FullFileNameRaw="${FullFileName}.ppm"
FullFileNameDescr="${FullFileName}.txt"
FullFileNameDest="${FullFileName}.${ImgOutFormat}"
ListArgs="${W},${H},${XMin},${XMax},${YMin},${YMax},${KRe},${KIm},${MaxIterations},'${FullFileNameRaw}',${N},${NameColorPalette}"
Log=$(printf "FN: %s H: %s W: %s I: %s K: %s, %si Z: [%s,%s] x [%s, %s] N: %s C: %s - %s\n" \
${FileName} ${W} ${H} ${MaxIterations} ${KRe} ${KIm} ${XMin} ${XMax} ${YMin} ${YMax} ${N} ${NameColorPalette} ${CMD} \
)
echo $Log
echo $Log > ${FullFileNameDescr}
date >> ${FullFileNameDescr}
erl -pz ebin -noshell -eval "parallel:julia($ListArgs)." -run init stop
convert ${ConvertOutputOptions} ${FullFileNameRaw} ${FullFileNameDest}
echo "saved: ${FullFileNameDest}"