2 # -*- coding: utf-8 -*-
3 # Copyright (C) 2011-2019 CEA/DEN, EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 Exemple de couplage HOMARD-Salome
23 Copyright EDF 1996, 2010, 2018
30 # ==================================
31 PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
32 # Repertoire des donnees du tutorial
33 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
34 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
35 sys.path.append(DATA_TUTORIAL)
36 from tutorial_util import gzip_gunzip
37 from tutorial_util import creation_dircase
38 # ==================================
39 DIRCASE = creation_dircase(1)
40 gzip_gunzip(DATA_TUTORIAL, 1, -1)
41 # ==================================
47 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
50 #============================= Début des commandes =============================
54 l_hypothese = homard.CreateHypothesis('hypo_1')
55 l_hypothese.SetUnifRefinUnRef(1)
59 le_cas = homard.CreateCase('Case_1', 'MAILL', os.path.join(DATA_TUTORIAL, "tutorial_1.00.med"))
60 le_cas.SetDirName(DIRCASE)
64 # Iteration "iter_1_1"
65 iter_1_1 = le_cas.NextIteration('iter_1_1')
66 iter_1_1.SetMeshName('MESH')
67 iter_1_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
68 iter_1_1.AssociateHypo('hypo_1')
69 erreur = iter_1_1.Compute(1, 2)
71 # Iteration "iter_1_2"
72 iter_1_2 = iter_1_1.NextIteration('iter_1_2')
73 iter_1_2.SetMeshName('MESH')
74 iter_1_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
75 iter_1_2.AssociateHypo('hypo_1')
76 erreur = iter_1_2.Compute(1, 2)
78 # Iteration "iter_1_3"
79 iter_1_3 = iter_1_2.NextIteration('iter_1_3')
80 iter_1_3.SetMeshName('MESH')
81 iter_1_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
82 iter_1_3.AssociateHypo('hypo_1')
83 erreur = iter_1_3.Compute(1, 2)
85 #============================== Fin des commandes ==============================
87 # ==================================
88 gzip_gunzip(DATA_TUTORIAL, 1, 1)
89 # ==================================
91 if salome.sg.hasDesktop():
92 salome.sg.updateObjBrowser()