From 1148349a61330daaa07b3eaa159d35e49864861a Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Thu, 3 Oct 2013 09:07:14 +0200 Subject: [PATCH] Removing obsolete case files --- src/tests/daSalome/Makefile.am | 55 -- src/tests/daSalome/test000_Blue.py | 75 --- .../daSalome/test000_Blue_AnalysisCode.py | 37 -- .../daSalome/test000_Blue_AnalysisFile.py.in | 60 -- src/tests/daSalome/test017.comm.in | 42 -- .../daSalome/test017_3DVAR_function_script.py | 66 --- src/tests/daSalome/test017_3DVAR_init_data.py | 44 -- .../test_aster_zzzz159a_LBFGSB.comm.in | 98 --- .../test_aster_zzzz159a_aster_functions.py | 560 ------------------ .../test_aster_zzzz159a_background.py | 35 -- .../test_aster_zzzz159a_background_error.py | 37 -- .../daSalome/test_aster_zzzz159a_functions.py | 90 --- .../test_aster_zzzz159a_init_algorithm.py | 35 -- ...st_aster_zzzz159a_init_algorithm_LBFGSB.py | 35 -- .../test_aster_zzzz159a_init_parameters.py.in | 87 --- .../test_aster_zzzz159a_observation.py | 38 -- .../test_aster_zzzz159a_observation_error.py | 36 -- src/tests/daSalome/zzzz159a.3 | 83 --- src/tests/daSalome/zzzz159a.export.esclave.in | 14 - src/tests/daSalome/zzzz159a.mail | 65 -- 20 files changed, 1592 deletions(-) delete mode 100644 src/tests/daSalome/Makefile.am delete mode 100644 src/tests/daSalome/test000_Blue.py delete mode 100644 src/tests/daSalome/test000_Blue_AnalysisCode.py delete mode 100644 src/tests/daSalome/test000_Blue_AnalysisFile.py.in delete mode 100644 src/tests/daSalome/test017.comm.in delete mode 100644 src/tests/daSalome/test017_3DVAR_function_script.py delete mode 100644 src/tests/daSalome/test017_3DVAR_init_data.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm.in delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_aster_functions.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_background.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_background_error.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_functions.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_init_algorithm.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_init_algorithm_LBFGSB.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_init_parameters.py.in delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_observation.py delete mode 100644 src/tests/daSalome/test_aster_zzzz159a_observation_error.py delete mode 100644 src/tests/daSalome/zzzz159a.3 delete mode 100644 src/tests/daSalome/zzzz159a.export.esclave.in delete mode 100644 src/tests/daSalome/zzzz159a.mail diff --git a/src/tests/daSalome/Makefile.am b/src/tests/daSalome/Makefile.am deleted file mode 100644 index fbf014d..0000000 --- a/src/tests/daSalome/Makefile.am +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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 - -include $(top_srcdir)/adm_local/make_common_starter.am - -DATA_INST = \ - test000_Blue_AnalysisCode.py test000_Blue_AnalysisFile.py test000_Blue.py \ - test017_3DVAR_function_script.py test017_3DVAR_init_data.py \ - test017.comm \ - test_aster_zzzz159a_background_error.py \ - test_aster_zzzz159a_background.py \ - test_aster_zzzz159a_observation_error.py \ - test_aster_zzzz159a_observation.py \ - test_aster_zzzz159a_functions.py \ - test_aster_zzzz159a_aster_functions.py \ - test_aster_zzzz159a_init_algorithm.py \ - test_aster_zzzz159a_init_parameters.py \ - test_aster_zzzz159a_init_algorithm_LBFGSB.py \ - zzzz159a.3 zzzz159a.export.esclave zzzz159a.mail \ - test_aster_zzzz159a_LBFGSB.comm - -testsdasalome_DATA = ${DATA_INST} - -EXTRA_DIST = test000_Blue_AnalysisCode.py test000_Blue_AnalysisFile.py.in test000_Blue.py \ - test017_3DVAR_function_script.py test017_3DVAR_init_data.py \ - test017.comm.in \ - test_aster_zzzz159a_background_error.py \ - test_aster_zzzz159a_background.py \ - test_aster_zzzz159a_observation_error.py \ - test_aster_zzzz159a_observation.py \ - test_aster_zzzz159a_functions.py \ - test_aster_zzzz159a_aster_functions.py \ - test_aster_zzzz159a_init_algorithm.py \ - test_aster_zzzz159a_init_parameters.py.in \ - test_aster_zzzz159a.py.in \ - test_aster_zzzz159a_init_algorithm_LBFGSB.py \ - zzzz159a.3 zzzz159a.export.esclave.in zzzz159a.mail \ - test_aster_zzzz159a_LBFGSB.comm.in diff --git a/src/tests/daSalome/test000_Blue.py b/src/tests/daSalome/test000_Blue.py deleted file mode 100644 index 5eb2ecb..0000000 --- a/src/tests/daSalome/test000_Blue.py +++ /dev/null @@ -1,75 +0,0 @@ -#-*-coding:iso-8859-1-*- -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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 - -study_config = {} -study_config["Name"] = "test000_Blue" -study_config["Algorithm"] = "Blue" - -Background_config = {} -Background_config["Data"] = "0,1,2" -Background_config["Type"] = "Vector" -Background_config["From"] = "String" -study_config["Background"] = Background_config - -BackgroundError_config = {} -BackgroundError_config["Data"] = "1 0 0;0 1 0;0 0 1" -BackgroundError_config["Type"] = "Matrix" -BackgroundError_config["From"] = "String" -study_config["BackgroundError"] = BackgroundError_config - -Observation_config = {} -Observation_config["Data"] = "0.5,1.5,2.5" -Observation_config["Type"] = "Vector" -Observation_config["From"] = "String" -study_config["Observation"] = Observation_config - -ObservationError_config = {} -ObservationError_config["Data"] = "1 0 0;0 1 0;0 0 1" -ObservationError_config["Type"] = "Matrix" -ObservationError_config["From"] = "String" -study_config["ObservationError"] = ObservationError_config - -ObservationOperator_config = {} -ObservationOperator_config["Data"] = "1 0 0;0 1 0;0 0 1" -ObservationOperator_config["Type"] = "Matrix" -ObservationOperator_config["From"] = "String" -study_config["ObservationOperator"] = ObservationOperator_config - -Analysis_config = {} -Analysis_config["Data"] = """ -import numpy -precision = 1.e-13 - -Xa = ADD.get("Analysis") -print -print " Nombre d'analyses :",Xa.stepnumber() -print " Analyse résultante :",Xa[0] -# -# Vérification du résultat -# ------------------------ -if max(numpy.array(Xa[0])-numpy.array([0.25, 1.25, 2.25])) > precision: - raise ValueError("Résultat du test erroné") -else: - print " Test correct, erreur maximale inférieure à %s"%precision - print -""" -Analysis_config["From"] = "String" -study_config["Analysis"] = Analysis_config diff --git a/src/tests/daSalome/test000_Blue_AnalysisCode.py b/src/tests/daSalome/test000_Blue_AnalysisCode.py deleted file mode 100644 index 6d07a3b..0000000 --- a/src/tests/daSalome/test000_Blue_AnalysisCode.py +++ /dev/null @@ -1,37 +0,0 @@ -#-*-coding:iso-8859-1-*- -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D - -import numpy -precision = 1.e-13 - -Xa = ADD.get("Analysis") -print -print " Nombre d'analyses :",Xa.stepnumber() -print " Analyse résultante :",Xa[0] -# -# Vérification du résultat -# ------------------------ -if max(numpy.array(Xa[0])-numpy.array([0.25, 1.25, 2.25])) > precision: - raise ValueError("Résultat du test erroné") -else: - print " Test correct, erreur maximale inférieure à %s"%precision - print - diff --git a/src/tests/daSalome/test000_Blue_AnalysisFile.py.in b/src/tests/daSalome/test000_Blue_AnalysisFile.py.in deleted file mode 100644 index 463f29d..0000000 --- a/src/tests/daSalome/test000_Blue_AnalysisFile.py.in +++ /dev/null @@ -1,60 +0,0 @@ -#-*-coding:iso-8859-1-*- -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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 - -study_config = {} -study_config["Name"] = "test000_Blue" -study_config["Algorithm"] = "Blue" - -Background_config = {} -Background_config["Data"] = "0,1,2" -Background_config["Type"] = "Vector" -Background_config["From"] = "String" -study_config["Background"] = Background_config - -BackgroundError_config = {} -BackgroundError_config["Data"] = "1 0 0;0 1 0;0 0 1" -BackgroundError_config["Type"] = "Matrix" -BackgroundError_config["From"] = "String" -study_config["BackgroundError"] = BackgroundError_config - -Observation_config = {} -Observation_config["Data"] = "0.5,1.5,2.5" -Observation_config["Type"] = "Vector" -Observation_config["From"] = "String" -study_config["Observation"] = Observation_config - -ObservationError_config = {} -ObservationError_config["Data"] = "1 0 0;0 1 0;0 0 1" -ObservationError_config["Type"] = "Matrix" -ObservationError_config["From"] = "String" -study_config["ObservationError"] = ObservationError_config - -ObservationOperator_config = {} -ObservationOperator_config["Data"] = "1 0 0;0 1 0;0 0 1" -ObservationOperator_config["Type"] = "Matrix" -ObservationOperator_config["From"] = "String" -study_config["ObservationOperator"] = ObservationOperator_config - -Analysis_config = {} -Analysis_config["Data"] = "@prefix@/tests/daSalome/test000_Blue_AnalysisCode.py" -Analysis_config["From"] = "Script" -study_config["Analysis"] = Analysis_config - diff --git a/src/tests/daSalome/test017.comm.in b/src/tests/daSalome/test017.comm.in deleted file mode 100644 index 4d6c934..0000000 --- a/src/tests/daSalome/test017.comm.in +++ /dev/null @@ -1,42 +0,0 @@ - -ASSIMILATION_STUDY(Study_name='test017', - Study_repertory='@prefix@/tests/daSalome', - Debug=0, - Algorithm='3DVAR', - Background=_F(INPUT_TYPE='Vector', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test017_3DVAR_init_data.py',),), - BackgroundError=_F(INPUT_TYPE='Matrix', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test017_3DVAR_init_data.py',),), - Observation=_F(INPUT_TYPE='Vector', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test017_3DVAR_init_data.py',),), - ObservationError=_F(INPUT_TYPE='Matrix', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test017_3DVAR_init_data.py',),), - ObservationOperator=_F(INPUT_TYPE='Function', - data=_F(FROM='FunctionDict', - FUNCTIONDICT_FILE= - 'test017_3DVAR_function_script.py',),), - UserPostAnalysis=_F(FROM='String', - STRING= -"""import numpy -dimension = 300 -precision = 1.e-10 -xt = numpy.matrix(numpy.arange(dimension)).T -xb = Study.getBackground() -xa = numpy.array(ADD.get("Analysis")[0]) -d = numpy.array(ADD.get("Innovation")[0]) -# -# Verification du resultat -# ------------------------ -if max(abs(xa - (xb+xt.A1)/2)) > precision: - raise ValueError("Resultat du test errone (1)") -else: - print " Test correct, erreur maximale inferieure à %s"%precision -""",),); diff --git a/src/tests/daSalome/test017_3DVAR_function_script.py b/src/tests/daSalome/test017_3DVAR_function_script.py deleted file mode 100644 index a951798..0000000 --- a/src/tests/daSalome/test017_3DVAR_function_script.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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 numpy - -print computation -method = "" -for param in computation["specificParameters"]: - if param["name"] == "method": - method = param["value"] -print "Method found is", method - -dimension = 300 -H = numpy.matrix(numpy.core.identity(dimension)) - -def FunctionH( X ): - return H * X - -def AdjointH( (X, Y) ): - return H.T * Y - -print computation["inputValues"][0][0][0] -print computation["inputValues"][0][0][0][0] - -if method == "Direct": - data = FunctionH(numpy.matrix(computation["inputValues"][0][0][0]).T) - -if method == "Tangent": - data = FunctionH(numpy.matrix(computation["inputValues"][0][0][0]).T) - -if method == "Adjoint": - data = AdjointH((numpy.matrix(computation["inputValues"][0][0][0]).T, numpy.matrix(computation["inputValues"][0][0][1]).T)) - - -outputValues = [[[[]]]] -it = data.flat -for val in it: - outputValues[0][0][0].append(val) - -print outputValues - -result = {} -result["outputValues"] = outputValues -result["specificOutputInfos"] = [] -result["returnCode"] = 0 -result["errorMessage"] = "" - -print result -print "Computation end" diff --git a/src/tests/daSalome/test017_3DVAR_init_data.py b/src/tests/daSalome/test017_3DVAR_init_data.py deleted file mode 100644 index f5b7177..0000000 --- a/src/tests/daSalome/test017_3DVAR_init_data.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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 numpy - -numpy.random.seed(1000) -dimension = 300 - -xt = numpy.matrix(numpy.arange(dimension)).T -Eo = numpy.matrix(numpy.zeros((dimension,))).T -Eb = numpy.matrix(numpy.random.normal(0.,1.,size=(dimension,))).T -H = numpy.matrix(numpy.core.identity(dimension)) -B = numpy.matrix(numpy.core.identity(dimension)).T -R = numpy.matrix(numpy.core.identity(dimension)).T - -def FunctionH( X ): - return H * X - -xb = xt + Eb -xb = xb.A1 -yo = FunctionH( xt ) + Eo -yo = yo.A1 - -Background = xb -BackgroundError = B -Observation = yo -ObservationError = R diff --git a/src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm.in b/src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm.in deleted file mode 100644 index e5dcd70..0000000 --- a/src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm.in +++ /dev/null @@ -1,98 +0,0 @@ - -ASSIMILATION_STUDY(Study_name='aster_zzzz159a_LBFGSB', - Study_repertory='@prefix@/tests/daSalome', - Debug=0, - Algorithm='3DVAR', - Background=_F(INPUT_TYPE='Vector', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test_aster_zzzz159a_background.py',),), - BackgroundError=_F(INPUT_TYPE='Matrix', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test_aster_zzzz159a_background_error.py',),), - Observation=_F(INPUT_TYPE='Vector', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test_aster_zzzz159a_observation.py',),), - ObservationError=_F(INPUT_TYPE='Matrix', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test_aster_zzzz159a_observation_error.py',),), - ObservationOperator=_F(INPUT_TYPE='Function', - data=_F(FROM='FunctionDict', - FUNCTIONDICT_FILE= - 'test_aster_zzzz159a_functions.py',),), - AlgorithmParameters=_F(INPUT_TYPE='Dict', - data=_F(FROM='Script', - SCRIPT_FILE= - 'test_aster_zzzz159a_init_algorithm_LBFGSB.py',),), - UserDataInit=_F(INIT_FILE= - 'test_aster_zzzz159a_init_parameters.py', - TARGET_LIST= - ('BackgroundError','Observation', - 'ObservationError','ObservationOperator','AlgorithmParameters', - 'UserPostAnalysis','Background',),), - UserPostAnalysis=_F(FROM='String', - STRING= -"""import numpy -import os -xa = ADD.get("Analysis")[0] -Innovation = ADD.get("Innovation")[0] -A = [] -J = ADD.get("CostFunctionJ")[:] -ADD.setDiagnostic("PlotVectors", "J") -MonPlot = ADD.get("J") -if os.path.isfile("recherche_xx_Fonctionnelles.ps"): - os.remove("recherche_xx_Fonctionnelles.ps") -MonPlot.calculate([J,ADD.get("CostFunctionJb")[:],ADD.get("CostFunctionJo")[:]], - title = "Fonctionnelles J, Jb et Jo", - ltitle = ["J","Jb","Jo"], - xlabel = "Pas", ylabel = "Valeur", - filename = "recherche_xx_Fonctionnelles.ps", - pause = False ) -nbmesures = 11 # De 0 vers 1 par pas de 0.1 -instants = numpy.array([0.1*i for i in range(nbmesures)]) -yo = [] -for reponse in init_data['experience']: - for t,v in list(reponse): - if min(abs(t - instants)) < 1.e-8: - yo.append(v) -xb = [] -Bornes = [] -for parametre in init_data['parametres']: - xb.append( parametre[1] ) - Bornes.append( parametre[2:4] ) -B = numpy.matrix(numpy.core.identity(len(xb))) -alpha = 1.e14 -B[0,0] = alpha * 100 -B[1,1] = alpha * 10 -B[2,2] = alpha * 1 -# Calcul de la RMS -# ---------------- -import test_aster_zzzz159a_aster_functions as Code_Aster -Hxa = Code_Aster.Calcul_Aster_Ponctuel( xa ) -V1 = numpy.array(Hxa) -V2 = numpy.array(yo) -import math -rms = math.sqrt( ((V2 - V1)**2).sum() / float(V1.size) ) -print -print "=========" -print "Ebauche = ",xb -print "Analyse = ",xa -print "RMS = ",rms -print -print "NbSteps = ",len(J) -print "J = ",J -print -print "B[0,0] = ",B[0,0] -print "B[1,1] = ",B[1,1] -print "B[2,2] = ",B[2,2] -print "Bornes = ",Bornes -print "=========" -print -""",), - InputVariables=_F(NAMES=('YOUN__','DSDE__','SIGY__',), - SIZES=(1,1,1,),), - OutputVariables=_F(NAMES=('REPONSE1','REPONSE2',), - SIZES=(11,11,),),); diff --git a/src/tests/daSalome/test_aster_zzzz159a_aster_functions.py b/src/tests/daSalome/test_aster_zzzz159a_aster_functions.py deleted file mode 100644 index 4af899c..0000000 --- a/src/tests/daSalome/test_aster_zzzz159a_aster_functions.py +++ /dev/null @@ -1,560 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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 os, sys, shutil, tempfile, glob -from math import log10 - -# Variables globales -debug=False -ASTER_ROOT = '' -SOURCES_ROOT = '' -export = None -calcul = None -parametres = None -python_version = '' - -#=============================================================================== -def UTMESS(code='I', txt=''): - print txt - if code=='F': sys.exit() - -#=============================================================================== -def get_tables(tables_calc,tmp_repe_table,prof): - """ Recupere les resultats Aster (Table Aster -> Numeric Python) - """ - global debug - import Numeric - assert (tables_calc is not None) - assert (tmp_repe_table is not None) - - # Import du module lire_table - if os.environ.has_key('ASTER_ROOT'): - version = prof['version'][0] - bibpyt = os.path.join(os.environ['ASTER_ROOT'], version, 'bibpyt') - sys.path.append(bibpyt) - for mdl in glob.glob(os.path.join(bibpyt, '*')): - sys.path.append(os.path.join(os.environ['ASTER_ROOT'], version, 'bibpyt', mdl)) - try: - from lire_table_ops import lecture_table - except: - UTMESS('F', "Impossible d'importer le module lire_table!") - - reponses = tables_calc - Lrep=[] - _TB = [None]*len(reponses) - for i in range(len(reponses)): - _fic_table = tmp_repe_table + os.sep + "fort."+str(int(100+i)) - - try: - file=open(_fic_table,'r') - texte=file.read() - file.close() - except Exception, err: - ier=1 - message = "Erreur 1!\n" + str(err) - UTMESS('F', message) - - try: - table_lue = lecture_table(texte, 1, ' ') - list_para = table_lue.para - tab_lue = table_lue.values() - except Exception, err: - ier=1 - message = "Erreur 2!\n" + str(err) - else: - ier=0 - - if ier!=0 : UTMESS('F', message) - - try: - nb_val = len(tab_lue[ list_para[0] ]) - F = Numeric.zeros((nb_val,2), Numeric.Float) - for k in range(nb_val): - F[k][0] = tab_lue[ str(reponses[i][1]) ][k] - F[k][1] = tab_lue[ str(reponses[i][2]) ][k] - Lrep.append(F) - except Exception, err: - message = "Erreur 3!\n" + str(err) - UTMESS('F', message) - resu_calc = Lrep - if debug: print 'resu_calc:', resu_calc - - return resu_calc -#=============================================================================== - - -#=============================================================================== -def Calcul_Aster_Ponctuel( X0 = None ): - # - global ASTER_ROOT - global debug - global SOURCES_ROOT - global export - global calcul - global parametres - global python_version - - import numpy - if type(X0) is type(numpy.matrix([])): - X0 = X0.A1.tolist() - else: - X0 = list(X0) - # ---------------------------------------------------------------------------- - # Parametres - #isFromYacs = globals().get('ASTER_ROOT', None) # execution via YACS ou en externe - #isFromYacs = ASTER_ROOT - #print "isFromYacs:", isFromYacs - #if not isFromYacs: - # from N_Parameters import ASTER_ROOT, debug, SOURCES_ROOT, DISPLAY - # from N_Study_Parameters import export - # from N_MR_Parameters import calcul, parametres - os.environ['ASTER_ROOT'] = ASTER_ROOT - - # ---------------------------------------------------------------------------- - # Repertoire contenant les resultats des calculs Aster (None = un rep temp est cree) - resudir = globals().get('resudir', None) - - # ---------------------------------------------------------------------------- - # Parametres remis en forme - list_params = [x[0] for x in parametres] - list_calc = calcul - - # ---------------------------------------------------------------------------- - # Procedure de calculs distribues - # - # Import des modules python d'ASTK - astk_serv_root = os.path.join(ASTER_ROOT, 'ASTK', 'ASTK_SERV') - sys.path.append(os.path.join(astk_serv_root, 'lib')) - sys.path.append(os.path.join(ASTER_ROOT, 'lib', python_version, 'site-packages')) - if debug: - print sys.path - try: - from asrun.run import AsRunFactory - from asrun.profil import ASTER_PROFIL - from asrun.common_func import get_hostrc - from asrun.utils import get_timeout - from asrun.parametric import is_list_of_dict - from asrun.thread import Dispatcher - from asrun.distrib import DistribParametricTask - except Exception, e: - print e - UTMESS('F', "Impossible de determiner l'emplacement d'Aster ! Fixer le chemin avec la variable d'environnement ASTER_ROOT.") - - # Import des modules supplementaires - sys.path.insert(0, SOURCES_ROOT) - sys.path.insert(0, os.path.join(SOURCES_ROOT, 'sources')) - - - # result directories - if resudir: - if not os.path.isdir(resudir): - try: os.mkdir(resudir) - except: - UTMESS('A', "Impossible de creer le repertoire : %s. On utilise un repertoire temporaire" % resudir) - resudir = None - if not resudir: resudir = tempfile.mkdtemp(prefix='tmp_macr_recal_') - flashdir = os.path.join(resudir,'flash') - UTMESS('I', "\n ASTER Exécution simple\n Répertoire temporaire de résultats : %s" % resudir) - - sys.argv = [''] - - run = AsRunFactory() - - prof = ASTER_PROFIL(filename=export) - #prof = init_profil_from(run, prof, keep_surch=True) - prof.Set('R', { - 'type' : 'repe', 'isrep' : True, 'ul' : 0, 'compr' : False, - 'path' : '/tmp/test_param' }) - - if debug: print prof - prof.WriteExportTo( os.path.join(resudir, 'master.export') ) - - # get hostrc object - hostrc = get_hostrc(run, prof) - - # timeout before rejected a job - timeout = get_timeout(prof) - - - # list of parameters - list_val = [] - - # Dictionnaire des parametres du point courant - dic = dict( zip( list_params, X0 ) ) - list_val.append( dic ) - - assert is_list_of_dict(list_val) - nbval = len(list_val) - - - # Ajout des impressions de tables a la fin du .comm - t = [] - reponses = list_calc - for i in range(len(reponses)): - _ul = str(int(100+i)) - num_ul = '99' - - try: os.remove( tmp_macr_recal+os.sep+"REPE_TABLE"+os.sep+"fort."+_ul ) - except: pass - - t.append("\n# Recuperation de la table : " + str(reponses[i][0]) + "\n") - t.append("DEFI_FICHIER(UNITE=" + num_ul + ", FICHIER='" + os.path.join('.', 'REPE_OUT', 'fort.'+_ul) + "',);\n" ) - t.append("IMPR_TABLE(TABLE="+str(reponses[i][0])+", FORMAT='ASTER', UNITE="+num_ul+", INFO=1, FORMAT_R='E30.20',);\n") - t.append("DEFI_FICHIER(ACTION='LIBERER', UNITE="+num_ul+",);\n") - - - # number of threads to follow execution - numthread = 1 - - # ----- Execute calcutions in parallel using a Dispatcher object - # elementary task... - task = DistribParametricTask(run=run, prof=prof, # IN - hostrc=hostrc, - nbmaxitem=0, timeout=timeout, - resudir=resudir, flashdir=flashdir, - keywords={'POST_CALCUL': '\n'.join(t)}, - info=1, - nbnook=0, exec_result=[]) # OUT - # ... and dispatch task on 'list_tests' - etiq = 'calc_%%0%dd' % (int(log10(nbval)) + 1) - labels = [etiq % (i+1) for i in range(nbval)] - couples = zip(labels, list_val) - execution = Dispatcher(couples, task, numthread=numthread) - - iret = 0 - if task.nbnook > 0: - iret = 4 - #run.Sortie(iret) - - # Recuperation des tables calculees - seq_FX = [] - seq_FY = [] - seq_DIMS = [] - lst_DIAG = [] - lst_iter = [] - i=0 - for c in labels: - tbl = get_tables(tables_calc=list_calc, tmp_repe_table=os.path.join(resudir, c, 'REPE_OUT'), prof=prof) - FX = [] - FY = [] - ldims = [] - for array in tbl: -# print 'AA1:', array -# print array[0] - FX.extend([ x[0] for x in array ]) - FY.extend([ x[1] for x in array ]) - ldims.append(len(array)) - - # Agregation des resultats - seq_FX.append(FX) - seq_FY.append(FY) - seq_DIMS.append(ldims) - lst_iter.append(i) - i+=1 - - # Liste des diagnostics - d_diag = {} - for result in task.exec_result: - label = result[0] - diag = result[2] - d_diag[label] = diag - lst_DIAG = [ d_diag[label] for label in labels] - - if debug: - print - print "list_calc =",list_calc - print "seq_FX =",seq_FX - print "seq_FY =",seq_FY - print "seq_DIMS =",seq_DIMS - print "lst_DIAG =",lst_DIAG - print "lst_iter =",lst_iter - print - - # ---------------------------------------------------------------------------- - # Procedure d'assemblage du gradient - - # Calcul maitre (point X0) - idx0 = lst_iter.index(0) # index (les calculs arrivent-ils dans le desordre?) - FY_X0 = seq_FY[idx0] - H_de_X = FY_X0 - - # Arret si tous les jobs ne se sont pas deroules correctement - for diag in lst_DIAG: - if not diag[0:2] in ['OK', ' 0: - iret = 4 - #run.Sortie(iret) - - # Recuperation des tables calculees - seq_FX = [] - seq_FY = [] - seq_DIMS = [] - lst_DIAG = [] - lst_iter = [] - i=0 - for c in labels: - tbl = get_tables(tables_calc=list_calc, tmp_repe_table=os.path.join(resudir, c, 'REPE_OUT'), prof=prof) - FX = [] - FY = [] - ldims = [] - for array in tbl: -# print 'AA1:', array -# print array[0] - FX.extend([ x[0] for x in array ]) - FY.extend([ x[1] for x in array ]) - ldims.append(len(array)) - - # Agregation des resultats - seq_FX.append(FX) - seq_FY.append(FY) - seq_DIMS.append(ldims) - lst_iter.append(i) - i+=1 - - # Liste des diagnostics - d_diag = {} - for result in task.exec_result: - label = result[0] - diag = result[2] - d_diag[label] = diag - lst_DIAG = [ d_diag[label] for label in labels] - - if debug: - print - print "list_calc =",list_calc - print "seq_FX =",seq_FX - print "seq_FY =",seq_FY - print "seq_DIMS =",seq_DIMS - print "lst_DIAG =",lst_DIAG - print "lst_iter =",lst_iter - print "dX =",dX - print - - # ---------------------------------------------------------------------------- - # Procedure d'assemblage du gradient - - # Calcul maitre (point X0) - idx0 = lst_iter.index(0) # index (les calculs arrivent-ils dans le desordre?) - FY_X0 = seq_FY[idx0] - H_de_X = FY_X0 - - # Arret si tous les jobs ne se sont pas deroules correctement - for diag in lst_DIAG: - if not diag[0:2] in ['OK', '',v -if debug: - print "Observations = ",yo - print - -Observation = yo diff --git a/src/tests/daSalome/test_aster_zzzz159a_observation_error.py b/src/tests/daSalome/test_aster_zzzz159a_observation_error.py deleted file mode 100644 index 3b8954c..0000000 --- a/src/tests/daSalome/test_aster_zzzz159a_observation_error.py +++ /dev/null @@ -1,36 +0,0 @@ -#-*-coding:iso-8859-1-*- -# Copyright (C) 2010-2013 EDF R&D -# -# This library is free software; you can redistribute it and/or -# 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. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# 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 numpy -experience = init_data["experience"] -nbmesures = 11 # De 0 à 1 par pas de 0.1 -instants = numpy.array([0.1*i for i in range(nbmesures)]) -yo = [] -for reponse in experience: - for t,v in list(reponse): - if min(abs(t - instants)) < 1.e-8: - yo.append(v) - -R = numpy.matrix(numpy.core.identity(len(yo))) -dimensionYo = len( yo ) -R = numpy.matrix( R, numpy.float ).reshape((dimensionYo,dimensionYo)) - -ObservationError = R diff --git a/src/tests/daSalome/zzzz159a.3 b/src/tests/daSalome/zzzz159a.3 deleted file mode 100644 index d591cf1..0000000 --- a/src/tests/daSalome/zzzz159a.3 +++ /dev/null @@ -1,83 +0,0 @@ -DEBUT(); - -DSDE__ = 200.; - -YOUN__ = 8.E4; - -SIGY__ = 1.; - -MA=LIRE_MAILLAGE(); - -MA=DEFI_GROUP(reuse =MA, - MAILLAGE=MA, - CREA_GROUP_NO=_F(TOUT_GROUP_MA='OUI',),); - - -ACIER=DEFI_MATERIAU(ECRO_LINE=_F(D_SIGM_EPSI=DSDE__, - SY=SIGY__,), - ELAS=_F(NU=0.3, - E=YOUN__,),); - -CHMAT=AFFE_MATERIAU(AFFE=_F(MATER=ACIER, - TOUT='OUI',), - MAILLAGE=MA,); - -MO=AFFE_MODELE(AFFE=_F(TOUT='OUI', - PHENOMENE='MECANIQUE', - MODELISATION='AXIS',), - MAILLAGE=MA,); - -TRACTION=AFFE_CHAR_MECA(DDL_IMPO=(_F(DY=5.E-3, - GROUP_NO='CD',), - _F(DY=0.0, - GROUP_NO='AB',),), - MODELE=MO,); - - -RAMPE=DEFI_FONCTION(NOM_PARA='INST', - VALE=(0.0,0.0,1.0,1.0),); - -INSTANTS=DEFI_LIST_REEL(INTERVALLE=_F(JUSQU_A=1.0, - NOMBRE=10,), - DEBUT=0.0,); - -EVOL=STAT_NON_LINE(CHAM_MATER=CHMAT, - MODELE=MO, - ARCHIVAGE=_F(LIST_INST=INSTANTS, - ARCH_ETAT_INIT='OUI',), - CONVERGENCE=_F(ITER_GLOB_MAXI=10, - RESI_GLOB_RELA=1.E-05,), - COMP_INCR=_F(RELATION='VMIS_ISOT_LINE',), - INCREMENT=_F(LIST_INST=INSTANTS, -# SUBD_METHODE='UNIFORME', -# SUBD_PAS=4, -# SUBD_COEF_PAS_1=1.0, -# SUBD_PAS_MINI=1.E-05, - ), - NEWTON=_F(REAC_ITER=1, - REAC_INCR=1,), - EXCIT=_F(CHARGE=TRACTION, - FONC_MULT=RAMPE,),); - -EVOL=CALC_ELEM(reuse =EVOL, - RESULTAT=EVOL, - CHAM_MATER=CHMAT, - MODELE=MO, - OPTION=('SIEF_ELNO_ELGA','VARI_ELNO_ELGA'),); - -REPONSE1=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION', - INTITULE='SIGYY', - RESULTAT =EVOL, - NOM_CHAM ='SIEF_ELNO_ELGA', - NOM_CMP = 'SIYY', - GROUP_NO = 'A',),); - -REPONSE2=POST_RELEVE_T(ACTION=_F(OPERATION='EXTRACTION', - INTITULE='V1', - RESULTAT =EVOL, - NOM_CHAM ='VARI_ELNO_ELGA', - NOM_CMP = 'V1', - GROUP_NO = 'A',),); - - -FIN(); diff --git a/src/tests/daSalome/zzzz159a.export.esclave.in b/src/tests/daSalome/zzzz159a.export.esclave.in deleted file mode 100644 index 5db5b97..0000000 --- a/src/tests/daSalome/zzzz159a.export.esclave.in +++ /dev/null @@ -1,14 +0,0 @@ -P version STA10.1 -P debug nodebug -P mode interactif -P nomjob zzzz159a -P origine ASTK 1.8.0 -A memjeveux 16.0 -A tpmax 300 -P tpsjob 5 -P xterm /usr/bin/xterm -sb -si -geometry 90x32 -display localhost:0 -F comm @prefix@/tests/daSalome/zzzz159a.3 D 1 -F mail @prefix@/tests/daSalome/zzzz159a.mail D 20 -F mess @prefix@/tests/daSalome/zzzz159a_esclave.mess R 6 -F resu @prefix@/tests/daSalome/zzzz159a_esclave.resu R 8 -P actions make_etude diff --git a/src/tests/daSalome/zzzz159a.mail b/src/tests/daSalome/zzzz159a.mail deleted file mode 100644 index 83696f9..0000000 --- a/src/tests/daSalome/zzzz159a.mail +++ /dev/null @@ -1,65 +0,0 @@ -TITRE - % GIBI FECIT - FINSF - % - COOR_2D - N1 0.00000000000000E+00 0.00000000000000E+00 - N2 1.00000000000000E+00 0.00000000000000E+00 - N3 1.00000000000000E+00 1.00000000000000E+00 - N4 0.00000000000000E+00 1.00000000000000E+00 - FINSF - % - QUAD4 - M1 N1 N2 N3 N4 - FINSF - % - SEG2 - M2 N4 N1 - M3 N1 N2 - M4 N2 N3 - M5 N3 N4 - FINSF - % - GROUP_NO - D N4 - FINSF - % - GROUP_NO - C N3 - FINSF - % - GROUP_NO - A N1 - FINSF - % - GROUP_NO - B N2 - FINSF - % - GROUP_MA - AB - M3 - FINSF - % - GROUP_MA - BC - M4 - FINSF - % - GROUP_MA - CD - M5 - FINSF - % - GROUP_MA - DA - M2 - FINSF - % - GROUP_MA - MA - M1 - M2 M3 M4 M5 - FINSF - % - FIN -- 2.39.2