Salome HOME
Passage de l'exécutable HOMARD à MED 3.1 : impact dans les tests
authorGérald NICOLAS <gerald.nicolas@edf.fr>
Tue, 3 Nov 2015 10:27:43 +0000 (11:27 +0100)
committerGérald NICOLAS <gerald.nicolas@edf.fr>
Tue, 3 Nov 2015 10:27:43 +0000 (11:27 +0100)
- 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

24 files changed:
tests/CMakeLists.txt
tests/test_1.en.odt
tests/test_1.en.pdf
tests/test_1.odt
tests/test_1.pdf
tests/test_1.py [changed mode: 0644->0755]
tests/test_13.apad.02.bilan
tests/test_14.apad.03.bilan
tests/test_15.apad.02.bilan
tests/test_2.en.odt
tests/test_2.en.pdf
tests/test_2.odt
tests/test_2.pdf
tests/test_3.en.odt
tests/test_3.en.pdf
tests/test_3.odt
tests/test_3.pdf
tests/test_4.apad.02.bilan [new file with mode: 0644]
tests/test_4.apad.03.bilan [new file with mode: 0644]
tests/test_4.en.odt [new file with mode: 0644]
tests/test_4.en.pdf [new file with mode: 0644]
tests/test_4.odt [new file with mode: 0644]
tests/test_4.pdf [new file with mode: 0644]
tests/test_4.py [new file with mode: 0755]

index 5ac2598976f36c5c73019c7fd9875ddc93fc2ca9..1dbb4424de957b4f01f31b705fb3ae3f66565c2a 100755 (executable)
@@ -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
index a728ba7829df2560ad4d6e187f6afd128dd68144..005ba6a2f4b8e81f4e0ee8ccefe20eca9f38cb3c 100644 (file)
Binary files a/tests/test_1.en.odt and b/tests/test_1.en.odt differ
index a0642bc07442af9a6fb83462ad0084cac937cf9e..909cb28e90976cef2cdfd35cfed1c12eb1ae9110 100644 (file)
Binary files a/tests/test_1.en.pdf and b/tests/test_1.en.pdf differ
index 257405ff43e0b34f4816e4685c295905c85124d4..cd2a6573baa9a23ae7e7488e1eeb9d7f796de794 100644 (file)
Binary files a/tests/test_1.odt and b/tests/test_1.odt differ
index d663a40a47df5bb05f0260faa85806f0fa3f47a9..caa7941ecfa4348fe808c3bc1b8e3941fb5b7b50 100644 (file)
Binary files a/tests/test_1.pdf and b/tests/test_1.pdf differ
old mode 100644 (file)
new mode 100755 (executable)
index b831dd4..a202ccb
 #
 """
 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()
index a70175e6bc0c04b85045ebf41bd18dea61fe62d3..30afe19add5eddbcb0fb21761f68f1fa0cf36e60 100644 (file)
@@ -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 *
      ************************************************************
index 2a7470097a36acd3accb74fd78f23afa89a28f96..45a987dc1708fe6ceecfad9eb3f8b5824d2b5834 100644 (file)
@@ -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 *
      ************************************************************
index 5e5f91a80c77641c666db7bead44cdb4acceb57e..3ce77611fb2d0f4d838a6639bf3340277ea271bb 100644 (file)
@@ -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 *
      ************************************************************
index 44de3cf715e5464f4953b5c6d105a8411b48c938..21ffeac2bd3d4b72e10c50d9f80e9d08338beb58 100644 (file)
Binary files a/tests/test_2.en.odt and b/tests/test_2.en.odt differ
index 75a9e87ac97dcc75341d2b85595cc7ed318e03c7..51e1c33a0cf83ad5582faf8d14019cd914e9db5f 100644 (file)
Binary files a/tests/test_2.en.pdf and b/tests/test_2.en.pdf differ
index 03c6177820a1dc066299effcfd8f150316ac17bd..1bcc25965a317644beb218959708427093f5b2ed 100644 (file)
Binary files a/tests/test_2.odt and b/tests/test_2.odt differ
index 0a058f33fcfed12dd810c2a2ea3437745e781c41..c9122cb1ba80d4cbf9cde0bbbae520b12c8f6c09 100644 (file)
Binary files a/tests/test_2.pdf and b/tests/test_2.pdf differ
index 83d4bd2c6c0624f63da4f3791e74a21668213887..0b65fe31ad7feec3c92be1e75112fdec2368da23 100644 (file)
Binary files a/tests/test_3.en.odt and b/tests/test_3.en.odt differ
index 7b1f6e325d0a3111004b1ad701f55fef50030829..8981740f38f0f83b109985b95a3fca09718d97fa 100644 (file)
Binary files a/tests/test_3.en.pdf and b/tests/test_3.en.pdf differ
index a3f0c93e52b900265514e8c74865a5d1b40e0311..a84751b90228db7d509fbbbe3e71c05021258e27 100644 (file)
Binary files a/tests/test_3.odt and b/tests/test_3.odt differ
index c05d06ff0d67ce2ee6ca4d048a42055a7f13867a..ffba80dc9e18c2be28f5a377a5506aeb23767cf0 100644 (file)
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 (file)
index 0000000..c1a9ff3
--- /dev/null
@@ -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 (file)
index 0000000..9ab79c5
--- /dev/null
@@ -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 (file)
index 0000000..af57cf3
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 (file)
index 0000000..f45e2c5
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 (file)
index 0000000..841bdf3
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 (file)
index 0000000..a313e82
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 (executable)
index 0000000..a34ef11
--- /dev/null
@@ -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)
+