-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreprocessing.sh.example
More file actions
executable file
·112 lines (97 loc) · 5 KB
/
preprocessing.sh.example
File metadata and controls
executable file
·112 lines (97 loc) · 5 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
set -e
# Backup Files
if [ $1 -eq 1 ]
then
cp -rf ./files/neighbour.txt ./backup_files/neighbour.txt
cp -rf ./files/output.txt ./backup_files/output.txt
cp -rf ./files/preprocessorfile_cleaned.txt ./backup_files/preprocessorfile_cleaned.txt
cp -rf ./files/preprocessorfile_rechecker.txt ./backup_files/preprocessorfile_rechecker.txt
cp -rf ./files/preprocessorfile.txt ./backup_files/preprocessorfile.txt
# cp -rf ./files/preprocessorfile_normal.txt ./backup_files/preprocessorfile_normal.txt
cp -rf wall.json ./backup_files/wall.json
echo Backup completed
# Reinstate Backup Files
elif [ $1 -eq 2 ]
then
cp -rf ./backup_files/neighbour.txt ./files/neighbour.txt
cp -rf ./backup_files/output.txt ./files/output.txt
cp -rf ./backup_files/preprocessorfile_cleaned.txt ./files/preprocessorfile_cleaned.txt
cp -rf ./backup_files/preprocessorfile_rechecker.txt ./files/preprocessorfile_rechecker.txt
cp -rf ./backup_files/preprocessorfile.txt ./files/preprocessorfile.txt
cp -rf ./backup_files/preprocessorfile_normal.txt ./files/preprocessorfile_normal.txt
cp -rf ./backup_files/wall.json wall.json
echo Backup reinstated
# Clean directory
elif [ $1 -eq 3 ]
then
rm -rf files
rm -rf backup_files
rm -f wall.json
rm -f adapted.txt
touch adapted.txt
mkdir files
mkdir backup_files
make clean -f ./quadtree/Makefile
make -f ./quadtree/Makefile
echo Everything wiped
# Adaptation
elif [ $1 -eq 4 ]
then
# Adaptation Points
python3 ./adapter/adapter.py -i ./files/preprocessorfile_normal.txt -a ./sensor_flag.dat
# cp -rlf ./pseudopoints.txt ./files/pseudopoints.txt
# rm ./pseudopoints.txt
echo Adaptation points added
elif [ $1 -eq 5 ]
then
# Iteration Backup
# Run as ./preprocessing.sh 5 Iteration_Number Folder{1,2,3,4,5 from the required f1,f2,f3,f4,f5 folder}_Number
GEOMETRY="airfoil_flap_dense" # The folder in which the iterations will be stored
mkdir ./backup_files/$GEOMETRY/$2
cp -rf ./files/f$3/neighbour.txt ./backup_files/$GEOMETRY/$2/neighbour.txt
cp -rf ./files/f$3/output.txt ./backup_files/$GEOMETRY/$2/output.txt
cp -rf ./files/f$3/preprocessorfile_cleaned.txt ./backup_files/$GEOMETRY/$2/preprocessorfile_cleaned.txt
cp -rf ./files/f$3/preprocessorfile_rechecker.txt ./backup_files/$GEOMETRY/$2/preprocessorfile_rechecker.txt
cp -rf ./files/f$3/preprocessorfile_normal.txt ./backup_files/$GEOMETRY/$2/preprocessorfile_normal.txt
cp -rf ./files/f$3/preprocessorfile.txt ./backup_files/$GEOMETRY/$2/preprocessorfile.txt
cp -rf ./files/f$3/preprocessorfile.poly ./backup_files/$GEOMETRY/$2/preprocessorfile.poly
cp -rf ./files/f$3/adapted.txt ./backup_files/$GEOMETRY/$2/adapted.txt
cp -rf ./files/f$3/blank.txt ./backup_files/$GEOMETRY/$2/blank.txt | echo "No Blank"
cp -rf ./files/f$3/wall.json ./backup_files/$GEOMETRY/$2/wall.json | echo "No Wall"
else
for value in {1..5}
do
echo $value Iteration
cp -rf ./adapted.txt ./files/f$value/adapted.txt | touch adapted.txt && echo "Creating Adaption File"
cp -rf ./blank.txt ./files/f$value/blank.txt | touch blank.txt && echo "Creating Blank File"
# Shape Generation
python3 shapemod/shape.py -w ./grids/airfoil_flap_dense/airfoil ./grids/airfoil_flap_dense/flap
# Neighbour Generation
./quadtree/main ./grids/airfoil_coarse_320/airfoil320 ./adapted.txt ./shape_generated.txt ./blank.txt
cp -rlf ./neighbour.txt ./files/f$value/neighbour.txt
rm ./neighbour.txt
# Indexing
python3 ./generator/generate.py -n ./files/f$value/neighbour.txt -w ./grids/airfoil_flap_dense/airfoil ./grids/airfoil_flap_dense/flap
cp -rlf ./preprocessorfile.txt ./files/f$value/preprocessorfile.txt
rm ./preprocessorfile.txt
# Pre Checks
python3 ./tools/pre.py -i ./files/f$value/preprocessorfile.txt
cp -rlf ./preprocessorfile_cleaned.txt ./files/f$value/preprocessorfile_cleaned.txt
cp -rlf ./preprocessorfile.poly ./files/f$value/preprocessorfile.poly
rm ./preprocessorfile.poly
rm ./preprocessorfile_cleaned.txt
python3 ./triangulate/triangulate.py -i ./files/f$value/preprocessorfile_cleaned.txt -a False True True
cp -rlf ./preprocessorfile_triangulate.txt ./files/f$value/preprocessorfile_triangulate.txt
rm ./preprocessorfile_triangulate.txt
python3 ./rechecker/rechecker.py -i ./files/f$value/preprocessorfile_triangulate.txt
cp -rlf ./preprocessorfile_rechecker.txt ./files/f$value/preprocessorfile_rechecker.txt
rm ./preprocessorfile_rechecker.txt
python3 ./normal/normal.py -i ./files/f$value/preprocessorfile_rechecker.txt
cp -rlf ./preprocessorfile_normal.txt ./files/f$value/preprocessorfile_normal.txt
rm ./preprocessorfile_normal.txt
python3 ./bspline/bspline.py -i ./files/f$value/preprocessorfile_normal.txt -p True -q True -s True
cp -rf ./wall.json ./files/f$value/wall.json
done
echo All Done
fi