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, 2011, 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 # ==================================
42 # Ce repertoire contient les fichiers de donnees : tutorial_4.00.med, tutorial_4.fr.med
43 pathHomard = os.getenv('HOMARD_ROOT_DIR')
44 data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
50 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
51 study_main = salome.myStudyManager.NewStudy("HOMARD")
52 homard.SetCurrentStudy(salome.myStudy)
54 # Creation of the boundaries
55 # ==========================
56 Boundary_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', data_dir+'/tutorial_4.fr.med')
58 Boundary_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
60 Boundary_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
62 Boundary_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
64 Boundary_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
68 # Creation of the hypothesis Hypo_1
69 Hypo_1 = homard.CreateHypothesis('Hypo_1')
70 Hypo_1.SetAdapRefinUnRef(-1, 1, 0)
71 Hypo_1.AddGroup('T1_INT_I')
72 Hypo_1.AddGroup('T1_INT_O')
73 Hypo_1.AddGroup('T2_INT')
74 # Creation of the hypothesis Hypo_2
75 Hypo_2 = homard.CreateHypothesis('Hypo_2')
76 Hypo_2.SetAdapRefinUnRef(-1, 1, 0)
77 Hypo_2.AddGroup('T1_EXT_I')
78 Hypo_2.AddGroup('T1_EXT_O')
79 Hypo_2.AddGroup('T2_EXT')
83 Case = homard.CreateCase('Case', 'PIQUAGE', data_dir+'/tutorial_4.00.med')
84 Case.SetDirName(dircase)
85 Case.AddBoundaryGroup( 'intersection', '' )
86 Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
87 Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
88 Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
89 Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
90 Case.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
91 Case.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
93 # Creation of the iterations
94 # ==========================
95 # Creation of the iteration Iter_1 : raffinement selon les faces internes
96 Iter_1 = Case.NextIteration('Iter_1')
97 Iter_1.SetMeshName('PIQUAGE_1')
98 Iter_1.SetMeshFile(dircase+'/maill.01.med')
99 Iter_1.AssociateHypo('Hypo_1')
100 codret = Iter_1.Compute(1, 2)
101 # Creation of the iteration Iter_2 : raffinement selon les faces externes
102 Iter_2 = Iter_1.NextIteration('Iter_2')
103 Iter_2.SetMeshName('PIQUAGE_2')
104 Iter_2.SetMeshFile(dircase+'/maill.02.med')
105 Iter_2.AssociateHypo('Hypo_2')
106 codret = Iter_2.Compute(1, 2)
107 # Creation of the iteration Iter_3 : second raffinement selon les faces externes
108 Iter_3 = Iter_2.NextIteration('Iter_3')
109 Iter_3.SetMeshName('PIQUAGE_3')
110 Iter_3.SetMeshFile(dircase+'/maill.03.med')
111 Iter_3.AssociateHypo('Hypo_2')
112 codret = Iter_3.Compute(1, 2)
114 if salome.sg.hasDesktop():
115 salome.sg.updateObjBrowser(1)