X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Ffiles%2Ftutorial_3.py;h=5337b32c44999bde19892f6a6f85820130829d0f;hb=6689e7dd2f2883516d5f57833bc94dfeb1ccaa44;hp=ad3afb333025e48db491efb394cdda94220883fb;hpb=c9b1dcc3d20a411f3094c58ec08fe1baf35de7e9;p=modules%2Fhomard.git diff --git a/doc/files/tutorial_3.py b/doc/files/tutorial_3.py index ad3afb33..5337b32c 100755 --- a/doc/files/tutorial_3.py +++ b/doc/files/tutorial_3.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python -# -*- coding: iso-8859-1 -*- +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- -# Copyright (C) 2011-2014 CEA/DEN, EDF R&D +# Copyright (C) 2011-2024 CEA, EDF # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,33 +22,22 @@ """ Exemple de couplage HOMARD-Salome -Copyright EDF-R&D 1996, 2010, 2014 +Copyright EDF 1996, 2010, 2019 """ -__revision__ = "V1.8" +__revision__ = "V3.03" # import os import sys # # ================================== -# Repertoire a personnaliser -# Ce repertoire contiendra les fichiers de resultats : maill.01.med, maill.02.med -if os.environ.has_key("LOGNAME") : - user = os.environ ["LOGNAME"] -else : - user = "anonymous" -dircase = os.path.join( os.sep, "tmp", "HOMARD_"+user) -if not os.path.isdir(dircase) : - os.mkdir (dircase) -dircase = os.path.join( dircase, "tutorial_3" ) -if not os.path.isdir(dircase) : - os.mkdir (dircase) +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 creation_dircase # ================================== -# Ce repertoire contient les fichiers de donnees : tutorial_3.00.med, tutorial_3.01.med -pathHomard = os.getenv('HOMARD_ROOT_DIR') -data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads") -sys.path.append(data_dir) -from tutorial_util import gzip_gunzip -gzip_gunzip(data_dir, 3, -1) +DIRCASE = creation_dircase(3) # ================================== # import salome @@ -56,85 +45,84 @@ salome.salome_init() import HOMARD # homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD") -study_main = salome.myStudyManager.NewStudy("HOMARD") -homard.SetCurrentStudy(salome.myStudy) +homard.UpdateStudy() # -# Hypothese "Hypo_0vers1" +#============================= Début des commandes ============================= +# +# Hypothese "hypo_0vers1" # ======================= -Hypo_0vers1 = homard.CreateHypothesis('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_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') +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.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') +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) +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 # === -Case_3 = homard.CreateCase('Case_3', 'G_0', data_dir+'/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" +# 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_dir+'/tutorial_3.00.med') -Iter_3_1.SetTimeStepRank( 1, 1) -Iter_3_1.AssociateHypo('Hypo_0vers1') -codret = Iter_3_1.Compute(1, 2) -# -# Iteration "Iter_3_2" +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, 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_dir+'/tutorial_3.01.med') -Iter_3_2.SetTimeStepRank(1, 1) -Iter_3_2.AssociateHypo('Hypo_1vers2') -codret = Iter_3_2.Compute(1, 2) -# -# Iteration "Iter_3_2_bis" +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, 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_dir+'/tutorial_3.01.med') -Iter_3_2_bis.SetTimeStepRank(1, 1) -Iter_3_2_bis.AssociateHypo('Hypo_1vers2_bis') -codret = Iter_3_2_bis.Compute(1, 2) - -# ================================== -gzip_gunzip(data_dir, 3, 1) -# ================================== - +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, 2) +# +#============================== Fin des commandes ============================== +# if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) + salome.sg.updateObjBrowser()