-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·285 lines (236 loc) · 5.17 KB
/
run
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
#!/bin/bash
function usage(){
echo "Usage: run_file run_mode {c/nc} eps_same {pc/kappa/n0/p0} plot_mode {eps/vnN/ve/slice/plot2d/error/error2d/ei/eis/eisp/all} CDIR {scp to ~/public_html/tdk/rhyd_2D/CDIR} [prefix=ag]"
}
if test $# -lt 5
then
usage
exit 1
fi
run_file=$1
run_mode=$2
eps_same=$3
plot_mode=$4
CDIR="~/public_html/hyd/rel/"$5
prefix=""
if test -z $6
then
prefix="rh_ag__";
else
prefix=$6"__";
fi
OPTDIR=$PWD"/opt/"
RUNFILE=$OPTDIR$run_file
function make_fs(){
local ofile
ofile=$1
fs=$(awk 'BEGIN{}{if ($0~/ /)print $1"="$3;}' $ofile)
fs=$(echo $fs | sed 's/p_s_corr/pc/g')
fs=$(echo $fs | tr " " "\n" | sort | tr "\n" "_" | sed 's/_$//g')
echo $fs
}
run=(`cat $RUNFILE| sed 's/\n/\ /g'`)
file_specs=()
param=()
for((i=0;i<${#run[@]};i++))
do
run[$i]=${OPTDIR}${run[$i]}
fs=`make_fs ${run[$i]}`
file_specs[$i]=$fs
param[$i]=${run[$i]}"__"$fs
done
if test "$run_mode" = "c"
then
make
rm *.o
./exe ${param[@]}
rm exe
fi
if [ "$eps_same" = "pc" ]
then
eps_same="p_s_corr"
fi
function in_array(){
local array
local element
array=("${!1}")
element=$2
if test -z "`echo ${array[@]}`"
then
echo "-1"
else
local t
local i
t=-1
for((i=0;i<${#array[@]};i++))
do
if test -z "`awk 'BEGIN{if ('${array[$i]}'!='$element') print \"o\";}'`"
then
t=$i
fi
done
if test $t -eq -1
then
echo "-1"
else
echo $t
fi
fi
}
function plot_eps(){
o[0]="";
c[0]="";
k=0;
for i in ${run[@]}
do
tmp=`cat $i | grep $eps_same | awk '{print $3}'`
in="`in_array "c[@]" "$tmp"`"
if test $in -eq -1
then
o[$k]=$i
c[$k]=$tmp
k=`expr $k + 1`
else
o[$in]+=";;"$i
fi
done
for i in ${o[@]}
do
me=`cat "$(echo $i | tr ";;" " " | awk '{print $1}')" | grep $eps_same | awk '{print $3}'`
es=`echo $eps_same | sed 's/p_s_corr/pc/g'`
./make_plot eps `echo $i | tr ";;" " "` "`echo ${es}\=${me}`"
cd data
mv n_eps.png ${prefix}eps_${es}\=${me}_n.png
mv v_eps.png ${prefix}eps_${es}\=${me}_v.png
mv p_eps.png ${prefix}eps_${es}\=${me}_p.png
scp ${prefix}eps_${es}\=${me}_n.png ${prefix}eps_${es}\=${me}_v.png ${prefix}eps_${es}\=${me}_p.png caesar:$CDIR
cd ..
done
}
function plot_vnN(){
o[0]="";
c[0]="";
k=0;
for i in ${run[@]}
do
tmp=`cat $i | grep $eps_same | awk '{print $3}'`
in="`in_array "c[@]" "$tmp"`"
if test $in -eq -1
then
o[$k]=$i
c[$k]=$tmp
k=`expr $k + 1`
else
o[$in]+=";;"$i
fi
done
for i in ${o[@]}
do
me=`cat "$(echo $i | tr ";;" " " | awk '{print $1}')" | grep $eps_same | awk '{print $3}'`
es=`echo $eps_same | sed 's/p_s_corr/pc/g'`
./make_plot vnN `echo $i | tr ";;" " "` "`echo ${es}\=${me}`"
cd data
mv vn.png ${prefix}vn_${es}\=${me}.png
mv Nfi.png ${prefix}Nfi_${es}\=${me}.png
mv Npt.png ${prefix}Npt_${es}\=${me}.png
scp ${prefix}vn_${es}\=${me}.png ${prefix}Nfi_${es}\=${me}.png ${prefix}Npt_${es}\=${me}.png caesar:$CDIR
cd ..
done
}
function plot_pint(){
for i in ${run[@]}
do
./make_plot pint $i
fs=`make_fs $i`
cd data
mv q1.png ${prefix}q1_${fs}.png
mv q2q3.png ${prefix}q2q3_${fs}.png
mv q4.png ${prefix}q4_${fs}.png
mv lost_q1.png ${prefix}lost_q1_${fs}.png
mv lost_q2q3.png ${prefix}lost_q2q3_${fs}.png
mv lost_q4.png ${prefix}lost_q4_${fs}.png
scp ${prefix}q1_${fs}.png ${prefix}q2q3_${fs}.png ${prefix}q4_${fs}.png ${prefix}lost_q1_${fs}.png ${prefix}lost_q2q3_${fs}.png ${prefix}lost_q4_${fs}.png caesar:$CDIR
cd ..
done
}
function plot_T(){
for i in ${run[@]}
do
./make_plot plotT $i
fs=`make_fs $i`
cd data
mv T.png ${prefix}T_${fs}.png
scp ${prefix}T_${fs}.png caesar:$CDIR
cd ..
done
}
function plot_slice(){
for i in ${run[@]}
do
./make_plot slice $i
fs=`make_fs $i`
cd data
mv slice.gif ${prefix}slice_${fs}.gif
mv T_slice.gif ${prefix}T_slice_${fs}.gif
scp ${prefix}slice_${fs}.gif ${prefix}T_slice_${fs}.gif caesar:$CDIR
cd ..
done
}
function plot_2d(){
for i in ${run[@]}
do
./make_plot plot2d $i
fs=`make_fs $i`
cd data
mv n.gif ${prefix}sol_${fs}_n.gif
mv v.gif ${prefix}sol_${fs}_v.gif
mv p.gif ${prefix}sol_${fs}_p.gif
scp ${prefix}sol_${fs}_n.gif ${prefix}sol_${fs}_v.gif ${prefix}sol_${fs}_p.gif caesar:$CDIR
cd ..
done
}
function plot_error(){
for i in ${run[@]}
do
./make_plot error $i
fs=`make_fs $i`
cd data
mv aerror.png ${prefix}aerror_${fs}.png
mv rerror.png ${prefix}rerror_${fs}.png
scp ${prefix}aerror_${fs}.png ${prefix}rerror_${fs}.png caesar:$CDIR
cd ..
done
}
function plot_error2d(){
for i in ${run[@]}
do
./make_plot error2d $i
cd data
mv dn.gif ${prefix}error_${fs}_n.gif
mv dp.gif ${prefix}error_${fs}_p.gif
scp ${prefix}error_${fs}_n.gif ${prefix}error_${fs}_p.gif caesar:$CDIR
cd ..
done
}
case $plot_mode in
"eps") plot_eps ;;
"vnN") plot_vnN ;;
"ve") plot_vnN
plot_eps ;;
"plotT") plot_T ;;
"pint") plot_pint ;;
"slice") plot_slice ;;
"plot2d") plot_2d ;;
"error") plot_error ;;
"error2d") plot_error2d ;;
"ei") plot_eps
plot_pint ;;
"eis") plot_eps
plot_pint
plot_slice ;;
"eisp") plot_eps
plot_slice
plot_pint
plot_2d ;;
*) usage ;;
esac