forked from scicomp-durham/gray-scott-sim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·48 lines (40 loc) · 1.63 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
#!/bin/bash
echo "Do you want to enter parameters manually? (yes/no)"
read response
if [ "$response" = "yes" ]; then
while true; do
echo "Enter <Du>: "
read Du
if [[ $Du =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then break; else echo "Du must be a float. Please try again."; fi
done
while true; do
echo "Enter <Dv>: "
read Dv
if [[ $Dv =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then break; else echo "Dv must be a float. Please try again."; fi
done
while true; do
echo "Enter <F>: "
read F
if [[ $F =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then break; else echo "F must be a float. Please try again."; fi
done
while true; do
echo "Enter <K>: "
read K
if [[ $K =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then break; else echo "K must be a float. Please try again."; fi
done
while true; do
echo "Enter <Threshold>: "
read Threshold
if [[ $Threshold =~ ^[+-]?[0-9]+\.?[0-9]*$ ]]; then break; else echo "Threshold must be a float. Please try again."; fi
done
else
Du=$(awk -v min=0 -v max=1 'BEGIN{srand(); print min+rand()*(max-min)}')
Dv=$(awk -v min=0 -v max=1 'BEGIN{srand(); print min+rand()*(max-min)}')
F=$(awk -v min=0.01 -v max=0.1 'BEGIN{srand(); print min+rand()*(max-min)}')
K=$(awk -v min=0.03 -v max=0.07 'BEGIN{srand(); print min+rand()*(max-min)}')
Threshold=$(awk -v min=0 -v max=1 'BEGIN{srand(); print min+rand()*(max-min)}')
fi
# Run the C++ executable and redirect its output to a file
./build/src/gs_main $Du $Dv $F $K $Threshold
# Run the Python script and redirect its output to a file
python3 -u simulation.py