]> SALOME platform Git repositories - modules/shaper.git/blob - solver.sh
Salome HOME
Prepare a release version 9.1.0RC1
[modules/shaper.git] / solver.sh
1 #!/bin/bash
2 #
3 # Modify plugins.xml to switch solver
4
5 export PLUGINS_PATH=${PLUGINS_PATH:-${SHAPER_ROOT_DIR}/share/salome/resources/shaper/plugins.xml}
6
7 while [[ $# > 0 ]]; do
8   key="$1"
9   case $key in
10     solvespace|ss)
11       export solver=SolveSpace
12       shift
13       ;;
14     planegcs|gcs)
15       export solver=PlaneGCS
16       shift
17       ;;
18     -p)
19       export PLUGINS_PATH="$2" 
20       shift
21       shift
22       ;;
23     *)
24       shift
25       ;;
26   esac
27 done
28
29 if [[ -z ${solver:-} ]]; then exit 0; fi
30
31 case $solver in
32   PlaneGCS)
33     export SWITCH_ON=PlaneGCSSolver
34     export SWITCH_OFF=SolveSpaceSolver
35     ;;
36   SolveSpace|*)
37     export SWITCH_ON=SolveSpaceSolver
38     export SWITCH_OFF=PlaneGCSSolver
39     ;;
40 esac
41
42 echo "Switch $solver solver in ${PLUGINS_PATH}"
43
44 cat ${PLUGINS_PATH} \
45   | tr '\n' '\r' \
46   | sed -e "s|\r  <plugin library=\"[^\r]*Solver\"\/>\r<!--|\r  <plugin library=\"${solver}Solver\"\/>\r<!--|" \
47   | tr '\r' '\n' \
48   > ${PLUGINS_PATH}_out
49 mv -f ${PLUGINS_PATH}_out ${PLUGINS_PATH}
50 cat ${PLUGINS_PATH}
51