]> SALOME platform Git repositories - modules/homard.git/blob - doc/files/tutorial_1.py
Salome HOME
automatisation FronTrack - fichiers à télécharger
[modules/homard.git] / doc / files / tutorial_1.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2016  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 """
21 Exemple de couplage HOMARD-Salome
22 Copyright EDF 1996, 2010, 2018
23 """
24 __revision__ = "V3.1"
25 #
26 import os
27 import sys
28 #
29 # ==================================
30 PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
31 # Repertoire des donnees du tutorial
32 DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
33 DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
34 sys.path.append(DATA_TUTORIAL)
35 from tutorial_util import gzip_gunzip
36 from tutorial_util import creation_dircase
37 # ==================================
38 DIRCASE = creation_dircase(1)
39 gzip_gunzip(DATA_TUTORIAL, 1, -1)
40 # ==================================
41 #
42 import salome
43 salome.salome_init()
44 import HOMARD
45 #
46 homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
47 homard.SetCurrentStudy(salome.myStudy)
48 #
49 #============================= Début des commandes =============================
50 #
51 # Hypotheses
52 # ==========
53 l_hypothese = homard.CreateHypothesis('hypo_1')
54 l_hypothese.SetUnifRefinUnRef(1)
55 #
56 # Cas
57 # ===
58 le_cas = homard.CreateCase('Case_1', 'MAILL', os.path.join(DATA_TUTORIAL, "tutorial_1.00.med"))
59 le_cas.SetDirName(DIRCASE)
60 #
61 # Iterations
62 # ==========
63 # Iteration "iter_1_1"
64 iter_1_1 = le_cas.NextIteration('iter_1_1')
65 iter_1_1.SetMeshName('MESH')
66 iter_1_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
67 iter_1_1.AssociateHypo('hypo_1')
68 erreur = iter_1_1.Compute(1, 2)
69
70 # Iteration "iter_1_2"
71 iter_1_2 = iter_1_1.NextIteration('iter_1_2')
72 iter_1_2.SetMeshName('MESH')
73 iter_1_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
74 iter_1_2.AssociateHypo('hypo_1')
75 erreur = iter_1_2.Compute(1, 2)
76
77 # Iteration "iter_1_3"
78 iter_1_3 = iter_1_2.NextIteration('iter_1_3')
79 iter_1_3.SetMeshName('MESH')
80 iter_1_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
81 iter_1_3.AssociateHypo('hypo_1')
82 erreur = iter_1_3.Compute(1, 2)
83 #
84 #============================== Fin des commandes ==============================
85 #
86 # ==================================
87 gzip_gunzip(DATA_TUTORIAL, 1, 1)
88 # ==================================
89 #
90 if salome.sg.hasDesktop():
91   salome.sg.updateObjBrowser(True)