Python script for HOMARD
Test test_1
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "test_1"
dico["-1"] = "deraffinement"
# Creation of the hypothesis a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM
hyponame_1 = "a10_1pc_de_mailles_a_raffiner_sur_ERRE_ELEM_SIGM"
- print "-------- Creation of the hypothesis", hyponame_1
+ print("-------- Creation of the hypothesis", hyponame_1)
hypo_1_1 = HOMARD.CreateHypothesis(hyponame_1)
hypo_1_1.SetField('RESU____ERRE_ELEM_SIGM__________')
hypo_1_1.SetUseComp(0)
hypo_1_1.SetRefinThr(3, 10.1)
hypo_1_1.AddFieldInterp('RESU____DEPL____________________')
hypo_1_1.AddFieldInterp('RESU____ERRE_ELEM_SIGM__________')
- print hyponame_1, " : champ utilisé :", hypo_1_1.GetFieldName()
- print hyponame_1, " : composantes utilisées :", hypo_1_1.GetComps()
+ print(hyponame_1, " : champ utilisé :", hypo_1_1.GetFieldName())
+ print(hyponame_1, " : composantes utilisées :", hypo_1_1.GetComps())
if ( len (hypo_1_1.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", hypo_1_1.GetField()
- print hyponame_1, " : champs interpolés :", hypo_1_1.GetFieldInterps()
+ print(".. caractéristiques de l'adaptation :", hypo_1_1.GetField())
+ print(hyponame_1, " : champs interpolés :", hypo_1_1.GetFieldInterps())
# Creation of the hypothesis Zones_1_et_2
hyponame_2 = "Zones_1_et_2"
- print "-------- Creation of the hypothesis", hyponame_2
+ print("-------- Creation of the hypothesis", hyponame_2)
zones_1_et_2 = HOMARD.CreateHypothesis(hyponame_2)
zones_1_et_2.AddZone('Zone_1_1', 1)
zones_1_et_2.AddZone('Zone_1_2', 1)
nbzone = len(laux)/2
jaux = 0
for iaux in range(nbzone) :
- print hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+ print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
jaux += 2
- print hyponame_2, " : champ utilisé :", zones_1_et_2.GetFieldName()
+ 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()
- print hyponame_2, " : champs interpolés :", zones_1_et_2.GetFieldInterps()
+ print(".. caractéristiques de l'adaptation :", zones_1_et_2.GetField())
+ print(hyponame_2, " : champs interpolés :", zones_1_et_2.GetFieldInterps())
#
# Creation of the cases
# =====================
# Creation of the case
- print "-------- Creation of the case", TEST_NAME
+ print("-------- Creation of the case", TEST_NAME)
mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
case_test_1 = HOMARD.CreateCase(TEST_NAME, 'MAILL', mesh_file)
case_test_1.SetDirName(DIRCASE)
# ==========================
# Creation of the iteration 1
iter_name = "I_" + TEST_NAME + "_1"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_1_1 = case_test_1.NextIteration(iter_name)
iter_test_1_1.AssociateHypo(hyponame_1)
- print ". Hypothese :", hyponame_1
+ print(". Hypothese :", hyponame_1)
iter_test_1_1.SetMeshName('M1')
iter_test_1_1.SetMeshFile(os.path.join(DIRCASE, 'maill.01.med'))
iter_test_1_1.SetFieldFile(os.path.join(REP_DATA, TEST_NAME + '.00.med'))
iter_test_1_1.SetTimeStepRank(1, 1)
iter_test_1_1.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
iter_test_1_1.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
- print ". Instants d'interpolation :", iter_test_1_1.GetFieldInterpsTimeStepRank()
+ print(". Instants d'interpolation :", iter_test_1_1.GetFieldInterpsTimeStepRank())
error = iter_test_1_1.Compute(1, 1)
if error :
error = 1
# Creation of the iteration 2
iter_name = "I_" + TEST_NAME + "_2"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_1_2 = iter_test_1_1.NextIteration(iter_name)
iter_test_1_2.AssociateHypo(hyponame_1)
- print ". Hypothese :", hyponame_1
+ print(". Hypothese :", hyponame_1)
iter_test_1_2.SetMeshName('M2')
iter_test_1_2.SetMeshFile(os.path.join(DIRCASE, 'maill.02.med'))
iter_test_1_2.SetFieldFile(os.path.join(REP_DATA, TEST_NAME + '.01.med'))
iter_test_1_2.SetTimeStepRank(1, 1)
iter_test_1_2.SetFieldInterpTimeStep('RESU____DEPL____________________', 1)
iter_test_1_2.SetFieldInterpTimeStepRank('RESU____ERRE_ELEM_SIGM__________', 1, 1)
- print ". Instants d'interpolation :", iter_test_1_2.GetFieldInterpsTimeStepRank()
+ print(". Instants d'interpolation :", iter_test_1_2.GetFieldInterpsTimeStepRank())
error = iter_test_1_2.Compute(1, 1)
if error :
error = 2
# Creation of the iteration 3
iter_name = "I_" + TEST_NAME + "_3"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_1_3 = iter_test_1_2.NextIteration(iter_name)
iter_test_1_3.AssociateHypo(hyponame_2)
- print ". Hypothese :", hyponame_2
+ print(". Hypothese :", hyponame_2)
iter_test_1_3.SetMeshName('M3')
iter_test_1_3.SetMeshFile(os.path.join(DIRCASE, 'maill.03.med'))
iter_test_1_2.SetFieldFile(os.path.join(REP_DATA, TEST_NAME + '.02.med'))
- print ". Instants d'interpolation :", iter_test_1_3.GetFieldInterpsTimeStepRank()
+ print(". Instants d'interpolation :", iter_test_1_3.GetFieldInterpsTimeStepRank())
error = iter_test_1_3.Compute(1, 1)
if error :
error = 3
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Test test_2
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "test_2"
# ==========================
# Creation of the hypothesis 1
hyponame_1 = "hypo_" + TEST_NAME + "_1"
- print "-------- Creation of the hypothesis", hyponame_1
+ print("-------- Creation of the hypothesis", hyponame_1)
hypo_test_2_1 = HOMARD.CreateHypothesis(hyponame_1)
hypo_test_2_1.SetUnifRefinUnRef(1)
hypo_test_2_1.AddGroup('EG')
hypo_test_2_1.AddGroup('BANDE')
- print hyponame_1, " : zones utilisées :", hypo_test_2_1.GetZones()
- print hyponame_1, " : champ utilisé :", hypo_test_2_1.GetFieldName()
- print hyponame_1, " : composantes utilisées :", hypo_test_2_1.GetComps()
+ print(hyponame_1, " : zones utilisées :", hypo_test_2_1.GetZones())
+ print(hyponame_1, " : champ utilisé :", hypo_test_2_1.GetFieldName())
+ print(hyponame_1, " : composantes utilisées :", hypo_test_2_1.GetComps())
if ( len (hypo_test_2_1.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", hypo_test_2_1.GetField()
+ print(".. caractéristiques de l'adaptation :", hypo_test_2_1.GetField())
# Creation of the hypothesis 2
hyponame_2 = "hypo_" + TEST_NAME + "_2"
- print "-------- Creation of the hypothesis", hyponame_2
+ print("-------- Creation of the hypothesis", hyponame_2)
hypo_test_2_2 = HOMARD.CreateHypothesis(hyponame_2)
hypo_test_2_2.SetUnifRefinUnRef(1)
hypo_test_2_2.AddGroup('M_D')
- print hyponame_2, " : zones utilisées :", hypo_test_2_2.GetZones()
- print hyponame_2, " : champ utilisé :", hypo_test_2_2.GetFieldName()
- print hyponame_2, " : composantes utilisées :", hypo_test_2_2.GetComps()
+ print(hyponame_2, " : zones utilisées :", hypo_test_2_2.GetZones())
+ print(hyponame_2, " : champ utilisé :", hypo_test_2_2.GetFieldName())
+ print(hyponame_2, " : composantes utilisées :", hypo_test_2_2.GetComps())
if ( len (hypo_test_2_2.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", hypo_test_2_2.GetField()
+ print(".. caractéristiques de l'adaptation :", hypo_test_2_2.GetField())
#
# Creation of the cases
# =====================
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Test test_3
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "test_3"
# ==========================
# Uniform refinement
hyponame = "hypo_" + TEST_NAME
- print "-------- Creation of the hypothesis", hyponame
+ print("-------- Creation of the hypothesis", hyponame)
hypo_test_3 = HOMARD.CreateHypothesis(hyponame)
hypo_test_3.SetUnifRefinUnRef(1)
- print hyponame, " : zones utilisées :", hypo_test_3.GetZones()
- print hyponame, " : champ utilisé :", hypo_test_3.GetFieldName()
- print hyponame, " : composantes utilisées :", hypo_test_3.GetComps()
+ print(hyponame, " : zones utilisées :", hypo_test_3.GetZones())
+ print(hyponame, " : champ utilisé :", hypo_test_3.GetFieldName())
+ print(hyponame, " : composantes utilisées :", hypo_test_3.GetComps())
#
for num in range (N_BOUCLE+1) :
#
- print "-------- num =", num, "--------"
+ print("-------- num =", num, "--------")
#
# Creation of the case case_test_3
# ===========================
if ( num <= 1 ) :
- print "-------- Creation of the case", TEST_NAME
+ print("-------- Creation of the case", TEST_NAME)
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)
# ==========================
# Creation of the iteration 1
iter_name = "I_" + TEST_NAME + "_1"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_3_1 = case_test_3.NextIteration(iter_name)
iter_test_3_1.SetMeshName('MOYEU_1')
iter_test_3_1.SetMeshFile(os.path.join(DIRCASE, 'maill.01.med'))
# Creation of the iteration 2
iter_name = "I_" + TEST_NAME + "_2"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_3_2 = iter_test_3_1.NextIteration(iter_name)
iter_test_3_2.SetMeshName('MOYEU_2')
iter_test_3_2.SetMeshFile(os.path.join(DIRCASE, 'maill.02.med'))
scriptfile = os.path.normpath(scriptfile)
dirname = DIRCASE
yacsname = "YACS_" + TEST_NAME
- print "-------- Creation of the schema", yacsname
+ print("-------- Creation of the schema", yacsname)
yacs_test_3 = case_test_3.CreateYACSSchema(yacsname, scriptfile, dirname, mesh_file)
yacs_test_3.SetType(2)
yacs_test_3.SetMaxIter(2)
# ============
# Destruction of the schema, sauf a la fin
if ( num < N_BOUCLE ) :
- print "-------- Destruction of the schema", yacs_test_3.GetName()
+ print("-------- Destruction of the schema", yacs_test_3.GetName())
error = yacs_test_3.Delete(1)
if error :
error = 10*num + 6
# After the first loop, the case is deleted, except the final mesh files
# All the iterations are deleted
if ( num == 0 ) :
- print "-------- Destruction of the case", case_test_3.GetName()
+ print("-------- Destruction of the case", case_test_3.GetName())
error = case_test_3.Delete(0)
if error :
break
# After the second loop, the iterations are deleted, with the final mesh files
elif ( num == 1 ) :
# Recursive destruction of the iterations
- print "-------- Recursive destruction of the iteration", iter_test_3_1.GetName()
+ print("-------- Recursive destruction of the iteration", iter_test_3_1.GetName())
error = iter_test_3_1.Delete(1)
if error :
error = 10*num + 3
break
# Destruction and creation of the hypothese
if ( num == 1 ) :
- print "-------- Destruction of the hypothese", hypo_test_3.GetName()
+ print("-------- Destruction of the hypothese", hypo_test_3.GetName())
error = hypo_test_3.Delete()
if error :
error = 10*num + 4
break
hyponame = "hypo_test_3"
- print "-------- Creation of the hypothesis", hyponame
+ print("-------- Creation of the hypothesis", hyponame)
hypo_test_3 = HOMARD.CreateHypothesis(hyponame)
hypo_test_3.SetUnifRefinUnRef(1)
#
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Test test_4
"""
-__revision__ = "V2.2"
+__revision__ = "V3.01"
#========================================================================
TEST_NAME = "test_4"
try:
ficmed = os.path.join(DIRCASE, 'maill.00.med')
box_m.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None, 1)
- except Exception, eee:
+ except Exception as eee:
error = 2
raise Exception('ExportToMEDX() failed. '+eee.message)
#
valeur[iaux] = 1.e0 / max ( 1.e-5, np.sqrt(distance) )
#print ". valeur", valeur
nparr = valeur.toNumPyArray()
- print ". mini/maxi", nparr.min(), nparr.max()
+ print(". mini/maxi", nparr.min(), nparr.max())
#
# Creation of the field
# =====================
dico["-1"] = "deraffinement"
# Creation of the hypothesis hypo_4_1
hyponame_1 = "Zone_1"
- print "-------- Creation of the hypothesis", hyponame_1
+ print("-------- Creation of the hypothesis", hyponame_1)
hypo_4_1 = HOMARD.CreateHypothesis(hyponame_1)
hypo_4_1.AddZone('Zone_4_1', 1)
hypo_4_1.SetExtraOutput(2)
nbzone = len(laux)/2
jaux = 0
for iaux in range(nbzone) :
- print hyponame_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+ print(hyponame_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
jaux += 2
# Creation of the hypothesis hypo_4_2
hyponame_2 = "Zone_2"
- print "-------- Creation of the hypothesis", hyponame_2
+ print("-------- Creation of the hypothesis", hyponame_2)
hypo_4_2 = HOMARD.CreateHypothesis(hyponame_2)
hypo_4_2.AddZone('Zone_4_2', 1)
hypo_4_2.SetExtraOutput(2)
nbzone = len(laux)/2
jaux = 0
for iaux in range(nbzone) :
- print hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux]
+ print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
jaux += 2
# Creation of the hypothesis DISTANCE INVERSE
hyponame_3 = "DISTANCE INVERSE"
- print "-------- Creation of the hypothesis", hyponame_3
+ print("-------- Creation of the hypothesis", hyponame_3)
hypo_4_3 = HOMARD.CreateHypothesis(hyponame_3)
hypo_4_3.SetField('DISTANCE')
hypo_4_3.SetUseComp(0)
hypo_4_3.SetUnRefThr(1, 0.2)
hypo_4_3.AddFieldInterp('DISTANCE')
hypo_4_3.SetExtraOutput(2)
- print hyponame_3, " : zones utilisées :", hypo_4_3.GetZones()
- print hyponame_3, " : champ utilisé :", hypo_4_3.GetFieldName()
- print hyponame_3, " : composantes utilisées :", hypo_4_3.GetComps()
+ print(hyponame_3, " : zones utilisées :", hypo_4_3.GetZones())
+ print(hyponame_3, " : champ utilisé :", hypo_4_3.GetFieldName())
+ print(hyponame_3, " : composantes utilisées :", hypo_4_3.GetComps())
if ( len (hypo_4_3.GetFieldName()) > 0 ) :
- print ".. caractéristiques de l'adaptation :", hypo_4_3.GetField()
- print hyponame_3, " : champs interpolés :", hypo_4_3.GetFieldInterps()
+ print(".. caractéristiques de l'adaptation :", hypo_4_3.GetField())
+ print(hyponame_3, " : champs interpolés :", hypo_4_3.GetFieldInterps())
#
# Creation of the cases
# =====================
# Creation of the case
- print "-------- Creation of the case", TEST_NAME
+ print("-------- Creation of the case", TEST_NAME)
mesh_file = os.path.join(DIRCASE, 'maill.00.med')
case_test_4 = HOMARD.CreateCase(TEST_NAME, 'MESH', mesh_file)
case_test_4.SetDirName(DIRCASE)
# ==========================
# Creation of the iteration 1
iter_name = "I_" + TEST_NAME + "_1"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_4_1 = case_test_4.NextIteration(iter_name)
iter_test_4_1.AssociateHypo(hyponame_1)
- print ". Hypothese :", hyponame_1
+ print(". Hypothese :", hyponame_1)
iter_test_4_1.SetMeshName('M1')
iter_test_4_1.SetMeshFile(os.path.join(DIRCASE, 'maill.01.med'))
error = iter_test_4_1.Compute(1, 2)
# Creation of the iteration 2
iter_name = "I_" + TEST_NAME + "_2"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_4_2 = iter_test_4_1.NextIteration(iter_name)
iter_test_4_2.AssociateHypo(hyponame_2)
- print ". Hypothese :", hyponame_2
+ print(". Hypothese :", hyponame_2)
iter_test_4_2.SetMeshName('M2')
iter_test_4_2.SetMeshFile(os.path.join(DIRCASE, 'maill.02.med'))
error = iter_test_4_2.Compute(1, 2)
break
#
iter_name = "I_" + TEST_NAME + "_3"
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
iter_test_4_3 = iter_test_4_2.NextIteration(iter_name)
iter_test_4_3.AssociateHypo(hyponame_3)
- print ". Hypothese :", hyponame_3
+ print(". Hypothese :", hyponame_3)
iter_test_4_3.SetMeshName('M3')
iter_test_4_3.SetFieldFile(os.path.join(DIRCASE, 'maill.02.med'))
iter_test_4_3.SetMeshFile(os.path.join(DIRCASE, 'maill.03.med'))
ERROR = geom_smesh_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in geom_smesh_exec')
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in geom_smesh_exec: '+eee.message)
HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Specific conditions for Code_Saturne
Test test_5
"""
-__revision__ = "V1.0"
+__revision__ = "V2.01"
#========================================================================
TEST_NAME = "test_5"
ficmed = os.path.join(DIRCASE, 'maill.00.med')
#print "Ecriture du maillage dans le fichier", ficmed
meshMEDFile3D.write(ficmed, 2)
- except Exception, eee:
+ except Exception as eee:
error = 2
raise Exception('ExportToMEDX() failed. '+eee.message)
#
valeur[num_mail] = 1.e0 / max ( 1.e-5, distance)
#print ". valeur", valeur
nparr = valeur.toNumPyArray()
- print ". mini/maxi", nparr.min(), nparr.max()
+ print(". mini/maxi", nparr.min(), nparr.max())
#
# Creation of the field
# =====================
# Creation of the hypothese DISTANCE INVERSE
# ==========================================
hyponame = "DISTANCE INVERSE"
- print "-------- Creation of the hypothesis", hyponame
+ print("-------- Creation of the hypothesis", hyponame)
hypo_5 = HOMARD.CreateHypothesis(hyponame)
hypo_5.SetField('DISTANCE')
hypo_5.SetUseComp(0)
hypo_5.SetRefinThr(1, 0.020)
hypo_5.SetUnRefThr(1, 0.015)
- print hyponame, " : champ utilisé :", hypo_5.GetFieldName()
- print ".. caractéristiques de l'adaptation :", hypo_5.GetField()
+ print(hyponame, " : champ utilisé :", hypo_5.GetFieldName())
+ print(".. caractéristiques de l'adaptation :", hypo_5.GetField())
#
# Creation of the cases
# =====================
# Creation of the case
- print "-------- Creation of the case", TEST_NAME
+ print("-------- Creation of the case", TEST_NAME)
mesh_file = os.path.join(DIRCASE, 'maill.00.med')
case_test_5 = HOMARD.CreateCase(TEST_NAME, 'MESH', mesh_file)
case_test_5.SetDirName(DIRCASE)
# Creation of the iteration
#
iter_name = "I_" + TEST_NAME + "_" + s_niterp1
- print "-------- Creation of the iteration", iter_name
+ print("-------- Creation of the iteration", iter_name)
if ( niter == 0 ) :
iter_test_5 = case_test_5.NextIteration(iter_name)
else :
ERROR = mesh_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in mesh_exec')
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in mesh_exec: '+eee.message)
HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Utilitaires pour les tests
"""
-__revision__ = "V2.1"
+__revision__ = "V3.01"
import os
import MEDLoader as ml
break
if not geomObj:
- raise RuntimeError, "Cant find a geometry object in the SALOME study with name = '%s'" % name
+ raise RuntimeError("Cant find a geometry object in the SALOME study with name = '%s'" % name)
# save the geom object in a XAO file
l_fields = list()
ligne += "\nfic_med_brut = %s" % fic_med_brut
ligne += "\nfic_med_new = %s" % fic_med_new
ligne += "\nxao_file = %s" % xao_file
- print ligne
+ print(ligne)
message = ""
erreur = 0
if l_fr :
#
if verbose :
- print "l_fr =", l_fr
- print "fic_hom_med =", fic_hom_med
+ print("l_fr =", l_fr)
+ print("fic_hom_med =", fic_hom_med)
#
# 2.1. La fonction :
# . prend le maillage brut dans le fichier fic_med_brut
# 2.3. Ménage de l'ancien fichier MED
#
if ( fic_med_brut != fic_med_new ) :
- print "Suppression du fichier %s" % fic_med_new
+ print("Suppression du fichier %s" % fic_med_new)
os.remove(fic_med_brut)
#
# 3. Renommage du fichier si aucun noeud n'est concerné
if verbose :
ligne = "rep_calc = %s" % rep_calc
ligne += "\nfic_med_calc = %s" % fic_med_calc
- print ligne
+ print(ligne)
message = ""
erreur = 0
# 3. Mise à jour
# 3.1. Détermination de l'exécutable
#
- if os.environ.has_key("HOMARD_REP_EXE_PRIVATE") :
+ if "HOMARD_REP_EXE_PRIVATE" in os.environ :
HOMARD_REP_EXE = os.environ["HOMARD_REP_EXE_PRIVATE"]
else :
HOMARD_REP_EXE = os.environ["HOMARD_REP_EXE"]
#
- if os.environ.has_key("HOMARD_EXE_PRIVATE") :
+ if "HOMARD_EXE_PRIVATE" in os.environ :
HOMARD_EXE = os.environ["HOMARD_EXE_PRIVATE"]
else :
HOMARD_EXE = os.environ["HOMARD_EXE"]
homard_exe = os.path.join(HOMARD_REP_EXE, HOMARD_EXE)
if verbose :
ligne = "homard_exe = %s" % homard_exe
- print ligne
+ print(ligne)
#
if not os.path.isfile(homard_exe) :
message = "homard_exe = %s" % homard_exe
Python script for HOMARD
Test tutorial_1 associe au tutorial 1
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "tutorial_1"
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Test tutorial_2 associe au tutorial 2
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "tutorial_2"
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Test tutorial_3 associe au tutorial 3
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "tutorial_3"
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Test tutorial_4 associe au tutorial 4
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "tutorial_4"
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results
Python script for HOMARD
Test tutorial_5 associe au tutorial 5
"""
-__revision__ = "V3.1"
+__revision__ = "V4.01"
#========================================================================
TEST_NAME = "tutorial_5"
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception, eee:
+except Exception as eee:
raise Exception('Pb in homard_exec: '+eee.message)
#
# Test of the results