]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Make salome_run.sh and linux_run.sh supporting args ss/gcs to select a solver
authorspo <sergey.pokhodenko@opencascade.com>
Wed, 23 Dec 2015 09:36:23 +0000 (12:36 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Wed, 23 Dec 2015 09:36:50 +0000 (12:36 +0300)
linux_run.sh
salome_run.sh
solver.sh [new file with mode: 0755]

index 5294b88287ccf7f3de55d1a420577f8457319062..f84755c194e9d9eb4c719d4d011de04b02cbe2fa 100755 (executable)
@@ -3,6 +3,8 @@
 source env.sh
 source ${TOOLS_DIR}/env_standalone.sh
 
+${TOOLS_DIR}/solver.sh "$@"
+
 APP=${NEWGEOM_ROOT_DIR}/bin/GeomApp
 
 ${APP}
index 5984410f1559f4ca1ab2cdc8c47478241e860ef3..8feb27cac881deaa6b8c23b1fcdf268edc6aeb81 100755 (executable)
@@ -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 (executable)
index 0000000..c4a2426
--- /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/^\(<!--\)\?\(.*${SWITCH_ON}.*\/>\)\( -->\)\?/\2/" \
+  | sed -e "s/^\(<!--\)\?\(.*${SWITCH_OFF}.*\/>\)\( -->\)\?/<!--\2 -->/" \
+  > ${PLUGINS_PATH}_out
+mv -f ${PLUGINS_PATH}_out ${PLUGINS_PATH}
+cat ${PLUGINS_PATH}
+