Salome HOME
Cleaned some code
authorRenaud Barate <renaud.barate@edf.fr>
Tue, 26 Jan 2010 13:46:48 +0000 (13:46 +0000)
committerRenaud Barate <renaud.barate@edf.fr>
Tue, 26 Jan 2010 13:46:48 +0000 (13:46 +0000)
build_configure
configure.ac
src/GENERICSOLVER/GENERICSOLVER.py
src/GENERICSOLVERGUI/GENERICSOLVERGUI.py

index 4f365ace5641a4c5b0adb41b7b709698bc087708..b2c03c9f1aa2f56c46ad5246ca1cd31f27363c0a 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/bash
-#  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -26,6 +26,9 @@
 # Modified by : Alexander BORODIN (OCN) - autotools usage
 # Date : 10/10/2002
 #
+# $Id$
+#
+
 ORIG_DIR=`pwd`
 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
 
@@ -50,21 +53,8 @@ cd ${CONF_DIR}
 ABS_CONF_DIR=`pwd`
 
 mkdir -p salome_adm/unix/config_files
-#cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/* salome_adm/unix/config_files
-#cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/pythonbe.py salome_adm/unix
-
 cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix
 
-#cp -f ${GUI_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
-
-# remove KERNEL deprecated configure files
-#for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \
-#  check_mico.m4 config.guess ltmain.sh ac_cxx_bool.m4 ltconfig ac_cxx_typename.m4 \
-#    check_pthreads.m4 config.sub libtool.m4 ac_cxx_mutable.m4 missing
-#    do
-#      rm -f salome_adm/unix/config_files/${deprecated}
-#      done
-
 
 # ____________________________________________________________________
 # aclocal creates the aclocal.m4 file from the standard macro and the
@@ -77,20 +67,7 @@ echo "====================================================== aclocal"
 
 aclocal -I adm_local/unix/config_files \
         -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
-       -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1
-
-# ____________________________________________________________________
-# libtoolize creates some configuration files (ltmain.sh,
-# config.guess and config.sub). It only depends on the libtool
-# version. The files are created in the directory specified with the
-# AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac).
-# output:
-#   salome_adm/unix/config_files/config.guess
-#   salome_adm/unix/config_files/config.sub
-#   salome_adm/unix/config_files/ltmain.sh
-#echo "====================================================== libtoolize"
-
-libtoolize --force --copy --automake || exit 1
+        -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1
 
 # ____________________________________________________________________
 # autoconf creates the configure script from the file configure.ac (or
index daf43a42d13cb3312c0b8972abf38085c1f9efdf..14eab81a00dc723ce1baffd9c5200ab2e912ea03 100644 (file)
@@ -1,4 +1,4 @@
-#  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-#  PLEASE DO NOT MODIFY configure.in FILE
-#  ALL CHANGES WILL BE DISCARDED BY THE NEXT
-#  build_configure COMMAND
-#  CHANGES MUST BE MADE IN configure.in.base FILE
 # Author : Marc Tajchman (CEA)
 # Date : 28/06/2001
 # Modified by : Patrick GOLDBRONN (CEA)
 # Modified by : Marc Tajchman (CEA)
-# Created from configure.in.base
+# $Id$
 #
-AC_INIT([Salome2 Project GENERICSOLVER module], [5.1.3], [webmaster.salome@opencascade.com], [SalomeGENERICSOLVER])
+
+AC_INIT([Salome GENERICSOLVER module],[5.1.3],[webmaster.salome@opencascade.com],[SalomeGENERICSOLVER])
 AC_CONFIG_AUX_DIR(salome_adm/unix/config_files)
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
@@ -64,15 +61,6 @@ echo
 AC_CHECK_PROG(SHELL,sh)
 AC_SUBST(SHELL)
 
-if test -z "$AR"; then
-   AC_CHECK_PROGS(AR,ar xar,:,$PATH)
-fi
-AC_SUBST(AR)
-
-dnl Export the AR macro so that it will be placed in the libtool file
-dnl correctly.
-export AR
-
 echo
 echo ---------------------------------------------
 echo testing make
@@ -81,23 +69,10 @@ echo
 
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
-dnl 
-dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + for shared libraries
 
 AC_ENABLE_DEBUG(yes)
 AC_DISABLE_PRODUCTION
 
-echo ---------------------------------------------
-echo testing libtool
-echo ---------------------------------------------
-
-dnl first, we set static to no!
-dnl if we want it, use --enable-static
-AC_ENABLE_STATIC(no)
-
-AC_LIBTOOL_DLOPEN
-AC_PROG_LIBTOOL
-
 dnl Fix up the INSTALL macro if it s a relative path. We want the
 dnl full-path to the binary instead.
 case "$INSTALL" in
@@ -207,15 +182,15 @@ echo generating Makefiles and configure files
 echo ---------------------------------------------
 echo
 
-AC_OUTPUT_COMMANDS([ \
+AC_CONFIG_COMMANDS([default-1],[[ \
       chmod +x ./bin/*; \
-])
+]],[[]])
 
 # This list is initiated using autoscan and must be updated manually
 # when adding a new file <filename>.in to manage. When you execute
 # autoscan, the Makefile list is generated in the output file configure.scan.
-# This could be helpfull to update de configuration.
-AC_OUTPUT([ \
+# This could be helpful to update de configuration.
+AC_CONFIG_FILES([ \
   salome_adm/unix/SALOMEconfig.h \
   adm_local/Makefile \
   adm_local/unix/Makefile \
@@ -232,3 +207,4 @@ AC_OUTPUT([ \
   idl/Makefile \
   Makefile \
 ])
+AC_OUTPUT
index 6a852f477b0021af684200e9ac62d7df3dc10bcb..702e5cb435715aceac2921dfe96ed8cdd6bcdd2f 100644 (file)
 #
 
 import traceback
+
+import salome
 import GENERICSOLVER_ORB__POA
 import SALOME_ComponentPy
 import SALOME_DriverPy
 
-from omniORB import CORBA
-from SALOME_NamingServicePy import *
-from LifeCycleCORBA import *
-import SALOMEDS
-import SALOMEDS_Attributes_idl
-
 
 VARIABLE_ID = 1030
 
-################################################
-
-# init ORB
-orb = CORBA.ORB_init( [''], CORBA.ORB_ID )
-
-# create naming service instance
-naming_service = SALOME_NamingServicePy_i( orb )
-
-# create life cycle CORBA instance
-lcc = LifeCycleCORBA( orb )
-
-# get study manager
-obj = naming_service.Resolve( '/myStudyManager' )
-studyManager = obj._narrow( SALOMEDS.StudyManager )
-
-################################################
-###
-# get active study
-###
-def getStudy( studyId ):
-    #studyId = getStudyId()
-    study = studyManager.GetStudyByID( studyId )
-    return study
-
 ###
 # Retrieve data from selected case
 ###
 def GetDataFromCase( studyId, caseEntry ):
     theCase = {}
-    study = getStudy( studyId )
+    study = salome.myStudyManager.GetStudyByID( studyId )
     case = study.FindObjectID( caseEntry )
     builder = study.NewBuilder()
     # Get the values of the variables and make them a list
@@ -81,7 +53,7 @@ def GetDataFromCase( studyId, caseEntry ):
 # Add some variable to the case
 ###
 def AddDataToCase( studyId, caseEntry, varName, varValue ):
-    study = getStudy( studyId )
+    study = salome.myStudyManager.GetStudyByID( studyId )
     case = study.FindObjectID( caseEntry )
     builder = study.NewBuilder()
     var = addObjectInStudy( builder, case, varName, VARIABLE_ID )
@@ -126,7 +98,7 @@ def getValueOfVariable( builder, varobj ):
 
 def getSubSObjectByName( studyId, sobjFather, childName ):
     print "GENERICSOLVER.getSubSObjectByName Looking for sobjet named", childName
-    study = getStudy( studyId )
+    study = salome.myStudyManager.GetStudyByID( studyId )
     iter = study.NewChildIterator( sobjFather )
     #builder = study.NewBuilder()
     while iter.More():
@@ -141,8 +113,8 @@ def getSubSObjectByName( studyId, sobjFather, childName ):
 ################################################
 
 class GENERICSOLVER(GENERICSOLVER_ORB__POA.GENERICSOLVER_Gen,
-              SALOME_ComponentPy.SALOME_ComponentPy_i,
-              SALOME_DriverPy.SALOME_DriverPy_i):
+                    SALOME_ComponentPy.SALOME_ComponentPy_i,
+                    SALOME_DriverPy.SALOME_DriverPy_i):
     """
         Pour etre un composant SALOME cette classe Python
         doit avoir le nom du composant et heriter de la
@@ -179,6 +151,7 @@ class GENERICSOLVER(GENERICSOLVER_ORB__POA.GENERICSOLVER_Gen,
         print "GENERICSOLVER.Init : enter"
         print "GENERICSOLVER.Init : studyId = %d - caseEntry = %s - wrapperDescription = %s" % ( studyId, caseEntry, wrapperDescription )
         self.wrapperDescription = wrapperDescription
+        salome.salome_init()
         
         try:
             self.case = GetDataFromCase( studyId, caseEntry )
index defaca3a20e04b89af3d93532251836cbf4b7fe2..65b8864be99038d1d0738222a1bdcdaf57d64017 100644 (file)
@@ -1,4 +1,4 @@
-#  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 # Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 # ---
 #
+# $Id$
+#
+
 import traceback
 import os
 from PyQt4.QtGui import *
 from PyQt4.QtCore import *
 
-from omniORB import CORBA
-from SALOME_NamingServicePy import *
-from LifeCycleCORBA import *
+import salome
 import SALOMEDS
-import SALOMEDS_Attributes_idl
-
 import GENERICSOLVER_ORB
 
+salome.salome_init()
+
 ################################################
 # GUI context class
 # Used to store actions, menus, toolbars, etc...
@@ -143,21 +144,6 @@ sgPyQt = SalomePyQt.SalomePyQt()
 import libSALOME_Swig
 sg = libSALOME_Swig.SALOMEGUI_Swig()
 
-################################################
-
-# init ORB
-orb = CORBA.ORB_init( [''], CORBA.ORB_ID )
-
-# create naming service instance
-naming_service = SALOME_NamingServicePy_i( orb )
-
-# create life cycle CORBA instance
-lcc = LifeCycleCORBA( orb )
-
-# get study manager
-obj = naming_service.Resolve( '/myStudyManager' )
-studyManager = obj._narrow( SALOMEDS.StudyManager )
-
 ################################################
 # Internal methods
 ################################################
@@ -181,7 +167,7 @@ def verbose():
 # get GENERICSOLVER engine
 ###
 def getEngine():
-    engine = lcc.FindOrLoadComponent( "FactoryServerPy", GUIcontext.MODULE_NAME )
+    engine = salome.lcc.FindOrLoadComponent( "FactoryServerPy", GUIcontext.MODULE_NAME )
     return engine
 
 ###
@@ -195,7 +181,7 @@ def getStudyId():
 ###
 def getStudy():
     studyId = getStudyId()
-    study = studyManager.GetStudyByID( studyId )
+    study = salome.myStudyManager.GetStudyByID( studyId )
     return study
 
 ###
@@ -655,10 +641,8 @@ def RunSOLVER():
     getEngine().Init( getStudyId(), case, "" )
     
     inPoint = GetDataFromCase( case )[:2]
-    outPoint = [0, 0]
     print "GENERICSOLVERGUI.RunSOLVER (1): inPoint  = ", inPoint
-    print "GENERICSOLVERGUI.RunSOLVER (1): outPoint = ", outPoint
-    (ok,outPoint) = getEngine().Exec( inPoint, outPoint )
+    (ok, outPoint) = getEngine().Exec(inPoint)
     print "GENERICSOLVERGUI.RunSOLVER (2): inPoint  = ", inPoint
     print "GENERICSOLVERGUI.RunSOLVER (2): outPoint = ", outPoint
     AddDataToCase( case, "Deviation", outPoint[0] )