2 # -*- coding: iso-8859-1 -*-
4 # Copyright (C) 2011-2012 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
29 # ==================================
30 # Repertoire a personnaliser
31 # Ce repertoire contient les fichiers de donnees : tutorial_5.00.med, tutorial_5.fr.med
32 # Ce repertoire contiendra les fichiers de resultats : maill.01.med, maill.02.med
34 # ==================================
36 # Ce repertoire contient les fichiers de donnees : tutorial_5.00.med, tutorial_5.fr.med
37 pathHomard = os.getenv('HOMARD_ROOT_DIR')
38 data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/_downloads")
44 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
45 study_main = salome.myStudyManager.NewStudy("HOMARD")
46 homard.SetCurrentStudy(salome.myStudy)
48 # Creation of the boundaries
49 # ==========================
50 # Creation of the discrete boundary Boun_1
51 Boun_1 = homard.CreateBoundaryDi('Boun_1', 'MAIL_EXT', data_dir+'/tutorial_5.fr.med')
53 # Creation of the zones
54 # =====================
55 # Creation of the disk with hole enveloppe
56 enveloppe = homard.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
57 # Creation of the rectangle quart_sup
58 quart_sup = homard.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
62 # Creation of the hypothesis Hypo_1
63 Hypo_1 = homard.CreateHypothesis('Hypo_1')
64 Hypo_1.SetAdapRefinUnRef(0, 1, 0)
65 Hypo_1.AddZone('enveloppe', 1)
66 # Creation of the hypothesis Hypo_2
67 Hypo_2 = homard.CreateHypothesis('Hypo_2')
68 Hypo_2.SetAdapRefinUnRef(0, 1, 0)
69 Hypo_2.AddZone('quart_sup', 1)
73 Case_1 = homard.CreateCase('Case_1', 'COEUR_2D', data_dir+'/tutorial_5.00.med')
74 Case_1.SetDirName(dircase)
76 Case_1.AddBoundaryGroup('Boun_1', '')
80 Iter_1 = Case_1.NextIteration('Iter_1')
81 Iter_1.SetMeshName('COEUR_2D_01')
82 Iter_1.SetMeshFile(dircase+'/maill.01.med')
83 Iter_1.AssociateHypo('Hypo_1')
84 codret = Iter_1.Compute(1)
88 Iter_2 = Iter_1.NextIteration('Iter_2')
89 Iter_2.SetMeshName('COEUR_2D_02')
90 Iter_2.SetMeshFile(dircase+'/maill.02.med')
91 Iter_2.AssociateHypo('Hypo_2')
92 codret = Iter_2.Compute(1)
95 if salome.sg.hasDesktop():
96 salome.sg.updateObjBrowser(1)