/
update_parameters.sh
executable file
·54 lines (46 loc) · 2.26 KB
/
update_parameters.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
#!/bin/bash
# run this script from the doc directory to update parameters.tex. Note that
# you need an in-source build or a symbolic link to the ASPECT binary in the
# main directory.
ASPECT=${1:-"./aspect"}
cd ..
if test ! -f $ASPECT ; then
echo "Please provide the path of the ASPECT executable as the first argument to this script or create a link in the main source directory. "
exit 1
fi
rm -f output/parameters.tex
$ASPECT doc/manual/empty.prm >/dev/null 2>/dev/null || echo "running ASPECT failed"
cp output/parameters.tex doc/manual/ || echo "ERROR: could not copy parameters.tex"
cd doc/manual
echo patching parameters.tex
sed -i 's/LD_LIBRARY_PATH/LD\\_LIBRARY\\_PATH/g' parameters.tex
sed -i 's/tecplot_binary/tecplot\\_binary/g' parameters.tex
sed -i 's/MIN_DOUBLE/MIN\\_DOUBLE/g' parameters.tex
sed -i 's/MAX_DOUBLE/MAX\\_DOUBLE/g' parameters.tex
sed -i 's/hyper_shell/hyper\\_shell/g' parameters.tex
sed -i 's/\$ASPECT_SOURCE_DIR/\\\$ASPECT\\_SOURCE\\_DIR/g' parameters.tex
sed -i 's/<depth_average.ext>/$<$depth\\_average.ext$>$/g' parameters.tex
sed -i 's/<myplugin.so>/$<$myplugin.so$>$/g' parameters.tex
sed -i 's/<\.\/myplugin.so>/$<$\.\/myplugin.so$>$/g' parameters.tex
sed -i 's/<\[/\[/g' parameters.tex
sed -i 's/\]>/\]/g' parameters.tex
sed -i 's/dynamic_topography.NNNNN/dynamic\\_topography.NNNNN/g' parameters.tex
sed -i 's/Spline_knots.txt/Spline\\_knots.txt/g' parameters.tex
sed -i 's/stokes_residuals.txt/stokes\\_residuals.txt/g' parameters.tex
sed -i 's/adiabatic_boundary.txt/adiabatic\\_boundary.txt/g' parameters.tex
sed -i 's/melt_fraction/melt\\_fraction/g' parameters.tex
sed -i 's/phi\.%d/phi\.\\%d/g' parameters.tex
sed -i 's/box_2d_%s.%d/box\\_2d\\_\\%s.\\%d/g' parameters.tex
sed -i 's/box_2d_%s./box\\_2d\\_\\%s./g' parameters.tex
sed -i 's/box_2d\.txt/box\\_2d\.txt/g' parameters.tex
sed -i 's/#/\\#/g' parameters.tex
# Process index entries to contain at most three levels (by replacing the
# fourth separator marker ! by /). This is repeated 10 times because only one
# nesting level is removed in each call to sed. The replacement is necessary
# as makeindex only allows for three levels of nesting.
for i in `seq 1 10`; do
sed -i 's/{\([^!]*\)!\([^!]*\)!\([^!]*\)!\([^}]*\)}/{\1!\2!\3\/\4}/' parameters.tex
done
grep '[^\\]%' parameters.tex
cd ..
echo done