]> SALOME platform Git repositories - modules/homard.git/commitdiff
Salome HOME
Merge branch 'gn/evol'
authorGerald NICOLAS <gerald.nicolas@edf.fr>
Wed, 10 Jan 2018 11:06:10 +0000 (12:06 +0100)
committerGerald NICOLAS <gerald.nicolas@edf.fr>
Wed, 10 Jan 2018 11:06:10 +0000 (12:06 +0100)
Mise a jour de tutorial

16 files changed:
doc/files/tutorial_5.py
doc/files/tutorial_6.py
src/HOMARD_I/HOMARD_Gen_i.cxx
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
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

index c155c1d975d5601da44a60413d2514bcef373fdd..93dce3f135d6a04057f0d960ff8b3ccea857f3d0 100755 (executable)
@@ -24,7 +24,7 @@
 Exemple de couplage HOMARD-Salome
 Copyright EDF 1996, 2010, 2018
 """
-__revision__ = "V3.1"
+__revision__ = "V3.2"
 #
 import os
 import sys
@@ -85,7 +85,7 @@ 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')
-error = iter_5_1.Compute(1, 2)
+erreur = iter_5_1.Compute(1, 2)
 #
 # Iteration "iter_5_2"
 # ====================
@@ -93,7 +93,7 @@ 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')
-error = iter_5_2.Compute(1, 2)
+erreur = iter_5_2.Compute(1, 2)
 #
 #============================== Fin des commandes ==============================
 #
index cc12c54899d9dcff7862eb845da8847681454f18..c464402074f26c67ae848bc6c0e8fa4f5db1fe7f 100755 (executable)
@@ -24,7 +24,7 @@
 Exemple de couplage HOMARD-Salome
 Copyright EDF 1996, 2011, 2018
 """
-__revision__ = "V4.3"
+__revision__ = "V4.4"
 #
 import os
 import sys
@@ -54,7 +54,7 @@ homard.SetCurrentStudy(salome.myStudy)
 #
 # Frontières
 # ==========
-boun_6_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', os.path.join(DATA_TUTORIAL, "tutorial_6.fr.med"))
+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.)
 #
@@ -83,6 +83,8 @@ le_cas.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
 # 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')
index 21e018ef7b1096bc1b5d59b2d3be7cdff124071b..eca83e6997d985d9198f555bc9a1b940f04dee5f 100644 (file)
@@ -3315,11 +3315,8 @@ void HOMARD_Gen_i::DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HO
   for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++)
   {
     std::string nomCompo = std::string((*mescompo)[NumeComp]);
-    if ((system(nomCompo.c_str())) != 0)
-    {
-      MESSAGE( "... nomCompo = " << nomCompo );
-      myDriver->TexteCompo(NumeComp, nomCompo);
-    }
+    MESSAGE( "... nomCompo = " << nomCompo );
+    myDriver->TexteCompo(NumeComp, nomCompo);
   }
   return ;
 }
index 01055418a99ec828053a2d4d7e87c898a1eabb4a..cbc2a598277bcfdb0e602e7f074eccca961c5752 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(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -107,11 +98,11 @@ Python script for HOMARD
     zones_1_et_2.AddZone('Zone_1_1', 1)
     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
+    nbzone = len(laux) // 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,8 +196,8 @@ try :
   ERROR = homard_exec(salome.myStudy)
   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 5183eca0150660db8e8182d33d57fb859f9608c7..80c2d02b2ddae1117afc71a23abd455257722ab3 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(prefix=TEST_NAME)
+# ==================================
+# 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(salome.myStudy)
   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 3318dd52f05a510e73988458a50748d043634a85..92525f35829e411491de0a0f6b87ef806c604138 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_3
 """
-__revision__ = "V4.02"
+__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(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -211,8 +202,8 @@ try :
   ERROR = homard_exec(salome.myStudy)
   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 aae310290b1da85c5cd3958099e20f62fb84e14c..8d6306bc49a773724b566b57106dd53cef1dbfaa 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(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
 # ==================================
 
 salome.salome_init()
@@ -128,9 +119,9 @@ Python script for GEOM and SMESH
     try:
       ficmed = os.path.join(DIRCASE, 'maill.00.med')
       box_m.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None, 1)
-    except Exception as eee:
+    except IOError as eee:
       error = 2
-      raise Exception('ExportToMEDX() failed. '+eee.message)
+      raise Exception('ExportToMEDX() failed. '+str(eee.message))
   #
     break
   #
@@ -218,9 +209,9 @@ Python script for HOMARD
     hypo_4_1.AddZone('Zone_4_1', 1)
     hypo_4_1.SetExtraOutput(2)
     laux = hypo_4_1.GetZones()
-    nbzone = len(laux)/2
+    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
@@ -230,9 +221,9 @@ Python script for HOMARD
     hypo_4_2.AddZone('Zone_4_2', 1)
     hypo_4_2.SetExtraOutput(2)
     laux = hypo_4_2.GetZones()
-    nbzone = len(laux)/2
+    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,8 +311,8 @@ try :
   ERROR = geom_smesh_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in geom_smesh_exec')
-except Exception as eee:
-  raise Exception('Pb in geom_smesh_exec: '+eee.message)
+except RuntimeError as eee:
+  raise Exception('Pb in geom_smesh_exec: '+str(eee.message))
 
 HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
 assert HOMARD is not None, "Impossible to load homard engine"
@@ -333,8 +324,8 @@ try :
   ERROR = homard_exec(salome.myStudy)
   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 bb3dad194b7e169ac90b0b7ad2e27fed4c656437..84bde230713468a881c4ced120b9ce451c3555b9 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(prefix=TEST_NAME)
+# ==================================
+# 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,9 +158,9 @@ 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('ExportToMEDX() failed. '+eee.message)
+      raise Exception('ExportToMEDX() failed. '+str(eee.message))
   #
     break
   #
@@ -308,8 +299,8 @@ try :
   ERROR = mesh_exec(salome.myStudy)
   if ERROR :
     raise Exception('Pb in mesh_exec')
-except Exception as eee:
-  raise Exception('Pb in mesh_exec: '+eee.message)
+except RuntimeError as eee:
+  raise Exception('Pb in mesh_exec: '+str(eee.message))
 
 HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
 assert HOMARD is not None, "Impossible to load homard engine"
@@ -321,8 +312,8 @@ try :
   ERROR = homard_exec(salome.myStudy)
   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 7a1226e013ddd7203af9d06a33bbcb2f1b18e838..a64379b94391b723e6d1e8c404691c86c6b18508 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test test_6
 """
-__revision__ = "V1.02"
+__revision__ = "V1.04"
 
 #========================================================================
 TEST_NAME = "test_6"
@@ -32,7 +32,6 @@ TAILLE = 10.
 LG_ARETE = TAILLE*2.5
 #========================================================================
 import os
-import tempfile
 import sys
 import HOMARD
 import salome
@@ -43,20 +42,13 @@ 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 test_results
 from test_util import saveGeometry
-# 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(prefix=TEST_NAME)
+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
@@ -299,9 +291,9 @@ while not ERREUR :
   XAO_FILE = os.path.join(DIRCASE, TEST_NAME+".xao")
   try :
     ERREUR = saveGeometry(XAO_FILE, TEST_NAME, "test_salome_"+TEST_NAME)
-  except Exception, eee:
-    ERREUR = 2000
-    MESSAGE = eee.message
+  except IOError as eee:
+    ERREUR = os.error
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in saveGeometry"
@@ -321,9 +313,9 @@ while not ERREUR :
 #
   try:
     ERREUR, MESSAGE = homard_exec(TEST_NAME, FICMED, XAO_FILE, VERBOSE)
-  except Exception, eee:
-    ERREUR = 4000
-    MESSAGE = eee.message
+  except RuntimeError as eee:
+    ERREUR = os.error
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in homard_exec"
index e43156c88ee0878e3f8c8e8ce1c9ba44d5fb2b3c..960c0e8dafb814808456df205695df057ce17e32 100755 (executable)
 Python script for HOMARD
 Utilitaires pour les tests
 """
-__revision__ = "V3.03"
+__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.
index 070277b551fcd88593ff7fafed0f8ccb6ac0a801..2cf3337ca8a2576de9080e227c559e1718c1e7be 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_1 associe au tutorial 1
 """
-__revision__ = "V4.02"
+__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(prefix=TEST_NAME)
-# 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
 # ==================================
@@ -152,9 +143,9 @@ while not ERREUR :
   FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
   try:
     ERREUR, MESSAGE = homard_exec("MAILL", FICMED, DEBUG)
-  except Exception, eee:
+  except RuntimeError as eee:
     ERREUR = 2
-    MESSAGE = eee.message
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in homard_exec"
index f8bfaf34a2d65da80039f3f3c4dc4bb2e4ad8496..29595c1aa6b586bd32f2d56ab702ea862495b099 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_2 associe au tutorial 2
 """
-__revision__ = "V4.02"
+__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(prefix=TEST_NAME)
-# 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
 # ==================================
@@ -168,9 +159,9 @@ while not ERREUR :
   FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
   try:
     ERREUR, MESSAGE = homard_exec("MZERO", FICMED, DEBUG)
-  except Exception, eee:
+  except RuntimeError as eee:
     ERREUR = 2
-    MESSAGE = eee.message
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in homard_exec"
index 602ace5fbdefb3206bad38b543e7ca1f74377caa..7b7dfaa3b12940e14ebacd5a0282f2474d990e42 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_3 associe au tutorial 3
 """
-__revision__ = "V4.02"
+__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(prefix=TEST_NAME)
-# 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
 # ==================================
@@ -196,9 +187,9 @@ while not ERREUR :
   FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
   try:
     ERREUR, MESSAGE = homard_exec("G_0", FICMED, DEBUG)
-  except Exception, eee:
+  except RuntimeError as eee:
     ERREUR = 2
-    MESSAGE = eee.message
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in homard_exec"
index 9e05df945ec7ad76c4f577c5a79ede78273ded0b..157c7712a47edc9fe19ed19a275bd3b5103f8665 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_4 associe au tutorial 4
 """
-__revision__ = "V5.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(prefix=TEST_NAME)
-# 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
 # ==================================
@@ -179,9 +170,9 @@ while not ERREUR :
   XAO_FILE = os.path.join(DATA_TUTORIAL, TEST_NAME+".xao")
   try:
     ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, XAO_FILE, DEBUG)
-  except Exception, eee:
+  except RuntimeError as eee:
     ERREUR = 2
-    MESSAGE = eee.message
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in homard_exec"
index afdad37e300b1f6c0762f061b41c23ac77329dfa..26f4fde5613469ce841faad24ad386d59af06f65 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_5 associe au tutorial 5
 """
-__revision__ = "V4.02"
+__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(prefix=TEST_NAME)
-# 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
 # ==================================
@@ -169,9 +160,9 @@ while not ERREUR :
   FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
   try:
     ERREUR, MESSAGE = homard_exec("COEUR_2D", FICMED, "MAIL_EXT", FICFRMED, DEBUG)
-  except Exception, eee:
+  except RuntimeError as eee:
     ERREUR = 2
-    MESSAGE = eee.message
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in homard_exec"
index 849998df2545463f4d530cfcc0bb22c243a3900e..2b97e81bce7d87c23e91879a380a3b8def5d9655 100755 (executable)
@@ -21,7 +21,7 @@
 Python script for HOMARD
 Test tutorial_6 associe au tutorial 6
 """
-__revision__ = "V4.02"
+__revision__ = "V4.04"
 
 #========================================================================
 TEST_NAME = "tutorial_6"
@@ -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(prefix=TEST_NAME)
-# 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
 # ==================================
@@ -193,9 +184,9 @@ while not ERREUR :
   FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
   try:
     ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, "COURBES", FICFRMED, DEBUG)
-  except Exception, eee:
+  except RuntimeError as eee:
     ERREUR = 2
-    MESSAGE = eee.message
+    MESSAGE = str(eee.message)
   #
   if ERREUR :
     MESSAGE += "Pb in homard_exec"