1#! /bin/bash
2WHAT=$1
3DIR=$2
4echo $WHAT script generation
5cat $WHAT.hh > $WHAT.gnuplot
6
7DATA_FILE=`find $DIR -name "*.dat" | grep $WHAT`
8
9echo plot \\ >> $WHAT.gnuplot
10
11for FILE in $DATA_FILE
12do
13    LAST=$FILE
14done
15
16echo LAST=$LAST
17
18for FILE in $DATA_FILE
19do
20     if [ $FILE != $LAST ]
21     then
22	BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
23	echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >>  $WHAT.gnuplot
24     fi
25done
26BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
27echo "'"$LAST"'" title "'"$TITLE"'" >>  $WHAT.gnuplot
28
29#echo set term postscript color >> $WHAT.gnuplot
30#echo set output "'"$WHAT.ps"'" >> $WHAT.gnuplot
31echo set term pbm small color >> $WHAT.gnuplot
32echo set output "'"$WHAT.ppm"'" >> $WHAT.gnuplot
33echo plot \\ >> $WHAT.gnuplot
34
35for FILE in $DATA_FILE
36do
37     if [ $FILE != $LAST ]
38     then
39	BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
40	echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >>  $WHAT.gnuplot
41     fi
42done
43BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
44echo "'"$LAST"'" title "'"$TITLE"'" >>  $WHAT.gnuplot
45
46echo set term jpeg large >> $WHAT.gnuplot
47echo set output "'"$WHAT.jpg"'" >> $WHAT.gnuplot
48echo plot \\ >> $WHAT.gnuplot
49
50for FILE in $DATA_FILE
51do
52     if [ $FILE != $LAST ]
53     then
54	BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
55	echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >>  $WHAT.gnuplot
56     fi
57done
58BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
59echo "'"$LAST"'" title "'"$TITLE"'" >>  $WHAT.gnuplot
60
61
62gnuplot -persist < $WHAT.gnuplot
63
64rm $WHAT.gnuplot
65
66
67
68
69