2 # -*- coding: iso-8859-1 -*-
4 # Copyright (C) 2011-2014 CEA/DEN, EDF R&D
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 Exemple de couplage HOMARD-Salome
25 Copyright EDF-R&D 1996, 2010, 2014
32 # ==================================
33 # Repertoire a personnaliser
34 # Ce repertoire contiendra les fichiers de resultats : maill.01.med, maill.02.med, maill.03.med
35 if os.environ.has_key("LOGNAME") :
36 user = os.environ ["LOGNAME"]
39 dircase = os.path.join( os.sep, "tmp", "HOMARD_"+user)
40 if not os.path.isdir(dircase) :
42 dircase = os.path.join( dircase, "tutorial_1" )
43 if not os.path.isdir(dircase) :
45 # ==================================
46 # Ce repertoire contient les fichiers de donnees : tutorial_1.00.med
47 pathHomard = os.getenv('HOMARD_ROOT_DIR')
48 data_dir = os.path.join(pathHomard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
49 sys.path.append(data_dir)
50 from tutorial_util import gzip_gunzip
51 gzip_gunzip(data_dir, 1, -1)
52 # ==================================
58 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
59 study_main = salome.myStudyManager.NewStudy("HOMARD")
60 homard.SetCurrentStudy(salome.myStudy)
64 Hypo_1 = homard.CreateHypothesis('Hypo_1')
65 Hypo_1.SetUnifRefinUnRef(1)
69 Case_1 = homard.CreateCase('Case_1', 'MAILL', data_dir+'/tutorial_1.00.med')
70 Case_1.SetDirName(dircase)
75 # Iteration "Iter_1_1"
76 Iter_1_1 = Case_1.NextIteration('Iter_1_1')
77 Iter_1_1.SetMeshName('MESH')
78 Iter_1_1.SetMeshFile(dircase+'/maill.01.med')
79 Iter_1_1.AssociateHypo('Hypo_1')
80 codret = Iter_1_1.Compute(1, 2)
82 # Iteration "Iter_1_2"
83 Iter_1_2 = Iter_1_1.NextIteration('Iter_1_2')
84 Iter_1_2.SetMeshName('MESH')
85 Iter_1_2.SetMeshFile(dircase+'/maill.02.med')
86 Iter_1_2.AssociateHypo('Hypo_1')
87 codret = Iter_1_2.Compute(1, 2)
89 # Iteration "Iter_1_3"
90 Iter_1_3 = Iter_1_2.NextIteration('Iter_1_3')
91 Iter_1_3.SetMeshName('MESH')
92 Iter_1_3.SetMeshFile(dircase+'/maill.03.med')
93 Iter_1_3.AssociateHypo('Hypo_1')
94 codret = Iter_1_3.Compute(1, 2)
96 # ==================================
97 gzip_gunzip(data_dir, 1, 1)
98 # ==================================
100 if salome.sg.hasDesktop():
101 salome.sg.updateObjBrowser(1)