-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_modeling_basic.sh
executable file
·99 lines (80 loc) · 1.91 KB
/
run_modeling_basic.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
#!/bin/bash
#
# run_modeling_basic.sh (Shell Script)
#
# It's necessary Seismic Unix package to visualization
# Necessita do pacote Seismic Unix instalado para visualização
#
# Main program: Basic acoustic wave equation modeling.
#
# Versão 0.01
#
# author: Felipe Timóteo | felipetimoteo@id.uff.br
#
# updated by: Rodolfo A. C. Neves | rodolfo_profissional@hotmail.com
#
# Licença: Software de uso livre e código aberto.
#--------------------------------------------------------------------------#
# Versão deste programa
VERSAO="Versão 0.01"
#--------------------------------------------------------------------------#
MENSAGEM_USO="
$(basename $0) [-h | -v | -c | -e | -r ]
-h --help Show all instructions
-v --version Show the version
-c Compiling the modeling program
-e Execute seimic modeling program
-p Visualize modeling and show seismogram
-r Clean files .bin
Usage:
bash$ $0 -c # Compile files .f90
bash$ $0 -e # Execute program
bash$ $0 -r # Plot results
bash$ $0 -r # Clean files .bin
"
# Check if user provide some parameter
[ -z "$1" ] && {
echo "The user doesn't provide any parameter"
echo "Type $0 -h for more info"
exit 1
}
case "$1" in
-h | --help) ## Show help
echo -e "$MENSAGEM_USO"
exit 0
;;
-v | --version) ## Show version
echo "$VERSAO"
exit 0
;;
-c) ## Compiling
# Makefile compiling
make
exit 0
;;
-e) ## run main program
./modeling_basic
echo ""
echo "To visualize the results you'll need Seismic Unix package"
echo "Run $0 -p to plot the results"
echo ""
exit 0
;;
-p)
## Visualization
#Snapshots
xmovie n1=301 n2=301 sleep=1 loop=1 < snapshots.bin
#Seismogram
ximage n1=1001 < seismogram.bin perc=99
exit 0
;;
-r) ## Opção para remover arquivos .bin
rm *.bin
exit 0
;;
*) ## Message for bad parameter
echo -e "\033[31mERRO: Option $1 unknown!\033[m"
echo -e "\033[31mType $0 -h for help \033[m"
exit 3
;;
esac