From: Gérald NICOLAS Date: Tue, 3 Nov 2015 10:27:43 +0000 (+0100) Subject: Passage de l'exécutable HOMARD à MED 3.1 : impact dans les tests X-Git-Tag: V8_0_0a1~9^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7b9bf1ac9aea840176cf1f4e9abf6752e2a06c43;p=modules%2Fhomard.git Passage de l'exécutable HOMARD à MED 3.1 : impact dans les tests - Modification des fichiers de bilan par suppression de lignes - Nouveau cas-test, test_4. La géométrie, le maillage, un champ sont créés par les modules GEOM, SMESH et MED. Cela permet de tester la cohérence des ficheirs MED échangés --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5ac25989..1dbb4424 100755 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -38,6 +38,10 @@ SET(HOMARD_TEST_FILES test_3.00.med test_3.fr.med test_3.apad.02.bilan + test_4.pdf + test_4.en.pdf + test_4.py + test_4.apad.03.bilan test_11.py test_11.apad.03.bilan test_12.py diff --git a/tests/test_1.en.odt b/tests/test_1.en.odt index a728ba78..005ba6a2 100644 Binary files a/tests/test_1.en.odt and b/tests/test_1.en.odt differ diff --git a/tests/test_1.en.pdf b/tests/test_1.en.pdf index a0642bc0..909cb28e 100644 Binary files a/tests/test_1.en.pdf and b/tests/test_1.en.pdf differ diff --git a/tests/test_1.odt b/tests/test_1.odt index 257405ff..cd2a6573 100644 Binary files a/tests/test_1.odt and b/tests/test_1.odt differ diff --git a/tests/test_1.pdf b/tests/test_1.pdf index d663a40a..caa7941e 100644 Binary files a/tests/test_1.pdf and b/tests/test_1.pdf differ diff --git a/tests/test_1.py b/tests/test_1.py old mode 100644 new mode 100755 index b831dd4a..a202ccb5 --- a/tests/test_1.py +++ b/tests/test_1.py @@ -19,10 +19,10 @@ # """ Python script for HOMARD -Copyright EDF-R&D 2010, 2014 +Copyright EDF-R&D 2010, 2015 Test test_1 """ -__revision__ = "V2.4" +__revision__ = "V2.5" #======================================================================== Test_Name = "test_1" @@ -72,6 +72,9 @@ Python script for HOMARD # # Creation of the hypotheses # ========================== + dico = {} + dico["1"] = "raffinement" + dico["-1"] = "deraffinement" # Creation of the hypothesis a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM HypoName_1 = "a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM" print "-------- Creation of the hypothesis", HypoName_1 @@ -82,7 +85,6 @@ Python script for HOMARD Hypo_1_1.SetRefinThr(3, 10.1) Hypo_1_1.AddFieldInterp('RESU____DEPL____________________') Hypo_1_1.AddFieldInterp('RESU____ERRE_ELEM_SIGM__________') - print HypoName_1, " : zones utilisées :", Hypo_1_1.GetZones() print HypoName_1, " : champ utilisé :", Hypo_1_1.GetFieldName() print HypoName_1, " : composantes utilisées :", Hypo_1_1.GetComps() if ( len (Hypo_1_1.GetFieldName()) > 0 ) : @@ -94,7 +96,12 @@ Python script for HOMARD Zones_1_et_2 = homard.CreateHypothesis(HypoName_2) Zones_1_et_2.AddZone('Zone_1_1', 1) Zones_1_et_2.AddZone('Zone_1_2', 1) - print HypoName_2, " : zones utilisées :", Zones_1_et_2.GetZones() + laux = Zones_1_et_2.GetZones() + nbzone = len(laux)/2 + jaux = 0 + for iaux in range(nbzone) : + print HypoName_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux] + jaux += 2 print HypoName_2, " : champ utilisé :", Zones_1_et_2.GetFieldName() if ( len (Zones_1_et_2.GetFieldName()) > 0 ) : print ".. caractéristiques de l'adaptation :", Zones_1_et_2.GetField() diff --git a/tests/test_13.apad.02.bilan b/tests/test_13.apad.02.bilan index a70175e6..30afe19a 100644 --- a/tests/test_13.apad.02.bilan +++ b/tests/test_13.apad.02.bilan @@ -5,7 +5,7 @@ ANALYSE DU MAILLAGE Maillage apres adaptation G_0 - Date de creation : mardi 29 avril 2014 a 17 h 19 mn 46 s + Date de creation : lundi 2 novembre 2015 a 9 h 14 mn 1 s Dimension : 3 Degre : 2 C'est un maillage obtenu apres 2 adaptations. @@ -52,7 +52,6 @@ ANALYSE DU MAILLAGE * . du niveau 0.5 * 168 * * . du niveau 1 * 0 * * . du niveau 1.5 * 120 * - * . du niveau 2 * 0 * ************************************************************ ************************************************************ @@ -79,7 +78,6 @@ ANALYSE DU MAILLAGE * . du niveau 0.5 * 96 * * . du niveau 1 * 0 * * . du niveau 1.5 * 160 * - * . du niveau 2 * 0 * ************************************************************ ************************************************************ @@ -103,5 +101,4 @@ ANALYSE DU MAILLAGE * . du niveau 0.5 * 120 * * . du niveau 1 * 0 * * . du niveau 1.5 * 312 * - * . du niveau 2 * 0 * ************************************************************ diff --git a/tests/test_14.apad.03.bilan b/tests/test_14.apad.03.bilan index 2a747009..45a987dc 100644 --- a/tests/test_14.apad.03.bilan +++ b/tests/test_14.apad.03.bilan @@ -5,7 +5,7 @@ ANALYSE DU MAILLAGE Maillage apres adaptation PIQUAGE - Date de creation : mardi 29 avril 2014 a 17 h 47 mn 59 s + Date de creation : lundi 2 novembre 2015 a 9 h 13 mn 13 s Dimension : 3 Degre : 1 C'est un maillage obtenu apres 3 adaptations. @@ -62,5 +62,4 @@ ANALYSE DU MAILLAGE * . du niveau 0.5 * 0 * * . du niveau 1 * 18174 * * . du niveau 1.5 * 25316 * - * . du niveau 2 * 0 * ************************************************************ diff --git a/tests/test_15.apad.02.bilan b/tests/test_15.apad.02.bilan index 5e5f91a8..3ce77611 100644 --- a/tests/test_15.apad.02.bilan +++ b/tests/test_15.apad.02.bilan @@ -5,7 +5,7 @@ ANALYSE DU MAILLAGE Maillage apres adaptation COEUR_2D - Date de creation : vendredi 21 mars 2014 a 11 h 33 mn 45 s + Date de creation : lundi 2 novembre 2015 a 9 h 11 mn 58 s Dimension : 2 Degre : 1 C'est un maillage obtenu apres 2 adaptations. @@ -54,5 +54,4 @@ ANALYSE DU MAILLAGE ************************************************************ * . du niveau 0 * 162 * * . du niveau 1 * 172 * - * . du niveau 2 * 0 * ************************************************************ diff --git a/tests/test_2.en.odt b/tests/test_2.en.odt index 44de3cf7..21ffeac2 100644 Binary files a/tests/test_2.en.odt and b/tests/test_2.en.odt differ diff --git a/tests/test_2.en.pdf b/tests/test_2.en.pdf index 75a9e87a..51e1c33a 100644 Binary files a/tests/test_2.en.pdf and b/tests/test_2.en.pdf differ diff --git a/tests/test_2.odt b/tests/test_2.odt index 03c61778..1bcc2596 100644 Binary files a/tests/test_2.odt and b/tests/test_2.odt differ diff --git a/tests/test_2.pdf b/tests/test_2.pdf index 0a058f33..c9122cb1 100644 Binary files a/tests/test_2.pdf and b/tests/test_2.pdf differ diff --git a/tests/test_3.en.odt b/tests/test_3.en.odt index 83d4bd2c..0b65fe31 100644 Binary files a/tests/test_3.en.odt and b/tests/test_3.en.odt differ diff --git a/tests/test_3.en.pdf b/tests/test_3.en.pdf index 7b1f6e32..8981740f 100644 Binary files a/tests/test_3.en.pdf and b/tests/test_3.en.pdf differ diff --git a/tests/test_3.odt b/tests/test_3.odt index a3f0c93e..a84751b9 100644 Binary files a/tests/test_3.odt and b/tests/test_3.odt differ diff --git a/tests/test_3.pdf b/tests/test_3.pdf index c05d06ff..ffba80dc 100644 Binary files a/tests/test_3.pdf and b/tests/test_3.pdf differ diff --git a/tests/test_4.apad.02.bilan b/tests/test_4.apad.02.bilan new file mode 100644 index 00000000..c1a9ff3d --- /dev/null +++ b/tests/test_4.apad.02.bilan @@ -0,0 +1,96 @@ + + +ANALYSE DU MAILLAGE +=================== + + Maillage apres adaptation + MESH + Date de creation : lundi 2 novembre 2015 a 11 h 32 mn 46 s + Dimension : 3 + Degre : 1 + C'est un maillage obtenu apres 2 adaptations. + Le niveau minimum actif est : 0 + Le niveau maximum atteint est : 2 + + Direction | Unite | Minimum | Maximum + --------------------------------------------------------------- + | | 0.0000 | 600.00 + | | 0.0000 | 400.00 + | | 0.0000 | 200.00 + + + NOMBRE D'ENTITES DU CALCUL + ========================== + + + ************************************************************ + * Noeuds * + ************************************************************ + * Nombre total * 1389 * + ************************************************************ + + ************************************************************ + * Segments * + ************************************************************ + * Nombre total * 124 * + * . dont aretes isolees * 0 * + * . dont aretes de bord de regions 2D * 0 * + * . dont aretes internes aux faces/volumes * 124 * + ************************************************************ + + ************************************************************ + * Triangles * + ************************************************************ + * Nombre total * 54 * + * . dont triangles de regions 2D * 54 * + * . dont triangles de bord * 0 * + * . dont triangles internes aux volumes * 0 * + ************************************************************ + * . du niveau 0 * 0 * + * . du niveau 0.5 * 54 * + ************************************************************ + + ************************************************************ + * Quadrangles * + ************************************************************ + * Nombre total * 616 * + * . dont quadrangles de regions 2D * 9 * + * . dont quadrangles de bord * 607 * + * . dont quadrangles internes aux volumes * 0 * + ************************************************************ + * . du niveau 0 * 503 * + * . du niveau 0.5 * 9 * + * . du niveau 1 * 104 * + ************************************************************ + + ************************************************************ + * Tetraedres * + ************************************************************ + * Nombre total * 200 * + ************************************************************ + * . du niveau 0 * 0 * + * . du niveau 0.5 * 192 * + * . du niveau 1 * 0 * + * . du niveau 1.5 * 8 * + ************************************************************ + + ************************************************************ + * Hexaedres * + ************************************************************ + * Nombre total * 847 * + ************************************************************ + * . du niveau 0 * 657 * + * . du niveau 0.5 * 0 * + * . du niveau 1 * 190 * + ************************************************************ + + ************************************************************ + * Pyramides * + ************************************************************ + * Nombre total * 454 * + ************************************************************ + * . du niveau 0 * 0 * + * . du niveau 0.5 * 412 * + * . du niveau 1 * 0 * + * . du niveau 1.5 * 42 * + ************************************************************ diff --git a/tests/test_4.apad.03.bilan b/tests/test_4.apad.03.bilan new file mode 100644 index 00000000..9ab79c54 --- /dev/null +++ b/tests/test_4.apad.03.bilan @@ -0,0 +1,98 @@ + + +ANALYSE DU MAILLAGE +=================== + + Maillage apres adaptation + MESH + Date de creation : mardi 3 novembre 2015 a 9 h 1 mn 54 s + Dimension : 3 + Degre : 1 + C'est un maillage obtenu apres 3 adaptations. + Le niveau minimum actif est : 0 + Le niveau maximum atteint est : 2 + + Direction | Unite | Minimum | Maximum + --------------------------------------------------------------- + | | 0.0000 | 600.00 + | | 0.0000 | 400.00 + | | 0.0000 | 200.00 + + + NOMBRE D'ENTITES DU CALCUL + ========================== + + + ************************************************************ + * Noeuds * + ************************************************************ + * Nombre total * 2503 * + ************************************************************ + + ************************************************************ + * Segments * + ************************************************************ + * Nombre total * 120 * + * . dont aretes isolees * 0 * + * . dont aretes de bord de regions 2D * 0 * + * . dont aretes internes aux faces/volumes * 120 * + ************************************************************ + + ************************************************************ + * Triangles * + ************************************************************ + * Nombre total * 582 * + * . dont triangles de regions 2D * 582 * + * . dont triangles de bord * 0 * + * . dont triangles internes aux volumes * 0 * + ************************************************************ + * . du niveau 0 * 0 * + * . du niveau 0.5 * 558 * + * . du niveau 1 * 0 * + * . du niveau 1.5 * 24 * + ************************************************************ + + ************************************************************ + * Quadrangles * + ************************************************************ + * Nombre total * 455 * + * . dont quadrangles de regions 2D * 81 * + * . dont quadrangles de bord * 374 * + * . dont quadrangles internes aux volumes * 0 * + ************************************************************ + * . du niveau 0 * 322 * + * . du niveau 0.5 * 81 * + * . du niveau 1 * 52 * + ************************************************************ + + ************************************************************ + * Tetraedres * + ************************************************************ + * Nombre total * 1952 * + ************************************************************ + * . du niveau 0 * 0 * + * . du niveau 0.5 * 1824 * + * . du niveau 1 * 0 * + * . du niveau 1.5 * 128 * + ************************************************************ + + ************************************************************ + * Hexaedres * + ************************************************************ + * Nombre total * 523 * + ************************************************************ + * . du niveau 0 * 283 * + * . du niveau 0.5 * 0 * + * . du niveau 1 * 240 * + ************************************************************ + + ************************************************************ + * Pyramides * + ************************************************************ + * Nombre total * 3559 * + ************************************************************ + * . du niveau 0 * 0 * + * . du niveau 0.5 * 3239 * + * . du niveau 1 * 0 * + * . du niveau 1.5 * 320 * + ************************************************************ diff --git a/tests/test_4.en.odt b/tests/test_4.en.odt new file mode 100644 index 00000000..af57cf34 Binary files /dev/null and b/tests/test_4.en.odt differ diff --git a/tests/test_4.en.pdf b/tests/test_4.en.pdf new file mode 100644 index 00000000..f45e2c56 Binary files /dev/null and b/tests/test_4.en.pdf differ diff --git a/tests/test_4.odt b/tests/test_4.odt new file mode 100644 index 00000000..841bdf35 Binary files /dev/null and b/tests/test_4.odt differ diff --git a/tests/test_4.pdf b/tests/test_4.pdf new file mode 100644 index 00000000..a313e82f Binary files /dev/null and b/tests/test_4.pdf differ diff --git a/tests/test_4.py b/tests/test_4.py new file mode 100755 index 00000000..a34ef117 --- /dev/null +++ b/tests/test_4.py @@ -0,0 +1,341 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2011-2015 CEA/DEN, 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, 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 +# +""" +Python script for HOMARD +Copyright EDF-R&D 2010, 2015 +Test test_4 +""" +__revision__ = "V1.0" + +#======================================================================== +Test_Name = "test_4" +n_iter_test_file = 3 +DX = 600. +DY = 400. +DZ = 200. +#======================================================================== +import os +import tempfile +import sys +import numpy as np +import salome +import GEOM +import SMESH +import HOMARD +import MEDCoupling as mc +import MEDLoader as ml +# +# ================================== +pathHomard = os.getenv('HOMARD_ROOT_DIR') +# Repertoire des donnees du test +Rep_Test = os.path.join(pathHomard, "share", "salome", "resources", "homard") +Rep_Test = os.path.normpath(Rep_Test) +sys.path.append(Rep_Test) +from test_util import test_results +# Repertoire des resultats +dircase = tempfile.mkdtemp() +#dircase = "/scratch/D68518/Salome/resu" +# ================================== + +salome.salome_init() + +import SALOMEDS +from salome.geom import geomBuilder +from salome.smesh import smeshBuilder +from salome.StdMeshers import StdMeshersBuilder +# +from MEDLoader import MEDLoader +from MEDCouplingRemapper import MEDCouplingRemapper + +import iparameters +ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1)) +ipar.append("AP_MODULES_LIST", "Homard") +# +#======================================================================== +#======================================================================== +def geom_smesh_exec(theStudy): + """ +Python script for GEOM and SMESH + """ + error = 0 +# + while not error : + # + geompy = geomBuilder.New(theStudy) + # + # Creation of the box + # =================== + BOX = geompy.MakeBoxDXDYDZ(DX, DY, DZ, "BOX") + + # Creation of the mesh + # ==================== + smesh = smeshBuilder.New(theStudy) + MESH = smesh.Mesh(BOX) + smesh.SetName(MESH.GetMesh(), 'MESH') + # + # Creation of the hypotheses + # ========================== + Regular_1D = MESH.Segment() + smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D') + Length = min(DX, DY, DZ) / 5. + Local_Length = Regular_1D.LocalLength(Length,None,1e-07) + smesh.SetName(Local_Length, 'Local Length') + # + Quadrangle_2D = MESH.Quadrangle(algo=smeshBuilder.QUADRANGLE) + smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') + Quadrangle_Parameters = Quadrangle_2D.QuadrangleParameters(StdMeshersBuilder.QUAD_STANDARD,-1,[],[]) + smesh.SetName(Quadrangle_Parameters, 'Quadrangle Parameters') + # + Hexa_3D = MESH.Hexahedron(algo=smeshBuilder.Hexa) + smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') + # + # Computation + # =========== + # + isDone = MESH.Compute() + if not isDone : + error = 1 + break + # + # MED exportation + # =============== + # + try: + ficmed = os.path.join(dircase, 'maill.00.med') + MESH.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None ,1) + except Exception, e: + raise Exception('ExportToMEDX() failed. '+e.message) + error = 2 + # + break + # + return error + +#======================================================================== +# +#======================================================================== +def field_exec(theStudy, niter): + """ +Python script for MEDCoupling + """ + error = 0 +# + while not error : + # + # The mesh + # ======== + ficmed = os.path.join(dircase, 'maill.%02d.med' % niter) + meshMEDFileRead = ml.MEDFileMesh.New(ficmed) + meshRead0 = meshMEDFileRead.getMeshAtLevel(0) + # Valeurs of the field + # ==================== + nbNodes = meshRead0.getNumberOfNodes() + valeur = mc.DataArrayDouble(nbNodes) + for iaux, taux in enumerate(meshRead0.getCoords()) : + #ligne = "x = %f" % taux[0] + #ligne += ", y = %f" % taux[1] + #ligne += ", z = %f" % taux[2] + #print ligne + #distance = (taux[0]-DX*0.2)**2 + (taux[1]-DY*0.2)**2 + (taux[2]-DZ*0.4)**2 + distance = min(abs(taux[0]-DX*0.4), abs(taux[1]-DY*0.2), abs(taux[2]-DZ*0.4)) + valeur[iaux] = 1.e0 / max ( 1.e-5, np.sqrt(distance) ) + #print ". valeur", valeur + nparr = valeur.toNumPyArray() + print ". mini/maxi", nparr.min(), nparr.max() + # + # Creation of the field + # ===================== + field = ml.MEDCouplingFieldDouble(ml.ON_NODES, ml.ONE_TIME) + field.setArray(valeur) + field.setMesh(meshRead0) + field.setName("DISTANCE") + # + fMEDFile_ch = ml.MEDFileField1TS() + fMEDFile_ch.setFieldNoProfileSBT(field) # No profile desired on the field, Sort By Type + fMEDFile_ch.write(ficmed, 0) # 0 to indicate that we *append* (and no overwrite) to the MED file + # + break + # + return error + +#======================================================================== +#======================================================================== +def homard_exec(theStudy): + """ +Python script for HOMARD + """ + error = 0 +# + while not error : + # + homard.SetCurrentStudy(theStudy) + # + # Creation of the zones + # ===================== + # + epsilon = min(DX, DY, DZ) / 100. + # Creation of the box Zone_4_1 + Zone_4_1 = homard.CreateZoneBox('Zone_4_1', -epsilon, DX/3.+epsilon, DY/4.-epsilon, 3.*DY/4.+epsilon, 4.*DZ/5.-epsilon, DZ+epsilon) + + # Creation of the sphere Zone_4_2 + rayon = min(DX, DY, DZ) / 4. + Zone_4_2 = homard.CreateZoneSphere('Zone_4_2', DX/3., DY*0.3, DZ*0.6, rayon) + # + # Creation of the hypotheses + # ========================== + dico = {} + dico["1"] = "raffinement" + dico["-1"] = "deraffinement" + # Creation of the hypothesis Hypo_4_1 + HypoName_1 = "Zone_1" + print "-------- Creation of the hypothesis", HypoName_1 + Hypo_4_1 = homard.CreateHypothesis(HypoName_1) + Hypo_4_1.AddZone('Zone_4_1', 1) + Hypo_4_1.SetExtraOutput(2) + laux = Hypo_4_1.GetZones() + nbzone = len(laux)/2 + jaux = 0 + for iaux in range(nbzone) : + print HypoName_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux] + jaux += 2 + # Creation of the hypothesis Hypo_4_2 + HypoName_2 = "Zone_2" + print "-------- Creation of the hypothesis", HypoName_2 + Hypo_4_2 = homard.CreateHypothesis(HypoName_2) + Hypo_4_2.AddZone('Zone_4_2', 1) + Hypo_4_2.SetExtraOutput(2) + laux = Hypo_4_2.GetZones() + nbzone = len(laux)/2 + jaux = 0 + for iaux in range(nbzone) : + print HypoName_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux] + jaux += 2 + # Creation of the hypothesis DISTANCE INVERSE + HypoName_3 = "DISTANCE INVERSE" + print "-------- Creation of the hypothesis", HypoName_3 + Hypo_4_3 = homard.CreateHypothesis(HypoName_3) + Hypo_4_3.SetField('DISTANCE') + Hypo_4_3.SetUseComp(0) + Hypo_4_3.SetRefinThr(1, 0.3) + Hypo_4_3.SetUnRefThr(1, 0.2) + Hypo_4_3.AddFieldInterp('DISTANCE') + Hypo_4_3.SetExtraOutput(2) + print HypoName_3, " : zones utilisées :", Hypo_4_3.GetZones() + print HypoName_3, " : champ utilisé :", Hypo_4_3.GetFieldName() + print HypoName_3, " : composantes utilisées :", Hypo_4_3.GetComps() + if ( len (Hypo_4_3.GetFieldName()) > 0 ) : + print ".. caractéristiques de l'adaptation :", Hypo_4_3.GetField() + print HypoName_3, " : champs interpolés :", Hypo_4_3.GetFieldInterps() + # + # Creation of the cases + # ===================== + # Creation of the case + CaseName = "Case_" + Test_Name + print "-------- Creation of the case", CaseName + MeshFile = os.path.join(dircase, 'maill.00.med') + Case_test_4 = homard.CreateCase(CaseName, 'MESH', MeshFile) + Case_test_4.SetDirName(dircase) + Case_test_4.SetConfType(1) + # + # Creation of the iterations + # ========================== + # Creation of the iteration 1 + IterName = "I_" + Test_Name + "_1" + print "-------- Creation of the iteration", IterName + Iter_test_4_1 = Case_test_4.NextIteration(IterName) + Iter_test_4_1.AssociateHypo(HypoName_1) + print ". Hypothese :", HypoName_1 + Iter_test_4_1.SetMeshName('M1') + Iter_test_4_1.SetMeshFile(os.path.join(dircase, 'maill.01.med')) + error = Iter_test_4_1.Compute(1, 2) + if error : + error = 1 + break + + # Creation of the iteration 2 + IterName = "I_" + Test_Name + "_2" + print "-------- Creation of the iteration", IterName + Iter_test_4_2 = Iter_test_4_1.NextIteration(IterName) + Iter_test_4_2.AssociateHypo(HypoName_2) + print ". Hypothese :", HypoName_2 + Iter_test_4_2.SetMeshName('M2') + Iter_test_4_2.SetMeshFile(os.path.join(dircase, 'maill.02.med')) + error = Iter_test_4_2.Compute(1, 2) + if error : + error = 2 + break + + # Creation of the iteration 3 + # + error = field_exec(theStudy, 2) + if error : + error = 30 + break + # + IterName = "I_" + Test_Name + "_3" + print "-------- Creation of the iteration", IterName + Iter_test_4_3 = Iter_test_4_2.NextIteration(IterName) + Iter_test_4_3.AssociateHypo(HypoName_3) + print ". Hypothese :", HypoName_3 + Iter_test_4_3.SetMeshName('M3') + Iter_test_4_3.SetFieldFile(os.path.join(dircase, 'maill.02.med')) + Iter_test_4_3.SetMeshFile(os.path.join(dircase, 'maill.03.med')) + error = Iter_test_4_3.Compute(1, 2) + if error : + error = 3 + break + # + break + # + return error + +#======================================================================== +# +# Geometry and Mesh +# +try : + error_main = geom_smesh_exec(salome.myStudy) + if error_main : + raise Exception('Pb in geom_smesh_exec') +except Exception, e: + raise Exception('Pb in geom_smesh_exec: '+e.message) + +homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD') +assert homard is not None, "Impossible to load homard engine" +homard.SetLanguageShort("fr") +# +# Exec of HOMARD-SALOME +# +try : + error_main = homard_exec(salome.myStudy) + if error_main : + raise Exception('Pb in homard_exec at iteration %d' %error_main ) +except Exception, e: + raise Exception('Pb in homard_exec: '+e.message) +# +# 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) +# +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser(1) + iparameters.getSession().restoreVisualState(1) +