X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=doc%2Ffiles%2Ftutorial_1.py;h=b05232c3677ff86967530ff9813d33e6302e0dc6;hb=refs%2Ftags%2FV9_13_0b1;hp=20d1b33164f89c3a2c96ed10bd7aa593b213abf9;hpb=97e4e858387f05b6260ff7ed68c9b73f99aecb22;p=modules%2Fhomard.git diff --git a/doc/files/tutorial_1.py b/doc/files/tutorial_1.py old mode 100644 new mode 100755 index 20d1b331..b05232c3 --- a/doc/files/tutorial_1.py +++ b/doc/files/tutorial_1.py @@ -1,12 +1,11 @@ -#!/usr/bin/env python -# -*- coding: iso-8859-1 -*- - -# Copyright (C) 2011-2013 CEA/DEN, EDF R&D +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# 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 # License as published by the Free Software Foundation; either -# version 2.1 of the License. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,74 +18,69 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # - """ Exemple de couplage HOMARD-Salome -Copyright EDF-R&D 1996, 2010, 2013 +Copyright EDF 1996, 2010, 2019 """ -__revision__ = "V1.6" +__revision__ = "V3.03" # import os +import sys # # ================================== -# Repertoire a personnaliser -# Ce repertoire contiendra les fichiers de resultats : maill.01.med, maill.02.med, maill.03.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_1" ) -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 +# ================================== +DIRCASE = creation_dircase(1) # ================================== -# Ce repertoire contient les fichiers de donnees : tutorial_1.00.med -pathHomard = os.getenv('HOMARD_ROOT_DIR') -data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads") # import salome 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 ============================= # # Hypotheses # ========== -Hypo_1 = homard.CreateHypothesis('Hypo_1') -Hypo_1.SetAdapRefinUnRef(-1, 1, 0) +l_hypothese = homard.CreateHypothesis('hypo_1') +l_hypothese.SetUnifRefinUnRef(1) # # Cas # === -Case_1 = homard.CreateCase('Case_1', 'MAILL', data_dir+'/tutorial_1.00.med') -Case_1.SetDirName(dircase) -Case_1.SetConfType(1) +le_cas = homard.CreateCase('Case_1', 'MAILL', os.path.join(DATA_TUTORIAL, "tutorial_1.00.med")) +le_cas.SetDirName(DIRCASE) # # Iterations # ========== -# Iteration "Iter_1_0" -Iter_1_0 = Case_1.NextIteration('Iter_1_0') -Iter_1_0.SetMeshName('MESH') -Iter_1_0.SetMeshFile(dircase+'/maill.01.med') -Iter_1_0.AssociateHypo('Hypo_1') -codret = Iter_1_0.Compute(1, 2) +# Iteration "iter_1_1" +iter_1_1 = le_cas.NextIteration('iter_1_1') +iter_1_1.SetMeshName('MESH') +iter_1_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med")) +iter_1_1.AssociateHypo('hypo_1') +erreur = iter_1_1.Compute(1, 2) -# Iteration "Iter_1_1" -Iter_1_1 = Iter_1_0.NextIteration('Iter_1_1') -Iter_1_1.SetMeshName('MESH') -Iter_1_1.SetMeshFile(dircase+'/maill.02.med') -Iter_1_1.AssociateHypo('Hypo_1') -codret = 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.03.med') -Iter_1_2.AssociateHypo('Hypo_1') -codret = Iter_1_2.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(os.path.join(DIRCASE, "maill.02.med")) +iter_1_2.AssociateHypo('hypo_1') +erreur = 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(os.path.join(DIRCASE, "maill.03.med")) +iter_1_3.AssociateHypo('hypo_1') +erreur = iter_1_3.Compute(1, 2) +# +#============================== Fin des commandes ============================== +# if salome.sg.hasDesktop(): - salome.sg.updateObjBrowser(1) + salome.sg.updateObjBrowser()