From: spo Date: Wed, 23 Dec 2015 09:36:23 +0000 (+0300) Subject: Make salome_run.sh and linux_run.sh supporting args ss/gcs to select a solver X-Git-Tag: V_2.1.0~99 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=31511e6b2ba2ac8a4650581d9abcb3beb3191a43;p=modules%2Fshaper.git Make salome_run.sh and linux_run.sh supporting args ss/gcs to select a solver --- diff --git a/linux_run.sh b/linux_run.sh index 5294b8828..f84755c19 100755 --- a/linux_run.sh +++ b/linux_run.sh @@ -3,6 +3,8 @@ source env.sh source ${TOOLS_DIR}/env_standalone.sh +${TOOLS_DIR}/solver.sh "$@" + APP=${NEWGEOM_ROOT_DIR}/bin/GeomApp ${APP} diff --git a/salome_run.sh b/salome_run.sh index 5984410f1..8feb27cac 100755 --- a/salome_run.sh +++ b/salome_run.sh @@ -3,6 +3,8 @@ source env.sh source ${TOOLS_DIR}/env_salome.sh +${TOOLS_DIR}/solver.sh "$@" + # kill processes of previous SALOME run if [ -f .salomeport ]; then SALOME_PORT=$(cat .salomeport) diff --git a/solver.sh b/solver.sh new file mode 100755 index 000000000..c4a2426ac --- /dev/null +++ b/solver.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Modify plugins.xml to switch solver + +export solver=${solver:-SolveSpace} +export PLUGINS_PATH=${PLUGINS_PATH:-${NEWGEOM_ROOT_DIR}/plugins/plugins.xml} + +while [[ $# > 0 ]]; do + key="$1" + case $key in + solvespace|ss) + export solver=SolveSpace + shift + ;; + planegcs|gcs) + export solver=PlaneGCS + shift + ;; + -p) + export PLUGINS_PATH="$2" + shift + shift + ;; + *) + shift + ;; + esac +done + +case $solver in + PlaneGCS) + export SWITCH_ON=PlaneGCSSolver + export SWITCH_OFF=SolveSpaceSolver + ;; + SolveSpace|*) + export SWITCH_ON=SolveSpaceSolver + export SWITCH_OFF=PlaneGCSSolver + ;; +esac + +echo "Switch $solver solver in ${PLUGINS_PATH}" + +cat ${PLUGINS_PATH} \ + | sed -e "s/^\(\)\?/\2/" \ + | sed -e "s/^\(\)\?//" \ + > ${PLUGINS_PATH}_out +mv -f ${PLUGINS_PATH}_out ${PLUGINS_PATH} +cat ${PLUGINS_PATH} +