Exemple de couplage HOMARD-Salome
Copyright EDF-R&D 1996, 2010, 2014
"""
-__revision__ = "V1.9"
+__revision__ = "V2.1"
#
import os
import sys
#
# ==================================
-pathHomard = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
# Repertoire des donnees du tutorial
-data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-data_dir = os.path.normpath(data_dir)
-sys.path.append(data_dir)
+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(1)
-gzip_gunzip(data_dir, 1, -1)
+DIRCASE = creation_dircase(1)
+gzip_gunzip(DATA_TUTORIAL, 1, -1)
# ==================================
#
import salome
#
# Hypotheses
# ==========
-Hypo_1 = homard.CreateHypothesis('Hypo_1')
-Hypo_1.SetUnifRefinUnRef(1)
+hypo_1 = homard.CreateHypothesis('hypo_1')
+hypo_1.SetUnifRefinUnRef(1)
#
# Cas
# ===
-Case_1 = homard.CreateCase('Case_1', 'MAILL', data_dir+'/tutorial_1.00.med')
-Case_1.SetDirName(dircase)
-Case_1.SetConfType(1)
+case_1 = homard.CreateCase('Case_1', 'MAILL', DATA_TUTORIAL+'/tutorial_1.00.med')
+case_1.SetDirName(DIRCASE)
+case_1.SetConfType(1)
#
# 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)
+# 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)
-# 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_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_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_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)
+#
# ==================================
-gzip_gunzip(data_dir, 1, 1)
+gzip_gunzip(DATA_TUTORIAL, 1, 1)
# ==================================
-
+#
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
+ iparameters.getSession().restoreVisualState(1)