-
Notifications
You must be signed in to change notification settings - Fork 3
/
animate1
executable file
·50 lines (41 loc) · 1.27 KB
/
animate1
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
#! /usr/bin/env bash
#
#
# athenak animations of 1D problems using NEMO's tabplot
#
#> IFILE base=LinWave
#> RADIO xcol=x1v i,x1v,rho,press,vel1,vel2,vel3
#> RADIO ycol=vel1 i,x1v,rho,press,vel1,vel2,vel3
#--HELP
# Animation of tables using NEMO's tabplot
base=LinWave # basename (including directories if needed)
xcol=x1v # X column name
ycol=vel1 # Y column name
#--HELP
if [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
set +x
awk 'BEGIN{s=0} {if ($1=="#--HELP") s=1-s; else if(s) print $0; }' $0
exit 0
fi
# simple keyword=value command line parser for bash
for arg in "$@"; do
export "$arg"
done
# no NEMO, no go
if [ "$NEMO" == "" ]; then
echo "Alas, we need some NEMO tools for this"
exit 0
fi
# we need to translate the column name to the column number.....
# a bash contortion
tmp=/tmp/tmp.log
f0=$(ls ${base}*tab | head -1)
for i in $(tabrows $f0 2); do echo $i; done | awk '{print NR-1,$1}' > $tmp
ixcol=$(grep -w $xcol $tmp | awk '{print $1}')
iycol=$(grep -w $ycol $tmp | awk '{print $1}')
for f in ${base}*tab; do
tabplot $f xcol=$ixcol ycol=$iycol xlab=$xcol ylab=$ycol
done
echo -n "DEBUG: "
tabrows $f0 2
echo "DEBUG: xcol=$ixcol ($xcol) ycol=$iycol ($ycol)"