Salome HOME
tests et tutorial
authorGerald NICOLAS <gerald.nicolas@edf.fr>
Mon, 15 Jan 2018 10:41:55 +0000 (11:41 +0100)
committerGerald NICOLAS <gerald.nicolas@edf.fr>
Mon, 15 Jan 2018 10:41:55 +0000 (11:41 +0100)
33 files changed:
doc/files/tutorial_1.py
doc/files/tutorial_2.py
doc/files/tutorial_3.py
doc/files/tutorial_4.00.med.gz
doc/files/tutorial_4.fr.med.gz [deleted file]
doc/files/tutorial_4.py
doc/files/tutorial_4.xao.gz [new file with mode: 0755]
doc/files/tutorial_4.xml
doc/files/tutorial_5.py
doc/files/tutorial_6.fr.med.gz [new file with mode: 0755]
doc/files/tutorial_6.py [new file with mode: 0755]
doc/files/tutorial_6.xml [new file with mode: 0755]
doc/files/tutorial_util.py
doc/files/yacs_script.py
doc/files/yacs_script_test.py
src/tests/Test/CMakeLists.txt
src/tests/Test/CTestTestfileInstall.cmake
src/tests/Test/test_1.py
src/tests/Test/test_2.py
src/tests/Test/test_3.py
src/tests/Test/test_4.py
src/tests/Test/test_5.py
src/tests/Test/test_6.py [new file with mode: 0755]
src/tests/Test/test_util.py
src/tests/Test/tutorial_1.py
src/tests/Test/tutorial_2.py
src/tests/Test/tutorial_3.py
src/tests/Test/tutorial_4.py
src/tests/Test/tutorial_5.py
src/tests/Test/tutorial_6.py [new file with mode: 0755]
src/tests/samples/test_6.apad.03.bilan [new file with mode: 0755]
src/tests/samples/tutorial_4.apad.03.bilan
src/tests/samples/tutorial_6.apad.03.bilan [new file with mode: 0755]

index 51b46e37e0794402b3b00dcef14a04a7d5f0faab..b02c56ec555357029ae10d572992a8bf9f6088d5 100755 (executable)
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
 """
-__revision__ = "V2.1"
+__revision__ = "V3.1"
 #
 import os
 import sys
 #
 # ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
 # Repertoire des donnees du tutorial
 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
@@ -47,40 +47,44 @@ salome.salome_init()
 import HOMARD
 #
 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
+homard.UpdateStudy()
+#
+#============================= Début des commandes =============================
 #
 # Hypotheses
 # ==========
-hypo_1 = homard.CreateHypothesis('hypo_1')
-hypo_1.SetUnifRefinUnRef(1)
+l_hypothese = homard.CreateHypothesis('hypo_1')
+l_hypothese.SetUnifRefinUnRef(1)
 #
 # Cas
 # ===
-case_1 = homard.CreateCase('Case_1', 'MAILL', DATA_TUTORIAL+'/tutorial_1.00.med')
-case_1.SetDirName(DIRCASE)
-case_1.SetConfType(1)
+le_cas = homard.CreateCase('Case_1', 'MAILL', os.path.join(DATA_TUTORIAL, "tutorial_1.00.med"))
+le_cas.SetDirName(DIRCASE)
 #
 # Iterations
 # ==========
 # Iteration "iter_1_1"
-iter_1_1 = case_1.NextIteration('iter_1_1')
+iter_1_1 = le_cas.NextIteration('iter_1_1')
 iter_1_1.SetMeshName('MESH')
-iter_1_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_1_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
 iter_1_1.AssociateHypo('hypo_1')
-error = iter_1_1.Compute(1, 2)
+erreur = iter_1_1.Compute(1, 2)
 
 # Iteration "iter_1_2"
 iter_1_2 = iter_1_1.NextIteration('iter_1_2')
 iter_1_2.SetMeshName('MESH')
-iter_1_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_1_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
 iter_1_2.AssociateHypo('hypo_1')
-error = iter_1_2.Compute(1, 2)
+erreur = iter_1_2.Compute(1, 2)
 
 # Iteration "iter_1_3"
 iter_1_3 = iter_1_2.NextIteration('iter_1_3')
 iter_1_3.SetMeshName('MESH')
-iter_1_3.SetMeshFile(DIRCASE+'/maill.03.med')
+iter_1_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
 iter_1_3.AssociateHypo('hypo_1')
-error = iter_1_3.Compute(1, 2)
+erreur = iter_1_3.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
 #
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 1, 1)
index 8fe7b6a9e92e643581ef9753ba3197a0d8f47415..9a3513572b197ffc5439af10e7315f1a079272c6 100755 (executable)
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
 """
-__revision__ = "V2.10"
+__revision__ = "V3.01"
 #
 import os
 import sys
 #
 # ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
 # Repertoire des donnees du tutorial
 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
@@ -47,6 +47,9 @@ salome.salome_init()
 import HOMARD
 #
 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
+homard.UpdateStudy()
+#
+#============================= Début des commandes =============================
 #
 # Creation des zones
 # ==================
@@ -61,37 +64,39 @@ Zone_2 = homard.CreateZoneBox ('Zone_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
 #
 # Hypothese "hypo_2"
 # ==================
-hypo_2 = homard.CreateHypothesis('hypo_2')
-hypo_2.AddZone('Zone_1', 1)
-hypo_2.AddZone('Zone_0', 1)
+l_hypothese = homard.CreateHypothesis('hypo_2')
+l_hypothese.AddZone('Zone_1', 1)
+l_hypothese.AddZone('Zone_0', 1)
 #
 # Hypothese "hypo_2_bis"
 # ======================
-hypo_2_bis = homard.CreateHypothesis('hypo_2_bis')
-hypo_2_bis.AddZone('Zone_0', -1)
-hypo_2_bis.AddZone('Zone_2', 1)
+l_hypothese_bis = homard.CreateHypothesis('hypo_2_bis')
+l_hypothese_bis.AddZone('Zone_0', -1)
+l_hypothese_bis.AddZone('Zone_2', 1)
 #
 # Cas
 # ===
-case_2 = homard.CreateCase('Case_2', 'MZERO', DATA_TUTORIAL+'/tutorial_2.00.med')
-case_2.SetDirName(DIRCASE)
+le_cas = homard.CreateCase('Case_2', 'MZERO', os.path.join(DATA_TUTORIAL, "tutorial_2.00.med"))
+le_cas.SetDirName(DIRCASE)
 #
 # Iteration "iter_2_1"
 # ====================
-iter_2_1 = case_2.NextIteration('iter_2_1')
+iter_2_1 = le_cas.NextIteration('iter_2_1')
 iter_2_1.SetMeshName('M_1')
-iter_2_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_2_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
 iter_2_1.AssociateHypo('hypo_2')
-error = iter_2_1.Compute(1, 2)
+erreur = iter_2_1.Compute(1, 2)
 #
 # Iteration "iter_2_2"
 # ====================
 iter_2_2 = iter_2_1.NextIteration('iter_2_2')
 iter_2_2.SetMeshName('M_2')
-iter_2_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_2_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
 iter_2_2.AssociateHypo('hypo_2_bis')
-error = iter_2_2.Compute(1, 2)
-
+erreur = iter_2_2.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
+#
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 2, 1)
 # ==================================
index 61ffaae60fd68bca483d9251368296bf86935209..22eba2b1f6d31d5c82961109548ab7281d2173ed 100755 (executable)
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
 """
-__revision__ = "V2.1"
+__revision__ = "V3.1"
 #
 import os
 import sys
 #
 # ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
 # Repertoire des donnees du tutorial
 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
@@ -47,6 +47,9 @@ salome.salome_init()
 import HOMARD
 #
 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
+homard.UpdateStudy()
+#
+#============================= Début des commandes =============================
 #
 # Hypothese "hypo_0vers1"
 # =======================
@@ -88,39 +91,41 @@ hypo_1vers2_bis.SetTypeFieldInterp(0)
 #
 # Cas
 # ===
-case_3 = homard.CreateCase('Case_3', 'G_0', DATA_TUTORIAL+'/tutorial_3.00.med')
-case_3.SetDirName(DIRCASE)
+le_cas = homard.CreateCase('Case_3', 'G_0', os.path.join(DATA_TUTORIAL, "tutorial_3.00.med"))
+le_cas.SetDirName(DIRCASE)
 #
 # Iteration "iter_3_1"
 # ====================
-iter_3_1 = case_3.NextIteration('iter_3_1')
+iter_3_1 = le_cas.NextIteration('iter_3_1')
 iter_3_1.SetMeshName('H_1')
-iter_3_1.SetMeshFile(DIRCASE+'/maill.01.med')
-iter_3_1.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.00.med')
+iter_3_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+iter_3_1.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.00.med"))
 iter_3_1.SetTimeStepRank( 1, 1)
 iter_3_1.AssociateHypo('hypo_0vers1')
-error = iter_3_1.Compute(1, 2)
+erreur = iter_3_1.Compute(1, 2)
 #
 # Iteration "iter_3_2"
 # ====================
 iter_3_2 = iter_3_1.NextIteration('iter_3_2')
 iter_3_2.SetMeshName('H_2')
-iter_3_2.SetMeshFile(DIRCASE+'/maill.02.med')
-iter_3_2.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.01.med')
+iter_3_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+iter_3_2.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.01.med"))
 iter_3_2.SetTimeStepRank(1, 1)
 iter_3_2.AssociateHypo('hypo_1vers2')
-error = iter_3_2.Compute(1, 2)
+erreur = iter_3_2.Compute(1, 2)
 #
 # Iteration "iter_3_2_bis"
 # ========================
 iter_3_2_bis = iter_3_1.NextIteration('iter_3_2_bis')
 iter_3_2_bis.SetMeshName('H_2_bis')
-iter_3_2_bis.SetMeshFile(DIRCASE+'/maill.02.bis.med')
-iter_3_2_bis.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.01.med')
+iter_3_2_bis.SetMeshFile(os.path.join(DIRCASE, "maill.02.bis.med"))
+iter_3_2_bis.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.01.med"))
 iter_3_2_bis.SetTimeStepRank(1, 1)
 iter_3_2_bis.AssociateHypo('hypo_1vers2_bis')
-error = iter_3_2_bis.Compute(1, 2)
-
+erreur = iter_3_2_bis.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
+#
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 3, 1)
 # ==================================
index b0bc427354a4c1453f07751be52cc802a2a56f5c..d023424b4b6b2caf65f2fc766f8afd64a3a2edea 100644 (file)
Binary files a/doc/files/tutorial_4.00.med.gz and b/doc/files/tutorial_4.00.med.gz differ
diff --git a/doc/files/tutorial_4.fr.med.gz b/doc/files/tutorial_4.fr.med.gz
deleted file mode 100644 (file)
index 171bc3a..0000000
Binary files a/doc/files/tutorial_4.fr.med.gz and /dev/null differ
index 9b4751f168c044bc29f9bcc8f4fc6c5e7608caa2..02b05e2aa00d752cd784f6e9761b2226e302d8f2 100755 (executable)
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2011, 2014
+Copyright EDF 1996, 2011, 2018
 """
-__revision__ = "V3.1"
+__revision__ = "V4.2"
 #
 import os
 import sys
 #
 # ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
 # Repertoire des donnees du tutorial
 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
@@ -47,67 +47,58 @@ salome.salome_init()
 import HOMARD
 #
 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
+homard.UpdateStudy()
 #
-# Frontieres
-# ==========
-boun_4_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.fr.med')
-#
-boun_4_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
-#
-boun_4_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+#============================= Début des commandes =============================
 #
-boun_4_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+# Frontières
+# ==========
+boun_4 = homard.CreateBoundaryCAO("PIQUAGE", os.path.join(DATA_TUTORIAL, "tutorial_4.xao"))
 #
-boun_4_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+# Cas
+# ===
+le_cas = homard.CreateCase('Case_4', "PIQUAGE", os.path.join(DATA_TUTORIAL, "tutorial_4.00.med"))
+le_cas.SetDirName(DIRCASE)
+le_cas.AddBoundary( "PIQUAGE" )
 #
 # Hypotheses
 # ==========
 # Creation of the hypothesis hypo_4
-hypo_4 = homard.CreateHypothesis('hypo_4')
-hypo_4.SetUnifRefinUnRef(1)
-hypo_4.AddGroup('T1_INT_I')
-hypo_4.AddGroup('T1_INT_O')
-hypo_4.AddGroup('T2_INT')
+l_hypothese = homard.CreateHypothesis('hypo_4')
+l_hypothese.SetUnifRefinUnRef(1)
+l_hypothese.AddGroup('T1_INT_I')
+l_hypothese.AddGroup('T1_INT_O')
+l_hypothese.AddGroup('T2_INT')
 # Creation of the hypothesis hypo_4_bis
-hypo_4_bis = homard.CreateHypothesis('hypo_4_bis')
-hypo_4_bis.SetUnifRefinUnRef(1)
-hypo_4_bis.AddGroup('T1_EXT_I')
-hypo_4_bis.AddGroup('T1_EXT_O')
-hypo_4_bis.AddGroup('T2_EXT')
-#
-# Cas
-# ===
-case_4 = homard.CreateCase('Case_4', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.00.med')
-case_4.SetDirName(DIRCASE)
-case_4.AddBoundaryGroup( 'intersection', '' )
-case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
-case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
-case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
-case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
-case_4.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
-case_4.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+l_hypothese_bis = homard.CreateHypothesis('hypo_4_bis')
+l_hypothese_bis.SetUnifRefinUnRef(1)
+l_hypothese_bis.AddGroup('T1_EXT_I')
+l_hypothese_bis.AddGroup('T1_EXT_O')
+l_hypothese_bis.AddGroup('T2_EXT')
 #
 # Iterations
 # ==========
 # Iteration iter_4_1 : raffinement selon les faces internes
-iter_4_1 = case_4.NextIteration('iter_4_1')
+iter_4_1 = le_cas.NextIteration('iter_4_1')
 iter_4_1.SetMeshName('PIQUAGE_1')
-iter_4_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_4_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
 iter_4_1.AssociateHypo('hypo_4')
-error = iter_4_1.Compute(1, 2)
+erreur = iter_4_1.Compute(1, 2)
 # Iteration iter_4_2 : raffinement selon les faces externes
 iter_4_2 = iter_4_1.NextIteration('iter_4_2')
 iter_4_2.SetMeshName('PIQUAGE_2')
-iter_4_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_4_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
 iter_4_2.AssociateHypo('hypo_4_bis')
-error = iter_4_2.Compute(1, 2)
+erreur = iter_4_2.Compute(1, 2)
 # Iteration iter_4_3 : second raffinement selon les faces externes
 iter_4_3 = iter_4_2.NextIteration('iter_4_3')
 iter_4_3.SetMeshName('PIQUAGE_3')
-iter_4_3.SetMeshFile(DIRCASE+'/maill.03.med')
+iter_4_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
 iter_4_3.AssociateHypo('hypo_4_bis')
-error = iter_4_3.Compute(1, 2)
-
+erreur = iter_4_3.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
+#
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 4, 1)
 # ==================================
diff --git a/doc/files/tutorial_4.xao.gz b/doc/files/tutorial_4.xao.gz
new file mode 100755 (executable)
index 0000000..ecb87d3
Binary files /dev/null and b/doc/files/tutorial_4.xao.gz differ
index 0fadf72f6dfb70720f1e5977a58f6f207c73939e..2ccdb22c8a28a79f934009bfd1ef595d440c6efc 100644 (file)
@@ -1,5 +1,6 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc name="tutorial_4">
+   <property name="DefaultStudyID" value="1"/>
    <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
    <type name="string" kind="string"/>
    <struct name="Engines/dataref">
    <sequence name="seqdblevec" content="dblevec"/>
    <sequence name="seqint" content="int"/>
    <sequence name="seqintvec" content="intvec"/>
+   <sequence name="seqpyobj" content="pyobj"/>
    <sequence name="stringvec" content="string"/>
    <sequence name="seqstringvec" content="stringvec"/>
    <container name="DefaultContainer">
+      <property name="container_kind" value="Salome"/>
+      <property name="attached_on_cloning" value="0"/>
       <property name="container_name" value="FactoryServer"/>
       <property name="name" value="localhost"/>
    </container>
@@ -51,6 +55,7 @@ import HOMARD_Boundary_idl
 clt = orbmodule.client()
 CurrentStudy = clt.Resolve("/Study")
 ]]></code></script>
+         <load container="DefaultContainer"/>
          <outport name="CurrentStudy" type="Study"/>
       </inline>
       <service name="SetCurrentStudy">
@@ -59,45 +64,6 @@ CurrentStudy = clt.Resolve("/Study")
          <method>SetCurrentStudy</method>
          <inport name="theStudy" type="Study"/>
       </service>
-      <service name="CreateBoundarycyl_1_int">
-         <node>Etude_Initialisation.SetCurrentStudy</node>
-         <method>CreateBoundaryCylinder</method>
-         <inport name="BoundaryName" type="string"/>
-         <inport name="Xcentre" type="double"/>
-         <inport name="Ycentre" type="double"/>
-         <inport name="Zcentre" type="double"/>
-         <inport name="Xaxis" type="double"/>
-         <inport name="Yaxis" type="double"/>
-         <inport name="Zaxis" type="double"/>
-         <inport name="Radius" type="double"/>
-         <outport name="return" type="HOMARD_Boundary"/>
-      </service>
-      <service name="CreateBoundarycyl_1_ext">
-         <node>Etude_Initialisation.SetCurrentStudy</node>
-         <method>CreateBoundaryCylinder</method>
-         <inport name="BoundaryName" type="string"/>
-         <inport name="Xcentre" type="double"/>
-         <inport name="Ycentre" type="double"/>
-         <inport name="Zcentre" type="double"/>
-         <inport name="Xaxis" type="double"/>
-         <inport name="Yaxis" type="double"/>
-         <inport name="Zaxis" type="double"/>
-         <inport name="Radius" type="double"/>
-         <outport name="return" type="HOMARD_Boundary"/>
-      </service>
-      <service name="CreateBoundarycyl_2_int">
-         <node>Etude_Initialisation.SetCurrentStudy</node>
-         <method>CreateBoundaryCylinder</method>
-         <inport name="BoundaryName" type="string"/>
-         <inport name="Xcentre" type="double"/>
-         <inport name="Ycentre" type="double"/>
-         <inport name="Zcentre" type="double"/>
-         <inport name="Xaxis" type="double"/>
-         <inport name="Yaxis" type="double"/>
-         <inport name="Zaxis" type="double"/>
-         <inport name="Radius" type="double"/>
-         <outport name="return" type="HOMARD_Boundary"/>
-      </service>
       <service name="CreateHypothesis_1">
          <node>Etude_Initialisation.SetCurrentStudy</node>
          <method>CreateHypothesis</method>
@@ -114,12 +80,13 @@ CurrentStudy = clt.Resolve("/Study")
       </service>
       <inline name="Hypo_Options_1">
          <script><code><![CDATA[# Raffinement uniforme
-Hypo.SetAdapRefinUnRef(-1, 1, 0)
+Hypo.SetUnifRefinUnRef(1)
 # Filtrage par des groupes
 Hypo.AddGroup('T1_INT_I')
 Hypo.AddGroup('T1_INT_O')
 Hypo.AddGroup('T2_INT')
 ]]></code></script>
+         <load container="DefaultContainer"/>
          <inport name="Hypo" type="HOMARD_Hypothesis"/>
       </inline>
       <inline name="Case_Options">
@@ -127,43 +94,23 @@ Hypo.AddGroup('T2_INT')
 # =========
 # Repertoire d'execution
 Case.SetDirName(DirName)
-# Options de conformite
-Case.SetConfType(1)
 # Liens avec les frontieres
-Case.AddBoundaryGroup( 'intersection', '' )
-Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
-Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
-Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
-Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
-Case.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
-Case.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+Case.AddBoundary(CAO.GetName())
 # Resultats
 # =========
 # Iteration 0 associee
 Iter0 = Case.GetIter0()
 ]]></code></script>
+         <load container="DefaultContainer"/>
          <inport name="Case" type="HOMARD_Cas"/>
          <inport name="DirName" type="string"/>
+         <inport name="CAO" type="HOMARD_Boundary"/>
          <outport name="Iter0" type="HOMARD_Iteration"/>
       </inline>
-      <service name="CreateBoundarycyl_2_ext">
+      <service name="CreateBoundaryCAO">
          <node>Etude_Initialisation.SetCurrentStudy</node>
-         <method>CreateBoundaryCylinder</method>
+         <method>CreateBoundaryCAO</method>
          <inport name="BoundaryName" type="string"/>
-         <inport name="Xcentre" type="double"/>
-         <inport name="Ycentre" type="double"/>
-         <inport name="Zcentre" type="double"/>
-         <inport name="Xaxis" type="double"/>
-         <inport name="Yaxis" type="double"/>
-         <inport name="Zaxis" type="double"/>
-         <inport name="Radius" type="double"/>
-         <outport name="return" type="HOMARD_Boundary"/>
-      </service>
-      <service name="CreateBoundaryintersection">
-         <node>Etude_Initialisation.SetCurrentStudy</node>
-         <method>CreateBoundaryDi</method>
-         <inport name="BoundaryName" type="string"/>
-         <inport name="MeshName" type="string"/>
          <inport name="FileName" type="string"/>
          <outport name="return" type="HOMARD_Boundary"/>
       </service>
@@ -175,25 +122,23 @@ Iter0 = Case.GetIter0()
       </service>
       <inline name="Hypo_Options_2">
          <script><code><![CDATA[# Raffinement uniforme
-Hypo.SetAdapRefinUnRef(-1, 1, 0)
+Hypo.SetUnifRefinUnRef(1)
 # Filtrage par des groupes
 Hypo.AddGroup('T1_EXT_I')
 Hypo.AddGroup('T1_EXT_O')
 Hypo.AddGroup('T2_EXT')
 ]]></code></script>
+         <load container="DefaultContainer"/>
          <inport name="Hypo" type="HOMARD_Hypothesis"/>
       </inline>
       <control> <fromnode>StudyCreation</fromnode> <tonode>SetCurrentStudy</tonode> </control>
-      <control> <fromnode>SetCurrentStudy</fromnode> <tonode>CreateBoundarycyl_1_int</tonode> </control>
-      <control> <fromnode>CreateBoundarycyl_1_int</fromnode> <tonode>CreateBoundarycyl_1_ext</tonode> </control>
-      <control> <fromnode>CreateBoundarycyl_1_ext</fromnode> <tonode>CreateBoundarycyl_2_int</tonode> </control>
-      <control> <fromnode>CreateBoundarycyl_2_int</fromnode> <tonode>CreateBoundarycyl_2_ext</tonode> </control>
+      <control> <fromnode>SetCurrentStudy</fromnode> <tonode>CreateBoundaryCAO</tonode> </control>
       <control> <fromnode>CreateHypothesis_1</fromnode> <tonode>Hypo_Options_1</tonode> </control>
       <control> <fromnode>CreateCase</fromnode> <tonode>Case_Options</tonode> </control>
       <control> <fromnode>Hypo_Options_1</fromnode> <tonode>CreateHypothesis_2</tonode> </control>
       <control> <fromnode>Case_Options</fromnode> <tonode>CreateHypothesis_1</tonode> </control>
-      <control> <fromnode>CreateBoundarycyl_2_ext</fromnode> <tonode>CreateBoundaryintersection</tonode> </control>
-      <control> <fromnode>CreateBoundaryintersection</fromnode> <tonode>CreateCase</tonode> </control>
+      <control> <fromnode>CreateBoundaryCAO</fromnode> <tonode>CreateCase</tonode> </control>
+      <control> <fromnode>CreateBoundaryCAO</fromnode> <tonode>Case_Options</tonode> </control>
       <control> <fromnode>CreateHypothesis_2</fromnode> <tonode>Hypo_Options_2</tonode> </control>
       <datalink control="false">
          <fromnode>StudyCreation</fromnode> <fromport>CurrentStudy</fromport>
@@ -207,6 +152,10 @@ Hypo.AddGroup('T2_EXT')
          <fromnode>CreateCase</fromnode> <fromport>return</fromport>
          <tonode>Case_Options</tonode> <toport>Case</toport>
       </datalink>
+      <datalink control="false">
+         <fromnode>CreateBoundaryCAO</fromnode> <fromport>return</fromport>
+         <tonode>Case_Options</tonode> <toport>CAO</toport>
+      </datalink>
       <datalink control="false">
          <fromnode>CreateHypothesis_2</fromnode> <fromport>return</fromport>
          <tonode>Hypo_Options_2</tonode> <toport>Hypo</toport>
@@ -267,6 +216,7 @@ else :
     MessInfo = ""
 
 ]]></code></script>
+         <load container="DefaultContainer"/>
          <inport name="NumAdapt" type="int"/>
          <inport name="LastIter" type="HOMARD_Iteration"/>
          <inport name="Hypo" type="HOMARD_Hypothesis"/>
@@ -287,17 +237,26 @@ else :
       </datalink>
    </forloop>
    <inline name="Bilan">
-      <script><code><![CDATA[from PyQt4 import QtGui
-import sys
-app = QtGui.QApplication(sys.argv)
-if MessInfo != "" :
-    MessageBoxTitle = "Bilan"
-    QtGui.QMessageBox.warning(None, MessageBoxTitle, MessInfo)
-else :
-    MessageBoxTitle = "Bilan"
-    MessInfo = "Le maillage final est dans le fichier : " + MeshFile
-    QtGui.QMessageBox.information(None, MessageBoxTitle, MessInfo)
+      <script><code><![CDATA[import sys
+from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
+class App(QWidget):
+    def __init__(self, MessInfo, MeshFile):
+        super(App, self).__init__()
+        self.title = "Bilan"
+        self._MessInfo = MessInfo
+        self._MeshFile = MeshFile
+        self.initUI()
+    def initUI(self):
+        if self._MessInfo != "" :
+            button = QMessageBox.critical(self, self.title, self._MessInfo)
+        else :
+            MessInfo = "Le maillage final est dans le fichier : " + self._MeshFile
+            button = QMessageBox.information(self, self.title, MessInfo)
+        self.show()
+app = QApplication(sys.argv)
+ex = App(MessInfo, MeshFile)
 ]]></code></script>
+      <load container="DefaultContainer"/>
       <inport name="MessInfo" type="string"/>
       <inport name="MeshFile" type="string"/>
    </inline>
@@ -305,8 +264,6 @@ else :
       <script><code><![CDATA[import os
 pathHomard = os.getenv("HOMARD_ROOT_DIR")
 data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
-print "data_dir =", data_dir
-print os.listdir(data_dir)
 #
 # Maillage de la structure
 # . Nom du maillage
@@ -314,14 +271,12 @@ MeshName = "PIQUAGE"
 # . Fichier du maillage
 FileName = os.path.join(data_dir, "tutorial_4.00.med")
 #
-# Maillage de la frontiere
-# . Nom du maillage
-BMeshName = "PIQUAGE"
-# . Fichier du maillage
-BFileName = os.path.join(data_dir, "tutorial_4.fr.med")
+# CAO
+# . Fichier XAO
+BFileName = os.path.join(data_dir, "tutorial_4.xao")
 #
-# Répertoire de travail
-if os.environ.has_key("LOGNAME") :
+# Repertoire de travail
+if "LOGNAME" in os.environ :
   user = os.environ ["LOGNAME"]
 else :
   user = "anonymous"
@@ -329,9 +284,9 @@ DirName = os.path.join( os.sep, "tmp", "HOMARD_"+user)
 if not os.path.isdir(DirName) :
     os.mkdir (DirName)
 ]]></code></script>
+      <load container="DefaultContainer"/>
       <outport name="MeshName" type="string"/>
       <outport name="FileName" type="string"/>
-      <outport name="BMeshName" type="string"/>
       <outport name="BFileName" type="string"/>
       <outport name="DirName" type="string"/>
    </inline>
@@ -385,6 +340,7 @@ else :
     MessInfo = ""
 
 ]]></code></script>
+      <load container="DefaultContainer"/>
       <inport name="LastIter" type="HOMARD_Iteration"/>
       <inport name="Hypo" type="HOMARD_Hypothesis"/>
       <inport name="DirName" type="string"/>
@@ -410,25 +366,21 @@ else :
       <fromnode>DataInit</fromnode> <fromport>FileName</fromport>
       <tonode>Etude_Initialisation.CreateCase</tonode> <toport>FileName</toport>
    </datalink>
-   <datalink control="false">
-      <fromnode>DataInit</fromnode> <fromport>BMeshName</fromport>
-      <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>MeshName</toport>
-   </datalink>
    <datalink control="false">
       <fromnode>DataInit</fromnode> <fromport>BFileName</fromport>
-      <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>FileName</toport>
+      <tonode>Etude_Initialisation.CreateBoundaryCAO</tonode> <toport>FileName</toport>
    </datalink>
    <datalink control="false">
       <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
-      <tonode>HOMARD_1</tonode> <toport>DirName</toport>
+      <tonode>Etude_Initialisation.Case_Options</tonode> <toport>DirName</toport>
    </datalink>
    <datalink control="false">
       <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
-      <tonode>Etude_Initialisation.Case_Options</tonode> <toport>DirName</toport>
+      <tonode>ForLoop.HOMARD_2</tonode> <toport>DirName</toport>
    </datalink>
    <datalink control="false">
       <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
-      <tonode>ForLoop.HOMARD_2</tonode> <toport>DirName</toport>
+      <tonode>HOMARD_1</tonode> <toport>DirName</toport>
    </datalink>
    <datalink control="false">
       <fromnode>HOMARD_1</fromnode> <fromport>MessInfo</fromport>
@@ -467,104 +419,16 @@ else :
       <tonode>HOMARD_1</tonode> <toport>Hypo</toport>
    </datalink>
    <parameter>
-      <tonode>ForLoop</tonode><toport>nsteps</toport>
-      <value><int>2</int></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>BoundaryName</toport>
-      <value><string>cyl_1_ext</string></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xcentre</toport>
-      <value><double>0</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Ycentre</toport>
-      <value><double>25</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zcentre</toport>
-      <value><double>-25</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xaxis</toport>
-      <value><double>25</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Yaxis</toport>
-      <value><double>50</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zaxis</toport>
-      <value><double>75</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Radius</toport>
-      <value><double>100</double></value>
+      <tonode>Etude_Initialisation.CreateBoundaryCAO</tonode><toport>BoundaryName</toport>
+      <value><string>CAO</string></value>
    </parameter>
    <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>BoundaryName</toport>
-      <value><string>cyl_1_int</string></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xcentre</toport>
-      <value><double>0</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Ycentre</toport>
-      <value><double>25</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zcentre</toport>
-      <value><double>-25</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xaxis</toport>
-      <value><double>25</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Yaxis</toport>
-      <value><double>50</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zaxis</toport>
-      <value><double>75</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Radius</toport>
-      <value><double>75</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>BoundaryName</toport>
-      <value><string>cyl_2_int</string></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xcentre</toport>
-      <value><double>17.5</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Ycentre</toport>
-      <value><double>-2.5</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zcentre</toport>
-      <value><double>-12.5</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xaxis</toport>
-      <value><double>-100</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Yaxis</toport>
-      <value><double>-75</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zaxis</toport>
-      <value><double>-25</double></value>
+      <tonode>Etude_Initialisation.CreateHypothesis_2</tonode><toport>HypoName</toport>
+      <value><string>Hypo_4_bis</string></value>
    </parameter>
    <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Radius</toport>
-      <value><double>25</double></value>
+      <tonode>ForLoop</tonode><toport>nsteps</toport>
+      <value><int>2</int></value>
    </parameter>
    <parameter>
       <tonode>Etude_Initialisation.CreateCase</tonode><toport>CaseName</toport>
@@ -572,66 +436,22 @@ else :
    </parameter>
    <parameter>
       <tonode>Etude_Initialisation.CreateHypothesis_1</tonode><toport>HypoName</toport>
-      <value><string>Hypo_1</string></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>BoundaryName</toport>
-      <value><string>cyl_2_ext</string></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xcentre</toport>
-      <value><double>17.5</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Ycentre</toport>
-      <value><double>-2.5</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zcentre</toport>
-      <value><double>-12.5</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xaxis</toport>
-      <value><double>-100</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Yaxis</toport>
-      <value><double>-75</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zaxis</toport>
-      <value><double>-25</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Radius</toport>
-      <value><double>50</double></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode><toport>BoundaryName</toport>
-      <value><string>intersection</string></value>
-   </parameter>
-   <parameter>
-      <tonode>Etude_Initialisation.CreateHypothesis_2</tonode><toport>HypoName</toport>
-      <value><string>Hypo_2</string></value>
-   </parameter>
-   <presentation name="Etude_Initialisation.StudyCreation" x="2.5" y="34" width="158" height="63" expanded="1" expx="2.5" expy="34" expWidth="158" expHeight="63" shownState="0"/>
-   <presentation name="ForLoop" x="385" y="802.5" width="169" height="237" expanded="1" expx="385" expy="802.5" expWidth="169" expHeight="237" shownState="0"/>
-   <presentation name="HOMARD_1" x="6" y="804.5" width="158" height="144" expanded="1" expx="6" expy="804.5" expWidth="158" expHeight="144" shownState="0"/>
-   <presentation name="DataInit" x="4" y="32" width="158" height="171" expanded="1" expx="4" expy="32" expWidth="158" expHeight="171" shownState="0"/>
-   <presentation name="Bilan" x="720.5" y="770" width="158" height="90" expanded="1" expx="720.5" expy="770" expWidth="158" expHeight="90" shownState="0"/>
+      <value><string>Hypo_4</string></value>
+   </parameter>
+   <presentation name="Etude_Initialisation.StudyCreation" x="4" y="32" width="158" height="63" expanded="1" expx="4" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.SetCurrentStudy" x="163" y="32" width="158" height="63" expanded="1" expx="163" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.Hypo_Options_1" x="163" y="214.605" width="158" height="63" expanded="1" expx="163" expy="214.605" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateBoundaryCAO" x="4" y="96" width="158" height="90" expanded="1" expx="4" expy="96" expWidth="158" expHeight="90" shownState="0"/>
+   <presentation name="Etude_Initialisation.Case_Options" x="322.605" y="98.2103" width="158" height="117" expanded="1" expx="322.605" expy="98.2103" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="Etude_Initialisation.Hypo_Options_2" x="481.105" y="212.395" width="158" height="63" expanded="1" expx="481.105" expy="212.395" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateHypothesis_2" x="321.5" y="242.71" width="158" height="63" expanded="1" expx="321.5" expy="242.71" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Bilan" x="332.5" y="513.71" width="158" height="90" expanded="1" expx="332.5" expy="513.71" expWidth="158" expHeight="90" shownState="0"/>
    <presentation name="ForLoop.HOMARD_2" x="7" y="62" width="158" height="171" expanded="1" expx="7" expy="62" expWidth="158" expHeight="171" shownState="0"/>
-   <presentation name="Etude_Initialisation.Case_Options" x="177.5" y="358.5" width="158" height="90" expanded="1" expx="177.5" expy="358.5" expWidth="158" expHeight="90" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateBoundarycyl_1_ext" x="161" y="98" width="158" height="252" expanded="1" expx="161" expy="98" expWidth="158" expHeight="252" shownState="0"/>
-   <presentation name="Etude_Initialisation.SetCurrentStudy" x="161.5" y="34" width="158" height="63" expanded="1" expx="161.5" expy="34" expWidth="158" expHeight="63" shownState="0"/>
-   <presentation name="Etude_Initialisation" x="4" y="204" width="802" height="549" expanded="1" expx="4" expy="204" expWidth="802" expHeight="549" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateBoundarycyl_1_int" x="2.5" y="98.5" width="158" height="252" expanded="1" expx="2.5" expy="98.5" expWidth="158" expHeight="252" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateBoundarycyl_2_int" x="319.5" y="98.5" width="158" height="252" expanded="1" expx="319.5" expy="98.5" expWidth="158" expHeight="252" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateCase" x="4" y="357" width="158" height="117" expanded="1" expx="4" expy="357" expWidth="158" expHeight="117" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateHypothesis_1" x="4" y="481" width="158" height="63" expanded="1" expx="4" expy="481" expWidth="158" expHeight="63" shownState="0"/>
-   <presentation name="Etude_Initialisation.Hypo_Options_1" x="165" y="481.5" width="158" height="63" expanded="1" expx="165" expy="481.5" expWidth="158" expHeight="63" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateBoundarycyl_2_ext" x="479" y="99.5" width="158" height="252" expanded="1" expx="479" expy="99.5" expWidth="158" expHeight="252" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateBoundaryintersection" x="640" y="99.5" width="158" height="117" expanded="1" expx="640" expy="99.5" expWidth="158" expHeight="117" shownState="0"/>
-   <presentation name="Etude_Initialisation.CreateHypothesis_2" x="342.5" y="482" width="158" height="63" expanded="1" expx="342.5" expy="482" expWidth="158" expHeight="63" shownState="0"/>
-   <presentation name="Etude_Initialisation.Hypo_Options_2" x="517.095" y="482.405" width="158" height="63" expanded="1" expx="517.095" expy="482.405" expWidth="158" expHeight="63" shownState="0"/>
-   <presentation name="__ROOT__" x="0" y="0" width="882.5" height="1043.5" expanded="1" expx="0" expy="0" expWidth="882.5" expHeight="1043.5" shownState="0"/>
+   <presentation name="HOMARD_1" x="4" y="513.71" width="158" height="144" expanded="1" expx="4" expy="513.71" expWidth="158" expHeight="144" shownState="0"/>
+   <presentation name="DataInit" x="4" y="32" width="158" height="144" expanded="1" expx="4" expy="32" expWidth="158" expHeight="144" shownState="0"/>
+   <presentation name="Etude_Initialisation" x="4" y="203.5" width="643.105" height="309.71" expanded="1" expx="4" expy="203.5" expWidth="643.105" expHeight="309.71" shownState="0"/>
+   <presentation name="ForLoop" x="163" y="513.71" width="169" height="237" expanded="1" expx="163" expy="513.71" expWidth="169" expHeight="237" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateCase" x="163" y="97.1052" width="158" height="117" expanded="1" expx="163" expy="97.1052" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateHypothesis_1" x="4" y="214.605" width="158" height="63" expanded="1" expx="4" expy="214.605" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="651.105" height="754.71" expanded="1" expx="0" expy="0" expWidth="651.105" expHeight="754.71" shownState="0"/>
 </proc>
index 12bb4943ac951b4067d2d6d5a847f2a91540eed3..fdb7ea5d70685115eb127780041e4b22a0442e26 100755 (executable)
 
 """
 Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
 """
-__revision__ = "V2.1"
+__revision__ = "V3.2"
 #
 import os
 import sys
 #
 # ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
 # Repertoire des donnees du tutorial
 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
@@ -47,11 +47,14 @@ salome.salome_init()
 import HOMARD
 #
 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
+homard.UpdateStudy()
 #
-# Frontiere
+#============================= Début des commandes =============================
+#
+# Frontière
 # =========
 # Creation of the discrete boundary boun_5_1
-boun_5_1 = homard.CreateBoundaryDi('boun_5_1', 'MAIL_EXT', DATA_TUTORIAL+'/tutorial_5.fr.med')
+boun_5_1 = homard.CreateBoundaryDi('boun_5_1', 'MAIL_EXT', os.path.join(DATA_TUTORIAL, "tutorial_5.fr.med"))
 #
 # Creation des zones
 # ==================
@@ -63,35 +66,37 @@ quart_sup = homard.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
 # Hypotheses
 # ==========
 # Creation of the hypothesis hypo_5
-hypo_5 = homard.CreateHypothesis('hypo_5')
-hypo_5.AddZone('enveloppe', 1)
-# Creation of the hypothesis hypo_5_bis
-hypo_5_bis = homard.CreateHypothesis('hypo_5_bis')
-hypo_5_bis.AddZone('quart_sup', 1)
+l_hypothese = homard.CreateHypothesis('hypo_5')
+l_hypothese.AddZone('enveloppe', 1)
+# Creation of the hypothesis l_hypothese_bis
+l_hypothese_bis = homard.CreateHypothesis('hypo_5_bis')
+l_hypothese_bis.AddZone('quart_sup', 1)
 #
 # Cas
 # ===
-case_5 = homard.CreateCase('Case_5', 'COEUR_2D', DATA_TUTORIAL+'/tutorial_5.00.med')
-case_5.SetDirName(DIRCASE)
-case_5.SetConfType(3)
-case_5.AddBoundaryGroup('boun_5_1', '')
+le_cas = homard.CreateCase('Case_5', 'COEUR_2D', os.path.join(DATA_TUTORIAL, "tutorial_5.00.med"))
+le_cas.SetDirName(DIRCASE)
+le_cas.SetConfType(1)
+le_cas.AddBoundary('boun_5_1')
 #
 # Iteration "iter_5_1"
 # ====================
-iter_5_1 = case_5.NextIteration('iter_5_1')
+iter_5_1 = le_cas.NextIteration('iter_5_1')
 iter_5_1.SetMeshName('COEUR_2D_01')
-iter_5_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_5_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
 iter_5_1.AssociateHypo('hypo_5')
-error = iter_5_1.Compute(1, 2)
+erreur = iter_5_1.Compute(1, 2)
 #
 # Iteration "iter_5_2"
 # ====================
 iter_5_2 = iter_5_1.NextIteration('iter_5_2')
 iter_5_2.SetMeshName('COEUR_2D_02')
-iter_5_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_5_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
 iter_5_2.AssociateHypo('hypo_5_bis')
-error = iter_5_2.Compute(1, 2)
-
+erreur = iter_5_2.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
+#
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 5, 1)
 # ==================================
diff --git a/doc/files/tutorial_6.fr.med.gz b/doc/files/tutorial_6.fr.med.gz
new file mode 100755 (executable)
index 0000000..e280810
Binary files /dev/null and b/doc/files/tutorial_6.fr.med.gz differ
diff --git a/doc/files/tutorial_6.py b/doc/files/tutorial_6.py
new file mode 100755 (executable)
index 0000000..c464402
--- /dev/null
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2011-2016  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
+#
+
+"""
+Exemple de couplage HOMARD-Salome
+Copyright EDF 1996, 2011, 2018
+"""
+__revision__ = "V4.4"
+#
+import os
+import sys
+#
+# ==================================
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
+# Repertoire des donnees du tutorial
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+from tutorial_util import creation_dircase
+# ==================================
+DIRCASE = creation_dircase(6)
+gzip_gunzip(DATA_TUTORIAL, 4, -1)
+gzip_gunzip(DATA_TUTORIAL, 6, -1)
+# ==================================
+#
+import salome
+salome.salome_init()
+import HOMARD
+#
+homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
+homard.SetCurrentStudy(salome.myStudy)
+#
+#============================= Début des commandes =============================
+#
+# Frontières
+# ==========
+boun_6_1 = homard.CreateBoundaryDi('intersection', 'COURBES', os.path.join(DATA_TUTORIAL, "tutorial_6.fr.med"))
+#
+boun_6_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+#
+boun_6_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+#
+boun_6_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+#
+boun_6_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+#
+# Cas
+# ===
+le_cas = homard.CreateCase('Case_6', 'PIQUAGE', os.path.join(DATA_TUTORIAL, "tutorial_4.00.med"))
+le_cas.SetDirName(DIRCASE)
+le_cas.AddBoundary( 'intersection' )
+le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
+le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
+le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
+le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
+le_cas.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
+le_cas.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+#
+#============================== Fin des commandes ==============================
+#
+# Hypotheses
+# ==========
+# Creation of the hypothesis hypo_6
+l_hypothese = homard.CreateHypothesis('hypo_6')
+l_hypothese.SetUnifRefinUnRef(1)
+l_hypothese.AddGroup('IN1')
+l_hypothese.AddGroup('IN2')
+l_hypothese.AddGroup('T1_INT_I')
+l_hypothese.AddGroup('T1_INT_O')
+l_hypothese.AddGroup('T2_INT')
+# Creation of the hypothesis hypo_6_bis
+l_hypothese_bis = homard.CreateHypothesis('hypo_6_bis')
+l_hypothese_bis.SetUnifRefinUnRef(1)
+l_hypothese_bis.AddGroup('T1_EXT_I')
+l_hypothese_bis.AddGroup('T1_EXT_O')
+l_hypothese_bis.AddGroup('T2_EXT')
+#
+# Iterations
+# ==========
+# Iteration iter_6_1 : raffinement selon les faces internes
+iter_6_1 = le_cas.NextIteration('iter_6_1')
+iter_6_1.SetMeshName('PIQUAGE_6_1')
+iter_6_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+iter_6_1.AssociateHypo('hypo_6')
+erreur = iter_6_1.Compute(1, 2)
+# Iteration iter_6_2 : raffinement selon les faces externes
+iter_6_2 = iter_6_1.NextIteration('iter_6_2')
+iter_6_2.SetMeshName('PIQUAGE_6_2')
+iter_6_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+iter_6_2.AssociateHypo('hypo_6_bis')
+erreur = iter_6_2.Compute(1, 2)
+# Iteration iter_6_3 : second raffinement selon les faces externes
+iter_6_3 = iter_6_2.NextIteration('iter_6_3')
+iter_6_3.SetMeshName('PIQUAGE_6_3')
+iter_6_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
+iter_6_3.AssociateHypo('hypo_6_bis')
+erreur = iter_6_3.Compute(1, 2)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 4, 1)
+gzip_gunzip(DATA_TUTORIAL, 6, 1)
+# ==================================
+
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser(True)
diff --git a/doc/files/tutorial_6.xml b/doc/files/tutorial_6.xml
new file mode 100755 (executable)
index 0000000..542251c
--- /dev/null
@@ -0,0 +1,652 @@
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="tutorial_6">
+   <property name="DefaultStudyID" value="1"/>
+   <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
+   <type name="string" kind="string"/>
+   <struct name="Engines/dataref">
+      <member name="ref" type="string"/>
+   </struct>
+   <objref name="HOMARD_Boundary" id="IDL:HOMARD/HOMARD_Boundary:1.0"/>
+   <objref name="HOMARD_Cas" id="IDL:HOMARD/HOMARD_Cas:1.0"/>
+   <objref name="HOMARD_Hypothesis" id="IDL:HOMARD/HOMARD_Hypothesis:1.0"/>
+   <objref name="HOMARD_Iteration" id="IDL:HOMARD/HOMARD_Iteration:1.0"/>
+   <objref name="HOMARD_Zone" id="IDL:HOMARD/HOMARD_Zone:1.0"/>
+   <objref name="Study" id="IDL:SALOMEDS/Study:1.0"/>
+   <type name="bool" kind="bool"/>
+   <sequence name="boolvec" content="bool"/>
+   <type name="double" kind="double"/>
+   <sequence name="dblevec" content="double"/>
+   <objref name="file" id="file"/>
+   <type name="int" kind="int"/>
+   <sequence name="intvec" content="int"/>
+   <struct name="stringpair">
+      <member name="name" type="string"/>
+      <member name="value" type="string"/>
+   </struct>
+   <sequence name="propvec" content="stringpair"/>
+   <objref name="pyobj" id="python:obj:1.0"/>
+   <sequence name="seqboolvec" content="boolvec"/>
+   <sequence name="seqdblevec" content="dblevec"/>
+   <sequence name="seqint" content="int"/>
+   <sequence name="seqintvec" content="intvec"/>
+   <sequence name="seqpyobj" content="pyobj"/>
+   <sequence name="stringvec" content="string"/>
+   <sequence name="seqstringvec" content="stringvec"/>
+   <container name="DefaultContainer">
+      <property name="container_kind" value="Salome"/>
+      <property name="attached_on_cloning" value="0"/>
+      <property name="container_name" value="FactoryServer"/>
+      <property name="name" value="localhost"/>
+   </container>
+   <bloc name="Etude_Initialisation">
+      <inline name="StudyCreation">
+         <script><code><![CDATA[
+import orbmodule
+import SALOMEDS_idl
+
+import HOMARD
+import HOMARD_Gen_idl
+import HOMARD_Cas_idl
+import HOMARD_Iteration_idl
+import HOMARD_Hypothesis_idl
+import HOMARD_Zone_idl
+import HOMARD_Boundary_idl
+
+clt = orbmodule.client()
+StudyManager = clt.Resolve("/myStudyManager")
+CurrentStudy = StudyManager.GetStudyByID(1)
+]]></code></script>
+         <load container="DefaultContainer"/>
+         <outport name="CurrentStudy" type="Study"/>
+      </inline>
+      <service name="SetCurrentStudy">
+         <component>HOMARD</component>
+         <load container="DefaultContainer"/>
+         <method>SetCurrentStudy</method>
+         <inport name="theStudy" type="Study"/>
+      </service>
+      <service name="CreateBoundarycyl_1_int">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateBoundaryCylinder</method>
+         <inport name="BoundaryName" type="string"/>
+         <inport name="Xcentre" type="double"/>
+         <inport name="Ycentre" type="double"/>
+         <inport name="Zcentre" type="double"/>
+         <inport name="Xaxis" type="double"/>
+         <inport name="Yaxis" type="double"/>
+         <inport name="Zaxis" type="double"/>
+         <inport name="Radius" type="double"/>
+         <outport name="return" type="HOMARD_Boundary"/>
+      </service>
+      <service name="CreateBoundarycyl_1_ext">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateBoundaryCylinder</method>
+         <inport name="BoundaryName" type="string"/>
+         <inport name="Xcentre" type="double"/>
+         <inport name="Ycentre" type="double"/>
+         <inport name="Zcentre" type="double"/>
+         <inport name="Xaxis" type="double"/>
+         <inport name="Yaxis" type="double"/>
+         <inport name="Zaxis" type="double"/>
+         <inport name="Radius" type="double"/>
+         <outport name="return" type="HOMARD_Boundary"/>
+      </service>
+      <service name="CreateBoundarycyl_2_int">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateBoundaryCylinder</method>
+         <inport name="BoundaryName" type="string"/>
+         <inport name="Xcentre" type="double"/>
+         <inport name="Ycentre" type="double"/>
+         <inport name="Zcentre" type="double"/>
+         <inport name="Xaxis" type="double"/>
+         <inport name="Yaxis" type="double"/>
+         <inport name="Zaxis" type="double"/>
+         <inport name="Radius" type="double"/>
+         <outport name="return" type="HOMARD_Boundary"/>
+      </service>
+      <service name="CreateHypothesis_1">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateHypothesis</method>
+         <inport name="HypoName" type="string"/>
+         <outport name="return" type="HOMARD_Hypothesis"/>
+      </service>
+      <service name="CreateCase">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateCase</method>
+         <inport name="CaseName" type="string"/>
+         <inport name="MeshName" type="string"/>
+         <inport name="FileName" type="string"/>
+         <outport name="return" type="HOMARD_Cas"/>
+      </service>
+      <inline name="Hypo_Options_1">
+         <script><code><![CDATA[# Raffinement uniforme
+Hypo.SetUnifRefinUnRef(1)
+# Filtrage par des groupes
+Hypo.AddGroup('T1_INT_I')
+Hypo.AddGroup('T1_INT_O')
+Hypo.AddGroup('T2_INT')
+]]></code></script>
+         <load container="DefaultContainer"/>
+         <inport name="Hypo" type="HOMARD_Hypothesis"/>
+      </inline>
+      <inline name="Case_Options">
+         <script><code><![CDATA[# Options
+# =========
+# Repertoire d'execution
+Case.SetDirName(DirName)
+# Liens avec les frontieres
+Case.AddBoundaryGroup( 'intersection', '' )
+Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
+Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
+Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
+Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
+Case.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
+Case.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+# Resultats
+# =========
+# Iteration 0 associee
+Iter0 = Case.GetIter0()
+]]></code></script>
+         <load container="DefaultContainer"/>
+         <inport name="Case" type="HOMARD_Cas"/>
+         <inport name="DirName" type="string"/>
+         <outport name="Iter0" type="HOMARD_Iteration"/>
+      </inline>
+      <service name="CreateBoundarycyl_2_ext">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateBoundaryCylinder</method>
+         <inport name="BoundaryName" type="string"/>
+         <inport name="Xcentre" type="double"/>
+         <inport name="Ycentre" type="double"/>
+         <inport name="Zcentre" type="double"/>
+         <inport name="Xaxis" type="double"/>
+         <inport name="Yaxis" type="double"/>
+         <inport name="Zaxis" type="double"/>
+         <inport name="Radius" type="double"/>
+         <outport name="return" type="HOMARD_Boundary"/>
+      </service>
+      <service name="CreateBoundaryintersection">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateBoundaryDi</method>
+         <inport name="BoundaryName" type="string"/>
+         <inport name="MeshName" type="string"/>
+         <inport name="FileName" type="string"/>
+         <outport name="return" type="HOMARD_Boundary"/>
+      </service>
+      <service name="CreateHypothesis_2">
+         <node>Etude_Initialisation.SetCurrentStudy</node>
+         <method>CreateHypothesis</method>
+         <inport name="HypoName" type="string"/>
+         <outport name="return" type="HOMARD_Hypothesis"/>
+      </service>
+      <inline name="Hypo_Options_2">
+         <script><code><![CDATA[# Raffinement uniforme
+Hypo.SetUnifRefinUnRef(1)
+# Filtrage par des groupes
+Hypo.AddGroup('T1_EXT_I')
+Hypo.AddGroup('T1_EXT_O')
+Hypo.AddGroup('T2_EXT')
+]]></code></script>
+         <load container="DefaultContainer"/>
+         <inport name="Hypo" type="HOMARD_Hypothesis"/>
+      </inline>
+      <control> <fromnode>StudyCreation</fromnode> <tonode>SetCurrentStudy</tonode> </control>
+      <control> <fromnode>SetCurrentStudy</fromnode> <tonode>CreateBoundarycyl_1_int</tonode> </control>
+      <control> <fromnode>CreateBoundarycyl_1_int</fromnode> <tonode>CreateBoundarycyl_1_ext</tonode> </control>
+      <control> <fromnode>CreateBoundarycyl_1_ext</fromnode> <tonode>CreateBoundarycyl_2_int</tonode> </control>
+      <control> <fromnode>CreateBoundarycyl_2_int</fromnode> <tonode>CreateBoundarycyl_2_ext</tonode> </control>
+      <control> <fromnode>CreateHypothesis_1</fromnode> <tonode>Hypo_Options_1</tonode> </control>
+      <control> <fromnode>CreateCase</fromnode> <tonode>Case_Options</tonode> </control>
+      <control> <fromnode>Hypo_Options_1</fromnode> <tonode>CreateHypothesis_2</tonode> </control>
+      <control> <fromnode>Case_Options</fromnode> <tonode>CreateHypothesis_1</tonode> </control>
+      <control> <fromnode>CreateBoundarycyl_2_ext</fromnode> <tonode>CreateBoundaryintersection</tonode> </control>
+      <control> <fromnode>CreateBoundaryintersection</fromnode> <tonode>CreateCase</tonode> </control>
+      <control> <fromnode>CreateHypothesis_2</fromnode> <tonode>Hypo_Options_2</tonode> </control>
+      <datalink control="false">
+         <fromnode>StudyCreation</fromnode> <fromport>CurrentStudy</fromport>
+         <tonode>SetCurrentStudy</tonode> <toport>theStudy</toport>
+      </datalink>
+      <datalink control="false">
+         <fromnode>CreateHypothesis_1</fromnode> <fromport>return</fromport>
+         <tonode>Hypo_Options_1</tonode> <toport>Hypo</toport>
+      </datalink>
+      <datalink control="false">
+         <fromnode>CreateCase</fromnode> <fromport>return</fromport>
+         <tonode>Case_Options</tonode> <toport>Case</toport>
+      </datalink>
+      <datalink control="false">
+         <fromnode>CreateHypothesis_2</fromnode> <fromport>return</fromport>
+         <tonode>Hypo_Options_2</tonode> <toport>Hypo</toport>
+      </datalink>
+   </bloc>
+   <forloop name="ForLoop" nsteps="2">
+      <inline name="HOMARD_2">
+         <script><code><![CDATA[import os
+#
+# Hypothese
+# =========
+# . Nom de l'hypothese
+# --------------------
+HypoName = Hypo.GetName()
+#
+# Nom de la future iteration et du futur maillage
+# ==========================
+# . Nom de l'iteration precedente
+LastIterName = LastIter.GetName()
+# . Nom du maillage precedent
+LastMeshName = LastIter.GetMeshName()#
+#
+aux = '%d' % (NumAdapt+2)
+#
+IterName = LastIterName[:-1] + aux
+MeshName = LastMeshName[:-1] + aux
+#
+# Creation de l'iteration
+# =======================
+Iter = LastIter.NextIteration(IterName)
+#
+# Options de l'iteration
+# ======================
+# . Association de l'hypothese
+Iter.AssociateHypo(HypoName)
+#
+# . Le fichier du futur maillage
+aux = '%02d' % (NumAdapt+2)
+MeshFile = os.path.join (DirName, "maill."+aux+".med")
+Iter.SetMeshFile(MeshFile)
+#
+# . Le nom du futur maillage
+Iter.SetMeshName(MeshName)
+#
+# Calcul si le precedent s'est bien passe
+# ======
+if LastPb :
+  Pb = LastPb
+  MessInfo = "Erreur dans HOMARD pour l'adaptation numero %d" % LastPb
+else :
+  Error = Iter.Compute(1, 1)
+#
+  if Error :
+    Pb = NumAdapt+2
+    MessInfo = "Erreur dans HOMARD pour l'adaptation numero %d" % NumAdapt
+  else :
+    Pb = 0
+    MessInfo = ""
+
+]]></code></script>
+         <inport name="NumAdapt" type="int"/>
+         <inport name="LastIter" type="HOMARD_Iteration"/>
+         <inport name="Hypo" type="HOMARD_Hypothesis"/>
+         <inport name="DirName" type="string"/>
+         <inport name="LastPb" type="int"/>
+         <outport name="MessInfo" type="string"/>
+         <outport name="MeshFile" type="string"/>
+         <outport name="Iter" type="HOMARD_Iteration"/>
+         <outport name="Pb" type="int"/>
+      </inline>
+      <datalink control="false">
+         <fromnode>HOMARD_2</fromnode> <fromport>Iter</fromport>
+         <tonode>HOMARD_2</tonode> <toport>LastIter</toport>
+      </datalink>
+      <datalink control="false">
+         <fromnode>HOMARD_2</fromnode> <fromport>Pb</fromport>
+         <tonode>HOMARD_2</tonode> <toport>LastPb</toport>
+      </datalink>
+   </forloop>
+   <inline name="Bilan">
+      <script><code><![CDATA[import sys
+from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
+class App(QWidget):
+    def __init__(self, MessInfo, MeshFile):
+        super(App, self).__init__()
+        self.title = "Bilan"
+        self._MessInfo = MessInfo
+        self._MeshFile = MeshFile
+        self.initUI()
+    def initUI(self):
+        if self._MessInfo != "" :
+            button = QMessageBox.critical(self, self.title, self._MessInfo)
+        else :
+            MessInfo = "Le maillage final est dans le fichier : " + self._MeshFile
+            button = QMessageBox.information(self, self.title, MessInfo)
+        self.show()
+app = QApplication(sys.argv)
+ex = App(MessInfo, MeshFile)
+]]></code></script>
+      <load container="DefaultContainer"/>
+      <inport name="MessInfo" type="string"/>
+      <inport name="MeshFile" type="string"/>
+   </inline>
+   <inline name="DataInit">
+      <script><code><![CDATA[import os
+pathHomard = os.getenv("HOMARD_ROOT_DIR")
+data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
+#
+# Maillage de la structure
+# . Nom du maillage
+MeshName = "PIQUAGE"
+# . Fichier du maillage
+FileName = os.path.join(data_dir, "tutorial_4.00.med")
+#
+# Maillage de la frontiere
+# . Nom du maillage
+BMeshName = "PIQUAGE"
+# . Fichier du maillage
+BFileName = os.path.join(data_dir, "tutorial_6.fr.med")
+#
+# Répertoire de travail
+if os.environ.has_key("LOGNAME") :
+  user = os.environ ["LOGNAME"]
+else :
+  user = "anonymous"
+DirName = os.path.join( os.sep, "tmp", "HOMARD_"+user)
+if not os.path.isdir(DirName) :
+    os.mkdir (DirName)
+]]></code></script>
+      <outport name="MeshName" type="string"/>
+      <outport name="FileName" type="string"/>
+      <outport name="BMeshName" type="string"/>
+      <outport name="BFileName" type="string"/>
+      <outport name="DirName" type="string"/>
+   </inline>
+   <inline name="HOMARD_1">
+      <script><code><![CDATA[import os
+#
+# Hypothese
+# =========
+# . Nom de l'hypothese
+# --------------------
+HypoName = Hypo.GetName()
+#
+# Nom de la future iteration et du futur maillage
+# ==========================
+# . Nom de l'iteration precedente
+LastIterName = LastIter.GetName()
+# . Nom du maillage precedent
+LastMeshName = LastIter.GetMeshName()
+#
+IterName = LastIterName + "_1"
+MeshName = LastMeshName + "_1"
+#
+# Creation de l'iteration
+# =======================
+Iter = LastIter.NextIteration(IterName)
+#
+# Options de l'iteration
+# ======================
+# . Association de l'hypothese
+Iter.AssociateHypo(HypoName)
+#
+# . Le fichier du futur maillage
+MeshFile = os.path.join (DirName, "maill.01.med")
+Iter.SetMeshFile(MeshFile)
+#
+# . Le nom du futur maillage
+Iter.SetMeshName(MeshName)
+#
+# Calcul
+# ======
+Error = Iter.Compute(1, 1)
+#
+# ============================
+# Arret si erreur
+if Error :
+    Pb = 1
+    MessInfo = "Erreur dans HOMARD pour la premiere adaptation"
+# Sinon on enchaine sur 2 autres adaptations
+else :
+    Pb= 0
+    MessInfo = ""
+
+]]></code></script>
+      <load container="DefaultContainer"/>
+      <inport name="LastIter" type="HOMARD_Iteration"/>
+      <inport name="Hypo" type="HOMARD_Hypothesis"/>
+      <inport name="DirName" type="string"/>
+      <outport name="MessInfo" type="string"/>
+      <outport name="MeshFile" type="string"/>
+      <outport name="Iter" type="HOMARD_Iteration"/>
+      <outport name="Pb" type="int"/>
+   </inline>
+   <control> <fromnode>Etude_Initialisation</fromnode> <tonode>HOMARD_1</tonode> </control>
+   <control> <fromnode>ForLoop</fromnode> <tonode>Bilan</tonode> </control>
+   <control> <fromnode>DataInit</fromnode> <tonode>HOMARD_1</tonode> </control>
+   <control> <fromnode>DataInit</fromnode> <tonode>Etude_Initialisation</tonode> </control>
+   <control> <fromnode>HOMARD_1</fromnode> <tonode>ForLoop</tonode> </control>
+   <datalink control="false">
+      <fromnode>ForLoop</fromnode> <fromport>index</fromport>
+      <tonode>ForLoop.HOMARD_2</tonode> <toport>NumAdapt</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>DataInit</fromnode> <fromport>MeshName</fromport>
+      <tonode>Etude_Initialisation.CreateCase</tonode> <toport>MeshName</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>DataInit</fromnode> <fromport>FileName</fromport>
+      <tonode>Etude_Initialisation.CreateCase</tonode> <toport>FileName</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>DataInit</fromnode> <fromport>BMeshName</fromport>
+      <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>MeshName</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>DataInit</fromnode> <fromport>BFileName</fromport>
+      <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>FileName</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
+      <tonode>ForLoop.HOMARD_2</tonode> <toport>DirName</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
+      <tonode>Etude_Initialisation.Case_Options</tonode> <toport>DirName</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
+      <tonode>HOMARD_1</tonode> <toport>DirName</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>HOMARD_1</fromnode> <fromport>MessInfo</fromport>
+      <tonode>Bilan</tonode> <toport>MessInfo</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>HOMARD_1</fromnode> <fromport>MeshFile</fromport>
+      <tonode>Bilan</tonode> <toport>MeshFile</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>HOMARD_1</fromnode> <fromport>Iter</fromport>
+      <tonode>ForLoop.HOMARD_2</tonode> <toport>LastIter</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>HOMARD_1</fromnode> <fromport>Pb</fromport>
+      <tonode>ForLoop.HOMARD_2</tonode> <toport>LastPb</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>Etude_Initialisation.CreateHypothesis_2</fromnode> <fromport>return</fromport>
+      <tonode>ForLoop.HOMARD_2</tonode> <toport>Hypo</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>ForLoop.HOMARD_2</fromnode> <fromport>MessInfo</fromport>
+      <tonode>Bilan</tonode> <toport>MessInfo</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>ForLoop.HOMARD_2</fromnode> <fromport>MeshFile</fromport>
+      <tonode>Bilan</tonode> <toport>MeshFile</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>Etude_Initialisation.Case_Options</fromnode> <fromport>Iter0</fromport>
+      <tonode>HOMARD_1</tonode> <toport>LastIter</toport>
+   </datalink>
+   <datalink control="false">
+      <fromnode>Etude_Initialisation.CreateHypothesis_1</fromnode> <fromport>return</fromport>
+      <tonode>HOMARD_1</tonode> <toport>Hypo</toport>
+   </datalink>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateHypothesis_2</tonode><toport>HypoName</toport>
+      <value><string>Hypo_6_bis</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode><toport>BoundaryName</toport>
+      <value><string>intersection</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>BoundaryName</toport>
+      <value><string>cyl_2_ext</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xcentre</toport>
+      <value><double>17.5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Ycentre</toport>
+      <value><double>-2.5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zcentre</toport>
+      <value><double>-12.5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xaxis</toport>
+      <value><double>-100</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Yaxis</toport>
+      <value><double>-75</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zaxis</toport>
+      <value><double>-25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Radius</toport>
+      <value><double>50</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateHypothesis_1</tonode><toport>HypoName</toport>
+      <value><string>Hypo_6</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>BoundaryName</toport>
+      <value><string>cyl_2_int</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xcentre</toport>
+      <value><double>17.5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Ycentre</toport>
+      <value><double>-2.5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zcentre</toport>
+      <value><double>-12.5</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xaxis</toport>
+      <value><double>-100</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Yaxis</toport>
+      <value><double>-75</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zaxis</toport>
+      <value><double>-25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Radius</toport>
+      <value><double>25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>BoundaryName</toport>
+      <value><string>cyl_1_ext</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xcentre</toport>
+      <value><double>0</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Ycentre</toport>
+      <value><double>25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zcentre</toport>
+      <value><double>-25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xaxis</toport>
+      <value><double>25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Yaxis</toport>
+      <value><double>50</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zaxis</toport>
+      <value><double>75</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Radius</toport>
+      <value><double>100</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateCase</tonode><toport>CaseName</toport>
+      <value><string>tutorial_6</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>BoundaryName</toport>
+      <value><string>cyl_1_int</string></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xcentre</toport>
+      <value><double>0</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Ycentre</toport>
+      <value><double>25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zcentre</toport>
+      <value><double>-25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xaxis</toport>
+      <value><double>25</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Yaxis</toport>
+      <value><double>50</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zaxis</toport>
+      <value><double>75</double></value>
+   </parameter>
+   <parameter>
+      <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Radius</toport>
+      <value><double>75</double></value>
+   </parameter>
+   <parameter>
+      <tonode>ForLoop</tonode><toport>nsteps</toport>
+      <value><int>2</int></value>
+   </parameter>
+   <presentation name="Etude_Initialisation.CreateHypothesis_2" x="321.5" y="465.422" width="158" height="63" expanded="1" expx="321.5" expy="465.422" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateBoundaryintersection" x="638.5" y="96.1845" width="158" height="117" expanded="1" expx="638.5" expy="96.1845" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="Etude_Initialisation.Hypo_Options_2" x="480" y="466.933" width="158" height="63" expanded="1" expx="480" expy="466.933" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="HOMARD_1" x="4" y="738.933" width="158" height="144" expanded="1" expx="4" expy="738.933" expWidth="158" expHeight="144" shownState="0"/>
+   <presentation name="DataInit" x="4" y="32" width="158" height="171" expanded="1" expx="4" expy="32" expWidth="158" expHeight="171" shownState="0"/>
+   <presentation name="Bilan" x="650.874" y="738.933" width="158" height="90" expanded="1" expx="650.874" expy="738.933" expWidth="158" expHeight="90" shownState="0"/>
+   <presentation name="Etude_Initialisation.Case_Options" x="163" y="348.5" width="158" height="90" expanded="1" expx="163" expy="348.5" expWidth="158" expHeight="90" shownState="0"/>
+   <presentation name="Etude_Initialisation.Hypo_Options_1" x="163" y="466.424" width="158" height="63" expanded="1" expx="163" expy="466.424" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateBoundarycyl_2_ext" x="480" y="96.1845" width="158" height="252" expanded="1" expx="480" expy="96.1845" expWidth="158" expHeight="252" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateHypothesis_1" x="4" y="466" width="158" height="63" expanded="1" expx="4" expy="466" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateBoundarycyl_2_int" x="321.5" y="96" width="158" height="252" expanded="1" expx="321.5" expy="96" expWidth="158" expHeight="252" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateBoundarycyl_1_ext" x="163" y="96" width="158" height="252" expanded="1" expx="163" expy="96" expWidth="158" expHeight="252" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateCase" x="4" y="348.5" width="158" height="117" expanded="1" expx="4" expy="348.5" expWidth="158" expHeight="117" shownState="0"/>
+   <presentation name="Etude_Initialisation.CreateBoundarycyl_1_int" x="4" y="96" width="158" height="252" expanded="1" expx="4" expy="96" expWidth="158" expHeight="252" shownState="0"/>
+   <presentation name="ForLoop.HOMARD_2" x="7" y="62" width="158" height="171" expanded="1" expx="7" expy="62" expWidth="158" expHeight="171" shownState="0"/>
+   <presentation name="Etude_Initialisation.SetCurrentStudy" x="163" y="32" width="158" height="63" expanded="1" expx="163" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="Etude_Initialisation.StudyCreation" x="4" y="32" width="158" height="63" expanded="1" expx="4" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+   <presentation name="ForLoop" x="163" y="738.933" width="169" height="237" expanded="1" expx="163" expy="738.933" expWidth="169" expHeight="237" shownState="0"/>
+   <presentation name="Etude_Initialisation" x="4" y="204" width="800.5" height="533.933" expanded="1" expx="4" expy="204" expWidth="800.5" expHeight="533.933" shownState="0"/>
+   <presentation name="__ROOT__" x="0" y="0" width="812.874" height="979.933" expanded="1" expx="0" expy="0" expWidth="812.874" expHeight="979.933" shownState="0"/>
+</proc>
index 8a22233f955abdb8d5147a3c89c071d2f9bf0503..57149f4a41020b9479b62d48b05858ba5b963f9b 100755 (executable)
@@ -19,9 +19,9 @@
 #
 """
 Python script for HOMARD
-Copyright EDF-R&D 2014, 2017
+Copyright EDF 2014, 2018
 """
-__revision__ = "V2.01"
+__revision__ = "V2.02"
 
 import os
 import sys
@@ -33,11 +33,12 @@ REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
 from test_util import remove_dir
 
-#========================================================================
-#========================================================================
+#
+#========================= Debut de la fonction ==================================
+#
 def gzip_gunzip(data_dir, num_tuto, option) :
   """
-Compression/Uncompression of the med files of a directory such as tutorial_x.nn.med
+Compression/Uncompression of the med(or xao) files of a directory such as tutorial_x.nn.med (or tutorial_x.nn.xao)
 data_dir: directory
 num_tuto: number of the tutorial
 option  : 1: compression, -1: uncompression
@@ -66,13 +67,14 @@ Copyright EDF-R&D 2014
           erreur = 1
           break
 #
-    ficloc = ficloc_basis + ".fr.med"
-    nomfic = os.path.join(data_dir, ficloc)
-    if not os.path.isfile(nomfic) :
-      ficloc += ".gz"
+    for suffixe in ( "xao", "fr.med" ) :
+      ficloc = ficloc_basis + "." + suffixe
       nomfic = os.path.join(data_dir, ficloc)
-      if os.path.isfile(nomfic) :
-        os.system("gunzip "+nomfic)
+      if not os.path.isfile(nomfic) :
+        ficloc += ".gz"
+        nomfic = os.path.join(data_dir, ficloc)
+        if os.path.isfile(nomfic) :
+          os.system("gunzip "+nomfic)
 #
 # Compression
 #
@@ -91,18 +93,21 @@ Copyright EDF-R&D 2014
           erreur = 2
           break
 #
-    ficloc = ficloc_basis + ".fr.med.gz"
-    nomfic = os.path.join(data_dir, ficloc)
-    if not os.path.isfile(nomfic) :
-      ficloc = ficloc_basis + ".fr.med"
+    for suffixe in ( "xao", "fr.med" ) :
+      ficloc = ficloc_basis + "." + suffixe + ".gz"
       nomfic = os.path.join(data_dir, ficloc)
-      if os.path.isfile(nomfic) :
-        os.system("gzip "+nomfic)
+      if not os.path.isfile(nomfic) :
+        ficloc = ficloc_basis + ".fr.med"
+        nomfic = os.path.join(data_dir, ficloc)
+        if os.path.isfile(nomfic) :
+          os.system("gzip "+nomfic)
 #
   return
 #
-#========================================================================
-#========================================================================
+#==========================  Fin de la fonction ==================================
+#
+#========================= Debut de la fonction ==================================
+#
 def creation_dircase(num_tuto) :
   """
 Creation of a directory for the results of tutorial_x
@@ -124,6 +129,6 @@ Copyright EDF-R&D 2014
   os.mkdir (dircase)
 #
   return dircase
-#========================================================================
-#========================================================================
+#
+#==========================  Fin de la fonction ==================================
 #
index 587ec7e285b16a4fdadb18bb9b5bc12740476985..20367f9675536c878ff144edbe355c98dfbcf86a 100755 (executable)
@@ -22,7 +22,7 @@
 """
 Lancement d'un calcul ASTER
 """
-__revision__ = "V5.9"
+__revision__ = "V5.11"
 #
 import sys
 import os
index 12f4f581323019c0c76ffc18381187f3d637b702..056b87f254237cdef9f8462929b5030a8c16070f 100755 (executable)
@@ -22,7 +22,7 @@
 """
 Pseudo-lancement d'un calcul pour valider les tests
 """
-__revision__ = "V2.1"
+__revision__ = "V2.2"
 #
 import sys
 import os
index 9326644406929dbb798c1f47e0a2f76a5b2b6dfc..d27d7859baac0a8959df5ef556742ade38ce426d 100755 (executable)
@@ -24,11 +24,13 @@ SET(HOMARD_TEST_FILES
   test_3.py
   test_4.py
   test_5.py
+  test_6.py
   tutorial_1.py
   tutorial_2.py
   tutorial_3.py
   tutorial_4.py
   tutorial_5.py
+  tutorial_6.py
   test_util.py
 )
 
index f9df746f3fb1a142d75fb1d50cc2d68737579974..a95627c3f36b97cab88d5c15123a19a8507d8918 100644 (file)
@@ -28,11 +28,13 @@ test_2
 test_3
 test_4
 test_5
+test_6
 tutorial_1
 tutorial_2
 tutorial_3
 tutorial_4
 tutorial_5
+tutorial_6
 )
 
 FOREACH(tfile ${HOMARD_TEST_FILES})
index 9690918fe9e0e9f9bee9de6c97267c2134437ea2..ca1a4c93bb92351cad2e72a35fff3de00edd90e3 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_1
 """
-__revision__ = "V4.01"
+__revision__ = "V4.03"
 
 #========================================================================
 TEST_NAME = "test_1"
@@ -29,7 +29,6 @@ DEBUG = False
 N_ITER_TEST_FILE = 3
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -40,19 +39,11 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -108,10 +99,10 @@ Python script for HOMARD
     zones_1_et_2.AddZone('Zone_1_2', 1)
     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
+    iaux = 0
+    for _ in range(nbzone) :
+      print(hyponame_2, " : ", dico[laux[iaux+1]], "sur la zone", laux[iaux])
+      iaux += 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())
@@ -205,7 +196,7 @@ try :
   ERROR = homard_exec()
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
+except RuntimeError as eee:
   raise Exception('Pb in homard_exec: '+str(eee.message))
 #
 # Test of the results
index f4f58a2189c3c26c1c0c1d1ff386186d34b7cd97..ad6cff7f3e4a5ef1b7a3ce53666d37f1d69032a5 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_2
 """
-__revision__ = "V4.01"
+__revision__ = "V4.03"
 
 #========================================================================
 TEST_NAME = "test_2"
@@ -29,7 +29,6 @@ DEBUG = False
 N_ITER_TEST_FILE = 3
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -40,19 +39,11 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -177,8 +168,8 @@ try :
   ERROR = homard_exec()
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
-  raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+  raise Exception('Pb in homard_exec: '+str(eee.message))
 #
 # Test of the results
 #
index cb324205722acdfedfb622482b40c99ce006f124..87175a93f21e046b9d3a8474ef7fc6f1a7784468 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_3
 """
-__revision__ = "V4.01"
+__revision__ = "V4.04"
 
 #========================================================================
 TEST_NAME = "test_3"
@@ -30,7 +30,6 @@ N_BOUCLE = 2
 N_ITER_TEST_FILE = 2
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -41,19 +40,11 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -112,7 +103,7 @@ Python script for HOMARD
         mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
         case_test_3 = HOMARD.CreateCase(TEST_NAME, 'MOYEU', mesh_file)
         case_test_3.SetDirName(DIRCASE)
-        case_test_3.AddBoundaryGroup('courbes', '')
+        case_test_3.AddBoundary('courbes')
         case_test_3.AddBoundaryGroup('cyl_ext', 'EXT')
         case_test_3.AddBoundaryGroup('cyl_int', 'INT')
         case_test_3.AddBoundaryGroup('sphere_1', 'END_1')
@@ -211,8 +202,8 @@ try :
   ERROR = homard_exec()
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
-  raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+  raise Exception('Pb in homard_exec: '+str(eee.message))
 #
 # Test of the results
 #
index 6a83c6f8e1bd60aa7dd1a724e63f6ce32907790f..ddb7d7d1d83fdf9f2e0c80583d5d30f9cf9ac572 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_4
 """
-__revision__ = "V3.01"
+__revision__ = "V3.03"
 
 #========================================================================
 TEST_NAME = "test_4"
@@ -32,7 +32,6 @@ DY = 400.
 DZ = 200.
 #========================================================================
 import os
-import tempfile
 import sys
 import numpy as np
 import salome
@@ -48,19 +47,11 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -128,7 +119,7 @@ Python script for GEOM and SMESH
     try:
       ficmed = os.path.join(DIRCASE, 'maill.00.med')
       box_m.ExportMED(ficmed)
-    except Exception as eee:
+    except IOError as eee:
       error = 2
       raise Exception('ExportMED() failed. ' + str(eee))
   #
@@ -220,7 +211,7 @@ Python script for HOMARD
     laux = hypo_4_1.GetZones()
     nbzone = len(laux) // 2
     jaux = 0
-    for iaux in range(nbzone) :
+    for _ in range(nbzone) :
       print(hyponame_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
       jaux += 2
   # Creation of the hypothesis hypo_4_2
@@ -232,7 +223,7 @@ Python script for HOMARD
     laux = hypo_4_2.GetZones()
     nbzone = len(laux) // 2
     jaux = 0
-    for iaux in range(nbzone) :
+    for _ in range(nbzone) :
       print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
       jaux += 2
   # Creation of the hypothesis DISTANCE INVERSE
@@ -320,7 +311,7 @@ try :
   ERROR = geom_smesh_exec()
   if ERROR :
     raise Exception('Pb in geom_smesh_exec')
-except Exception as eee:
+except RuntimeError as eee:
   raise Exception('Pb in geom_smesh_exec: '+str(eee.message))
 
 HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
@@ -333,7 +324,7 @@ try :
   ERROR = homard_exec()
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
+except RuntimeError as eee:
   raise Exception('Pb in homard_exec: '+str(eee.message))
 #
 # Test of the results
index 439426c02ef8b994aa0f19c1aa8fd115cc1fc963..125a9626a95ef280df7272fe4e2cf79fb501f853 100755 (executable)
@@ -22,7 +22,7 @@ Python script for HOMARD
 Specific conditions for Code_Saturne
 Test test_5
 """
-__revision__ = "V2.01"
+__revision__ = "V2.03"
 
 #========================================================================
 TEST_NAME = "test_5"
@@ -38,7 +38,6 @@ LG_Z = 160.
 MESH_NAME = "MESH"
 #========================================================================
 import os
-import tempfile
 import sys
 import numpy as np
 import salome
@@ -52,19 +51,11 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -103,11 +94,11 @@ Python script for MED
 #
     coordinates = list()
     coo_z = -0.5*LG_Z
-    for kaux in range(nbno_z) :
+    for _ in range(nbno_z) :
       coo_y = -0.5*LG_Y
-      for jaux in range(nbno_y) :
+      for _ in range(nbno_y) :
         coo_x = -0.5*LG_X
-        for iaux in range(nbno_x) :
+        for _ in range(nbno_x) :
           coordinates.append(coo_x)
           coordinates.append(coo_y)
           coordinates.append(coo_z)
@@ -167,7 +158,7 @@ Python script for MED
       ficmed = os.path.join(DIRCASE, 'maill.00.med')
       #print "Ecriture du maillage dans le fichier", ficmed
       meshMEDFile3D.write(ficmed, 2)
-    except Exception as eee:
+    except IOError as eee:
       error = 2
       raise Exception('MEDFileUMesh.write() failed. ' + str(eee))
   #
@@ -308,7 +299,7 @@ try :
   ERROR = mesh_exec()
   if ERROR :
     raise Exception('Pb in mesh_exec')
-except Exception as eee:
+except RuntimeError as eee:
   raise Exception('Pb in mesh_exec: '+str(eee.message))
 
 HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
@@ -321,7 +312,7 @@ try :
   ERROR = homard_exec()
   if ERROR :
     raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
+except RuntimeError as eee:
   raise Exception('Pb in homard_exec: '+str(eee.message))
 #
 # Test of the results
diff --git a/src/tests/Test/test_6.py b/src/tests/Test/test_6.py
new file mode 100755 (executable)
index 0000000..c329efd
--- /dev/null
@@ -0,0 +1,341 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2016  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
+Test test_6
+"""
+__revision__ = "V1.04"
+
+#========================================================================
+TEST_NAME = "test_6"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#
+TAILLE = 10.
+LG_ARETE = TAILLE*2.5
+#========================================================================
+import os
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import saveGeometry
+from test_util import get_dir
+from test_util import test_results
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
+
+salome.salome_init()
+import iparameters
+IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+IPAR.append("AP_MODULES_LIST", "Homard")
+#
+#========================= Debut de la fonction ==================================
+#
+def create_geom(nom_obj, taille, verbose=False) :
+  """
+Création de la géométrie
+  """
+#
+  erreur = 0
+#
+  if verbose :
+    texte = "Geometrie '%s'\n" % nom_obj
+    texte += "Taille de base = %f" % taille
+    print (texte)
+#
+  from salome.geom import geomBuilder
+  geompy = geomBuilder.New()
+#
+# 1. Les sommets et la première ligne
+#
+  vertex_1 = geompy.MakeVertex( 0.*taille,  0.*taille, 0.*taille, theName = "V1")
+  vertex_2 = geompy.MakeVertex( 5.*taille,  2.*taille, 0.*taille, theName = "V2")
+  vertex_3 = geompy.MakeVertex(10.*taille,  1.*taille, 0.*taille, theName = "V3")
+  vertex_4 = geompy.MakeVertex(16.*taille,  4.*taille, 0.*taille, theName = "V4")
+  vertex_5 = geompy.MakeVertex(16.*taille, 10.*taille, 0.*taille, theName = "V5")
+#
+  courbe_0 = geompy.MakeInterpol([vertex_1, vertex_2, vertex_3, vertex_4, vertex_5], False, False, theName="courbe_0")
+#
+# 2. Les sommets et la seconde ligne
+#
+  sommet_1 = geompy.MakeVertex( 0.*taille,  0.*taille, 20.*taille, theName = "S1")
+  sommet_2 = geompy.MakeVertex( 6.*taille, -5.*taille, 20.*taille, theName = "S2")
+  sommet_3 = geompy.MakeVertex(11.*taille, -2.*taille, 20.*taille, theName = "S3")
+  sommet_4 = geompy.MakeVertex(12.*taille,  3.*taille, 20.*taille, theName = "S4")
+  sommet_5 = geompy.MakeVertex(16.*taille, 10.*taille, 20.*taille, theName = "S5")
+#
+  courbe_1 = geompy.MakeInterpol([sommet_1, sommet_2, sommet_3, sommet_4, sommet_5], False, False, theName="courbe_1")
+#
+# 3. La face de base
+#
+  structure_g = geompy.MakeFilling([courbe_0, courbe_1], theName=nom_obj)
+#
+# 4. Groupes : on cherche les entites par des proximités avec des shapes bien choisies
+#
+  l_groupes_g = list()
+#
+  shape = geompy.GetFaceNearPoint (structure_g, vertex_2)
+  nom = "Voile"
+  groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["FACE"], nom)
+  geompy.UnionList ( groupe_g, [shape] )
+  l_groupes_g.append( (nom, groupe_g, 2) )
+#
+  shape = geompy.GetEdgeNearPoint (structure_g, vertex_2)
+  nom = "C_0"
+  groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+  geompy.UnionList ( groupe_g, [shape] )
+  l_groupes_g.append( (nom, groupe_g, 1) )
+#
+  shape = geompy.GetEdgeNearPoint (structure_g, sommet_2)
+  nom = "C_1"
+  groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+  geompy.UnionList ( groupe_g, [shape] )
+  l_groupes_g.append( (nom, groupe_g, 1) )
+#
+  shape = geompy.GetEdge (structure_g, vertex_1, sommet_1)
+  nom = "D_0"
+  groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+  geompy.UnionList ( groupe_g, [shape] )
+  l_groupes_g.append( (nom, groupe_g, 1) )
+#
+  shape = geompy.GetEdge (structure_g, vertex_5, sommet_5)
+  nom = "D_1"
+  groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+  geompy.UnionList ( groupe_g, [shape] )
+  l_groupes_g.append( (nom, groupe_g, 1) )
+#
+  return erreur, structure_g, l_groupes_g
+#
+#==========================  Fin de la fonction ==================================
+#
+#========================= Debut de la fonction ==================================
+#
+def create_mail(lg_arete, structure_g, l_groupes_g, rep_mail, verbose=False) :
+  """
+Création du maillage
+  """
+#
+  erreur = 0
+  message = ""
+  ficmed = ""
+#
+  while not erreur :
+#
+    nom = structure_g.GetName()
+    if verbose :
+      texte = "Maillage de '%s'\n" % nom
+      texte += "lg_arete = %f\n" % lg_arete
+      texte += "rep_mail = '%s'" % rep_mail
+      print (texte)
+#
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New()
+#
+# 2. Maillage de calcul
+#
+    maill_00 = smesh.Mesh(structure_g)
+    smesh.SetName(maill_00.GetMesh(), nom)
+#
+    MG_CADSurf = maill_00.Triangle(algo=smeshBuilder.MG_CADSurf)
+    smesh.SetName(MG_CADSurf.GetAlgorithm(), 'MG_CADSurf')
+#
+    MG_CADSurf_Parameters = MG_CADSurf.Parameters()
+    smesh.SetName(MG_CADSurf_Parameters, 'MG_CADSurf Triangles')
+    MG_CADSurf_Parameters.SetPhySize( lg_arete )
+    MG_CADSurf_Parameters.SetMinSize( lg_arete/20. )
+    MG_CADSurf_Parameters.SetMaxSize( lg_arete*5. )
+    MG_CADSurf_Parameters.SetChordalError( lg_arete )
+    MG_CADSurf_Parameters.SetAngleMesh( 12. )
+#
+# 3. Les groupes issus de la géométrie
+#
+    for taux in l_groupes_g :
+      groupe_m = maill_00.Group(taux[1])
+      smesh.SetName(groupe_m, taux[0])
+#
+# 4. Calcul
+#
+    isDone = maill_00.Compute()
+    if not isDone :
+      message += "Probleme dans le maillage de la surface."
+      erreur = 13
+      break
+#
+# 5. Export MED
+#
+    ficmed = os.path.join(rep_mail,'maill.00.med')
+    texte = "Ecriture du fichier '%s'" % ficmed
+    if verbose :
+      print (texte)
+    try:
+      maill_00.ExportMED(ficmed)
+    except IOError as eee:
+      error = 2
+      raise Exception('ExportMED() failed. ' + str(eee))
+#
+    break
+#
+  return erreur, message, ficmed
+#
+#==========================  Fin de la fonction ==================================
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, xao_file, verbose=False):
+  """
+Python script for HOMARD
+  """
+  erreur = 0
+  message = ""
+#
+  while not erreur :
+    #
+    HOMARD.UpdateStudy()
+    #
+    # Frontière
+    # =========
+    if verbose :
+      print(". Frontière")
+    cao_name = "CAO_" + nom
+    la_frontiere = HOMARD.CreateBoundaryCAO(cao_name, xao_file)
+    #
+    # Hypotheses
+    # ==========
+    if verbose :
+      print(". Hypothèses")
+    hyponame = "hypo_" + nom
+    l_hypothese = HOMARD.CreateHypothesis(hyponame)
+    l_hypothese.SetUnifRefinUnRef(1)
+    #
+    # Cas
+    # ===
+    if verbose :
+      print(". Cas")
+    le_cas = HOMARD.CreateCase('case_'+nom, nom, ficmed)
+    le_cas.SetDirName(DIRCASE)
+    le_cas.AddBoundary(cao_name)
+    #
+    # Creation of the iterations
+    # ==========================
+    if verbose :
+      option = 2
+    else :
+      option = 1
+    #
+    for niter in range(1, N_ITER_TEST_FILE+1):
+      if verbose :
+        print(". Itération numéro %d" % niter)
+      iter_name = "I_" + nom + "_%02d" % niter
+      if ( niter == 1 ) :
+        l_iteration = le_cas.NextIteration(iter_name)
+      else :
+        l_iteration = l_iteration.NextIteration(iter_name)
+      l_iteration.SetMeshName(nom)
+      mesh_file = os.path.join(DIRCASE, "maill.%02d.med" % niter)
+      l_iteration.SetMeshFile(mesh_file)
+      l_iteration.AssociateHypo(hyponame)
+      erreur = l_iteration.Compute(1, option)
+      if erreur :
+        erreur = niter
+        break
+    #
+    break
+  #
+  if erreur :
+    message += "Erreur au calcul de l'itération %d" % erreur
+  #
+  return erreur, message
+#
+#==========================  Fin de la fonction ==================================
+#
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
+  #
+  VERBOSE = DEBUG
+  #
+  # A. Geometry
+  #
+  ERREUR, STRUCTURE_G, L_GROUPES_G = create_geom(TEST_NAME, TAILLE, VERBOSE)
+  if ERREUR :
+    MESSAGE = "The construction of the geometry failed."
+    break
+  #
+  # B. Save the geometry
+  #
+  XAO_FILE = os.path.join(DIRCASE, TEST_NAME+".xao")
+  try :
+    ERREUR = saveGeometry(XAO_FILE, TEST_NAME, "test_salome_"+TEST_NAME)
+  except IOError as eee:
+    ERREUR = os.error
+    MESSAGE = str(eee.message)
+  #
+  if ERREUR :
+    MESSAGE += "Pb in saveGeometry"
+    break
+  #
+  # C. Mesh
+  #
+  ERREUR, MESSAGE, FICMED = create_mail(LG_ARETE, STRUCTURE_G, L_GROUPES_G, DIRCASE, VERBOSE)
+  if ERREUR :
+    break
+  #
+  # D. Exec of HOMARD-SALOME
+  #
+  HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+  assert HOMARD is not None, "Impossible to load homard engine"
+  HOMARD.SetLanguageShort("fr")
+#
+  try:
+    ERREUR, MESSAGE = homard_exec(TEST_NAME, FICMED, XAO_FILE, VERBOSE)
+  except RuntimeError as eee:
+    ERREUR = os.error
+    MESSAGE = str(eee.message)
+  #
+  if ERREUR :
+    MESSAGE += "Pb in homard_exec"
+    break
+  #
+  # E. Test of the results
+  #
+  N_REP_TEST_FILE = N_ITER_TEST_FILE
+  DESTROY_DIR = not DEBUG
+  test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+  #
+  break
+#
+if ERREUR:
+  MESSAGE = "\nErreur numéro %d\n" % ERREUR + MESSAGE
+  raise Exception(MESSAGE)
+#
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser()
+  iparameters.getSession().restoreVisualState(1)
+
index 6fb8c33f1e3d40fbfbd120c1b59562cd3194a248..960c0e8dafb814808456df205695df057ce17e32 100755 (executable)
 Python script for HOMARD
 Utilitaires pour les tests
 """
-__revision__ = "V3.01"
+__revision__ = "V4.02"
 
 import os
+import tempfile
 import MEDLoader as ml
 import shutil
 #========================================================================
 #========================================================================
+def get_dir(path_homard, test_name, debug=False) :
+  """
+Get directories for the test.
+Copyright EDF 2018
+  """
+#
+# Répertoire des données du test
+  rep_data = os.path.join(path_homard, "share", "salome", "homardsamples")
+  rep_data = os.path.normpath(rep_data)
+#
+# Répertoire des résultats
+  if debug :
+    dircase = os.path.join("/tmp", test_name)
+    if ( os.path.isdir(dircase) ) :
+      remove_dir(dircase)
+    os.mkdir(dircase)
+  else :
+    dircase = tempfile.mkdtemp(prefix=test_name)
+#
+  return rep_data, dircase
+#
+#========================================================================
+#========================================================================
+def get_dir_tutorial(path_homard) :
+  """
+Get directory for the tutorial.
+Copyright EDF 2018
+  """
+#
+# Répertoire des données du tutorial
+  data_tutorial = os.path.join(path_homard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+  data_tutorial = os.path.normpath(data_tutorial)
+#
+  return data_tutorial
+#========================================================================
+#========================================================================
 def remove_dir(directory) :
   """
 Empties, then removes a directory.
@@ -61,16 +98,15 @@ Copyright EDF-R&D 2014
   #
   test_file_suff = "apad.%02d.bilan" % n_iter_test_file
   rep_test_file = "I%02d" % n_rep_test_file
+#
+# Existence du fichier de référence
   #
   test_file = os.path.join(rep_test, test_name + "." + test_file_suff)
   mess_error_ref = "\nReference file: " + test_file
-#
-# Existence du fichier de référence
-#
+  #print ("test_file = %s" % test_file)
   try :
-    file = open (test_file, "r")
-    les_lignes_ref = file.readlines()
-    file.close()
+    with open (test_file, "r") as fichier :
+      les_lignes_ref = fichier.readlines()
   except :
     mess_error = mess_error_ref + "\nThis file does not exist.\n"
     destroy_dir = False
@@ -80,9 +116,8 @@ Copyright EDF-R&D 2014
 #
   test_file = os.path.join(dircase, rep_test_file, test_file_suff)
   if os.path.isfile (test_file) :
-    file = open (test_file, "r")
-    les_lignes = file.readlines()
-    file.close()
+    with open (test_file, "r") as fichier :
+      les_lignes = fichier.readlines()
   else :
     mess_error  = "\nResult file: " + test_file
     mess_error += "\nThis file does not exist.\n"
@@ -164,7 +199,7 @@ def saveGeometry( xao_file, name, author="" ):
 #========================================================================
 #========================================================================
 #
-def repositionnement (rep_calc, fic_med_brut, fic_med_new, xao_file, verbose=False) :
+def repositionnement (rep_calc, fic_med_brut, fic_med_new, xao_file, menage=True, verbose=False) :
 #
   """
 Pilote le repositionnement des noeuds qui ont bougé
@@ -173,12 +208,14 @@ Entrées :
   fic_med_brut : fichier MED du calcul avec les coordonnées avant projection
   fic_med_new  : fichier MED du calcul avec les coordonnées après projection
   xao_file : fichier XAO de la géométrie
+  menage : Suppression du fichier fic_med_brut
   """
   if verbose :
     ligne =    "rep_calc     = %s" % rep_calc
     ligne += "\nfic_med_brut = %s" % fic_med_brut
     ligne += "\nfic_med_new  = %s" % fic_med_new
     ligne += "\nxao_file     = %s" % xao_file
+    ligne += "\nmenage       = %d" % menage
     print(ligne)
 
   message = ""
@@ -186,8 +223,6 @@ Entrées :
   while not erreur :
 #
 # 1. l_fr = liste des fichiers des lignes/surfaces a suivre
-#           Les fichiers des numéros de groupes par frontière sont renommés selon le support
-#           à condition de ne pas être vide.
 #
     fic_hom_med = None
     laux = os.listdir(rep_calc)
@@ -197,33 +232,8 @@ Entrées :
     icpt_2D = 0
     for fic in laux :
       #print "\t" + fic
-      if ( fic[:5] == 'fort.' ) :
-        fic_fort = os.path.join(rep_calc, fic)
-        fichier = open (fic_fort, "r")
-        les_lignes = fichier.readlines()
-        fichier.close()
-        os.remove(fic_fort)
-        a_faire = False
-        for ligne in les_lignes[1:] :
-          laux1 = ligne.split()
-          if ( len(laux1) >= 3 ) :
-            a_faire = True
-            break
-        if a_faire :
-          if ( "1D" in les_lignes[0] ) :
-            nomfic_bis = "fr1D.%02d" % icpt_1D
-            icpt_1D += 1
-          else :
-            nomfic_bis = "fr2D.%02d" % icpt_2D
-            icpt_2D += 1
-          fic_1 = os.path.join(rep_calc, nomfic_bis)
-          fichier = open (fic_1, "w")
-          for ligne in les_lignes[1:] :
-            if ( ( "1D" not in ligne ) and ( "2D" not in ligne ) ) :
-              fichier.write(ligne)
-          fichier.close()
-          #print "\t\tajout de %s" % fic_1
-          l_fr.append(fic_1)
+      if ( fic[:2] == 'fr' ) :
+        l_fr.append(os.path.join(rep_calc, fic))
       elif ( fic[-4:] == '.med' ) :
         fic_hom_med = os.path.join(rep_calc, fic)
         #print "\t\treperage de fic_hom_med =", fic_hom_med
@@ -259,11 +269,14 @@ Entrées :
       #if erreur :
         #break
 #
-# 2.3. Ménage de l'ancien fichier MED
+# 2.3. Ménage éventuel de l'ancien fichier MED
 #
-      if ( fic_med_brut != fic_med_new ) :
-        print("Suppression du fichier %s" % fic_med_new)
-        os.remove(fic_med_brut)
+      if menage :
+#
+        if ( fic_med_brut != fic_med_new ) :
+          if verbose :
+            print("Suppression du fichier %s" % fic_med_brut)
+          os.remove(fic_med_brut)
 #
 # 3. Renommage du fichier si aucun noeud n'est concerné
 #
@@ -306,9 +319,8 @@ Entrées :
 # 1. Recherche des inforamtions permanentes dans le fichier de configuration
 #
     fic_conf = os.path.join(rep_calc, "HOMARD.Configuration")
-    fichier = open (fic_conf, "r")
-    les_lignes = fichier.readlines()
-    fichier.close()
+    with open (fic_conf, "r") as fichier :
+      les_lignes = fichier.readlines()
 #
     ligne0 = ""
     icpt = 0
@@ -336,22 +348,22 @@ Entrées :
 # 2. Création du fichier de configuration
 #
     fic_conf_sv = os.path.join(rep_calc, "HOMARD.Configuration.majc")
-    fichier = open (fic_conf_sv, "w")
-#
-    ligne = ligne0
-    ligne += "ModeHOMA 5\n"
-    fic = os.path.join(rep_calc, "Liste.%s.maj_coords.log" % s_iter)
-    ligne += "ListeStd %s\n" % fic
-    ligne += "CCMaiN__ %s\n" % fic_med_calc
-    ligne += "RepeTrav %s\n" % rep_calc
-    ligne += "RepeInfo %s\n" % rep_calc
-    ligne += "Action   homa\n"
-    ligne += "CCAssoci med\n"
-    ligne += "EcriFiHO N_SANS_FRONTIERE\n"
-    ligne += "MessInfo 10\n"
-#
-    fichier.write(ligne)
-    fichier.close()
+#
+    with open (fic_conf_sv, "w") as fichier :
+#
+      ligne = ligne0
+      ligne += "ModeHOMA 5\n"
+      fic = os.path.join(rep_calc, "Liste.%s.maj_coords.log" % s_iter)
+      ligne += "ListeStd %s\n" % fic
+      ligne += "CCMaiN__ %s\n" % fic_med_calc
+      ligne += "RepeTrav %s\n" % rep_calc
+      ligne += "RepeInfo %s\n" % rep_calc
+      ligne += "Action   homa\n"
+      ligne += "CCAssoci med\n"
+      ligne += "EcriFiHO N_SANS_FRONTIERE\n"
+      ligne += "MessInfo 10\n"
+#
+      fichier.write(ligne)
 #
 # 3. Mise à jour
 # 3.1. Détermination de l'exécutable
index 96a3868a970a8658e09f62034a8548b047625ee0..e8105bcef3868f2bc70806eaa75f08c8b43ee3cd 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_1 associe au tutorial 1
 """
-__revision__ = "V4.01"
+__revision__ = "V4.04"
 
 #========================================================================
 TEST_NAME = "tutorial_1"
@@ -29,7 +29,6 @@ DEBUG = False
 N_ITER_TEST_FILE = 3
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -40,22 +39,14 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
+from test_util import get_dir_tutorial
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
 sys.path.append(DATA_TUTORIAL)
 from tutorial_util import gzip_gunzip
 # ==================================
@@ -67,70 +58,109 @@ import iparameters
 IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
 IPAR.append("AP_MODULES_LIST", "Homard")
 #
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, verbose=False):
   """
 Python script for HOMARD
   """
+  erreur = 0
+  message = ""
   #
-  homard.UpdateStudy()
-  #
-  # Hypotheses
-  # ==========
-  hypo_1 = homard.CreateHypothesis('hypo_1')
-  hypo_1.SetUnifRefinUnRef(1)
-  #
-  # Cas
-  # ===
-  case_1 = homard.CreateCase('case_1', 'MAILL', DATA_TUTORIAL+'/tutorial_1.00.med')
-  case_1.SetDirName(DIRCASE)
+  while not erreur :
   #
-  # Iterations
-  # ==========
-  # Iteration "iter_1_1"
-  iter_1_1 = case_1.NextIteration('iter_1_1')
-  iter_1_1.SetMeshName('MESH')
-  iter_1_1.SetMeshFile(DIRCASE+'/maill.01.med')
-  iter_1_1.AssociateHypo('hypo_1')
-  error = iter_1_1.Compute(1, 2)
+    HOMARD.UpdateStudy()
+    #
+    # Hypotheses
+    # ==========
+    if verbose :
+      print(". Hypothèses")
+    hypo_1 = HOMARD.CreateHypothesis('hypo_1')
+    hypo_1.SetUnifRefinUnRef(1)
+    #
+    # Cas
+    # ===
+    if verbose :
+      print(". Cas")
+    le_cas = HOMARD.CreateCase('case_1', nom, ficmed)
+    le_cas.SetDirName(DIRCASE)
+    #
+    # Itérations
+    # ==========
+    if verbose :
+      option = 2
+    else :
+      option = 1
+    if verbose :
+      print(". Itérations")
+    # Iteration "iter_1_1"
+    iter_1_1 = le_cas.NextIteration('iter_1_1')
+    iter_1_1.SetMeshName('MESH')
+    iter_1_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_1_1.AssociateHypo('hypo_1')
+    erreur = iter_1_1.Compute(1, option)
+    if erreur :
+      break
 
-  # Iteration "iter_1_2"
-  iter_1_2 = iter_1_1.NextIteration('iter_1_2')
-  iter_1_2.SetMeshName('MESH')
-  iter_1_2.SetMeshFile(DIRCASE+'/maill.02.med')
-  iter_1_2.AssociateHypo('hypo_1')
-  error = iter_1_2.Compute(1, 2)
+    # Iteration "iter_1_2"
+    iter_1_2 = iter_1_1.NextIteration('iter_1_2')
+    iter_1_2.SetMeshName('MESH')
+    iter_1_2.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_1_2.AssociateHypo('hypo_1')
+    erreur = iter_1_2.Compute(1, option)
+    if erreur :
+      break
 
-  # Iteration "iter_1_3"
-  iter_1_3 = iter_1_2.NextIteration('iter_1_3')
-  iter_1_3.SetMeshName('MESH')
-  iter_1_3.SetMeshFile(DIRCASE+'/maill.03.med')
-  iter_1_3.AssociateHypo('hypo_1')
-  error = iter_1_3.Compute(1, 2)
+    # Iteration "iter_1_3"
+    iter_1_3 = iter_1_2.NextIteration('iter_1_3')
+    iter_1_3.SetMeshName('MESH')
+    iter_1_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
+    iter_1_3.AssociateHypo('hypo_1')
+    erreur = iter_1_3.Compute(1, option)
+    if erreur :
+      break
   #
-  return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
+    break
+  #
+  if erreur :
+    message += "Erreur au calcul de l'itération %d" % erreur
+  #
+  return erreur, message
 #
-# Exec of HOMARD-SALOME
+#==========================  Fin de la fonction ==================================
 #
-try :
-  ERROR = homard_exec()
-  if ERROR :
-    raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
-  raise Exception('Pb in homard_exec: '+eee.message)
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
+  #
+  # A. Exec of HOMARD-SALOME
+  #
+  HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+  assert HOMARD is not None, "Impossible to load homard engine"
+  HOMARD.SetLanguageShort("fr")
 #
-# Test of the results
+  FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
+  try:
+    ERREUR, MESSAGE = homard_exec("MAILL", FICMED, DEBUG)
+  except RuntimeError as eee:
+    ERREUR = 2
+    MESSAGE = str(eee.message)
+  #
+  if ERREUR :
+    MESSAGE += "Pb in homard_exec"
+    break
+  #
+  # B. Test of the results
+  #
+  N_REP_TEST_FILE = N_ITER_TEST_FILE
+  DESTROY_DIR = not DEBUG
+  test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+  #
+  break
 #
-N_REP_TEST_FILE = N_ITER_TEST_FILE
-DESTROY_DIR = not DEBUG
-test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+if ERREUR:
+  raise Exception(MESSAGE)
 #
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 1, 1)
index 585523c117eb64916232836df192a7e79fc2decc..7f89207c0d2091f30180175e516f44b1534a2bb3 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_2 associe au tutorial 2
 """
-__revision__ = "V4.01"
+__revision__ = "V4.04"
 
 #========================================================================
 TEST_NAME = "tutorial_2"
@@ -29,7 +29,6 @@ DEBUG = False
 N_ITER_TEST_FILE = 2
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -40,22 +39,14 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
+from test_util import get_dir_tutorial
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
 sys.path.append(DATA_TUTORIAL)
 from tutorial_util import gzip_gunzip
 # ==================================
@@ -67,81 +58,125 @@ import iparameters
 IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
 IPAR.append("AP_MODULES_LIST", "Homard")
 #
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, verbose=False):
   """
 Python script for HOMARD
   """
+  erreur = 0
+  message = ""
   #
-  HOMARD.UpdateStudy()
+  while not erreur :
+    #
+    HOMARD.UpdateStudy()
+    #
+    # Creation des zones
+    # ==================
+    if verbose :
+      print(". Zones")
+    # Box "Zone_12_0"
+    zone_12_0 = HOMARD.CreateZoneBox ('Zone_12_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
+    #
+    # Sphere "Zone_12_1"
+    zone_12_1 = HOMARD.CreateZoneSphere ('Zone_12_1', 0., 0., 0., 1.05)
+    #
+    # Box "Zone_12_2"
+    zone_12_2 = HOMARD.CreateZoneBox ('Zone_12_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
+    #
+    # Hypotheses
+    # ==========
+    if verbose :
+      print(". Hypothèses")
+    # Hypothese "hypo_2"
+    # ==================
+    hypo_2 = HOMARD.CreateHypothesis('hypo_2')
+    hypo_2.AddZone('Zone_12_1', 1)
+    hypo_2.AddZone('Zone_12_0', 1)
+    #
+    # Hypothese "hypo_2_bis"
+    # ======================
+    hypo_2_bis = HOMARD.CreateHypothesis('hypo_2_bis')
+    hypo_2_bis.AddZone('Zone_12_0', -1)
+    hypo_2_bis.AddZone('Zone_12_2', 1)
+    #
+    # Cas
+    # ===
+    if verbose :
+      print(". Cas")
+    le_cas = HOMARD.CreateCase('case_2', nom, ficmed)
+    le_cas.SetDirName(DIRCASE)
+    #
+    # Itérations
+    # ==========
+    if verbose :
+      option = 2
+    else :
+      option = 1
+    if verbose :
+      print(". Itérations")
+    #
+    # Iteration "iter_2_1"
+    # ====================
+    iter_2_1 = le_cas.NextIteration('iter_2_1')
+    iter_2_1.SetMeshName('M_1')
+    iter_2_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_2_1.AssociateHypo('hypo_2')
+    erreur = iter_2_1.Compute(1, option)
+    if erreur :
+      break
+    #
+    # Iteration "iter_2_2"
+    # ====================
+    iter_2_2 = iter_2_1.NextIteration('iter_2_2')
+    iter_2_2.SetMeshName('M_2')
+    iter_2_2.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_2_2.AssociateHypo('hypo_2_bis')
+    erreur = iter_2_2.Compute(1, option)
+    if erreur :
+      break
   #
-  # Creation des zones
-  # ==================
-  # Box "Zone_12_0"
-  zone_12_0 = HOMARD.CreateZoneBox ('Zone_12_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
+    break
   #
-  # Sphere "Zone_12_1"
-  zone_12_1 = HOMARD.CreateZoneSphere ('Zone_12_1', 0., 0., 0., 1.05)
+  if erreur :
+    message += "Erreur au calcul de l'itération %d" % erreur
   #
-  # Box "Zone_12_2"
-  zone_12_2 = HOMARD.CreateZoneBox ('Zone_12_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
+  return erreur, message
+#
+#==========================  Fin de la fonction ==================================
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
   #
-  # Hypothese "hypo_2"
-  # ==================
-  hypo_2 = HOMARD.CreateHypothesis('hypo_2')
-  hypo_2.AddZone('Zone_12_1', 1)
-  hypo_2.AddZone('Zone_12_0', 1)
+  # A. Exec of HOMARD-SALOME
   #
-  # Hypothese "hypo_2_bis"
-  # ======================
-  hypo_2_bis = HOMARD.CreateHypothesis('hypo_2_bis')
-  hypo_2_bis.AddZone('Zone_12_0', -1)
-  hypo_2_bis.AddZone('Zone_12_2', 1)
+  HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+  assert HOMARD is not None, "Impossible to load homard engine"
+  HOMARD.SetLanguageShort("fr")
+#
+  FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
+  try:
+    ERREUR, MESSAGE = homard_exec("MZERO", FICMED, DEBUG)
+  except RuntimeError as eee:
+    ERREUR = 2
+    MESSAGE = str(eee.message)
   #
-  # Cas
-  # ===
-  case_2 = HOMARD.CreateCase('case_2', 'MZERO', DATA_TUTORIAL+'/tutorial_2.00.med')
-  case_2.SetDirName(DIRCASE)
+  if ERREUR :
+    MESSAGE += "Pb in homard_exec"
+    break
   #
-  # Iteration "iter_2_1"
-  # ====================
-  iter_2_1 = case_2.NextIteration('iter_2_1')
-  iter_2_1.SetMeshName('M_1')
-  iter_2_1.SetMeshFile(DIRCASE+'/maill.01.med')
-  iter_2_1.AssociateHypo('hypo_2')
-  error = iter_2_1.Compute(1, 2)
+  # B. Test of the results
   #
-  # Iteration "iter_2_2"
-  # ====================
-  iter_2_2 = iter_2_1.NextIteration('iter_2_2')
-  iter_2_2.SetMeshName('M_2')
-  iter_2_2.SetMeshFile(DIRCASE+'/maill.02.med')
-  iter_2_2.AssociateHypo('hypo_2_bis')
-  error = iter_2_2.Compute(1, 2)
+  N_REP_TEST_FILE = N_ITER_TEST_FILE
+  DESTROY_DIR = not DEBUG
+  test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
   #
-  return error
-
-#========================================================================
-
-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 = homard_exec()
-  if ERROR :
-    raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
-  raise Exception('Pb in homard_exec: '+eee.message)
-#
-# Test of the results
+  break
 #
-N_REP_TEST_FILE = N_ITER_TEST_FILE
-DESTROY_DIR = not DEBUG
-test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+if ERREUR:
+  raise Exception(MESSAGE)
 #
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 2, 1)
index d9b843715087a5b55de52a002d80581f77c1da0e..ae8e15354f89d32cfb7b187aa6d286ff12e2d7bb 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_3 associe au tutorial 3
 """
-__revision__ = "V4.01"
+__revision__ = "V4.04"
 
 #========================================================================
 TEST_NAME = "tutorial_3"
@@ -29,7 +29,6 @@ DEBUG = False
 N_ITER_TEST_FILE = 2
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -40,22 +39,14 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
+from test_util import get_dir_tutorial
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
 sys.path.append(DATA_TUTORIAL)
 from tutorial_util import gzip_gunzip
 # ==================================
@@ -67,110 +58,153 @@ import iparameters
 IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
 IPAR.append("AP_MODULES_LIST", "Homard")
 #
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, verbose=False):
   """
 Python script for HOMARD
   """
+  erreur = 0
+  message = ""
   #
-  HOMARD.UpdateStudy()
+  while not erreur :
+    #
+    HOMARD.UpdateStudy()
+    #
+    # Hypotheses
+    # ==========
+    if verbose :
+      print(". Hypothèses")
+    # Hypothese "hypo_0vers1"
+    # =======================
+    hypo_0vers1 = HOMARD.CreateHypothesis('hypo_0vers1')
+    # Characterization of the field
+    hypo_0vers1.SetField('SOLU_0__QIRE_ELEM_SIGM__________')
+    hypo_0vers1.SetUseComp(0)
+    hypo_0vers1.AddComp('ERREST          ')
+    hypo_0vers1.SetRefinThr(3, 1.0)
+    hypo_0vers1.SetTypeFieldInterp(2)
+    hypo_0vers1.AddFieldInterp('SOLU_0__DEPL____________________')
+    hypo_0vers1.AddFieldInterp('SOLU_0__ERRE_ELEM_SIGM__________')
+    #
+    # Hypothese "hypo_1vers2"
+    # =======================
+    hypo_1vers2 = HOMARD.CreateHypothesis('hypo_1vers2')
+    # Characterization of the field
+    hypo_1vers2.SetField('SOLU_1__QIRE_ELEM_SIGM__________')
+    hypo_1vers2.SetUseComp(0)
+    hypo_1vers2.AddComp('ERREST          ')
+    hypo_1vers2.SetRefinThr(3, 1.5)
+    hypo_1vers2.SetUnRefThr(3, 6.)
+    hypo_1vers2.SetTypeFieldInterp(2)
+    hypo_1vers2.AddFieldInterp('SOLU_1__DEPL____________________')
+    hypo_1vers2.AddFieldInterp('SOLU_1__QIRE_ELEM_SIGM__________')
+    #
+    # Hypothese "hypo_1vers2_bis"
+    # ===========================
+    hypo_1vers2_bis = HOMARD.CreateHypothesis('hypo_1vers2_bis')
+    # Characterization of the field
+    hypo_1vers2_bis.SetField('SOLU_1__DEPL____________________')
+    hypo_1vers2_bis.SetUseComp(1)
+    hypo_1vers2_bis.AddComp('DX')
+    hypo_1vers2_bis.AddComp('DY')
+    hypo_1vers2_bis.AddComp('DZ')
+    hypo_1vers2_bis.SetRefinThr(1, 0.0001)
+    hypo_1vers2_bis.SetUnRefThr(1, 0.000001)
+    hypo_1vers2_bis.SetTypeFieldInterp(0)
+    #
+    # Cas
+    # ===
+    if verbose :
+      print(". Cas")
+    le_cas = HOMARD.CreateCase('case_3', nom, ficmed)
+    le_cas.SetDirName(DIRCASE)
+    #
+    # Itérations
+    # ==========
+    if verbose :
+      option = 2
+    else :
+      option = 1
+    if verbose :
+      print(". Itérations")
+    # Iteration "iter_3_1"
+    # ====================
+    iter_3_1 = le_cas.NextIteration('iter_3_1')
+    iter_3_1.SetMeshName('H_1')
+    iter_3_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_3_1.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.00.med"))
+    iter_3_1.SetTimeStepRank( 1, 1)
+    iter_3_1.AssociateHypo('hypo_0vers1')
+    erreur = iter_3_1.Compute(1, option)
+    if erreur :
+      break
+    #
+    # Iteration "iter_3_2"
+    # ====================
+    iter_3_2 = iter_3_1.NextIteration('iter_3_2')
+    iter_3_2.SetMeshName('H_2')
+    iter_3_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+    iter_3_2.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.01.med"))
+    iter_3_2.SetTimeStepRank(1, 1)
+    iter_3_2.AssociateHypo('hypo_1vers2')
+    erreur = iter_3_2.Compute(1, option)
+    if erreur :
+      break
+    #
+    # Iteration "iter_3_2_bis"
+    # ========================
+    iter_3_2_bis = iter_3_1.NextIteration('iter_3_2_bis')
+    iter_3_2_bis.SetMeshName('H_2_bis')
+    iter_3_2_bis.SetMeshFile(os.path.join(DIRCASE, "maill.02.bis.med"))
+    iter_3_2_bis.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.01.med"))
+    iter_3_2_bis.SetTimeStepRank(1, 1)
+    iter_3_2_bis.AssociateHypo('hypo_1vers2_bis')
+    erreur = iter_3_2_bis.Compute(1, option)
+    if erreur :
+      break
   #
-  # Hypothese "hypo_0vers1"
-  # =======================
-  hypo_0vers1 = HOMARD.CreateHypothesis('hypo_0vers1')
-  # Characterization of the field
-  hypo_0vers1.SetField('SOLU_0__QIRE_ELEM_SIGM__________')
-  hypo_0vers1.SetUseComp(0)
-  hypo_0vers1.AddComp('ERREST          ')
-  hypo_0vers1.SetRefinThr(3, 1.0)
-  hypo_0vers1.SetTypeFieldInterp(2)
-  hypo_0vers1.AddFieldInterp('SOLU_0__DEPL____________________')
-  hypo_0vers1.AddFieldInterp('SOLU_0__ERRE_ELEM_SIGM__________')
+    break
   #
-  # Hypothese "hypo_1vers2"
-  # =======================
-  hypo_1vers2 = HOMARD.CreateHypothesis('hypo_1vers2')
-  # Characterization of the field
-  hypo_1vers2.SetField('SOLU_1__QIRE_ELEM_SIGM__________')
-  hypo_1vers2.SetUseComp(0)
-  hypo_1vers2.AddComp('ERREST          ')
-  hypo_1vers2.SetRefinThr(3, 1.5)
-  hypo_1vers2.SetUnRefThr(3, 6.)
-  hypo_1vers2.SetTypeFieldInterp(2)
-  hypo_1vers2.AddFieldInterp('SOLU_1__DEPL____________________')
-  hypo_1vers2.AddFieldInterp('SOLU_1__QIRE_ELEM_SIGM__________')
+  if erreur :
+    message += "Erreur au calcul de l'itération %d" % erreur
+  #
+  return erreur, message
+#
+#==========================  Fin de la fonction ==================================
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
   #
-  # Hypothese "hypo_1vers2_bis"
-  # ===========================
-  hypo_1vers2_bis = HOMARD.CreateHypothesis('hypo_1vers2_bis')
-  # Characterization of the field
-  hypo_1vers2_bis.SetField('SOLU_1__DEPL____________________')
-  hypo_1vers2_bis.SetUseComp(1)
-  hypo_1vers2_bis.AddComp('DX')
-  hypo_1vers2_bis.AddComp('DY')
-  hypo_1vers2_bis.AddComp('DZ')
-  hypo_1vers2_bis.SetRefinThr(1, 0.0001)
-  hypo_1vers2_bis.SetUnRefThr(1, 0.000001)
-  hypo_1vers2_bis.SetTypeFieldInterp(0)
+  # A. Exec of HOMARD-SALOME
   #
-  # Cas
-  # ===
-  case_3 = HOMARD.CreateCase('case_3', 'G_0', DATA_TUTORIAL+'/tutorial_3.00.med')
-  case_3.SetDirName(DIRCASE)
+  HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+  assert HOMARD is not None, "Impossible to load homard engine"
+  HOMARD.SetLanguageShort("fr")
+#
+  FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
+  try:
+    ERREUR, MESSAGE = homard_exec("G_0", FICMED, DEBUG)
+  except RuntimeError as eee:
+    ERREUR = 2
+    MESSAGE = str(eee.message)
   #
-  # Iteration "iter_3_1"
-  # ====================
-  iter_3_1 = case_3.NextIteration('iter_3_1')
-  iter_3_1.SetMeshName('H_1')
-  iter_3_1.SetMeshFile(DIRCASE+'/maill.01.med')
-  iter_3_1.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.00.med')
-  iter_3_1.SetTimeStepRank( 1, 1)
-  iter_3_1.AssociateHypo('hypo_0vers1')
-  error = iter_3_1.Compute(1, 2)
+  if ERREUR :
+    MESSAGE += "Pb in homard_exec"
+    break
   #
-  # Iteration "iter_3_2"
-  # ====================
-  iter_3_2 = iter_3_1.NextIteration('iter_3_2')
-  iter_3_2.SetMeshName('H_2')
-  iter_3_2.SetMeshFile(DIRCASE+'/maill.02.med')
-  iter_3_2.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.01.med')
-  iter_3_2.SetTimeStepRank(1, 1)
-  iter_3_2.AssociateHypo('hypo_1vers2')
-  error = iter_3_2.Compute(1, 2)
+  # B. Test of the results
   #
-  # Iteration "iter_3_2_bis"
-  # ========================
-  iter_3_2_bis = iter_3_1.NextIteration('iter_3_2_bis')
-  iter_3_2_bis.SetMeshName('H_2_bis')
-  iter_3_2_bis.SetMeshFile(DIRCASE+'/maill.02.bis.med')
-  iter_3_2_bis.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.01.med')
-  iter_3_2_bis.SetTimeStepRank(1, 1)
-  iter_3_2_bis.AssociateHypo('hypo_1vers2_bis')
-  error = iter_3_2_bis.Compute(1, 2)
+  N_REP_TEST_FILE = 3
+  DESTROY_DIR = not DEBUG
+  test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
   #
-  return error
-
-#========================================================================
-
-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 = homard_exec()
-  if ERROR :
-    raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
-  raise Exception('Pb in homard_exec: '+eee.message)
-#
-# Test of the results
+  break
 #
-N_REP_TEST_FILE = 3
-DESTROY_DIR = not DEBUG
-test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+if ERREUR:
+  raise Exception(MESSAGE)
 #
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 3, 1)
index 1853abe37ebe0de6ac537196adb8f553c9cc4a71..61ee052c91f9afd33cd78ec705470d2487fc0724 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_4 associe au tutorial 4
 """
-__revision__ = "V4.01"
+__revision__ = "V5.03"
 
 #========================================================================
 TEST_NAME = "tutorial_4"
@@ -29,7 +29,6 @@ DEBUG = False
 N_ITER_TEST_FILE = 3
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -40,22 +39,14 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
+from test_util import get_dir_tutorial
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
 sys.path.append(DATA_TUTORIAL)
 from tutorial_util import gzip_gunzip
 # ==================================
@@ -67,97 +58,136 @@ import iparameters
 IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
 IPAR.append("AP_MODULES_LIST", "Homard")
 #
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, xao_file, verbose=True):
   """
 Python script for HOMARD
   """
-  #
-  HOMARD.UpdateStudy()
+  erreur = 0
+  message = ""
 #
-  # Frontieres
-  # ==========
-  boun_4_1 = HOMARD.CreateBoundaryDi('intersection', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.fr.med')
+  while not erreur :
+    #
+    HOMARD.UpdateStudy()
+    #
+    # Frontières
+    # ==========
+    if verbose :
+      print(". Frontières")
+    cao_name = "CAO_" + nom
+    la_frontiere = HOMARD.CreateBoundaryCAO(cao_name, xao_file)
+    #
+    # Hypotheses
+    # ==========
+    if verbose :
+      print(". Hypothèses")
+    # Creation of the hypothesis hypo_0_1
+    l_hypothese_0_1 = HOMARD.CreateHypothesis('hypo_4_0_1')
+    l_hypothese_0_1.SetUnifRefinUnRef(1)
+    l_hypothese_0_1.AddGroup('IN1')
+    l_hypothese_0_1.AddGroup('IN2')
+    l_hypothese_0_1.AddGroup('T1_INT_I')
+    l_hypothese_0_1.AddGroup('T1_INT_O')
+    l_hypothese_0_1.AddGroup('T2_INT')
+    # Creation of the hypothesis hypo_1_2
+    l_hypothese_1_2 = HOMARD.CreateHypothesis('hypo_4_1_2')
+    l_hypothese_1_2.SetUnifRefinUnRef(1)
+    l_hypothese_1_2.AddGroup('T1_EXT_I')
+    l_hypothese_1_2.AddGroup('T1_EXT_O')
+    l_hypothese_1_2.AddGroup('T2_EXT')
+    # Creation of the hypothesis hypo_2_3
+    l_hypothese_2_3 = HOMARD.CreateHypothesis('hypo_4_2_3')
+    l_hypothese_2_3.SetUnifRefinUnRef(1)
+    l_hypothese_2_3.AddGroup('INT_I')
+    l_hypothese_2_3.AddGroup('INT_E')
+    l_hypothese_2_3.AddGroup('IN1')
+    l_hypothese_2_3.AddGroup('IN2')
+    #
+    # Cas
+    # ===
+    if verbose :
+      print(". Cas")
+    le_cas = HOMARD.CreateCase('case_'+nom, nom, ficmed)
+    le_cas.SetDirName(DIRCASE)
+    le_cas.AddBoundary(cao_name)
+    #
+    # Itérations
+    # ==========
+    if verbose :
+      option = 2
+    else :
+      option = 1
+    if verbose :
+      print(". Itérations")
+    # Iteration iter_4_1 : raffinement selon les faces internes
+    iter_4_1 = le_cas.NextIteration('iter_4_1')
+    iter_4_1.SetMeshName('PIQUAGE_1')
+    iter_4_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_4_1.AssociateHypo('hypo_4_0_1')
+    erreur = iter_4_1.Compute(1, option)
+    print ("erreur = %d" % erreur)
+    if erreur :
+      break
+    # Iteration iter_4_2 : raffinement selon les faces externes
+    iter_4_2 = iter_4_1.NextIteration('iter_4_2')
+    iter_4_2.SetMeshName('PIQUAGE_2')
+    iter_4_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+    iter_4_2.AssociateHypo('hypo_4_1_2')
+    erreur = iter_4_2.Compute(1, option)
+    if erreur :
+      break
+    # Iteration iter_4_3 : second raffinement selon les faces externes
+    iter_4_3 = iter_4_2.NextIteration('iter_4_3')
+    iter_4_3.SetMeshName('PIQUAGE_3')
+    iter_4_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
+    iter_4_3.AssociateHypo('hypo_4_2_3')
+    erreur = iter_4_3.Compute(1, option)
+    if erreur :
+      break
   #
-  boun_4_2 = HOMARD.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+    break
   #
-  boun_4_3 = HOMARD.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+  if erreur :
+    message += "Erreur au calcul de l'itération %d" % erreur
   #
-  boun_4_4 = HOMARD.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+  return erreur, message
+#
+#==========================  Fin de la fonction ==================================
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
   #
-  boun_4_5 = HOMARD.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+  # A. Exec of HOMARD-SALOME
   #
-  # Hypotheses
-  # ==========
-  # Creation of the hypothesis hypo_4
-  hypo_4 = HOMARD.CreateHypothesis('hypo_4')
-  hypo_4.SetUnifRefinUnRef(1)
-  hypo_4.AddGroup('T1_INT_I')
-  hypo_4.AddGroup('T1_INT_O')
-  hypo_4.AddGroup('T2_INT')
-  # Creation of the hypothesis hypo_4_bis
-  hypo_4_bis = HOMARD.CreateHypothesis('hypo_4_bis')
-  hypo_4_bis.SetUnifRefinUnRef(1)
-  hypo_4_bis.AddGroup('T1_EXT_I')
-  hypo_4_bis.AddGroup('T1_EXT_O')
-  hypo_4_bis.AddGroup('T2_EXT')
+  HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+  assert HOMARD is not None, "Impossible to load homard engine"
+  HOMARD.SetLanguageShort("fr")
+#
+  FICMED = os.path.join(DATA_TUTORIAL, "tutorial_4.00.med")
+  XAO_FILE = os.path.join(DATA_TUTORIAL, TEST_NAME+".xao")
+  try:
+    ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, XAO_FILE, DEBUG)
+  except RuntimeError as eee:
+    ERREUR = 2
+    MESSAGE = str(eee.message)
   #
-  # Cas
-  # ===
-  case_4 = HOMARD.CreateCase('case_4', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.00.med')
-  case_4.SetDirName(DIRCASE)
-  case_4.AddBoundaryGroup( 'intersection', '' )
-  case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
-  case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
-  case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
-  case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
-  case_4.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
-  case_4.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+  if ERREUR :
+    MESSAGE += "Pb in homard_exec"
+    break
   #
-  # Iterations
-  # ==========
-  # Iteration iter_4_1 : raffinement selon les faces internes
-  iter_4_1 = case_4.NextIteration('iter_4_1')
-  iter_4_1.SetMeshName('PIQUAGE_1')
-  iter_4_1.SetMeshFile(DIRCASE+'/maill.01.med')
-  iter_4_1.AssociateHypo('hypo_4')
-  error = iter_4_1.Compute(1, 2)
-  # Iteration iter_4_2 : raffinement selon les faces externes
-  iter_4_2 = iter_4_1.NextIteration('iter_4_2')
-  iter_4_2.SetMeshName('PIQUAGE_2')
-  iter_4_2.SetMeshFile(DIRCASE+'/maill.02.med')
-  iter_4_2.AssociateHypo('hypo_4_bis')
-  error = iter_4_2.Compute(1, 2)
-  # Iteration iter_4_3 : second raffinement selon les faces externes
-  iter_4_3 = iter_4_2.NextIteration('iter_4_3')
-  iter_4_3.SetMeshName('PIQUAGE_3')
-  iter_4_3.SetMeshFile(DIRCASE+'/maill.03.med')
-  iter_4_3.AssociateHypo('hypo_4_bis')
-  error = iter_4_3.Compute(1, 2)
+  # B. Test of the results
   #
-  return error
-
-#========================================================================
-
-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 = homard_exec()
-  if ERROR :
-    raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
-  raise Exception('Pb in homard_exec: '+eee.message)
-#
-# Test of the results
+  N_REP_TEST_FILE = N_ITER_TEST_FILE
+  DESTROY_DIR = not DEBUG
+  test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+  #
+  break
 #
-N_REP_TEST_FILE = N_ITER_TEST_FILE
-DESTROY_DIR = not DEBUG
-test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+if ERREUR:
+  raise Exception(MESSAGE)
 #
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 4, 1)
index 00234d92fb2d8ff8ef17af2d77a0a0b754ae903a..499a195f6113a66afd4ba91cd2d6223d7b03b5a8 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_5 associe au tutorial 5
 """
-__revision__ = "V4.01"
+__revision__ = "V4.04"
 
 #========================================================================
 TEST_NAME = "tutorial_5"
@@ -29,7 +29,6 @@ DEBUG = False
 N_ITER_TEST_FILE = 2
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -40,22 +39,14 @@ PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
 REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
 REP_PYTHON = os.path.normpath(REP_PYTHON)
 sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
+from test_util import get_dir_tutorial
 from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
-  DIRCASE = os.path.join("/tmp", TEST_NAME)
-  if ( os.path.isdir(DIRCASE) ) :
-    remove_dir(DIRCASE)
-  os.mkdir(DIRCASE)
-else :
-  DIRCASE = tempfile.mkdtemp()
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
 sys.path.append(DATA_TUTORIAL)
 from tutorial_util import gzip_gunzip
 # ==================================
@@ -67,81 +58,126 @@ import iparameters
 IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
 IPAR.append("AP_MODULES_LIST", "Homard")
 #
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, nomfr, ficfrmed, verbose=False):
   """
 Python script for HOMARD
   """
+  erreur = 0
+  message = ""
+#
+  while not erreur :
+    #
+    HOMARD.UpdateStudy()
+    #
+    # Frontiere
+    # =========
+    if verbose :
+      print(". Frontière")
+    # Creation of the discrete boundary Boun_5_1
+    boun_5_1 = HOMARD.CreateBoundaryDi('Boun_5_1', nomfr, ficfrmed)
+    #
+    # Creation des zones
+    # ==================
+    if verbose :
+      print(". Zones")
+    # Creation of the disk with hole enveloppe
+    enveloppe = HOMARD.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
+    # Creation of the rectangle quart_sup
+    quart_sup = HOMARD.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
+    #
+    # Hypotheses
+    # ==========
+    if verbose :
+      print(". Hypothèses")
+    # Creation of the hypothesis hypo_5
+    hypo_5 = HOMARD.CreateHypothesis('hypo_5')
+    hypo_5.AddZone('enveloppe', 1)
+    # Creation of the hypothesis hypo_5_bis
+    hypo_5_bis = HOMARD.CreateHypothesis('hypo_5_bis')
+    hypo_5_bis.AddZone('quart_sup', 1)
+    #
+    # Cas
+    # ===
+    if verbose :
+      print(". Cas")
+    le_cas = HOMARD.CreateCase('case_5', nom, ficmed)
+    le_cas.SetDirName(DIRCASE)
+    le_cas.SetConfType(1)
+    le_cas.AddBoundary('Boun_5_1')
+    #
+    # Itérations
+    # ==========
+    if verbose :
+      option = 2
+    else :
+      option = 1
+    if verbose :
+      print(". Itérations")
+    #
+    # Iteration "iter_5_1"
+    # ====================
+    iter_5_1 = le_cas.NextIteration('iter_5_1')
+    iter_5_1.SetMeshName('COEUR_2D_01')
+    iter_5_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_5_1.AssociateHypo('hypo_5')
+    erreur = iter_5_1.Compute(1, option)
+    if erreur :
+      break
+    #
+    # Iteration "iter_5_2"
+    # ====================
+    iter_5_2 = iter_5_1.NextIteration('iter_5_2')
+    iter_5_2.SetMeshName('COEUR_2D_02')
+    iter_5_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+    iter_5_2.AssociateHypo('hypo_5_bis')
+    erreur = iter_5_2.Compute(1, option)
+    if erreur :
+      break
+  #
+    break
+  #
+  if erreur :
+    message += "Erreur au calcul de l'itération %d" % erreur
   #
-  HOMARD.UpdateStudy()
+  return erreur, message
+
+#==========================  Fin de la fonction ==================================
 #
-  # Frontiere
-  # =========
-  # Creation of the discrete boundary Boun_5_1
-  boun_5_1 = HOMARD.CreateBoundaryDi('Boun_5_1', 'MAIL_EXT', DATA_TUTORIAL+'/tutorial_5.fr.med')
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
   #
-  # Creation des zones
-  # ==================
-  # Creation of the disk with hole enveloppe
-  enveloppe = HOMARD.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
-  # Creation of the rectangle quart_sup
-  quart_sup = HOMARD.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
+  # A. Exec of HOMARD-SALOME
   #
-  # Hypotheses
-  # ==========
-  # Creation of the hypothesis hypo_5
-  hypo_5 = HOMARD.CreateHypothesis('hypo_5')
-  hypo_5.AddZone('enveloppe', 1)
-  # Creation of the hypothesis hypo_5_bis
-  hypo_5_bis = HOMARD.CreateHypothesis('hypo_5_bis')
-  hypo_5_bis.AddZone('quart_sup', 1)
+  HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+  assert HOMARD is not None, "Impossible to load homard engine"
+  HOMARD.SetLanguageShort("fr")
+#
+  FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
+  FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
+  try:
+    ERREUR, MESSAGE = homard_exec("COEUR_2D", FICMED, "MAIL_EXT", FICFRMED, DEBUG)
+  except RuntimeError as eee:
+    ERREUR = 2
+    MESSAGE = str(eee.message)
   #
-  # Cas
-  # ===
-  case_5 = HOMARD.CreateCase('case_5', 'COEUR_2D', DATA_TUTORIAL+'/tutorial_5.00.med')
-  case_5.SetDirName(DIRCASE)
-  case_5.SetConfType(1)
-  case_5.AddBoundaryGroup('Boun_5_1', '')
+  if ERREUR :
+    MESSAGE += "Pb in homard_exec"
+    break
   #
-  # Iteration "iter_5_1"
-  # ====================
-  iter_5_1 = case_5.NextIteration('iter_5_1')
-  iter_5_1.SetMeshName('COEUR_2D_01')
-  iter_5_1.SetMeshFile(DIRCASE+'/maill.01.med')
-  iter_5_1.AssociateHypo('hypo_5')
-  error = iter_5_1.Compute(1, 2)
+  # B. Test of the results
   #
-  # Iteration "iter_5_2"
-  # ====================
-  iter_5_2 = iter_5_1.NextIteration('iter_5_2')
-  iter_5_2.SetMeshName('COEUR_2D_02')
-  iter_5_2.SetMeshFile(DIRCASE+'/maill.02.med')
-  iter_5_2.AssociateHypo('hypo_5_bis')
-  error = iter_5_2.Compute(1, 2)
+  N_REP_TEST_FILE = N_ITER_TEST_FILE
+  DESTROY_DIR = not DEBUG
+  test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
   #
-  return error
-
-#========================================================================
-
-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 = homard_exec()
-  if ERROR :
-    raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
-  raise Exception('Pb in homard_exec: '+eee.message)
-#
-# Test of the results
+  break
 #
-N_REP_TEST_FILE = N_ITER_TEST_FILE
-DESTROY_DIR = not DEBUG
-test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+if ERREUR:
+  raise Exception(MESSAGE)
 #
 # ==================================
 gzip_gunzip(DATA_TUTORIAL, 5, 1)
diff --git a/src/tests/Test/tutorial_6.py b/src/tests/Test/tutorial_6.py
new file mode 100755 (executable)
index 0000000..433a7c8
--- /dev/null
@@ -0,0 +1,214 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2016  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
+Test tutorial_6 associe au tutorial 6
+"""
+__revision__ = "V4.04"
+
+#========================================================================
+TEST_NAME = "tutorial_6"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#========================================================================
+import os
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import get_dir
+from test_util import get_dir_tutorial
+from test_util import test_results
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 4, -1)
+gzip_gunzip(DATA_TUTORIAL, 6, -1)
+# ==================================
+
+salome.salome_init()
+import iparameters
+IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+IPAR.append("AP_MODULES_LIST", "Homard")
+#
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, nomfr, ficfrmed, verbose=False):
+  """
+Python script for HOMARD
+  """
+  erreur = 0
+  message = ""
+#
+  while not erreur :
+    #
+    HOMARD.UpdateStudy()
+    #
+    # Frontières
+    # ==========
+    if verbose :
+      print(". Frontières")
+    boun_6_1 = HOMARD.CreateBoundaryDi('intersection', nomfr, ficfrmed)
+    #
+    boun_6_2 = HOMARD.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+    #
+    boun_6_3 = HOMARD.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+    #
+    boun_6_6 = HOMARD.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+    #
+    boun_6_5 = HOMARD.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+    #
+    # Hypotheses
+    # ==========
+    if verbose :
+      print(". Hypothèses")
+    # Creation of the hypothesis hypo_0_1
+    l_hypothese_0_1 = HOMARD.CreateHypothesis('hypo_6_0_1')
+    l_hypothese_0_1.SetUnifRefinUnRef(1)
+    l_hypothese_0_1.AddGroup('IN1')
+    l_hypothese_0_1.AddGroup('IN2')
+    l_hypothese_0_1.AddGroup('T1_INT_I')
+    l_hypothese_0_1.AddGroup('T1_INT_O')
+    l_hypothese_0_1.AddGroup('T2_INT')
+    # Creation of the hypothesis hypo_1_2
+    l_hypothese_1_2 = HOMARD.CreateHypothesis('hypo_6_1_2')
+    l_hypothese_1_2.SetUnifRefinUnRef(1)
+    l_hypothese_1_2.AddGroup('T1_EXT_I')
+    l_hypothese_1_2.AddGroup('T1_EXT_O')
+    l_hypothese_1_2.AddGroup('T2_EXT')
+    # Creation of the hypothesis hypo_2_3
+    l_hypothese_2_3 = HOMARD.CreateHypothesis('hypo_6_2_3')
+    l_hypothese_2_3.SetUnifRefinUnRef(1)
+    l_hypothese_2_3.AddGroup('INT_I')
+    l_hypothese_2_3.AddGroup('INT_E')
+    l_hypothese_2_3.AddGroup('IN1')
+    l_hypothese_2_3.AddGroup('IN2')
+    #
+    # Cas
+    # ===
+    if verbose :
+      print(". Cas")
+    le_cas = HOMARD.CreateCase('case_'+nom, nom, ficmed)
+    le_cas.SetDirName(DIRCASE)
+    le_cas.AddBoundary( 'intersection' )
+    le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
+    le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
+    le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
+    le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
+    le_cas.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
+    le_cas.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+    #
+    # Itérations
+    # ==========
+    if verbose :
+      option = 2
+    else :
+      option = 1
+    if verbose :
+      print(". Itérations")
+    # Iteration iter_6_1 : raffinement selon les faces internes
+    iter_6_1 = le_cas.NextIteration('iter_6_1')
+    iter_6_1.SetMeshName('PIQUAGE_1')
+    iter_6_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+    iter_6_1.AssociateHypo('hypo_6_0_1')
+    erreur = iter_6_1.Compute(1, option)
+    print ("erreur = %d" % erreur)
+    if erreur :
+      break
+    # Iteration iter_6_2 : raffinement selon les faces externes
+    iter_6_2 = iter_6_1.NextIteration('iter_6_2')
+    iter_6_2.SetMeshName('PIQUAGE_2')
+    iter_6_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+    iter_6_2.AssociateHypo('hypo_6_1_2')
+    erreur = iter_6_2.Compute(1, option)
+    if erreur :
+      break
+    # Iteration iter_6_3 : second raffinement selon les faces externes
+    iter_6_3 = iter_6_2.NextIteration('iter_6_3')
+    iter_6_3.SetMeshName('PIQUAGE_3')
+    iter_6_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
+    iter_6_3.AssociateHypo('hypo_6_2_3')
+    erreur = iter_6_3.Compute(1, option)
+    if erreur :
+      break
+  #
+    break
+  #
+  if erreur :
+    message += "Erreur au calcul de l'itération %d" % erreur
+  #
+  return erreur, message
+#
+#==========================  Fin de la fonction ==================================
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
+  #
+  # A. Exec of HOMARD-SALOME
+  #
+  HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+  assert HOMARD is not None, "Impossible to load homard engine"
+  HOMARD.SetLanguageShort("fr")
+#
+  FICMED = os.path.join(DATA_TUTORIAL, "tutorial_4.00.med")
+  FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
+  try:
+    ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, "COURBES", FICFRMED, DEBUG)
+  except RuntimeError as eee:
+    ERREUR = 2
+    MESSAGE = str(eee.message)
+  #
+  if ERREUR :
+    MESSAGE += "Pb in homard_exec"
+    break
+  #
+  # B. Test of the results
+  #
+  N_REP_TEST_FILE = N_ITER_TEST_FILE
+  DESTROY_DIR = not DEBUG
+  test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+  #
+  break
+#
+if ERREUR:
+  raise Exception(MESSAGE)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 4, 1)
+gzip_gunzip(DATA_TUTORIAL, 6, 1)
+# ==================================
+#
+if salome.sg.hasDesktop():
+  salome.sg.updateObjBrowser()
+  iparameters.getSession().restoreVisualState(1)
+
diff --git a/src/tests/samples/test_6.apad.03.bilan b/src/tests/samples/test_6.apad.03.bilan
new file mode 100755 (executable)
index 0000000..bfa20c2
--- /dev/null
@@ -0,0 +1,53 @@
+
+
+ANALYSE DU MAILLAGE
+===================
+
+     Maillage apres adaptation                         
+     test_6                                                                          
+     Date de creation : jeudi 4 janvier 2018 a 14 h 20 mn 19 s          
+     Dimension : 3
+     Degre : 1
+     C'est un maillage obtenu apres      3 adaptations.
+     Le niveau minimum actif est   :     3
+     Le niveau maximum atteint est :     3
+
+         Direction    |       Unite       |  Minimum   |  Maximum
+     ---------------------------------------------------------------
+                      |                   |  0.0000    |  169.52    
+                      |                   | -50.434    |  100.00    
+                      |                   |  0.0000    |  200.00    
+
+
+   NOMBRE D'ENTITES DU CALCUL
+   ==========================
+
+
+     ************************************************************
+     *                      Noeuds                              *
+     ************************************************************
+     * Nombre total                                *       6441 *
+     ************************************************************
+
+     ************************************************************
+     *                      Segments                            *
+     ************************************************************
+     * Nombre total                                *        336 *
+     * . dont aretes isolees                       *          0 *
+     * . dont aretes de bord de regions 2D         *        336 *
+     * . dont aretes internes aux faces/volumes    *          0 *
+     ************************************************************
+
+     ************************************************************
+     *                      Triangles                           *
+     ************************************************************
+     * Nombre total                                *      12544 *
+     ************************************************************
+     * . du niveau   0                             *          0 *
+     * . du niveau   0.5                           *          0 *
+     * . du niveau   1                             *          0 *
+     * . du niveau   1.5                           *          0 *
+     * . du niveau   2                             *          0 *
+     * . du niveau   2.5                           *          0 *
+     * . du niveau   3                             *      12544 *
+     ************************************************************
index 45a987dc1708fe6ceecfad9eb3f8b5824d2b5834..4325d63ef8d7f2d0a5141618c1a4bc960963e04e 100644 (file)
@@ -5,7 +5,7 @@ ANALYSE DU MAILLAGE
 
      Maillage apres adaptation                         
      PIQUAGE                                                                         
-     Date de creation : lundi 2 novembre 2015 a 9 h 13 mn 13 s          
+     Date de creation : jeudi 4 janvier 2018 a 14 h 7 mn 55 s           
      Dimension : 3
      Degre : 1
      C'est un maillage obtenu apres      3 adaptations.
@@ -14,9 +14,9 @@ ANALYSE DU MAILLAGE
 
          Direction    |       Unite       |  Minimum   |  Maximum
      ---------------------------------------------------------------
-                      |                   | -230.00    |  136.45    
-                      |                   | -250.62    |  189.69    
-                      |                   | -285.21    |  155.03    
+                      |                   | -230.00    |  136.04    
+                      |                   | -250.19    |  188.38    
+                      |                   | -285.20    |  154.14    
 
 
    NOMBRE D'ENTITES DU CALCUL
@@ -26,40 +26,40 @@ ANALYSE DU MAILLAGE
      ************************************************************
      *                      Noeuds                              *
      ************************************************************
-     * Nombre total                                *      12825 *
+     * Nombre total                                *       3040 *
      ************************************************************
 
      ************************************************************
      *                      Segments                            *
      ************************************************************
-     * Nombre total                                *        758 *
+     * Nombre total                                *        452 *
      * . dont aretes isolees                       *          0 *
      * . dont aretes de bord de regions 2D         *          0 *
-     * . dont aretes internes aux faces/volumes    *        758 *
+     * . dont aretes internes aux faces/volumes    *        452 *
      ************************************************************
 
      ************************************************************
      *                      Triangles                           *
      ************************************************************
-     * Nombre total                                *      20838 *
+     * Nombre total                                *       4562 *
      * . dont triangles de regions 2D              *          0 *
-     * . dont triangles de bord                    *      20560 *
-     * . dont triangles internes aux volumes       *        278 *
+     * . dont triangles de bord                    *       4418 *
+     * . dont triangles internes aux volumes       *        144 *
      ************************************************************
      * . du niveau   0                             *          0 *
      * . du niveau   0.5                           *          0 *
-     * . du niveau   1                             *       3530 *
-     * . du niveau   1.5                           *        380 *
-     * . du niveau   2                             *      16928 *
+     * . du niveau   1                             *       3526 *
+     * . du niveau   1.5                           *        316 *
+     * . du niveau   2                             *        720 *
      ************************************************************
 
      ************************************************************
      *                      Tetraedres                          *
      ************************************************************
-     * Nombre total                                *      43490 *
+     * Nombre total                                *      11214 *
      ************************************************************
      * . du niveau   0                             *          0 *
      * . du niveau   0.5                           *          0 *
-     * . du niveau   1                             *      18174 *
-     * . du niveau   1.5                           *      25316 *
+     * . du niveau   1                             *       9930 *
+     * . du niveau   1.5                           *       1284 *
      ************************************************************
diff --git a/src/tests/samples/tutorial_6.apad.03.bilan b/src/tests/samples/tutorial_6.apad.03.bilan
new file mode 100755 (executable)
index 0000000..452d42a
--- /dev/null
@@ -0,0 +1,65 @@
+
+
+ANALYSE DU MAILLAGE
+===================
+
+     Maillage apres adaptation                         
+     PIQUAGE                                                                         
+     Date de creation : lundi 25 septembre 2017 a 13 h 52 mn 40 s       
+     Dimension : 3
+     Degre : 1
+     C'est un maillage obtenu apres      3 adaptations.
+     Le niveau minimum actif est   :     1
+     Le niveau maximum atteint est :     2
+
+         Direction    |       Unite       |  Minimum   |  Maximum
+     ---------------------------------------------------------------
+                      |                   | -230.00    |  136.04    
+                      |                   | -250.52    |  189.69    
+                      |                   | -285.20    |  155.02    
+
+
+   NOMBRE D'ENTITES DU CALCUL
+   ==========================
+
+
+     ************************************************************
+     *                      Noeuds                              *
+     ************************************************************
+     * Nombre total                                *       3040 *
+     ************************************************************
+
+     ************************************************************
+     *                      Segments                            *
+     ************************************************************
+     * Nombre total                                *        452 *
+     * . dont aretes isolees                       *          0 *
+     * . dont aretes de bord de regions 2D         *          0 *
+     * . dont aretes internes aux faces/volumes    *        452 *
+     ************************************************************
+
+     ************************************************************
+     *                      Triangles                           *
+     ************************************************************
+     * Nombre total                                *       4562 *
+     * . dont triangles de regions 2D              *          0 *
+     * . dont triangles de bord                    *       4418 *
+     * . dont triangles internes aux volumes       *        144 *
+     ************************************************************
+     * . du niveau   0                             *          0 *
+     * . du niveau   0.5                           *          0 *
+     * . du niveau   1                             *       3526 *
+     * . du niveau   1.5                           *        316 *
+     * . du niveau   2                             *        720 *
+     ************************************************************
+
+     ************************************************************
+     *                      Tetraedres                          *
+     ************************************************************
+     * Nombre total                                *      11214 *
+     ************************************************************
+     * . du niveau   0                             *          0 *
+     * . du niveau   0.5                           *          0 *
+     * . du niveau   1                             *       9930 *
+     * . du niveau   1.5                           *       1284 *
+     ************************************************************