-
Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathraven_framework
executable file
·88 lines (82 loc) · 2.53 KB
/
raven_framework
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
#!/bin/bash
SCRIPT_NAME=`readlink $0`
if test -x "$SCRIPT_NAME";
then
SCRIPT_DIRNAME=`dirname $SCRIPT_NAME`
else
SCRIPT_DIRNAME=`dirname $0`
fi
SCRIPT_DIR=`(cd $SCRIPT_DIRNAME; pwd)`
source $SCRIPT_DIR/scripts/setup_raven_libs
# set up run keywords
# "ARGS" stores command line arguments not treated in this file (passed through)
declare -a ARGS
# by default run in "opt" mode
MODE='opt'
# loop through arguments and look for those that are handled before Python is called
for var in "$@"; do
if [ "$var" = '-D' ]; then
# run in development mode (assertions not stripped)
MODE='dev'
continue
elif [ "$var" = 'help' ]; then
# display "help" print
MODE='help'
continue
fi
# otherwise, pass through arguments
ARGS[${#ARGS[@]}]="$var"
done
# if there's no file to run after parsing arguments, run "help" after warning of the problem.
if [ ${#ARGS[@]} -eq 0 ]; then
echo ''
echo 'ERROR: No input file specified! See options below.'
MODE='help'
fi
# run Driver.py based on the mode chosen
case $MODE in
'opt' )
echo 'Running RAVEN in "opt" mode.'
python -O $SCRIPT_DIR/framework/Driver.py "$ARGS"
;;
'dev' )
echo 'Running RAVEN in "dev" mode.'
python $SCRIPT_DIR/framework/Driver.py "$ARGS"
;;
'help' )
echo ''
echo ' ------------------------------------------'
echo ' Default usage:'
echo ' raven_framework filename.xml'
echo ''
echo ' Description:'
echo ' This will run RAVEN in "opt" mode using "filename.xml" as the input. This should be'
echo ' sufficient for the majority of RAVEN calculations. For more options, see below.'
echo ' ------------------------------------------'
echo ''
echo ' Advanced usage:'
echo ' raven_framework [-D][interfaceCheck][interactive][interactiveCheck] filename'
echo ''
echo ' Description:'
echo ' Runs RAVEN using the input file given by "filename".'
echo ''
echo ' Options:'
echo ' -D'
echo ' Development mode. Turns Python "assert" statements on.'
echo ''
echo ' help'
echo ' Shows this description and exits.'
echo ''
echo ' interfaceCheck'
echo ' Do not attempt to run the model executable, but read from existing output files.'
echo ''
echo ' interactive'
echo ' Run RAVEN in GUI mode if possible.'
echo ''
echo ' interactiveCheck'
echo ' Run tests on interactive GUI.'
echo ''
;;
*)
echo 'Unrecognized MODE "'${MODE}'" in raven_framework! Exiting ...'
esac