-
Notifications
You must be signed in to change notification settings - Fork 1
/
BCstatus
executable file
·59 lines (48 loc) · 1.17 KB
/
BCstatus
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
#!/bin/bash
# Generates an html table of Boundary conditions for ReFRESCO
# $REFRESCO_CODE_DIR needs to be defined correctly for this to run
result=$(grep '^\ *BCType.*NEUMANN\|^\ *BCType.*DIRICHLET' $REFRESCO_CODE_DIR/src/*F90 | \
sed 's/^.*\///;s/!.*$//;s/BCType//;s/[(|)]//g;s/=/:/;s/\ //g' |\
awk -F':' '{print $2 ":" $1 ":" $3}')
BC_list=$(awk -F':' '{print $1}' <<<"$result" | sort | uniq)
file_list=$(awk -F':' '{print $2}' <<<"$result" | sort | uniq)
echo '<style>
th {
text-align: left;
}
th, td, tr {
padding-left: 10px;
padding-right: 10px;
}
.NEUMANN {
color: #B0000A;
}
.DIRICHLET {
color: #0049B0;
}
</style>'
echo '<table>'
echo '<th>BC</th>'
for file in $file_list
do
echo '<th>'$file'</th>' | sed 's/\.F90//'
done
for BC in $BC_list
do
echo '<tr>'
echo '<th>'$BC'</th>'
for file in $file_list
do
values=$(grep -m 1 "^${BC}:$file" <<<"$result" | awk -F':' '{print $3}')
nb=$(grep -c "^${BC}:$file" <<<"$result")
if [[ "$nb" -gt 1 ]]
then
nb='*'
else
nb=''
fi
echo '<td class="'$values'">'$values$nb'</td>'
done
echo '</tr>'
done
echo '</table>'