X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Ffiles%2Ftutorial_3.py;h=5337b32c44999bde19892f6a6f85820130829d0f;hb=refs%2Fheads%2Fmaster;hp=cec15ff92b949c32d25d2fe7df71ef96c675e003;hpb=67bca232c2178b2ed8e921dcb9c54640f5a0a286;p=modules%2Fhomard.git diff --git a/doc/files/tutorial_3.py b/doc/files/tutorial_3.py index cec15ff9..5337b32c 100755 --- a/doc/files/tutorial_3.py +++ b/doc/files/tutorial_3.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright (C) 2011-2015 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,24 +22,22 @@ """ Exemple de couplage HOMARD-Salome -Copyright EDF-R&D 1996, 2010, 2014 +Copyright EDF 1996, 2010, 2019 """ -__revision__ = "V2.1" +__revision__ = "V3.03" # 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) sys.path.append(DATA_TUTORIAL) -from tutorial_util import gzip_gunzip from tutorial_util import creation_dircase # ================================== DIRCASE = creation_dircase(3) -gzip_gunzip(DATA_TUTORIAL, 3, -1) # ================================== # import salome @@ -47,8 +45,9 @@ salome.salome_init() import HOMARD # homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD") -study_main = salome.myStudyManager.NewStudy("HOMARD") -homard.SetCurrentStudy(salome.myStudy) +homard.UpdateStudy() +# +#============================= Début des commandes ============================= # # Hypothese "hypo_0vers1" # ======================= @@ -90,42 +89,40 @@ 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) - -# ================================== -gzip_gunzip(DATA_TUTORIAL, 3, 1) -# ================================== - +erreur = iter_3_2_bis.Compute(1, 2) +# +#============================== Fin des commandes ============================== +# if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) + salome.sg.updateObjBrowser()