From 93b118af438d6a9b86b5b4efc4866dc2567208e6 Mon Sep 17 00:00:00 2001 From: Gerald Nicolas Date: Tue, 13 May 2014 09:41:11 +0200 Subject: [PATCH] =?utf8?q?Corrections=20d'enchainement=20dans=20les=20sch?= =?utf8?q?=C3=A9mas=20YACS=20produits.=20Cr=C3=A9ation=20d'un=20script=20s?= =?utf8?q?ans=20effet,=20pour=20pouvoir=20tester.=20Mise=20=C3=A0=20jour?= =?utf8?q?=20du=20catalogue=20YACS.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- doc/en/yacs.rst | 1 + doc/files/yacs_script_test.py | 261 +++++++++++++ doc/fr/yacs.rst | 1 + idl/Gen.xml | 708 ++++++++++++++++++---------------- resources/yacs_01.en.xml | 2 + resources/yacs_01.fr.xml | 2 + src/HOMARD/YACSDriver.cxx | 33 +- src/HOMARD/YACSDriver.hxx | 2 +- src/HOMARD_I/HOMARD_Gen_i.cxx | 6 +- tests/test_1.py | 4 +- tests/test_2.py | 6 +- tests/test_3.py | 6 +- tests/test_util.py | 7 +- 13 files changed, 688 insertions(+), 351 deletions(-) create mode 100755 doc/files/yacs_script_test.py diff --git a/doc/en/yacs.rst b/doc/en/yacs.rst index 03e6de2a..afec03cf 100644 --- a/doc/en/yacs.rst +++ b/doc/en/yacs.rst @@ -288,6 +288,7 @@ Use this scheme To reproduce this example, download: * :download:`the scheme <../files/yacs_01.en.xml>` * :download:`an example of python script <../files/yacs_script.py>` + * :download:`an example of python script ... for nothing <../files/yacs_script_test.py>` It should be adapted to simulation considered. In particular, it is necessary: diff --git a/doc/files/yacs_script_test.py b/doc/files/yacs_script_test.py new file mode 100755 index 00000000..b401f480 --- /dev/null +++ b/doc/files/yacs_script_test.py @@ -0,0 +1,261 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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, or (at your option) any later version. +# +# 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 +# + +""" +Pseudo-lancement d'un calcul pour valider les tests +""" +__revision__ = "V2.1" +# +import sys +import os +# +class Script : +# + """ +Mode d'emploi : +============== +yacs_script_test --rep_calc=rep_calc --mesh_file=mesh_file --num=nro [-h|-help] [-v] [-v_max] + +Arguments obligatoires : +------------------------ +--rep_calc=rep_calc : le repertoire du calcul. +--mesh_file=mesh_file : le fichier contenant le maillage sur lequel on veut calculer. Le nom est absolu ou relatif par rapport au repertoire de calcul ou a $HOME. +--num=nro : le numero du calcul, depuis 0. + +Exemples : +---------- +./yacs_script_test.py --rep_calc=`pwd` --mesh_file=maill.00.med --num=0 + """ +# +#==== +# 0. Les defauts +#==== +# + affiche_aide_globale = 0 + verbose = 0 + verbose_max = 0 +# + message_info = "\n" +# +# +#========================= Debut de la fonction ================================== +# + def __init__ ( self, liste_arg ) : +# + """ +Le constructeur de la classe Script + """ +# +# 1. Decodage des arguments +# + self.rep_calc = None + self.numero = None + self.mesh_file = None +# + for argu in liste_arg : +# + #print argu + l_aux = argu.split("=") + #print l_aux + if len(l_aux) == 2 : + #print l_aux[0] + #print l_aux[1] + if l_aux[0] == "--rep_calc" : + self.rep_calc = l_aux[1] + elif l_aux[0] == "--num" : + self.numero = int(l_aux[1]) + elif l_aux[0] == "--mesh_file" : + self.mesh_file = l_aux[1] + else : + saux = argu.upper() + if saux in ( "-H", "-HELP" ) : + self.affiche_aide_globale = 1 + elif saux == "-V" : + self.verbose = 1 + elif saux in ( "-V_MAX", "-VMAX" ) : + self.verbose = 1 + self.verbose_max = 1 +# +# 2. Les paramètres de base +# + self.dico = {} +# + if self.verbose_max : + nom_fonction = __name__ + "/__init__" + print "\nDans " + nom_fonction + "," + print ". rep_calc :", self.rep_calc + print ". mesh_file :", self.mesh_file + print ". numero :", self.numero +# +#========================= Fin de la fonction =================================== +# +#========================= Debut de la fonction ================================== +# + def compute ( self ) : +# + """ +Lancement d'un calcul + """ +# + nom_fonction = __name__ + "/compute" + blabla = "\nDans " + nom_fonction + "," +# + erreur = 0 + message_erreur = " " +# + dico_resu = {} +# + while not erreur : +# +# 1. Controles des arguments +# + #print "\n==== self.controle_argument () ====" + erreur, message_erreur = self.controle_argument() + if erreur : + break +# +# 2. Pseudo-Calcul +# + #print "\n==== self.calcul () ====" + dico_resu["FileName"] = self.mesh_file + dico_resu["V_TEST"] = 1./float(self.numero+1) +# + break +# + if self.verbose_max : + print blabla + print ". erreur :", erreur +# + return erreur, message_erreur, dico_resu +# +#========================= Fin de la fonction =================================== +# +#========================= Debut de la fonction ================================== +# + def controle_argument ( self ) : +# + """ +Controle les arguments et stockage de quelques informations + """ +# + messages_erreur = { 0 : None, + -1 : "Quel repertoire de calcul ?", + -3 : "Quel fichier de maillage ?", + -4 : "Ce repertoire est inconnu.", + -5 : "Ce fichier est inconnu.", + -9 : "Quel numero de calcul ?" } +# + nom_fonction = __name__ + "/controle_argument" + blabla = "\nDans " + nom_fonction + "," +# + erreur = 0 + message_erreur = " " +# + if self.verbose_max : + print blabla + print ". rep_calc :", self.rep_calc + print ". mesh_file :", self.mesh_file + print ". numero :", self.numero +# + while not erreur : +# +# 1. Les repertoire et fichier +# 1.1. Il y a bien eu une donnee +# + if self.rep_calc == None : + erreur = -1 + elif self.mesh_file == None : + erreur = -3 + if erreur < 0 : + self.message_info += "Relancer avec -h pour avoir le mode d'emploi." + break +# +# 1.2. Le repertoire de calcul +# + if os.environ.has_key("HOME") : + HOME = os.environ ["HOME"] + else : + HOME = "/local/home/salome" +# + if ( self.rep_calc[:1] == "~" ) : + self.rep_calc = os.path.join(HOME, self.rep_calc[2:]) + if not os.path.isdir(self.rep_calc) : + self.message_info += "Repertoire " + self.rep_calc + erreur = -4 + break + else : + aux = os.path.join(os.getcwd(), self.rep_calc) + self.rep_calc = os.path.normpath(aux) +# +# 1.3. Les fichiers +# + fic = self.mesh_file +# + if ( fic[:1] == "~" ) : + fic = os.path.join(HOME, fic[2:]) + if not os.path.isfile(fic) : + aux = os.path.join(self.rep_calc, fic) + if not os.path.isfile(aux) : + self.message_info += "Fichier : " + fic + erreur = -5 + break + else : + fic = os.path.normpath(aux) + aux = os.path.join(os.getcwd(), fic) +# + self.mesh_file = os.path.normpath(aux) +# +# 2. Le numero du calcul +# + if self.numero == None : + erreur = -9 +# + break +# + if erreur : + message_erreur = messages_erreur[erreur] +# + if self.verbose_max : + print ". rep_calc :", self.rep_calc + print ". mesh_file :", self.mesh_file +# + return erreur, message_erreur +# +#========================= Fin de la fonction =================================== +# +# +if __name__ == "__main__" : +# + #print "Arguments a l'entree de", sys.argv[0], ":", sys.argv[1:], "\n" +# + Script_A = Script(sys.argv[1:]) +# + if Script_A.affiche_aide_globale : + Script_A.message_info = Script_A.__doc__ + erreur_m = 0 + message_erreur_m = "" + else : + dico_resu_m = {} + erreur_m, message_erreur_m, dico_resu_m = Script_A.compute () +# + sys.stdout.write(Script_A.message_info+"\n") + sys.stderr.write(message_erreur_m+"\n") + sys.exit(erreur_m) diff --git a/doc/fr/yacs.rst b/doc/fr/yacs.rst index d9e47ba8..8a3bbf79 100644 --- a/doc/fr/yacs.rst +++ b/doc/fr/yacs.rst @@ -288,6 +288,7 @@ Utiliser ce sch Pour reproduire cet exemple, on pourra télécharger : * :download:`le schéma <../files/yacs_01.fr.xml>` * :download:`un exemple de script python <../files/yacs_script.py>` + * :download:`un exemple de script python qui ne fait rien <../files/yacs_script_test.py>` Il faut l'adapter à la simulation envisagée. En particulier, il faut : diff --git a/idl/Gen.xml b/idl/Gen.xml index 0f965c5f..be9297ea 100644 --- a/idl/Gen.xml +++ b/idl/Gen.xml @@ -8,14 +8,15 @@ + HOMARD HOMARD OTHER - HOMARD team - EDF RD - 1.5 + EDF + 1.6 unknown 1 1 @@ -26,14 +27,14 @@ unknown - CreateCase - HOMARD team - EDF RD - 1.1 + CreateBoundaryDi + EDF + 1.6 unknown 0 - CaseName + BoundaryName string unknown @@ -51,159 +52,160 @@ return - HOMARD/HOMARD_Cas + HOMARD/HOMARD_Boundary unknown - CreateCaseFromIteration - HOMARD team - EDF RD - 1.1 + CreateBoundaryCylinder + EDF + 1.6 unknown 0 - CaseName + BoundaryName string unknown - DirNameStart - string + Xcentre + double unknown - - - - return - HOMARD/HOMARD_Cas - unknown - - - - - - CreateCaseFromCaseLastIteration - HOMARD team - EDF RD - 1.1 - unknown - 0 - - CaseName - string + Ycentre + double unknown - DirNameStart - string + Zcentre + double unknown - - - - return - HOMARD/HOMARD_Cas - unknown - - - - - - CreateCaseFromCaseIteration - HOMARD team - EDF RD - 1.1 - unknown - 0 - - CaseName - string + Xaxis + double unknown - DirNameStart - string + Yaxis + double unknown - Number - long + Zaxis + double + unknown + + + Radius + double unknown return - HOMARD/HOMARD_Cas + HOMARD/HOMARD_Boundary unknown - CreateHypothesis - HOMARD team - EDF RD - 1.1 + CreateBoundarySphere + EDF + 1.6 unknown 0 - HypoName + BoundaryName string unknown + + Xcentre + double + unknown + + + Ycentre + double + unknown + + + Zcentre + double + unknown + + + Radius + double + unknown + return - HOMARD/HOMARD_Hypothesis + HOMARD/HOMARD_Boundary unknown - CreateZoneBox - HOMARD team - EDF RD - 1.1 + CreateBoundaryConeR + EDF + 1.6 unknown 0 - ZoneName + BoundaryName string unknown - Xmini + Xcentre1 double unknown - Xmaxi + Ycentre1 double unknown - Ymini + Zcentre1 double unknown - Ymaxi + Radius1 double unknown - Zmini + Xcentre2 double unknown - Zmaxi + Ycentre2 + double + unknown + + + Zcentre2 + double + unknown + + + Radius2 double unknown @@ -211,61 +213,56 @@ return - HOMARD/HOMARD_Zone + HOMARD/HOMARD_Boundary unknown - CreateZoneCylinder - HOMARD team - EDF RD - 1.1 + CreateBoundaryConeA + EDF + 1.6 unknown 0 - ZoneName + BoundaryName string unknown - Xcentre - double - unknown - - - Ycentre + Xaxis double unknown - Zcentre + Yaxis double unknown - Xaxis + Zaxis double unknown - Yaxis + Angle double unknown - Zaxis + Xcentre double unknown - Radius + Ycentre double unknown - Height + Zcentre double unknown @@ -273,21 +270,21 @@ return - HOMARD/HOMARD_Zone + HOMARD/HOMARD_Boundary unknown - CreateZonePipe - HOMARD team - EDF RD - 1.1 + CreateBoundaryTorus + EDF + 1.6 unknown 0 - ZoneName + BoundaryName string unknown @@ -322,17 +319,12 @@ unknown - Radius + RadiusRev double unknown - Height - double - unknown - - - InternalRadius + RadiusPri double unknown @@ -340,88 +332,117 @@ return - HOMARD/HOMARD_Zone + HOMARD/HOMARD_Boundary unknown - CreateZoneSphere - HOMARD team - EDF RD - 1.1 + CreateCase + EDF + 1.6 unknown 0 - ZoneName + CaseName string unknown - Xcentre - double + MeshName + string unknown - Ycentre - double + FileName + string unknown + + + + return + HOMARD/HOMARD_Cas + unknown + + + + + + CreateCaseFromIteration + EDF + 1.6 + unknown + 0 + - Zcentre - double + CaseName + string unknown - Radius - double + DirNameStart + string unknown return - HOMARD/HOMARD_Zone + HOMARD/HOMARD_Cas unknown - CreateZoneBox2D - HOMARD team - EDF RD - 1.1 + CreateCaseFromCaseLastIteration + EDF + 1.6 unknown 0 - ZoneName + CaseName string unknown - Umini - double - unknown - - - Umaxi - double + DirNameStart + string unknown + + + + return + HOMARD/HOMARD_Cas + unknown + + + + + + CreateCaseFromCaseIteration + EDF + 1.6 + unknown + 0 + - Vmini - double + CaseName + string unknown - Vmaxi - double + DirNameStart + string unknown - Orient + Number long unknown @@ -429,58 +450,38 @@ return - HOMARD/HOMARD_Zone + HOMARD/HOMARD_Cas unknown - CreateZoneDisk - HOMARD team - EDF RD - 1.1 + CreateHypothesis + EDF + 1.6 unknown 0 - ZoneName + HypoName string unknown - - Ucentre - double - unknown - - - Vcentre - double - unknown - - - Radius - double - unknown - - - Orient - long - unknown - return - HOMARD/HOMARD_Zone + HOMARD/HOMARD_Hypothesis unknown - CreateZoneDiskWithHole - HOMARD team - EDF RD - 1.1 + CreateZoneBox + EDF + 1.6 unknown 0 @@ -490,28 +491,33 @@ unknown - Ucentre + Xmini double unknown - Vcentre + Xmaxi double unknown - Radius + Ymini double unknown - InternalRadius + Ymaxi double unknown - Orient - long + Zmini + double + unknown + + + Zmaxi + double unknown @@ -525,46 +531,61 @@ - CreateBoundaryDi - HOMARD team - EDF RD - 1.1 + CreateZoneBox2D + EDF + 1.6 unknown 0 - BounName - string + ZoneName + string + unknown + + + Umini + double + unknown + + + Umaxi + double + unknown + + + Vmini + double unknown - MeshName - string + Vmaxi + double unknown - FileName - string + Orient + long unknown return - HOMARD/HOMARD_Boundary + HOMARD/HOMARD_Zone unknown - CreateBoundaryCylinder - HOMARD team - EDF RD - 1.1 + CreateZoneCylinder + EDF + 1.6 unknown 0 - BounName + ZoneName string unknown @@ -603,164 +624,164 @@ double unknown + + Height + double + unknown + return - HOMARD/HOMARD_Boundary + HOMARD/HOMARD_Zone unknown - CreateBoundarySphere - HOMARD team - EDF RD - 1.1 + CreateZoneDisk + EDF + 1.6 unknown 0 - BounName + ZoneName string unknown - Xcentre + Ucentre double unknown - Ycentre + Vcentre double unknown - Zcentre + Radius double unknown - Radius - double + Orient + long unknown return - HOMARD/HOMARD_Boundary + HOMARD/HOMARD_Zone unknown - CreateBoundaryConeA - HOMARD team - EDF RD - 1.1 + CreateZoneDiskWithHole + EDF + 1.6 unknown 0 - BoundaryName + ZoneName string unknown - Xaxis - double - unknown - - - Yaxis - double - unknown - - - Zaxis + Ucentre double unknown - Angle + Vcentre double unknown - Xcentre + Radius double unknown - Ycentre + InternalRadius double unknown - Zcentre - double + Orient + long unknown return - HOMARD/HOMARD_Boundary + HOMARD/HOMARD_Zone unknown - CreateBoundaryConeR - HOMARD team - EDF RD - 1.1 + CreateZonePipe + EDF + 1.6 unknown 0 - BoundaryName + ZoneName string unknown - Xcentre1 + Xcentre double unknown - Ycentre1 + Ycentre double unknown - Zcentre1 + Zcentre double unknown - Radius1 + Xaxis double unknown - Xcentre2 + Yaxis double unknown - Ycentre2 + Zaxis double unknown - Zcentre2 + Radius double unknown - Radius2 + Height + double + unknown + + + InternalRadius double unknown @@ -768,21 +789,21 @@ return - HOMARD/HOMARD_Boundary + HOMARD/HOMARD_Zone unknown - CreateBoundaryTorus - HOMARD team - EDF RD - 1.1 + CreateZoneSphere + EDF + 1.6 unknown 0 - BounName + ZoneName string unknown @@ -802,27 +823,7 @@ unknown - Xaxis - double - unknown - - - Yaxis - double - unknown - - - Zaxis - double - unknown - - - RRev - double - unknown - - - RPri + Radius double unknown @@ -830,21 +831,21 @@ return - HOMARD/HOMARD_Boundary + HOMARD/HOMARD_Zone unknown - GetCase - HOMARD team - EDF RD - 1.1 + GetBoundary + EDF + 1.6 unknown 0 - CaseName + BoundaryName string unknown @@ -852,21 +853,21 @@ return - HOMARD/HOMARD_Cas + HOMARD/HOMARD_Boundary unknown - GetBoundary - HOMARD team - EDF RD - 1.1 + GetCase + EDF + 1.6 unknown 0 - BounName + CaseName string unknown @@ -874,7 +875,7 @@ return - HOMARD/HOMARD_Boundary + HOMARD/HOMARD_Cas unknown @@ -882,8 +883,8 @@ GetHypothesis - HOMARD team - EDF RD - 1.1 + EDF + 1.6 unknown 0 @@ -904,8 +905,8 @@ GetIteration - HOMARD team - EDF RD - 1.1 + EDF + 1.6 unknown 0 @@ -926,8 +927,8 @@ GetZone - HOMARD team - EDF RD - 1.1 + EDF + 1.6 unknown 0 @@ -947,32 +948,32 @@ - GetAllCasesName - HOMARD team - EDF RD - 1.1 + GetAllBoundarysName + EDF + 1.6 unknown 0 return - HOMARD/listeCases + HOMARD/listeBoundarys unknown - GetAllBoundarysName - HOMARD team - EDF RD - 1.1 + GetAllCasesName + EDF + 1.6 unknown 0 return - HOMARD/listeBoundarys + HOMARD/listeCases unknown @@ -980,8 +981,8 @@ GetAllHypothesesName - HOMARD team - EDF RD - 1.1 + EDF + 1.6 unknown 0 @@ -995,41 +996,97 @@ - GetAllZonesName - HOMARD team - EDF RD - 1.1 + GetAllIterationsName + EDF + 1.6 unknown 0 return - HOMARD/listeZones + HOMARD/listeIterations unknown - GetAllIterationsName - HOMARD team - EDF RD - 1.1 + GetAllZonesName + EDF + 1.6 unknown 0 return - HOMARD/listeIterations + HOMARD/listeZones unknown + + MeshInfo + EDF + 1.6 + unknown + 0 + + + CaseName + string + unknown + + + MeshName + string + unknown + + + FileName + string + unknown + + + DirName + string + unknown + + + Qual + long + unknown + + + Diam + long + unknown + + + Conn + long + unknown + + + Tail + long + unknown + + + Inte + long + unknown + + + + + LastIteration - HOMARD team - EDF RD - 1.1 + EDF + 1.6 unknown 0 @@ -1050,8 +1107,8 @@ SetCurrentStudy - HOMARD team - EDF RD - 1.1 + EDF + 1.6 unknown 0 @@ -1065,20 +1122,25 @@ - PublishResultInSmesh - HOMARD team - EDF RD - 1.1 + PublishFileUnderIteration + EDF + 1.6 unknown 0 + + IterName + string + unknown + FileName string unknown - Option - long + Comment + string unknown @@ -1086,9 +1148,9 @@ - MeshInfo - HOMARD team - EDF RD - 1.1 + PublishBoundaryUnderCase + EDF + 1.6 unknown 0 @@ -1098,43 +1160,45 @@ unknown - MeshName + BoundaryName string unknown + + + + + + PublishResultInSmesh + EDF + 1.6 + unknown + 0 + FileName string unknown - DirName - string - unknown - - - Qual - long - unknown - - - Diam - long - unknown - - - Conn - long - unknown - - - Tail + Option long unknown + + + + + + PublishMeshIterInSmesh + EDF + 1.6 + unknown + 0 + - Inte - long + IterName + string unknown diff --git a/resources/yacs_01.en.xml b/resources/yacs_01.en.xml index da766f03..dad1bf34 100644 --- a/resources/yacs_01.en.xml +++ b/resources/yacs_01.en.xml @@ -219,6 +219,7 @@ Iter_1_Case_Options # Associated iteration #0 Iter0 = Case.GetIter0() ]]> + @@ -301,6 +302,7 @@ else : OK = 1 MessInfo = " " ]]> + diff --git a/resources/yacs_01.fr.xml b/resources/yacs_01.fr.xml index a05d1645..1c14561d 100644 --- a/resources/yacs_01.fr.xml +++ b/resources/yacs_01.fr.xml @@ -219,6 +219,7 @@ Iter_1_Case_Options # Iteration 0 associee Iter0 = Case.GetIter0() ]]> + @@ -301,6 +302,7 @@ else : OK = 1 MessInfo = " " ]]> + diff --git a/src/HOMARD/YACSDriver.cxx b/src/HOMARD/YACSDriver.cxx index 23c1483e..df73992e 100644 --- a/src/HOMARD/YACSDriver.cxx +++ b/src/HOMARD/YACSDriver.cxx @@ -38,7 +38,7 @@ YACSDriver::YACSDriver(const std::string XMLFile, const std::string DirName): _XMLFile( "" ), _DirName( "" ), _Texte( "" ), _Texte_parametres( "" ), - _noeud_1( "CreateHypothesis" ), + _noeud_1( "CreateCase" ), _bLu( false ) { MESSAGE("XMLFile = "<\n" ; @@ -283,8 +284,9 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri std::string noeud_2 = methode + "_" + BoundaryName ; std::string node = "Boucle_de_convergence.Alternance_Calcul_HOMARD.Adaptation.p0_Adaptation_HOMARD.HOMARD_Initialisation.p1_Iter_1." ; node += noeud_2 ; -// 2. Texte de controle - std::string texte_control = Texte_control (_noeud_1, noeud_2) ; +// 2. Texte de controle : le noeud precedent est _noeud_1, le noeud courant noeud_2. +// A la fin, on bascule le courant dans le precedent + std::string texte_control = Texte_control (_noeud_1, noeud_2, 1) ; _noeud_1 = noeud_2 ; // 3. Definition du service _Texte += " \n" ; @@ -438,15 +440,15 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri // } //=============================================================================== -// Controle des enchainements de noeud dans le noeud Iter_1 +// Fin du controle des enchainements de noeud dans le noeud Iter_1 //=============================================================================== std::string YACSDriver::Texte_Iter_1_control() { MESSAGE("Texte_Iter_1_control"); // std::string texte ; - texte = Texte_control ("CreateCase", "Case_Options") ; - texte += Texte_control ("Case_Options", "CreateHypothesis") ; + texte = Texte_control (_noeud_1, "CreateHypothesis", 1) ; + texte += Texte_control ("CreateHypothesis", "Case_Options", 0) ; // return texte ; // @@ -455,16 +457,19 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri // Controle des enchainements de noeuds // noeud_1 : noeud de depart // noeud_2 : noeud d'arrivee +// option : 0 : sans caractere de saut de ligne a la fin +// 1 : avec caractere de saut de ligne a la fin //=============================================================================== - std::string YACSDriver::Texte_control( const std::string noeud_1, const std::string noeud_2 ) + std::string YACSDriver::Texte_control( const std::string noeud_1, const std::string noeud_2, int option ) { - MESSAGE("Texte_control, noeud_1 = "< " ; texte += "" + noeud_1 + "" ; texte += " " + noeud_2 + "" ; - texte += " \n" ; + texte += " " ; + if ( option == 1 ) { texte += "\n" ; } return texte ; // @@ -476,7 +481,7 @@ std::string YACSDriver::Texte_Iter_1_Boundary( int BoundaryType, const std::stri //=============================================================================== std::string YACSDriver::Texte_inport( const std::string inport_type, const std::string inport_nom ) { -// MESSAGE("Texte_control, inport_type = "< indice ) { int position = ligne.find_first_of( "." ) ; -// MESSAGE("\nposition : "<< position); + MESSAGE("\nposition : "<< position); if ( position > 0 ) { ligne_bis = ligne.substr( position ); -// MESSAGE("\nligne_bis : "<< ligne_bis); + MESSAGE("\nligne_bis : "<< ligne_bis); _Texte += concept + ligne_bis + "\n" ; } } diff --git a/src/HOMARD/YACSDriver.hxx b/src/HOMARD/YACSDriver.hxx index bbf500bb..d708dda0 100644 --- a/src/HOMARD/YACSDriver.hxx +++ b/src/HOMARD/YACSDriver.hxx @@ -40,7 +40,7 @@ public: std::string Texte_Iter_1_Boundary( int BoundaryType, const std::string pythonStructure, const std::string methode, const std::string BoundaryName ) ; std::string Texte_Iter_1_Zone( int ZoneType, const std::string pythonStructure, const std::string methode, const std::string ZoneName ) ; std::string Texte_Iter_1_control() ; - std::string Texte_control( const std::string noeud_1, const std::string noeud_2 ) ; + std::string Texte_control( const std::string noeud_1, const std::string noeud_2, int option ) ; std::string Texte_inport( const std::string inport_type, const std::string inport_nom ) ; void Texte_HOMARD_Exec_DirName( ) ; void Texte_HOMARD_Exec_MeshName( const std::string MeshName ) ; diff --git a/src/HOMARD_I/HOMARD_Gen_i.cxx b/src/HOMARD_I/HOMARD_Gen_i.cxx index f7f2dc6b..3f12a790 100755 --- a/src/HOMARD_I/HOMARD_Gen_i.cxx +++ b/src/HOMARD_I/HOMARD_Gen_i.cxx @@ -4162,12 +4162,14 @@ CORBA::Long HOMARD_Gen_i::YACSWriteOnFile(const char* nomYACS, const char* XMLFi // G.1.8. Execution de HOMARD : les options de l'iteration else if ( mot_cle == "HOMARD_Exec_Iter_Options" ) { myDriver->Texte_python_2( pythonIter, "TimeStep", "Iter" ) ; } - // G.1.9. Zones et frontieres : les creations + // G.1.9. a. Creation eventuelles des zones et frontieres + // b. Enchainement else if ( mot_cle == "Iter_1" ) { - std::string texte_control = myDriver->Texte_Iter_1_control() ; + std::string texte_control = "" ; if ( TypeAdap == 0 ) { texte_control += YACSDriverTexteZone( myHypo, myDriver ) ; } texte_control += YACSDriverTexteBoundary( myCase, myDriver ) ; + texte_control += myDriver->Texte_Iter_1_control() ; myDriver->TexteAdd(texte_control); } // G.1.10. Les tests de convergence diff --git a/tests/test_1.py b/tests/test_1.py index f9027d90..196524c4 100755 --- a/tests/test_1.py +++ b/tests/test_1.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_1 """ -__revision__ = "V2.2" +__revision__ = "V2.3" #======================================================================== Test_Name = "test_1" @@ -167,7 +167,7 @@ Python script for HOMARD # # Creation of the schema YACS # =========================== - ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script.py") + ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py") ScriptFile = os.path.normpath(ScriptFile) DirName = dircase YACS_test_1 = Case_test_1.CreateYACSSchema("YACS_test_1", ScriptFile, DirName, MeshFile) diff --git a/tests/test_2.py b/tests/test_2.py index df819821..4d9dd18d 100755 --- a/tests/test_2.py +++ b/tests/test_2.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2010, 2014 Test test_2 """ -__revision__ = "V2.2" +__revision__ = "V2.3" #======================================================================== Test_Name = "test_2" @@ -143,7 +143,7 @@ Python script for HOMARD # # Creation of the schema YACS # =========================== - ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script.py") + ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py") ScriptFile = os.path.normpath(ScriptFile) DirName = dircase YACS_test_2 = Case_test_2.CreateYACSSchema("YACS_test_2", ScriptFile, DirName, MeshFile) @@ -176,7 +176,7 @@ except Exception, e: # Test of the results # n_rep_test_file = n_iter_test_file -test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file) +test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, True) # if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/tests/test_3.py b/tests/test_3.py index 936c1a2d..02df6ef8 100755 --- a/tests/test_3.py +++ b/tests/test_3.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2011, 2013 Test test_3 """ -__revision__ = "V2.1" +__revision__ = "V2.2" #======================================================================== Test_Name = "test_3" @@ -137,7 +137,7 @@ Copyright EDF-R&D 2010, 2013 # # Creation of the schema YACS # =========================== - ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script.py") + ScriptFile = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "en", "_downloads", "yacs_script_test.py") ScriptFile = os.path.normpath(ScriptFile) DirName = dircase YACSName = "YACS_" + Test_Name @@ -207,7 +207,7 @@ except Exception, e: # Test of the results # n_rep_test_file = n_iter_test_file*n_boucle -test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file) +test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, True) # if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/tests/test_util.py b/tests/test_util.py index 75a851af..15035462 100755 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -22,7 +22,7 @@ Python script for HOMARD Copyright EDF-R&D 2014 Test test_1 """ -__revision__ = "V1.1" +__revision__ = "V1.2" import os #======================================================================== @@ -46,7 +46,7 @@ Copyright EDF-R&D 2013 # #======================================================================== #======================================================================== -def test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file) : +def test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file, destroy_dir = True) : """ Test of the result Rep_Test: repertoire des tests @@ -54,11 +54,10 @@ Test_Name: nom du test dircase: repertoire des resultats du test n_iter_test_file: numero de l'iteration a tester n_rep_test_file: numero du repertoire de l'iteration a tester +destroy_dir: destruction du repertoire de calcul Copyright EDF-R&D 2014 """ # - destroy_dir = True - # test_file_suff = "apad.%02d.bilan" % n_iter_test_file rep_test_file = "I%02d" % n_rep_test_file # -- 2.39.2