From: Jean-Philippe ARGAUD Date: Wed, 25 Feb 2015 09:59:11 +0000 (+0100) Subject: Simplifying internal treatments and documentation X-Git-Tag: V7_6_0~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e7d4192b945dad67eabcc251d78da60d5db08f10;p=modules%2Fadao.git Simplifying internal treatments and documentation --- diff --git a/bin/AdaoYacsSchemaCreator.py b/bin/AdaoYacsSchemaCreator.py index 9ebc5b0..eb3322b 100644 --- a/bin/AdaoYacsSchemaCreator.py +++ b/bin/AdaoYacsSchemaCreator.py @@ -5,7 +5,7 @@ # This file is part of SALOME ADAO module # # This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public +# modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License. # @@ -18,6 +18,8 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# # Author: André Ribes, andre.ribes@edf.fr, EDF R&D import sys diff --git a/bin/module_version.py b/bin/module_version.py index 00c041f..d9ee3cf 100644 --- a/bin/module_version.py +++ b/bin/module_version.py @@ -23,6 +23,6 @@ # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D name = "ADAO" -version = "V7_5_1" # Version pour catalogue, avec des "_" entre les numeros +version = "V7_6_0" # Version pour catalogue, avec des "_" entre les numeros date = "" year = "2015" # Annee de copyright diff --git a/doc/fr/resources/ADAOlogo.svg b/doc/fr/resources/ADAOlogo.svg deleted file mode 100644 index e2f5901..0000000 --- a/doc/fr/resources/ADAOlogo.svg +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - DA - - DA - - DA - D A - - - diff --git a/src/daEficas/Makefile.am b/src/daEficas/Makefile.am index c0181fe..744f1ef 100644 --- a/src/daEficas/Makefile.am +++ b/src/daEficas/Makefile.am @@ -1,3 +1,4 @@ +# # Copyright (C) 2008-2015 EDF R&D # # This file is part of SALOME ADAO module diff --git a/src/daEficas/__init__.py b/src/daEficas/__init__.py index 4723adf..b3bdc49 100644 --- a/src/daEficas/__init__.py +++ b/src/daEficas/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# # Copyright (C) 2008-2015 EDF R&D # # This file is part of SALOME ADAO module diff --git a/src/daEficas/configuration_ADAO.py b/src/daEficas/configuration_ADAO.py index 58cef68..4cd78ec 100644 --- a/src/daEficas/configuration_ADAO.py +++ b/src/daEficas/configuration_ADAO.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# # Copyright (C) 2008-2015 EDF R&D # # This file is part of SALOME ADAO module diff --git a/src/daEficas/convert_adao.py b/src/daEficas/convert_adao.py index 877b2ed..91386bb 100644 --- a/src/daEficas/convert_adao.py +++ b/src/daEficas/convert_adao.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# # Copyright (C) 2008-2015 EDF R&D # # This file is part of SALOME ADAO module @@ -19,7 +20,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# Author: André Ribes, andre.ribes@edf.fr, EDF R&D +# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D # print "import convert_adao" @@ -27,15 +28,15 @@ import convert.parseur_python from convert.convert_python import * def entryPoint(): - """ - Retourne les informations nécessaires pour le chargeur de plugins - Ces informations sont retournées dans un dictionnaire - """ - return { + """ + Retourne les informations nécessaires pour le chargeur de plugins + Ces informations sont retournées dans un dictionnaire + """ + return { # Le nom du plugin - 'name' : 'adao', + 'name' : 'ADAO', # La factory pour créer une instance du plugin - 'factory' : PythonParser, - } + 'factory' : PythonParser, + } diff --git a/src/daEficas/prefs.py b/src/daEficas/prefs.py index b948797..b4f0463 100644 --- a/src/daEficas/prefs.py +++ b/src/daEficas/prefs.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# # Copyright (C) 2010-2015 EDF R&D # # This file is part of SALOME ADAO module diff --git a/src/daEficas/prefs_ADAO.py.in b/src/daEficas/prefs_ADAO.py.in index 9920c74..f794946 100644 --- a/src/daEficas/prefs_ADAO.py.in +++ b/src/daEficas/prefs_ADAO.py.in @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# # Copyright (C) 2008-2015 EDF R&D # # This file is part of SALOME ADAO module diff --git a/src/daSalome/daYacsSchemaCreator/help_methods.py b/src/daSalome/daYacsSchemaCreator/help_methods.py index 09d7726..b10e74a 100644 --- a/src/daSalome/daYacsSchemaCreator/help_methods.py +++ b/src/daSalome/daYacsSchemaCreator/help_methods.py @@ -199,35 +199,11 @@ def check_data(data_name, data_config, repertory_check=False, repertory=""): check_file_name = os.path.join(repertory, os.path.basename(data_config["Data"])) if not os.path.exists(check_file_name): raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name)) - elif from_type == "FunctionDict": - FunctionDict = data_config["Data"] - for FunctionName in FunctionDict["Function"]: - check_file_name = FunctionDict["Script"][FunctionName] + elif (from_type == "FunctionDict" or from_type == "ScriptWithSwitch" or from_type == "ScriptWithFunctions" or from_type == "ScriptWithOneFunction"): + TheData = data_config["Data"] + for FunctionName in TheData["Function"]: + check_file_name = TheData["Script"][FunctionName] if repertory_check and not os.path.exists(check_file_name): - check_file_name = os.path.join(repertory, os.path.basename(FunctionDict["Script"][FunctionName])) - if not os.path.exists(check_file_name): - raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name)) - elif from_type == "ScriptWithSwitch": - ScriptWithSwitch = data_config["Data"] - for FunctionName in ScriptWithSwitch["Function"]: - check_file_name = ScriptWithSwitch["Script"][FunctionName] - if repertory_check and not os.path.exists(check_file_name): - check_file_name = os.path.join(repertory, os.path.basename(ScriptWithSwitch["Script"][FunctionName])) - if not os.path.exists(check_file_name): - raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name)) - elif from_type == "ScriptWithFunctions": - ScriptWithFunctions = data_config["Data"] - for FunctionName in ScriptWithFunctions["Function"]: - check_file_name = ScriptWithFunctions["Script"][FunctionName] - if repertory_check and not os.path.exists(check_file_name): - check_file_name = os.path.join(repertory, os.path.basename(ScriptWithFunctions["Script"][FunctionName])) - if not os.path.exists(check_file_name): - raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name)) - elif from_type == "ScriptWithOneFunction": - ScriptWithOneFunction = data_config["Data"] - for FunctionName in ScriptWithOneFunction["Function"]: - check_file_name = ScriptWithOneFunction["Script"][FunctionName] - if repertory_check and not os.path.exists(check_file_name): - check_file_name = os.path.join(repertory, os.path.basename(ScriptWithOneFunction["Script"][FunctionName])) + check_file_name = os.path.join(repertory, os.path.basename(TheData["Script"][FunctionName])) if not os.path.exists(check_file_name): raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name)) diff --git a/src/daSalome/daYacsSchemaCreator/methods.py b/src/daSalome/daYacsSchemaCreator/methods.py index 98b568d..f796239 100644 --- a/src/daSalome/daYacsSchemaCreator/methods.py +++ b/src/daSalome/daYacsSchemaCreator/methods.py @@ -361,133 +361,21 @@ def create_yacs_proc(study_config): ADAO_Case.edAddDFLink(back_node.getOutputPort("type"), CAS_node.getInputPort(key_type)) ADAO_Case.edAddDFLink(back_node.getOutputPort("stored"), CAS_node.getInputPort(key_stored)) - if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict" and key == "ObservationOperator": - FunctionDict = data_config["Data"] - for FunctionName in FunctionDict["Function"]: - port_name = "ObservationOperator" + FunctionName + if data_config["Type"] == "Function" and (key == "ObservationOperator" or key == "EvolutionModel"): + TheData = data_config["Data"] + for FunctionName in TheData["Function"]: + port_name = key + FunctionName CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(FunctionDict["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(FunctionDict["Script"][FunctionName]))) - elif repertory and os.path.exists(FunctionDict["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName]) + if repertory and not os.path.exists(TheData["Script"][FunctionName]): + CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(TheData["Script"][FunctionName]))) + elif repertory and os.path.exists(TheData["Script"][FunctionName]): + CAS_node.getInputPort(port_name).edInitPy(TheData["Script"][FunctionName]) try: CAS_node.edAddInputPort("studydir", t_string) CAS_node.getInputPort("studydir").edInitPy(base_repertory) except: pass else: - CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName]) - - if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict" and key == "EvolutionModel": - FunctionDict = data_config["Data"] - for FunctionName in FunctionDict["Function"]: - port_name = "EvolutionModel" + FunctionName - CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(FunctionDict["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(FunctionDict["Script"][FunctionName]))) - elif repertory and os.path.exists(FunctionDict["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName]) - try: - CAS_node.edAddInputPort("studydir", t_string) - CAS_node.getInputPort("studydir").edInitPy(base_repertory) - except: pass - else: - CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName]) - - if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch" and key == "ObservationOperator": - ScriptWithSwitch = data_config["Data"] - for FunctionName in ScriptWithSwitch["Function"]: - port_name = "ObservationOperator" + FunctionName - CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(ScriptWithSwitch["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithSwitch["Script"][FunctionName]))) - elif repertory and os.path.exists(ScriptWithSwitch["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName]) - try: - CAS_node.edAddInputPort("studydir", t_string) - CAS_node.getInputPort("studydir").edInitPy(base_repertory) - except: pass - else: - CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName]) - - if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch" and key == "EvolutionModel": - ScriptWithSwitch = data_config["Data"] - for FunctionName in ScriptWithSwitch["Function"]: - port_name = "EvolutionModel" + FunctionName - CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(ScriptWithSwitch["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithSwitch["Script"][FunctionName]))) - elif repertory and os.path.exists(ScriptWithSwitch["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName]) - try: - CAS_node.edAddInputPort("studydir", t_string) - CAS_node.getInputPort("studydir").edInitPy(base_repertory) - except: pass - else: - CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName]) - - if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithFunctions" and key == "ObservationOperator": - ScriptWithFunctions = data_config["Data"] - for FunctionName in ScriptWithFunctions["Function"]: - port_name = "ObservationOperator" + FunctionName - CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(ScriptWithFunctions["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithFunctions["Script"][FunctionName]))) - elif repertory and os.path.exists(ScriptWithFunctions["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName]) - try: - CAS_node.edAddInputPort("studydir", t_string) - CAS_node.getInputPort("studydir").edInitPy(base_repertory) - except: pass - else: - CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName]) - - if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithFunctions" and key == "EvolutionModel": - ScriptWithFunctions = data_config["Data"] - for FunctionName in ScriptWithFunctions["Function"]: - port_name = "EvolutionModel" + FunctionName - CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(ScriptWithFunctions["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithFunctions["Script"][FunctionName]))) - elif repertory and os.path.exists(ScriptWithFunctions["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName]) - try: - CAS_node.edAddInputPort("studydir", t_string) - CAS_node.getInputPort("studydir").edInitPy(base_repertory) - except: pass - else: - CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName]) - - if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithOneFunction" and key == "ObservationOperator": - ScriptWithOneFunction = data_config["Data"] - for FunctionName in ScriptWithOneFunction["Function"]: - port_name = "ObservationOperator" + FunctionName - CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(ScriptWithOneFunction["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithOneFunction["Script"][FunctionName]))) - elif repertory and os.path.exists(ScriptWithOneFunction["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName]) - try: - CAS_node.edAddInputPort("studydir", t_string) - CAS_node.getInputPort("studydir").edInitPy(base_repertory) - except: pass - else: - CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName]) - - if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithOneFunction" and key == "EvolutionModel": - ScriptWithOneFunction = data_config["Data"] - for FunctionName in ScriptWithOneFunction["Function"]: - port_name = "EvolutionModel" + FunctionName - CAS_node.edAddInputPort(port_name, t_string) - if repertory and not os.path.exists(ScriptWithOneFunction["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithOneFunction["Script"][FunctionName]))) - elif repertory and os.path.exists(ScriptWithOneFunction["Script"][FunctionName]): - CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName]) - try: - CAS_node.edAddInputPort("studydir", t_string) - CAS_node.getInputPort("studydir").edInitPy(base_repertory) - except: pass - else: - CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName]) + CAS_node.getInputPort(port_name).edInitPy(TheData["Script"][FunctionName]) # Step 3: create compute bloc compute_bloc = runtime.createBloc("compute_bloc") @@ -504,41 +392,13 @@ def create_yacs_proc(study_config): # Check if we have a python script for OptimizerLoopNode data_config = study_config["ObservationOperator"] opt_script_nodeOO = None - if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict": + if data_config["Type"] == "Function" and (data_config["From"] == "ScriptWithSwitch" or data_config["From"] == "FunctionDict"): # Get script - FunctionDict = data_config["Data"] + TheData = data_config["Data"] script_filename = "" - for FunctionName in FunctionDict["Function"]: + for FunctionName in TheData["Function"]: # We currently support only one file - script_filename = FunctionDict["Script"][FunctionName] - break - - # We create a new pyscript node - opt_script_nodeOO = runtime.createScriptNode("", "FunctionNodeOO") - if repertory and not os.path.exists(script_filename): - script_filename = os.path.join(base_repertory, os.path.basename(script_filename)) - try: - script_str= open(script_filename, 'r') - except: - raise ValueError("Exception in opening function script file: " + script_filename) - node_script = "#-*-coding:iso-8859-1-*-\n" - node_script += "import sys, os \n" - node_script += "filepath = \"" + os.path.dirname(script_filename) + "\"\n" - node_script += "filename = \"" + os.path.basename(script_filename) + "\"\n" - node_script += "if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):\n" - node_script += " sys.path.insert(0,filepath)\n" - node_script += script_str.read() - opt_script_nodeOO.setScript(node_script) - opt_script_nodeOO.edAddInputPort("computation", t_param_input) - opt_script_nodeOO.edAddOutputPort("result", t_param_output) - - elif data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch": - # Get script - ScriptWithSwitch = data_config["Data"] - script_filename = "" - for FunctionName in ScriptWithSwitch["Function"]: - # We currently support only one file - script_filename = ScriptWithSwitch["Script"][FunctionName] + script_filename = TheData["Script"][FunctionName] break # We create a new pyscript node opt_script_nodeOO = runtime.createScriptNode("", "FunctionNodeOO") @@ -727,43 +587,14 @@ def create_yacs_proc(study_config): if "EvolutionModel" in study_config.keys(): data_config = study_config["EvolutionModel"] opt_script_nodeEM = None - if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict": + if data_config["Type"] == "Function" and (data_config["From"] == "ScriptWithSwitch" or data_config["From"] == "FunctionDict"): # Get script - FunctionDict = data_config["Data"] + TheData = data_config["Data"] script_filename = "" - for FunctionName in FunctionDict["Function"]: + for FunctionName in TheData["Function"]: # We currently support only one file - script_filename = FunctionDict["Script"][FunctionName] + script_filename = TheData["Script"][FunctionName] break - - # We create a new pyscript node - opt_script_nodeEM = runtime.createScriptNode("", "FunctionNodeEM") - if repertory and not os.path.exists(script_filename): - script_filename = os.path.join(base_repertory, os.path.basename(script_filename)) - try: - script_str= open(script_filename, 'r') - except: - raise ValueError("Exception in opening function script file: " + script_filename) - node_script = "#-*-coding:iso-8859-1-*-\n" - node_script += "import sys, os \n" - node_script += "filepath = \"" + os.path.dirname(script_filename) + "\"\n" - node_script += "filename = \"" + os.path.basename(script_filename) + "\"\n" - node_script += "if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):\n" - node_script += " sys.path.insert(0,filepath)\n" - node_script += script_str.read() - opt_script_nodeEM.setScript(node_script) - opt_script_nodeEM.edAddInputPort("computation", t_param_input) - opt_script_nodeEM.edAddOutputPort("result", t_param_output) - - elif data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch": - # Get script - ScriptWithSwitch = data_config["Data"] - script_filename = "" - for FunctionName in ScriptWithSwitch["Function"]: - # We currently support only one file - script_filename = ScriptWithSwitch["Script"][FunctionName] - break - # We create a new pyscript node opt_script_nodeEM = runtime.createScriptNode("", "FunctionNodeEM") if repertory and not os.path.exists(script_filename):