2 # -*- coding: iso-8859-1 -*-
4 # Copyright (C) 2011-2013 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.
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, 2013
31 # ==================================
32 # Repertoire a personnaliser
33 # Ce repertoire contiendra les fichiers de resultats : maill.01.med, maill.02.med, maill.03.med
34 if os.environ.has_key("LOGNAME") :
35 user = os.environ ["LOGNAME"]
38 dircase = os.path.join( os.sep, "tmp", "HOMARD_"+user)
39 if not os.path.isdir(dircase) :
41 dircase = os.path.join( dircase, "tutorial_1" )
42 if not os.path.isdir(dircase) :
44 # ==================================
45 # Ce repertoire contient les fichiers de donnees : tutorial_1.00.med
46 pathHomard = os.getenv('HOMARD_ROOT_DIR')
47 data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
53 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
54 study_main = salome.myStudyManager.NewStudy("HOMARD")
55 homard.SetCurrentStudy(salome.myStudy)
59 Hypo_1 = homard.CreateHypothesis('Hypo_1')
60 Hypo_1.SetAdapRefinUnRef(-1, 1, 0)
64 Case_1 = homard.CreateCase('Case_1', 'MAILL', data_dir+'/tutorial_1.00.med')
65 Case_1.SetDirName(dircase)
70 # Iteration "Iter_1_0"
71 Iter_1_0 = Case_1.NextIteration('Iter_1_0')
72 Iter_1_0.SetMeshName('MESH')
73 Iter_1_0.SetMeshFile(dircase+'/maill.01.med')
74 Iter_1_0.AssociateHypo('Hypo_1')
75 codret = Iter_1_0.Compute(1, 2)
77 # Iteration "Iter_1_1"
78 Iter_1_1 = Iter_1_0.NextIteration('Iter_1_1')
79 Iter_1_1.SetMeshName('MESH')
80 Iter_1_1.SetMeshFile(dircase+'/maill.02.med')
81 Iter_1_1.AssociateHypo('Hypo_1')
82 codret = Iter_1_1.Compute(1, 2)
84 # Iteration "Iter_1_2"
85 Iter_1_2 = Iter_1_1.NextIteration('Iter_1_2')
86 Iter_1_2.SetMeshName('MESH')
87 Iter_1_2.SetMeshFile(dircase+'/maill.03.med')
88 Iter_1_2.AssociateHypo('Hypo_1')
89 codret = Iter_1_2.Compute(1, 2)
91 if salome.sg.hasDesktop():
92 salome.sg.updateObjBrowser(1)