-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.sh
executable file
·55 lines (41 loc) · 1.34 KB
/
run.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
#!/bin/bash
#=======================
jpsvis=/Applications/jpsvis.app/Contents/MacOS/jpsvis
CONVERTER=~/workspace/jupedsim/jpscore/scripts/petrack2jpsvis.py
#python_path=~/workspace/jupedsim/jpscore/build/lib:~/workspace/jupedsim/jpscore/python_modules/jupedsim/
#=======================
EXPECTED_ARGS=4
if [[ "$#" -ne "$EXPECTED_ARGS" ]]; then
echo "Invalid number of arguments."
echo "Usage: $0 <python-script> <input-file> <output-file> <run-jpsvis>"
exit 1
fi
PYTHON_SCRIPT="$1"
INPUT_FILE="$2"
OUTPUT_FILE="$3"
RUN_JPSVIS="$4"
if [[ ! -f "$PYTHON_SCRIPT" ]]; then
echo "Error: Python script file not found: $PYTHON_SCRIPT"
exit 1
fi
if [[ ! -f "$INPUT_FILE" ]]; then
echo "Error: Input file not found: $INPUT_FILE"
exit 1
fi
echo "INFO: Running $PYTHON_SCRIPT with $INPUT_FILE $OUTPUT_FILE"
#PYTHONPATH=$python_path python "$PYTHON_SCRIPT" "$INPUT_FILE" "$OUTPUT_FILE"
python "$PYTHON_SCRIPT" "$INPUT_FILE" "$OUTPUT_FILE"
if [[ $? -ne 0 ]]; then
echo "ERROR: Simulation errors!"
exit 1
fi
if [[ "$RUN_JPSVIS" -eq 1 ]]; then
echo "INFO: Running petrack2jpsvis converter"
# create jps_output_file
$CONVERTER "$OUTPUT_FILE"
# create geometry.xml file
echo "INFO: Running json2xml converter"
python src/json2xml.py "$INPUT_FILE"
echo "INFO : run jpsvis"
$jpsvis jps_$OUTPUT_FILE
fi