2 # -*- coding: utf-8 -*-
4 # Copyright (C) 2011-2024 CEA, EDF
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 1996, 2010, 2019
27 __revision__ = "V3.03"
32 # ==================================
33 PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
34 # Repertoire des donnees du tutorial
35 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
36 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
37 sys.path.append(DATA_TUTORIAL)
38 from tutorial_util import creation_dircase
39 # ==================================
40 DIRCASE = creation_dircase(2)
41 # ==================================
47 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
50 #============================= Début des commandes =============================
55 Zone_0 = homard.CreateZoneBox ('Zone_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
58 Zone_1 = homard.CreateZoneSphere ('Zone_1', 0., 0., 0., 1.05)
61 Zone_2 = homard.CreateZoneBox ('Zone_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
65 l_hypothese = homard.CreateHypothesis('hypo_2')
66 l_hypothese.AddZone('Zone_1', 1)
67 l_hypothese.AddZone('Zone_0', 1)
69 # Hypothese "hypo_2_bis"
70 # ======================
71 l_hypothese_bis = homard.CreateHypothesis('hypo_2_bis')
72 l_hypothese_bis.AddZone('Zone_0', -1)
73 l_hypothese_bis.AddZone('Zone_2', 1)
77 le_cas = homard.CreateCase('Case_2', 'MZERO', os.path.join(DATA_TUTORIAL, "tutorial_2.00.med"))
78 le_cas.SetDirName(DIRCASE)
80 # Iteration "iter_2_1"
81 # ====================
82 iter_2_1 = le_cas.NextIteration('iter_2_1')
83 iter_2_1.SetMeshName('M_1')
84 iter_2_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
85 iter_2_1.AssociateHypo('hypo_2')
86 erreur = iter_2_1.Compute(1, 2)
88 # Iteration "iter_2_2"
89 # ====================
90 iter_2_2 = iter_2_1.NextIteration('iter_2_2')
91 iter_2_2.SetMeshName('M_2')
92 iter_2_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
93 iter_2_2.AssociateHypo('hypo_2_bis')
94 erreur = iter_2_2.Compute(1, 2)
96 #============================== Fin des commandes ==============================
98 if salome.sg.hasDesktop():
99 salome.sg.updateObjBrowser()