-#!/usr/bin/env python
# -*- coding: utf-8 -*-
-
# Copyright (C) 2011-2016 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-
"""
Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
"""
-__revision__ = "V2.1"
+__revision__ = "V3.1"
#
import os
import sys
#
# ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
# Repertoire des donnees du tutorial
DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
import HOMARD
#
homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
-study_main = salome.myStudyManager.NewStudy("HOMARD")
homard.SetCurrentStudy(salome.myStudy)
#
+#============================= Début des commandes =============================
+#
# Hypotheses
# ==========
-hypo_1 = homard.CreateHypothesis('hypo_1')
-hypo_1.SetUnifRefinUnRef(1)
+l_hypothese = homard.CreateHypothesis('hypo_1')
+l_hypothese.SetUnifRefinUnRef(1)
#
# Cas
# ===
-case_1 = homard.CreateCase('Case_1', 'MAILL', DATA_TUTORIAL+'/tutorial_1.00.med')
-case_1.SetDirName(DIRCASE)
-case_1.SetConfType(1)
+le_cas = homard.CreateCase('Case_1', 'MAILL', os.path.join(DATA_TUTORIAL, "tutorial_1.00.med"))
+le_cas.SetDirName(DIRCASE)
#
# Iterations
# ==========
# Iteration "iter_1_1"
-iter_1_1 = case_1.NextIteration('iter_1_1')
+iter_1_1 = le_cas.NextIteration('iter_1_1')
iter_1_1.SetMeshName('MESH')
-iter_1_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_1_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
iter_1_1.AssociateHypo('hypo_1')
-error = iter_1_1.Compute(1, 2)
+erreur = iter_1_1.Compute(1, 2)
# Iteration "iter_1_2"
iter_1_2 = iter_1_1.NextIteration('iter_1_2')
iter_1_2.SetMeshName('MESH')
-iter_1_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_1_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
iter_1_2.AssociateHypo('hypo_1')
-error = iter_1_2.Compute(1, 2)
+erreur = iter_1_2.Compute(1, 2)
# Iteration "iter_1_3"
iter_1_3 = iter_1_2.NextIteration('iter_1_3')
iter_1_3.SetMeshName('MESH')
-iter_1_3.SetMeshFile(DIRCASE+'/maill.03.med')
+iter_1_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
iter_1_3.AssociateHypo('hypo_1')
-error = iter_1_3.Compute(1, 2)
+erreur = iter_1_3.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 1, 1)
"""
Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
"""
-__revision__ = "V2.10"
+__revision__ = "V3.01"
#
import os
import sys
#
# ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
# Repertoire des donnees du tutorial
DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
import HOMARD
#
homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
-study_main = salome.myStudyManager.NewStudy("HOMARD")
homard.SetCurrentStudy(salome.myStudy)
#
+#============================= Début des commandes =============================
+#
# Creation des zones
# ==================
# Box "Zone_0"
#
# Hypothese "hypo_2"
# ==================
-hypo_2 = homard.CreateHypothesis('hypo_2')
-hypo_2.AddZone('Zone_1', 1)
-hypo_2.AddZone('Zone_0', 1)
+l_hypothese = homard.CreateHypothesis('hypo_2')
+l_hypothese.AddZone('Zone_1', 1)
+l_hypothese.AddZone('Zone_0', 1)
#
# Hypothese "hypo_2_bis"
# ======================
-hypo_2_bis = homard.CreateHypothesis('hypo_2_bis')
-hypo_2_bis.AddZone('Zone_0', -1)
-hypo_2_bis.AddZone('Zone_2', 1)
+l_hypothese_bis = homard.CreateHypothesis('hypo_2_bis')
+l_hypothese_bis.AddZone('Zone_0', -1)
+l_hypothese_bis.AddZone('Zone_2', 1)
#
# Cas
# ===
-case_2 = homard.CreateCase('Case_2', 'MZERO', DATA_TUTORIAL+'/tutorial_2.00.med')
-case_2.SetDirName(DIRCASE)
+le_cas = homard.CreateCase('Case_2', 'MZERO', os.path.join(DATA_TUTORIAL, "tutorial_2.00.med"))
+le_cas.SetDirName(DIRCASE)
#
# Iteration "iter_2_1"
# ====================
-iter_2_1 = case_2.NextIteration('iter_2_1')
+iter_2_1 = le_cas.NextIteration('iter_2_1')
iter_2_1.SetMeshName('M_1')
-iter_2_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_2_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
iter_2_1.AssociateHypo('hypo_2')
-error = iter_2_1.Compute(1, 2)
+erreur = iter_2_1.Compute(1, 2)
#
# Iteration "iter_2_2"
# ====================
iter_2_2 = iter_2_1.NextIteration('iter_2_2')
iter_2_2.SetMeshName('M_2')
-iter_2_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_2_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
iter_2_2.AssociateHypo('hypo_2_bis')
-error = iter_2_2.Compute(1, 2)
-
+erreur = iter_2_2.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
+#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 2, 1)
# ==================================
"""
Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
"""
-__revision__ = "V2.1"
+__revision__ = "V3.1"
#
import os
import sys
#
# ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
# Repertoire des donnees du tutorial
DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
import HOMARD
#
homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
-study_main = salome.myStudyManager.NewStudy("HOMARD")
homard.SetCurrentStudy(salome.myStudy)
#
+#============================= Début des commandes =============================
+#
# Hypothese "hypo_0vers1"
# =======================
hypo_0vers1 = homard.CreateHypothesis('hypo_0vers1')
#
# Cas
# ===
-case_3 = homard.CreateCase('Case_3', 'G_0', DATA_TUTORIAL+'/tutorial_3.00.med')
-case_3.SetDirName(DIRCASE)
+le_cas = homard.CreateCase('Case_3', 'G_0', os.path.join(DATA_TUTORIAL, "tutorial_3.00.med"))
+le_cas.SetDirName(DIRCASE)
#
# Iteration "iter_3_1"
# ====================
-iter_3_1 = case_3.NextIteration('iter_3_1')
+iter_3_1 = le_cas.NextIteration('iter_3_1')
iter_3_1.SetMeshName('H_1')
-iter_3_1.SetMeshFile(DIRCASE+'/maill.01.med')
-iter_3_1.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.00.med')
+iter_3_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+iter_3_1.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.00.med"))
iter_3_1.SetTimeStepRank( 1, 1)
iter_3_1.AssociateHypo('hypo_0vers1')
-error = iter_3_1.Compute(1, 2)
+erreur = iter_3_1.Compute(1, 2)
#
# Iteration "iter_3_2"
# ====================
iter_3_2 = iter_3_1.NextIteration('iter_3_2')
iter_3_2.SetMeshName('H_2')
-iter_3_2.SetMeshFile(DIRCASE+'/maill.02.med')
-iter_3_2.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.01.med')
+iter_3_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+iter_3_2.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.01.med"))
iter_3_2.SetTimeStepRank(1, 1)
iter_3_2.AssociateHypo('hypo_1vers2')
-error = iter_3_2.Compute(1, 2)
+erreur = iter_3_2.Compute(1, 2)
#
# Iteration "iter_3_2_bis"
# ========================
iter_3_2_bis = iter_3_1.NextIteration('iter_3_2_bis')
iter_3_2_bis.SetMeshName('H_2_bis')
-iter_3_2_bis.SetMeshFile(DIRCASE+'/maill.02.bis.med')
-iter_3_2_bis.SetFieldFile(DATA_TUTORIAL+'/tutorial_3.01.med')
+iter_3_2_bis.SetMeshFile(os.path.join(DIRCASE, "maill.02.bis.med"))
+iter_3_2_bis.SetFieldFile(os.path.join(DATA_TUTORIAL, "tutorial_3.01.med"))
iter_3_2_bis.SetTimeStepRank(1, 1)
iter_3_2_bis.AssociateHypo('hypo_1vers2_bis')
-error = iter_3_2_bis.Compute(1, 2)
-
+erreur = iter_3_2_bis.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
+#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 3, 1)
# ==================================
"""
Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2011, 2014
+Copyright EDF 1996, 2011, 2018
"""
-__revision__ = "V3.1"
+__revision__ = "V4.2"
#
import os
import sys
#
# ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
# Repertoire des donnees du tutorial
DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
import HOMARD
#
homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
-study_main = salome.myStudyManager.NewStudy("HOMARD")
homard.SetCurrentStudy(salome.myStudy)
#
-# Frontieres
-# ==========
-boun_4_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.fr.med')
-#
-boun_4_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
-#
-boun_4_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+#============================= Début des commandes =============================
#
-boun_4_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+# Frontières
+# ==========
+boun_4 = homard.CreateBoundaryCAO("PIQUAGE", os.path.join(DATA_TUTORIAL, "tutorial_4.xao"))
#
-boun_4_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+# Cas
+# ===
+le_cas = homard.CreateCase('Case_4', "PIQUAGE", os.path.join(DATA_TUTORIAL, "tutorial_4.00.med"))
+le_cas.SetDirName(DIRCASE)
+le_cas.AddBoundary( "PIQUAGE" )
#
# Hypotheses
# ==========
# Creation of the hypothesis hypo_4
-hypo_4 = homard.CreateHypothesis('hypo_4')
-hypo_4.SetUnifRefinUnRef(1)
-hypo_4.AddGroup('T1_INT_I')
-hypo_4.AddGroup('T1_INT_O')
-hypo_4.AddGroup('T2_INT')
+l_hypothese = homard.CreateHypothesis('hypo_4')
+l_hypothese.SetUnifRefinUnRef(1)
+l_hypothese.AddGroup('T1_INT_I')
+l_hypothese.AddGroup('T1_INT_O')
+l_hypothese.AddGroup('T2_INT')
# Creation of the hypothesis hypo_4_bis
-hypo_4_bis = homard.CreateHypothesis('hypo_4_bis')
-hypo_4_bis.SetUnifRefinUnRef(1)
-hypo_4_bis.AddGroup('T1_EXT_I')
-hypo_4_bis.AddGroup('T1_EXT_O')
-hypo_4_bis.AddGroup('T2_EXT')
-#
-# Cas
-# ===
-case_4 = homard.CreateCase('Case_4', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.00.med')
-case_4.SetDirName(DIRCASE)
-case_4.AddBoundaryGroup( 'intersection', '' )
-case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
-case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
-case_4.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
-case_4.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
-case_4.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
-case_4.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+l_hypothese_bis = homard.CreateHypothesis('hypo_4_bis')
+l_hypothese_bis.SetUnifRefinUnRef(1)
+l_hypothese_bis.AddGroup('T1_EXT_I')
+l_hypothese_bis.AddGroup('T1_EXT_O')
+l_hypothese_bis.AddGroup('T2_EXT')
#
# Iterations
# ==========
# Iteration iter_4_1 : raffinement selon les faces internes
-iter_4_1 = case_4.NextIteration('iter_4_1')
+iter_4_1 = le_cas.NextIteration('iter_4_1')
iter_4_1.SetMeshName('PIQUAGE_1')
-iter_4_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_4_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
iter_4_1.AssociateHypo('hypo_4')
-error = iter_4_1.Compute(1, 2)
+erreur = iter_4_1.Compute(1, 2)
# Iteration iter_4_2 : raffinement selon les faces externes
iter_4_2 = iter_4_1.NextIteration('iter_4_2')
iter_4_2.SetMeshName('PIQUAGE_2')
-iter_4_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_4_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
iter_4_2.AssociateHypo('hypo_4_bis')
-error = iter_4_2.Compute(1, 2)
+erreur = iter_4_2.Compute(1, 2)
# Iteration iter_4_3 : second raffinement selon les faces externes
iter_4_3 = iter_4_2.NextIteration('iter_4_3')
iter_4_3.SetMeshName('PIQUAGE_3')
-iter_4_3.SetMeshFile(DIRCASE+'/maill.03.med')
+iter_4_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
iter_4_3.AssociateHypo('hypo_4_bis')
-error = iter_4_3.Compute(1, 2)
-
+erreur = iter_4_3.Compute(1, 2)
+#
+#============================== Fin des commandes ==============================
+#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 4, 1)
# ==================================
<sequence name="seqdblevec" content="dblevec"/>
<sequence name="seqint" content="int"/>
<sequence name="seqintvec" content="intvec"/>
+ <sequence name="seqpyobj" content="pyobj"/>
<sequence name="stringvec" content="string"/>
<sequence name="seqstringvec" content="stringvec"/>
<container name="DefaultContainer">
+ <property name="container_kind" value="Salome"/>
+ <property name="attached_on_cloning" value="0"/>
<property name="container_name" value="FactoryServer"/>
<property name="name" value="localhost"/>
</container>
StudyManager = clt.Resolve("/myStudyManager")
CurrentStudy = StudyManager.GetStudyByID(1)
]]></code></script>
+ <load container="DefaultContainer"/>
<outport name="CurrentStudy" type="Study"/>
</inline>
<service name="SetCurrentStudy">
<method>SetCurrentStudy</method>
<inport name="theStudy" type="Study"/>
</service>
- <service name="CreateBoundarycyl_1_int">
- <node>Etude_Initialisation.SetCurrentStudy</node>
- <method>CreateBoundaryCylinder</method>
- <inport name="BoundaryName" type="string"/>
- <inport name="Xcentre" type="double"/>
- <inport name="Ycentre" type="double"/>
- <inport name="Zcentre" type="double"/>
- <inport name="Xaxis" type="double"/>
- <inport name="Yaxis" type="double"/>
- <inport name="Zaxis" type="double"/>
- <inport name="Radius" type="double"/>
- <outport name="return" type="HOMARD_Boundary"/>
- </service>
- <service name="CreateBoundarycyl_1_ext">
- <node>Etude_Initialisation.SetCurrentStudy</node>
- <method>CreateBoundaryCylinder</method>
- <inport name="BoundaryName" type="string"/>
- <inport name="Xcentre" type="double"/>
- <inport name="Ycentre" type="double"/>
- <inport name="Zcentre" type="double"/>
- <inport name="Xaxis" type="double"/>
- <inport name="Yaxis" type="double"/>
- <inport name="Zaxis" type="double"/>
- <inport name="Radius" type="double"/>
- <outport name="return" type="HOMARD_Boundary"/>
- </service>
- <service name="CreateBoundarycyl_2_int">
- <node>Etude_Initialisation.SetCurrentStudy</node>
- <method>CreateBoundaryCylinder</method>
- <inport name="BoundaryName" type="string"/>
- <inport name="Xcentre" type="double"/>
- <inport name="Ycentre" type="double"/>
- <inport name="Zcentre" type="double"/>
- <inport name="Xaxis" type="double"/>
- <inport name="Yaxis" type="double"/>
- <inport name="Zaxis" type="double"/>
- <inport name="Radius" type="double"/>
- <outport name="return" type="HOMARD_Boundary"/>
- </service>
<service name="CreateHypothesis_1">
<node>Etude_Initialisation.SetCurrentStudy</node>
<method>CreateHypothesis</method>
</service>
<inline name="Hypo_Options_1">
<script><code><![CDATA[# Raffinement uniforme
-Hypo.SetAdapRefinUnRef(-1, 1, 0)
+Hypo.SetUnifRefinUnRef(1)
# Filtrage par des groupes
Hypo.AddGroup('T1_INT_I')
Hypo.AddGroup('T1_INT_O')
Hypo.AddGroup('T2_INT')
]]></code></script>
+ <load container="DefaultContainer"/>
<inport name="Hypo" type="HOMARD_Hypothesis"/>
</inline>
<inline name="Case_Options">
# =========
# Repertoire d'execution
Case.SetDirName(DirName)
-# Options de conformite
-Case.SetConfType(1)
# Liens avec les frontieres
-Case.AddBoundaryGroup( 'intersection', '' )
-Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
-Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
-Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
-Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
-Case.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
-Case.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+Case.AddBoundary(CAO.GetName())
# Resultats
# =========
# Iteration 0 associee
Iter0 = Case.GetIter0()
]]></code></script>
+ <load container="DefaultContainer"/>
<inport name="Case" type="HOMARD_Cas"/>
<inport name="DirName" type="string"/>
+ <inport name="CAO" type="HOMARD_Boundary"/>
<outport name="Iter0" type="HOMARD_Iteration"/>
</inline>
- <service name="CreateBoundarycyl_2_ext">
+ <service name="CreateBoundaryCAO">
<node>Etude_Initialisation.SetCurrentStudy</node>
- <method>CreateBoundaryCylinder</method>
+ <method>CreateBoundaryCAO</method>
<inport name="BoundaryName" type="string"/>
- <inport name="Xcentre" type="double"/>
- <inport name="Ycentre" type="double"/>
- <inport name="Zcentre" type="double"/>
- <inport name="Xaxis" type="double"/>
- <inport name="Yaxis" type="double"/>
- <inport name="Zaxis" type="double"/>
- <inport name="Radius" type="double"/>
- <outport name="return" type="HOMARD_Boundary"/>
- </service>
- <service name="CreateBoundaryintersection">
- <node>Etude_Initialisation.SetCurrentStudy</node>
- <method>CreateBoundaryDi</method>
- <inport name="BoundaryName" type="string"/>
- <inport name="MeshName" type="string"/>
<inport name="FileName" type="string"/>
<outport name="return" type="HOMARD_Boundary"/>
</service>
</service>
<inline name="Hypo_Options_2">
<script><code><![CDATA[# Raffinement uniforme
-Hypo.SetAdapRefinUnRef(-1, 1, 0)
+Hypo.SetUnifRefinUnRef(1)
# Filtrage par des groupes
Hypo.AddGroup('T1_EXT_I')
Hypo.AddGroup('T1_EXT_O')
Hypo.AddGroup('T2_EXT')
]]></code></script>
+ <load container="DefaultContainer"/>
<inport name="Hypo" type="HOMARD_Hypothesis"/>
</inline>
<control> <fromnode>StudyCreation</fromnode> <tonode>SetCurrentStudy</tonode> </control>
- <control> <fromnode>SetCurrentStudy</fromnode> <tonode>CreateBoundarycyl_1_int</tonode> </control>
- <control> <fromnode>CreateBoundarycyl_1_int</fromnode> <tonode>CreateBoundarycyl_1_ext</tonode> </control>
- <control> <fromnode>CreateBoundarycyl_1_ext</fromnode> <tonode>CreateBoundarycyl_2_int</tonode> </control>
- <control> <fromnode>CreateBoundarycyl_2_int</fromnode> <tonode>CreateBoundarycyl_2_ext</tonode> </control>
+ <control> <fromnode>SetCurrentStudy</fromnode> <tonode>CreateBoundaryCAO</tonode> </control>
<control> <fromnode>CreateHypothesis_1</fromnode> <tonode>Hypo_Options_1</tonode> </control>
<control> <fromnode>CreateCase</fromnode> <tonode>Case_Options</tonode> </control>
<control> <fromnode>Hypo_Options_1</fromnode> <tonode>CreateHypothesis_2</tonode> </control>
<control> <fromnode>Case_Options</fromnode> <tonode>CreateHypothesis_1</tonode> </control>
- <control> <fromnode>CreateBoundarycyl_2_ext</fromnode> <tonode>CreateBoundaryintersection</tonode> </control>
- <control> <fromnode>CreateBoundaryintersection</fromnode> <tonode>CreateCase</tonode> </control>
+ <control> <fromnode>CreateBoundaryCAO</fromnode> <tonode>CreateCase</tonode> </control>
+ <control> <fromnode>CreateBoundaryCAO</fromnode> <tonode>Case_Options</tonode> </control>
<control> <fromnode>CreateHypothesis_2</fromnode> <tonode>Hypo_Options_2</tonode> </control>
<datalink control="false">
<fromnode>StudyCreation</fromnode> <fromport>CurrentStudy</fromport>
<fromnode>CreateCase</fromnode> <fromport>return</fromport>
<tonode>Case_Options</tonode> <toport>Case</toport>
</datalink>
+ <datalink control="false">
+ <fromnode>CreateBoundaryCAO</fromnode> <fromport>return</fromport>
+ <tonode>Case_Options</tonode> <toport>CAO</toport>
+ </datalink>
<datalink control="false">
<fromnode>CreateHypothesis_2</fromnode> <fromport>return</fromport>
<tonode>Hypo_Options_2</tonode> <toport>Hypo</toport>
MessInfo = ""
]]></code></script>
+ <load container="DefaultContainer"/>
<inport name="NumAdapt" type="int"/>
<inport name="LastIter" type="HOMARD_Iteration"/>
<inport name="Hypo" type="HOMARD_Hypothesis"/>
</datalink>
</forloop>
<inline name="Bilan">
- <script><code><![CDATA[from PyQt4 import QtGui
-import sys
-app = QtGui.QApplication(sys.argv)
-if MessInfo != "" :
- MessageBoxTitle = "Bilan"
- QtGui.QMessageBox.warning(None, MessageBoxTitle, MessInfo)
-else :
- MessageBoxTitle = "Bilan"
- MessInfo = "Le maillage final est dans le fichier : " + MeshFile
- QtGui.QMessageBox.information(None, MessageBoxTitle, MessInfo)
+ <script><code><![CDATA[import sys
+from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
+class App(QWidget):
+ def __init__(self, MessInfo, MeshFile):
+ super(App, self).__init__()
+ self.title = "Bilan"
+ self._MessInfo = MessInfo
+ self._MeshFile = MeshFile
+ self.initUI()
+ def initUI(self):
+ if self._MessInfo != "" :
+ button = QMessageBox.critical(self, self.title, self._MessInfo)
+ else :
+ MessInfo = "Le maillage final est dans le fichier : " + self._MeshFile
+ button = QMessageBox.information(self, self.title, MessInfo)
+ self.show()
+app = QApplication(sys.argv)
+ex = App(MessInfo, MeshFile)
]]></code></script>
+ <load container="DefaultContainer"/>
<inport name="MessInfo" type="string"/>
<inport name="MeshFile" type="string"/>
</inline>
<script><code><![CDATA[import os
pathHomard = os.getenv("HOMARD_ROOT_DIR")
data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
-print "data_dir =", data_dir
-print os.listdir(data_dir)
#
# Maillage de la structure
# . Nom du maillage
# . Fichier du maillage
FileName = os.path.join(data_dir, "tutorial_4.00.med")
#
-# Maillage de la frontiere
-# . Nom du maillage
-BMeshName = "PIQUAGE"
-# . Fichier du maillage
-BFileName = os.path.join(data_dir, "tutorial_4.fr.med")
+# CAO
+# . Fichier XAO
+BFileName = os.path.join(data_dir, "tutorial_4.xao")
#
-# Répertoire de travail
-if os.environ.has_key("LOGNAME") :
+# Repertoire de travail
+if "LOGNAME" in os.environ :
user = os.environ ["LOGNAME"]
else :
user = "anonymous"
if not os.path.isdir(DirName) :
os.mkdir (DirName)
]]></code></script>
+ <load container="DefaultContainer"/>
<outport name="MeshName" type="string"/>
<outport name="FileName" type="string"/>
- <outport name="BMeshName" type="string"/>
<outport name="BFileName" type="string"/>
<outport name="DirName" type="string"/>
</inline>
MessInfo = ""
]]></code></script>
+ <load container="DefaultContainer"/>
<inport name="LastIter" type="HOMARD_Iteration"/>
<inport name="Hypo" type="HOMARD_Hypothesis"/>
<inport name="DirName" type="string"/>
<fromnode>DataInit</fromnode> <fromport>FileName</fromport>
<tonode>Etude_Initialisation.CreateCase</tonode> <toport>FileName</toport>
</datalink>
- <datalink control="false">
- <fromnode>DataInit</fromnode> <fromport>BMeshName</fromport>
- <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>MeshName</toport>
- </datalink>
<datalink control="false">
<fromnode>DataInit</fromnode> <fromport>BFileName</fromport>
- <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>FileName</toport>
+ <tonode>Etude_Initialisation.CreateBoundaryCAO</tonode> <toport>FileName</toport>
</datalink>
<datalink control="false">
<fromnode>DataInit</fromnode> <fromport>DirName</fromport>
- <tonode>HOMARD_1</tonode> <toport>DirName</toport>
+ <tonode>Etude_Initialisation.Case_Options</tonode> <toport>DirName</toport>
</datalink>
<datalink control="false">
<fromnode>DataInit</fromnode> <fromport>DirName</fromport>
- <tonode>Etude_Initialisation.Case_Options</tonode> <toport>DirName</toport>
+ <tonode>ForLoop.HOMARD_2</tonode> <toport>DirName</toport>
</datalink>
<datalink control="false">
<fromnode>DataInit</fromnode> <fromport>DirName</fromport>
- <tonode>ForLoop.HOMARD_2</tonode> <toport>DirName</toport>
+ <tonode>HOMARD_1</tonode> <toport>DirName</toport>
</datalink>
<datalink control="false">
<fromnode>HOMARD_1</fromnode> <fromport>MessInfo</fromport>
<tonode>HOMARD_1</tonode> <toport>Hypo</toport>
</datalink>
<parameter>
- <tonode>ForLoop</tonode><toport>nsteps</toport>
- <value><int>2</int></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>BoundaryName</toport>
- <value><string>cyl_1_ext</string></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xcentre</toport>
- <value><double>0</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Ycentre</toport>
- <value><double>25</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zcentre</toport>
- <value><double>-25</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xaxis</toport>
- <value><double>25</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Yaxis</toport>
- <value><double>50</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zaxis</toport>
- <value><double>75</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Radius</toport>
- <value><double>100</double></value>
+ <tonode>Etude_Initialisation.CreateBoundaryCAO</tonode><toport>BoundaryName</toport>
+ <value><string>CAO</string></value>
</parameter>
<parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>BoundaryName</toport>
- <value><string>cyl_1_int</string></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xcentre</toport>
- <value><double>0</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Ycentre</toport>
- <value><double>25</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zcentre</toport>
- <value><double>-25</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xaxis</toport>
- <value><double>25</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Yaxis</toport>
- <value><double>50</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zaxis</toport>
- <value><double>75</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Radius</toport>
- <value><double>75</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>BoundaryName</toport>
- <value><string>cyl_2_int</string></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xcentre</toport>
- <value><double>17.5</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Ycentre</toport>
- <value><double>-2.5</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zcentre</toport>
- <value><double>-12.5</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xaxis</toport>
- <value><double>-100</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Yaxis</toport>
- <value><double>-75</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zaxis</toport>
- <value><double>-25</double></value>
+ <tonode>Etude_Initialisation.CreateHypothesis_2</tonode><toport>HypoName</toport>
+ <value><string>Hypo_4_bis</string></value>
</parameter>
<parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Radius</toport>
- <value><double>25</double></value>
+ <tonode>ForLoop</tonode><toport>nsteps</toport>
+ <value><int>2</int></value>
</parameter>
<parameter>
<tonode>Etude_Initialisation.CreateCase</tonode><toport>CaseName</toport>
</parameter>
<parameter>
<tonode>Etude_Initialisation.CreateHypothesis_1</tonode><toport>HypoName</toport>
- <value><string>Hypo_1</string></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>BoundaryName</toport>
- <value><string>cyl_2_ext</string></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xcentre</toport>
- <value><double>17.5</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Ycentre</toport>
- <value><double>-2.5</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zcentre</toport>
- <value><double>-12.5</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xaxis</toport>
- <value><double>-100</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Yaxis</toport>
- <value><double>-75</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zaxis</toport>
- <value><double>-25</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Radius</toport>
- <value><double>50</double></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode><toport>BoundaryName</toport>
- <value><string>intersection</string></value>
- </parameter>
- <parameter>
- <tonode>Etude_Initialisation.CreateHypothesis_2</tonode><toport>HypoName</toport>
- <value><string>Hypo_2</string></value>
- </parameter>
- <presentation name="Etude_Initialisation.StudyCreation" x="2.5" y="34" width="158" height="63" expanded="1" expx="2.5" expy="34" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="ForLoop" x="385" y="802.5" width="169" height="237" expanded="1" expx="385" expy="802.5" expWidth="169" expHeight="237" shownState="0"/>
- <presentation name="HOMARD_1" x="6" y="804.5" width="158" height="144" expanded="1" expx="6" expy="804.5" expWidth="158" expHeight="144" shownState="0"/>
- <presentation name="DataInit" x="4" y="32" width="158" height="171" expanded="1" expx="4" expy="32" expWidth="158" expHeight="171" shownState="0"/>
- <presentation name="Bilan" x="720.5" y="770" width="158" height="90" expanded="1" expx="720.5" expy="770" expWidth="158" expHeight="90" shownState="0"/>
+ <value><string>Hypo_4</string></value>
+ </parameter>
+ <presentation name="Etude_Initialisation.StudyCreation" x="4" y="32" width="158" height="63" expanded="1" expx="4" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.SetCurrentStudy" x="163" y="32" width="158" height="63" expanded="1" expx="163" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.Hypo_Options_1" x="163" y="214.605" width="158" height="63" expanded="1" expx="163" expy="214.605" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateBoundaryCAO" x="4" y="96" width="158" height="90" expanded="1" expx="4" expy="96" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="Etude_Initialisation.Case_Options" x="322.605" y="98.2103" width="158" height="117" expanded="1" expx="322.605" expy="98.2103" expWidth="158" expHeight="117" shownState="0"/>
+ <presentation name="Etude_Initialisation.Hypo_Options_2" x="481.105" y="212.395" width="158" height="63" expanded="1" expx="481.105" expy="212.395" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateHypothesis_2" x="321.5" y="242.71" width="158" height="63" expanded="1" expx="321.5" expy="242.71" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Bilan" x="332.5" y="513.71" width="158" height="90" expanded="1" expx="332.5" expy="513.71" expWidth="158" expHeight="90" shownState="0"/>
<presentation name="ForLoop.HOMARD_2" x="7" y="62" width="158" height="171" expanded="1" expx="7" expy="62" expWidth="158" expHeight="171" shownState="0"/>
- <presentation name="Etude_Initialisation.Case_Options" x="177.5" y="358.5" width="158" height="90" expanded="1" expx="177.5" expy="358.5" expWidth="158" expHeight="90" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateBoundarycyl_1_ext" x="161" y="98" width="158" height="252" expanded="1" expx="161" expy="98" expWidth="158" expHeight="252" shownState="0"/>
- <presentation name="Etude_Initialisation.SetCurrentStudy" x="161.5" y="34" width="158" height="63" expanded="1" expx="161.5" expy="34" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="Etude_Initialisation" x="4" y="204" width="802" height="549" expanded="1" expx="4" expy="204" expWidth="802" expHeight="549" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateBoundarycyl_1_int" x="2.5" y="98.5" width="158" height="252" expanded="1" expx="2.5" expy="98.5" expWidth="158" expHeight="252" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateBoundarycyl_2_int" x="319.5" y="98.5" width="158" height="252" expanded="1" expx="319.5" expy="98.5" expWidth="158" expHeight="252" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateCase" x="4" y="357" width="158" height="117" expanded="1" expx="4" expy="357" expWidth="158" expHeight="117" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateHypothesis_1" x="4" y="481" width="158" height="63" expanded="1" expx="4" expy="481" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="Etude_Initialisation.Hypo_Options_1" x="165" y="481.5" width="158" height="63" expanded="1" expx="165" expy="481.5" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateBoundarycyl_2_ext" x="479" y="99.5" width="158" height="252" expanded="1" expx="479" expy="99.5" expWidth="158" expHeight="252" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateBoundaryintersection" x="640" y="99.5" width="158" height="117" expanded="1" expx="640" expy="99.5" expWidth="158" expHeight="117" shownState="0"/>
- <presentation name="Etude_Initialisation.CreateHypothesis_2" x="342.5" y="482" width="158" height="63" expanded="1" expx="342.5" expy="482" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="Etude_Initialisation.Hypo_Options_2" x="517.095" y="482.405" width="158" height="63" expanded="1" expx="517.095" expy="482.405" expWidth="158" expHeight="63" shownState="0"/>
- <presentation name="__ROOT__" x="0" y="0" width="882.5" height="1043.5" expanded="1" expx="0" expy="0" expWidth="882.5" expHeight="1043.5" shownState="0"/>
+ <presentation name="HOMARD_1" x="4" y="513.71" width="158" height="144" expanded="1" expx="4" expy="513.71" expWidth="158" expHeight="144" shownState="0"/>
+ <presentation name="DataInit" x="4" y="32" width="158" height="144" expanded="1" expx="4" expy="32" expWidth="158" expHeight="144" shownState="0"/>
+ <presentation name="Etude_Initialisation" x="4" y="203.5" width="643.105" height="309.71" expanded="1" expx="4" expy="203.5" expWidth="643.105" expHeight="309.71" shownState="0"/>
+ <presentation name="ForLoop" x="163" y="513.71" width="169" height="237" expanded="1" expx="163" expy="513.71" expWidth="169" expHeight="237" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateCase" x="163" y="97.1052" width="158" height="117" expanded="1" expx="163" expy="97.1052" expWidth="158" expHeight="117" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateHypothesis_1" x="4" y="214.605" width="158" height="63" expanded="1" expx="4" expy="214.605" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="651.105" height="754.71" expanded="1" expx="0" expy="0" expWidth="651.105" expHeight="754.71" shownState="0"/>
</proc>
"""
Exemple de couplage HOMARD-Salome
-Copyright EDF-R&D 1996, 2010, 2014
+Copyright EDF 1996, 2010, 2018
"""
-__revision__ = "V2.1"
+__revision__ = "V3.1"
#
import os
import sys
#
# ==================================
-PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
# Repertoire des donnees du tutorial
DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
import HOMARD
#
homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
-study_main = salome.myStudyManager.NewStudy("HOMARD")
homard.SetCurrentStudy(salome.myStudy)
#
-# Frontiere
+#============================= Début des commandes =============================
+#
+# Frontière
# =========
# Creation of the discrete boundary boun_5_1
-boun_5_1 = homard.CreateBoundaryDi('boun_5_1', 'MAIL_EXT', DATA_TUTORIAL+'/tutorial_5.fr.med')
+boun_5_1 = homard.CreateBoundaryDi('boun_5_1', 'MAIL_EXT', os.path.join(DATA_TUTORIAL, "tutorial_5.fr.med"))
#
# Creation des zones
# ==================
# Hypotheses
# ==========
# Creation of the hypothesis hypo_5
-hypo_5 = homard.CreateHypothesis('hypo_5')
-hypo_5.AddZone('enveloppe', 1)
-# Creation of the hypothesis hypo_5_bis
-hypo_5_bis = homard.CreateHypothesis('hypo_5_bis')
-hypo_5_bis.AddZone('quart_sup', 1)
+l_hypothese = homard.CreateHypothesis('hypo_5')
+l_hypothese.AddZone('enveloppe', 1)
+# Creation of the hypothesis l_hypothese_bis
+l_hypothese_bis = homard.CreateHypothesis('hypo_5_bis')
+l_hypothese_bis.AddZone('quart_sup', 1)
#
# Cas
# ===
-case_5 = homard.CreateCase('Case_5', 'COEUR_2D', DATA_TUTORIAL+'/tutorial_5.00.med')
-case_5.SetDirName(DIRCASE)
-case_5.SetConfType(3)
-case_5.AddBoundaryGroup('boun_5_1', '')
+le_cas = homard.CreateCase('Case_5', 'COEUR_2D', os.path.join(DATA_TUTORIAL, "tutorial_5.00.med"))
+le_cas.SetDirName(DIRCASE)
+le_cas.SetConfType(1)
+le_cas.AddBoundary('boun_5_1')
#
# Iteration "iter_5_1"
# ====================
-iter_5_1 = case_5.NextIteration('iter_5_1')
+iter_5_1 = le_cas.NextIteration('iter_5_1')
iter_5_1.SetMeshName('COEUR_2D_01')
-iter_5_1.SetMeshFile(DIRCASE+'/maill.01.med')
+iter_5_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
iter_5_1.AssociateHypo('hypo_5')
error = iter_5_1.Compute(1, 2)
#
# ====================
iter_5_2 = iter_5_1.NextIteration('iter_5_2')
iter_5_2.SetMeshName('COEUR_2D_02')
-iter_5_2.SetMeshFile(DIRCASE+'/maill.02.med')
+iter_5_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
iter_5_2.AssociateHypo('hypo_5_bis')
error = iter_5_2.Compute(1, 2)
-
+#
+#============================== Fin des commandes ==============================
+#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 5, 1)
# ==================================
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2011-2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+"""
+Exemple de couplage HOMARD-Salome
+Copyright EDF 1996, 2011, 2018
+"""
+__revision__ = "V4.3"
+#
+import os
+import sys
+#
+# ==================================
+PATH_HOMARD = os.getenv("HOMARD_ROOT_DIR")
+# Repertoire des donnees du tutorial
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+from tutorial_util import creation_dircase
+# ==================================
+DIRCASE = creation_dircase(6)
+gzip_gunzip(DATA_TUTORIAL, 4, -1)
+gzip_gunzip(DATA_TUTORIAL, 6, -1)
+# ==================================
+#
+import salome
+salome.salome_init()
+import HOMARD
+#
+homard = salome.lcc.FindOrLoadComponent("FactoryServer", "HOMARD")
+homard.SetCurrentStudy(salome.myStudy)
+#
+#============================= Début des commandes =============================
+#
+# Frontières
+# ==========
+boun_6_1 = homard.CreateBoundaryDi('intersection', 'PIQUAGE', os.path.join(DATA_TUTORIAL, "tutorial_6.fr.med"))
+#
+boun_6_2 = homard.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+#
+boun_6_3 = homard.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+#
+boun_6_4 = homard.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+#
+boun_6_5 = homard.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+#
+# Cas
+# ===
+le_cas = homard.CreateCase('Case_6', 'PIQUAGE', os.path.join(DATA_TUTORIAL, "tutorial_4.00.med"))
+le_cas.SetDirName(DIRCASE)
+le_cas.AddBoundary( 'intersection' )
+le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
+le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
+le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
+le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
+le_cas.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
+le_cas.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+#
+#============================== Fin des commandes ==============================
+#
+# Hypotheses
+# ==========
+# Creation of the hypothesis hypo_6
+l_hypothese = homard.CreateHypothesis('hypo_6')
+l_hypothese.SetUnifRefinUnRef(1)
+l_hypothese.AddGroup('T1_INT_I')
+l_hypothese.AddGroup('T1_INT_O')
+l_hypothese.AddGroup('T2_INT')
+# Creation of the hypothesis hypo_6_bis
+l_hypothese_bis = homard.CreateHypothesis('hypo_6_bis')
+l_hypothese_bis.SetUnifRefinUnRef(1)
+l_hypothese_bis.AddGroup('T1_EXT_I')
+l_hypothese_bis.AddGroup('T1_EXT_O')
+l_hypothese_bis.AddGroup('T2_EXT')
+#
+# Iterations
+# ==========
+# Iteration iter_6_1 : raffinement selon les faces internes
+iter_6_1 = le_cas.NextIteration('iter_6_1')
+iter_6_1.SetMeshName('PIQUAGE_6_1')
+iter_6_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+iter_6_1.AssociateHypo('hypo_6')
+erreur = iter_6_1.Compute(1, 2)
+# Iteration iter_6_2 : raffinement selon les faces externes
+iter_6_2 = iter_6_1.NextIteration('iter_6_2')
+iter_6_2.SetMeshName('PIQUAGE_6_2')
+iter_6_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+iter_6_2.AssociateHypo('hypo_6_bis')
+erreur = iter_6_2.Compute(1, 2)
+# Iteration iter_6_3 : second raffinement selon les faces externes
+iter_6_3 = iter_6_2.NextIteration('iter_6_3')
+iter_6_3.SetMeshName('PIQUAGE_6_3')
+iter_6_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
+iter_6_3.AssociateHypo('hypo_6_bis')
+erreur = iter_6_3.Compute(1, 2)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 4, 1)
+gzip_gunzip(DATA_TUTORIAL, 6, 1)
+# ==================================
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
--- /dev/null
+<?xml version='1.0' encoding='iso-8859-1' ?>
+<proc name="tutorial_6">
+ <property name="DefaultStudyID" value="1"/>
+ <objref name="CALCIUM_real" id="IDL:Ports/Calcium_Ports/Calcium_Real_Port:1.0"/>
+ <type name="string" kind="string"/>
+ <struct name="Engines/dataref">
+ <member name="ref" type="string"/>
+ </struct>
+ <objref name="HOMARD_Boundary" id="IDL:HOMARD/HOMARD_Boundary:1.0"/>
+ <objref name="HOMARD_Cas" id="IDL:HOMARD/HOMARD_Cas:1.0"/>
+ <objref name="HOMARD_Hypothesis" id="IDL:HOMARD/HOMARD_Hypothesis:1.0"/>
+ <objref name="HOMARD_Iteration" id="IDL:HOMARD/HOMARD_Iteration:1.0"/>
+ <objref name="HOMARD_Zone" id="IDL:HOMARD/HOMARD_Zone:1.0"/>
+ <objref name="Study" id="IDL:SALOMEDS/Study:1.0"/>
+ <type name="bool" kind="bool"/>
+ <sequence name="boolvec" content="bool"/>
+ <type name="double" kind="double"/>
+ <sequence name="dblevec" content="double"/>
+ <objref name="file" id="file"/>
+ <type name="int" kind="int"/>
+ <sequence name="intvec" content="int"/>
+ <struct name="stringpair">
+ <member name="name" type="string"/>
+ <member name="value" type="string"/>
+ </struct>
+ <sequence name="propvec" content="stringpair"/>
+ <objref name="pyobj" id="python:obj:1.0"/>
+ <sequence name="seqboolvec" content="boolvec"/>
+ <sequence name="seqdblevec" content="dblevec"/>
+ <sequence name="seqint" content="int"/>
+ <sequence name="seqintvec" content="intvec"/>
+ <sequence name="seqpyobj" content="pyobj"/>
+ <sequence name="stringvec" content="string"/>
+ <sequence name="seqstringvec" content="stringvec"/>
+ <container name="DefaultContainer">
+ <property name="container_kind" value="Salome"/>
+ <property name="attached_on_cloning" value="0"/>
+ <property name="container_name" value="FactoryServer"/>
+ <property name="name" value="localhost"/>
+ </container>
+ <bloc name="Etude_Initialisation">
+ <inline name="StudyCreation">
+ <script><code><![CDATA[
+import orbmodule
+import SALOMEDS_idl
+
+import HOMARD
+import HOMARD_Gen_idl
+import HOMARD_Cas_idl
+import HOMARD_Iteration_idl
+import HOMARD_Hypothesis_idl
+import HOMARD_Zone_idl
+import HOMARD_Boundary_idl
+
+clt = orbmodule.client()
+StudyManager = clt.Resolve("/myStudyManager")
+CurrentStudy = StudyManager.GetStudyByID(1)
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <outport name="CurrentStudy" type="Study"/>
+ </inline>
+ <service name="SetCurrentStudy">
+ <component>HOMARD</component>
+ <load container="DefaultContainer"/>
+ <method>SetCurrentStudy</method>
+ <inport name="theStudy" type="Study"/>
+ </service>
+ <service name="CreateBoundarycyl_1_int">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateBoundaryCylinder</method>
+ <inport name="BoundaryName" type="string"/>
+ <inport name="Xcentre" type="double"/>
+ <inport name="Ycentre" type="double"/>
+ <inport name="Zcentre" type="double"/>
+ <inport name="Xaxis" type="double"/>
+ <inport name="Yaxis" type="double"/>
+ <inport name="Zaxis" type="double"/>
+ <inport name="Radius" type="double"/>
+ <outport name="return" type="HOMARD_Boundary"/>
+ </service>
+ <service name="CreateBoundarycyl_1_ext">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateBoundaryCylinder</method>
+ <inport name="BoundaryName" type="string"/>
+ <inport name="Xcentre" type="double"/>
+ <inport name="Ycentre" type="double"/>
+ <inport name="Zcentre" type="double"/>
+ <inport name="Xaxis" type="double"/>
+ <inport name="Yaxis" type="double"/>
+ <inport name="Zaxis" type="double"/>
+ <inport name="Radius" type="double"/>
+ <outport name="return" type="HOMARD_Boundary"/>
+ </service>
+ <service name="CreateBoundarycyl_2_int">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateBoundaryCylinder</method>
+ <inport name="BoundaryName" type="string"/>
+ <inport name="Xcentre" type="double"/>
+ <inport name="Ycentre" type="double"/>
+ <inport name="Zcentre" type="double"/>
+ <inport name="Xaxis" type="double"/>
+ <inport name="Yaxis" type="double"/>
+ <inport name="Zaxis" type="double"/>
+ <inport name="Radius" type="double"/>
+ <outport name="return" type="HOMARD_Boundary"/>
+ </service>
+ <service name="CreateHypothesis_1">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateHypothesis</method>
+ <inport name="HypoName" type="string"/>
+ <outport name="return" type="HOMARD_Hypothesis"/>
+ </service>
+ <service name="CreateCase">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateCase</method>
+ <inport name="CaseName" type="string"/>
+ <inport name="MeshName" type="string"/>
+ <inport name="FileName" type="string"/>
+ <outport name="return" type="HOMARD_Cas"/>
+ </service>
+ <inline name="Hypo_Options_1">
+ <script><code><![CDATA[# Raffinement uniforme
+Hypo.SetUnifRefinUnRef(1)
+# Filtrage par des groupes
+Hypo.AddGroup('T1_INT_I')
+Hypo.AddGroup('T1_INT_O')
+Hypo.AddGroup('T2_INT')
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="Hypo" type="HOMARD_Hypothesis"/>
+ </inline>
+ <inline name="Case_Options">
+ <script><code><![CDATA[# Options
+# =========
+# Repertoire d'execution
+Case.SetDirName(DirName)
+# Liens avec les frontieres
+Case.AddBoundaryGroup( 'intersection', '' )
+Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
+Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
+Case.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
+Case.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
+Case.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
+Case.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+# Resultats
+# =========
+# Iteration 0 associee
+Iter0 = Case.GetIter0()
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="Case" type="HOMARD_Cas"/>
+ <inport name="DirName" type="string"/>
+ <outport name="Iter0" type="HOMARD_Iteration"/>
+ </inline>
+ <service name="CreateBoundarycyl_2_ext">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateBoundaryCylinder</method>
+ <inport name="BoundaryName" type="string"/>
+ <inport name="Xcentre" type="double"/>
+ <inport name="Ycentre" type="double"/>
+ <inport name="Zcentre" type="double"/>
+ <inport name="Xaxis" type="double"/>
+ <inport name="Yaxis" type="double"/>
+ <inport name="Zaxis" type="double"/>
+ <inport name="Radius" type="double"/>
+ <outport name="return" type="HOMARD_Boundary"/>
+ </service>
+ <service name="CreateBoundaryintersection">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateBoundaryDi</method>
+ <inport name="BoundaryName" type="string"/>
+ <inport name="MeshName" type="string"/>
+ <inport name="FileName" type="string"/>
+ <outport name="return" type="HOMARD_Boundary"/>
+ </service>
+ <service name="CreateHypothesis_2">
+ <node>Etude_Initialisation.SetCurrentStudy</node>
+ <method>CreateHypothesis</method>
+ <inport name="HypoName" type="string"/>
+ <outport name="return" type="HOMARD_Hypothesis"/>
+ </service>
+ <inline name="Hypo_Options_2">
+ <script><code><![CDATA[# Raffinement uniforme
+Hypo.SetUnifRefinUnRef(1)
+# Filtrage par des groupes
+Hypo.AddGroup('T1_EXT_I')
+Hypo.AddGroup('T1_EXT_O')
+Hypo.AddGroup('T2_EXT')
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="Hypo" type="HOMARD_Hypothesis"/>
+ </inline>
+ <control> <fromnode>StudyCreation</fromnode> <tonode>SetCurrentStudy</tonode> </control>
+ <control> <fromnode>SetCurrentStudy</fromnode> <tonode>CreateBoundarycyl_1_int</tonode> </control>
+ <control> <fromnode>CreateBoundarycyl_1_int</fromnode> <tonode>CreateBoundarycyl_1_ext</tonode> </control>
+ <control> <fromnode>CreateBoundarycyl_1_ext</fromnode> <tonode>CreateBoundarycyl_2_int</tonode> </control>
+ <control> <fromnode>CreateBoundarycyl_2_int</fromnode> <tonode>CreateBoundarycyl_2_ext</tonode> </control>
+ <control> <fromnode>CreateHypothesis_1</fromnode> <tonode>Hypo_Options_1</tonode> </control>
+ <control> <fromnode>CreateCase</fromnode> <tonode>Case_Options</tonode> </control>
+ <control> <fromnode>Hypo_Options_1</fromnode> <tonode>CreateHypothesis_2</tonode> </control>
+ <control> <fromnode>Case_Options</fromnode> <tonode>CreateHypothesis_1</tonode> </control>
+ <control> <fromnode>CreateBoundarycyl_2_ext</fromnode> <tonode>CreateBoundaryintersection</tonode> </control>
+ <control> <fromnode>CreateBoundaryintersection</fromnode> <tonode>CreateCase</tonode> </control>
+ <control> <fromnode>CreateHypothesis_2</fromnode> <tonode>Hypo_Options_2</tonode> </control>
+ <datalink control="false">
+ <fromnode>StudyCreation</fromnode> <fromport>CurrentStudy</fromport>
+ <tonode>SetCurrentStudy</tonode> <toport>theStudy</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>CreateHypothesis_1</fromnode> <fromport>return</fromport>
+ <tonode>Hypo_Options_1</tonode> <toport>Hypo</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>CreateCase</fromnode> <fromport>return</fromport>
+ <tonode>Case_Options</tonode> <toport>Case</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>CreateHypothesis_2</fromnode> <fromport>return</fromport>
+ <tonode>Hypo_Options_2</tonode> <toport>Hypo</toport>
+ </datalink>
+ </bloc>
+ <forloop name="ForLoop" nsteps="2">
+ <inline name="HOMARD_2">
+ <script><code><![CDATA[import os
+#
+# Hypothese
+# =========
+# . Nom de l'hypothese
+# --------------------
+HypoName = Hypo.GetName()
+#
+# Nom de la future iteration et du futur maillage
+# ==========================
+# . Nom de l'iteration precedente
+LastIterName = LastIter.GetName()
+# . Nom du maillage precedent
+LastMeshName = LastIter.GetMeshName()#
+#
+aux = '%d' % (NumAdapt+2)
+#
+IterName = LastIterName[:-1] + aux
+MeshName = LastMeshName[:-1] + aux
+#
+# Creation de l'iteration
+# =======================
+Iter = LastIter.NextIteration(IterName)
+#
+# Options de l'iteration
+# ======================
+# . Association de l'hypothese
+Iter.AssociateHypo(HypoName)
+#
+# . Le fichier du futur maillage
+aux = '%02d' % (NumAdapt+2)
+MeshFile = os.path.join (DirName, "maill."+aux+".med")
+Iter.SetMeshFile(MeshFile)
+#
+# . Le nom du futur maillage
+Iter.SetMeshName(MeshName)
+#
+# Calcul si le precedent s'est bien passe
+# ======
+if LastPb :
+ Pb = LastPb
+ MessInfo = "Erreur dans HOMARD pour l'adaptation numero %d" % LastPb
+else :
+ Error = Iter.Compute(1, 1)
+#
+ if Error :
+ Pb = NumAdapt+2
+ MessInfo = "Erreur dans HOMARD pour l'adaptation numero %d" % NumAdapt
+ else :
+ Pb = 0
+ MessInfo = ""
+
+]]></code></script>
+ <inport name="NumAdapt" type="int"/>
+ <inport name="LastIter" type="HOMARD_Iteration"/>
+ <inport name="Hypo" type="HOMARD_Hypothesis"/>
+ <inport name="DirName" type="string"/>
+ <inport name="LastPb" type="int"/>
+ <outport name="MessInfo" type="string"/>
+ <outport name="MeshFile" type="string"/>
+ <outport name="Iter" type="HOMARD_Iteration"/>
+ <outport name="Pb" type="int"/>
+ </inline>
+ <datalink control="false">
+ <fromnode>HOMARD_2</fromnode> <fromport>Iter</fromport>
+ <tonode>HOMARD_2</tonode> <toport>LastIter</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>HOMARD_2</fromnode> <fromport>Pb</fromport>
+ <tonode>HOMARD_2</tonode> <toport>LastPb</toport>
+ </datalink>
+ </forloop>
+ <inline name="Bilan">
+ <script><code><![CDATA[import sys
+from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
+class App(QWidget):
+ def __init__(self, MessInfo, MeshFile):
+ super(App, self).__init__()
+ self.title = "Bilan"
+ self._MessInfo = MessInfo
+ self._MeshFile = MeshFile
+ self.initUI()
+ def initUI(self):
+ if self._MessInfo != "" :
+ button = QMessageBox.critical(self, self.title, self._MessInfo)
+ else :
+ MessInfo = "Le maillage final est dans le fichier : " + self._MeshFile
+ button = QMessageBox.information(self, self.title, MessInfo)
+ self.show()
+app = QApplication(sys.argv)
+ex = App(MessInfo, MeshFile)
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="MessInfo" type="string"/>
+ <inport name="MeshFile" type="string"/>
+ </inline>
+ <inline name="DataInit">
+ <script><code><![CDATA[import os
+pathHomard = os.getenv("HOMARD_ROOT_DIR")
+data_dir = os.path.join(pathHomard, "share/doc/salome/gui/HOMARD/fr/_downloads")
+#
+# Maillage de la structure
+# . Nom du maillage
+MeshName = "PIQUAGE"
+# . Fichier du maillage
+FileName = os.path.join(data_dir, "tutorial_4.00.med")
+#
+# Maillage de la frontiere
+# . Nom du maillage
+BMeshName = "PIQUAGE"
+# . Fichier du maillage
+BFileName = os.path.join(data_dir, "tutorial_6.fr.med")
+#
+# Répertoire de travail
+if os.environ.has_key("LOGNAME") :
+ user = os.environ ["LOGNAME"]
+else :
+ user = "anonymous"
+DirName = os.path.join( os.sep, "tmp", "HOMARD_"+user)
+if not os.path.isdir(DirName) :
+ os.mkdir (DirName)
+]]></code></script>
+ <outport name="MeshName" type="string"/>
+ <outport name="FileName" type="string"/>
+ <outport name="BMeshName" type="string"/>
+ <outport name="BFileName" type="string"/>
+ <outport name="DirName" type="string"/>
+ </inline>
+ <inline name="HOMARD_1">
+ <script><code><![CDATA[import os
+#
+# Hypothese
+# =========
+# . Nom de l'hypothese
+# --------------------
+HypoName = Hypo.GetName()
+#
+# Nom de la future iteration et du futur maillage
+# ==========================
+# . Nom de l'iteration precedente
+LastIterName = LastIter.GetName()
+# . Nom du maillage precedent
+LastMeshName = LastIter.GetMeshName()
+#
+IterName = LastIterName + "_1"
+MeshName = LastMeshName + "_1"
+#
+# Creation de l'iteration
+# =======================
+Iter = LastIter.NextIteration(IterName)
+#
+# Options de l'iteration
+# ======================
+# . Association de l'hypothese
+Iter.AssociateHypo(HypoName)
+#
+# . Le fichier du futur maillage
+MeshFile = os.path.join (DirName, "maill.01.med")
+Iter.SetMeshFile(MeshFile)
+#
+# . Le nom du futur maillage
+Iter.SetMeshName(MeshName)
+#
+# Calcul
+# ======
+Error = Iter.Compute(1, 1)
+#
+# ============================
+# Arret si erreur
+if Error :
+ Pb = 1
+ MessInfo = "Erreur dans HOMARD pour la premiere adaptation"
+# Sinon on enchaine sur 2 autres adaptations
+else :
+ Pb= 0
+ MessInfo = ""
+
+]]></code></script>
+ <load container="DefaultContainer"/>
+ <inport name="LastIter" type="HOMARD_Iteration"/>
+ <inport name="Hypo" type="HOMARD_Hypothesis"/>
+ <inport name="DirName" type="string"/>
+ <outport name="MessInfo" type="string"/>
+ <outport name="MeshFile" type="string"/>
+ <outport name="Iter" type="HOMARD_Iteration"/>
+ <outport name="Pb" type="int"/>
+ </inline>
+ <control> <fromnode>Etude_Initialisation</fromnode> <tonode>HOMARD_1</tonode> </control>
+ <control> <fromnode>ForLoop</fromnode> <tonode>Bilan</tonode> </control>
+ <control> <fromnode>DataInit</fromnode> <tonode>HOMARD_1</tonode> </control>
+ <control> <fromnode>DataInit</fromnode> <tonode>Etude_Initialisation</tonode> </control>
+ <control> <fromnode>HOMARD_1</fromnode> <tonode>ForLoop</tonode> </control>
+ <datalink control="false">
+ <fromnode>ForLoop</fromnode> <fromport>index</fromport>
+ <tonode>ForLoop.HOMARD_2</tonode> <toport>NumAdapt</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>DataInit</fromnode> <fromport>MeshName</fromport>
+ <tonode>Etude_Initialisation.CreateCase</tonode> <toport>MeshName</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>DataInit</fromnode> <fromport>FileName</fromport>
+ <tonode>Etude_Initialisation.CreateCase</tonode> <toport>FileName</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>DataInit</fromnode> <fromport>BMeshName</fromport>
+ <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>MeshName</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>DataInit</fromnode> <fromport>BFileName</fromport>
+ <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode> <toport>FileName</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
+ <tonode>ForLoop.HOMARD_2</tonode> <toport>DirName</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
+ <tonode>Etude_Initialisation.Case_Options</tonode> <toport>DirName</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>DataInit</fromnode> <fromport>DirName</fromport>
+ <tonode>HOMARD_1</tonode> <toport>DirName</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>HOMARD_1</fromnode> <fromport>MessInfo</fromport>
+ <tonode>Bilan</tonode> <toport>MessInfo</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>HOMARD_1</fromnode> <fromport>MeshFile</fromport>
+ <tonode>Bilan</tonode> <toport>MeshFile</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>HOMARD_1</fromnode> <fromport>Iter</fromport>
+ <tonode>ForLoop.HOMARD_2</tonode> <toport>LastIter</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>HOMARD_1</fromnode> <fromport>Pb</fromport>
+ <tonode>ForLoop.HOMARD_2</tonode> <toport>LastPb</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>Etude_Initialisation.CreateHypothesis_2</fromnode> <fromport>return</fromport>
+ <tonode>ForLoop.HOMARD_2</tonode> <toport>Hypo</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>ForLoop.HOMARD_2</fromnode> <fromport>MessInfo</fromport>
+ <tonode>Bilan</tonode> <toport>MessInfo</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>ForLoop.HOMARD_2</fromnode> <fromport>MeshFile</fromport>
+ <tonode>Bilan</tonode> <toport>MeshFile</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>Etude_Initialisation.Case_Options</fromnode> <fromport>Iter0</fromport>
+ <tonode>HOMARD_1</tonode> <toport>LastIter</toport>
+ </datalink>
+ <datalink control="false">
+ <fromnode>Etude_Initialisation.CreateHypothesis_1</fromnode> <fromport>return</fromport>
+ <tonode>HOMARD_1</tonode> <toport>Hypo</toport>
+ </datalink>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateHypothesis_2</tonode><toport>HypoName</toport>
+ <value><string>Hypo_6_bis</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundaryintersection</tonode><toport>BoundaryName</toport>
+ <value><string>intersection</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>BoundaryName</toport>
+ <value><string>cyl_2_ext</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xcentre</toport>
+ <value><double>17.5</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Ycentre</toport>
+ <value><double>-2.5</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zcentre</toport>
+ <value><double>-12.5</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Xaxis</toport>
+ <value><double>-100</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Yaxis</toport>
+ <value><double>-75</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Zaxis</toport>
+ <value><double>-25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_ext</tonode><toport>Radius</toport>
+ <value><double>50</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateHypothesis_1</tonode><toport>HypoName</toport>
+ <value><string>Hypo_6</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>BoundaryName</toport>
+ <value><string>cyl_2_int</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xcentre</toport>
+ <value><double>17.5</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Ycentre</toport>
+ <value><double>-2.5</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zcentre</toport>
+ <value><double>-12.5</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Xaxis</toport>
+ <value><double>-100</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Yaxis</toport>
+ <value><double>-75</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Zaxis</toport>
+ <value><double>-25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_2_int</tonode><toport>Radius</toport>
+ <value><double>25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>BoundaryName</toport>
+ <value><string>cyl_1_ext</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xcentre</toport>
+ <value><double>0</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Ycentre</toport>
+ <value><double>25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zcentre</toport>
+ <value><double>-25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Xaxis</toport>
+ <value><double>25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Yaxis</toport>
+ <value><double>50</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Zaxis</toport>
+ <value><double>75</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_ext</tonode><toport>Radius</toport>
+ <value><double>100</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateCase</tonode><toport>CaseName</toport>
+ <value><string>tutorial_6</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>BoundaryName</toport>
+ <value><string>cyl_1_int</string></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xcentre</toport>
+ <value><double>0</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Ycentre</toport>
+ <value><double>25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zcentre</toport>
+ <value><double>-25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Xaxis</toport>
+ <value><double>25</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Yaxis</toport>
+ <value><double>50</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Zaxis</toport>
+ <value><double>75</double></value>
+ </parameter>
+ <parameter>
+ <tonode>Etude_Initialisation.CreateBoundarycyl_1_int</tonode><toport>Radius</toport>
+ <value><double>75</double></value>
+ </parameter>
+ <parameter>
+ <tonode>ForLoop</tonode><toport>nsteps</toport>
+ <value><int>2</int></value>
+ </parameter>
+ <presentation name="Etude_Initialisation.CreateHypothesis_2" x="321.5" y="465.422" width="158" height="63" expanded="1" expx="321.5" expy="465.422" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateBoundaryintersection" x="638.5" y="96.1845" width="158" height="117" expanded="1" expx="638.5" expy="96.1845" expWidth="158" expHeight="117" shownState="0"/>
+ <presentation name="Etude_Initialisation.Hypo_Options_2" x="480" y="466.933" width="158" height="63" expanded="1" expx="480" expy="466.933" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="HOMARD_1" x="4" y="738.933" width="158" height="144" expanded="1" expx="4" expy="738.933" expWidth="158" expHeight="144" shownState="0"/>
+ <presentation name="DataInit" x="4" y="32" width="158" height="171" expanded="1" expx="4" expy="32" expWidth="158" expHeight="171" shownState="0"/>
+ <presentation name="Bilan" x="650.874" y="738.933" width="158" height="90" expanded="1" expx="650.874" expy="738.933" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="Etude_Initialisation.Case_Options" x="163" y="348.5" width="158" height="90" expanded="1" expx="163" expy="348.5" expWidth="158" expHeight="90" shownState="0"/>
+ <presentation name="Etude_Initialisation.Hypo_Options_1" x="163" y="466.424" width="158" height="63" expanded="1" expx="163" expy="466.424" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateBoundarycyl_2_ext" x="480" y="96.1845" width="158" height="252" expanded="1" expx="480" expy="96.1845" expWidth="158" expHeight="252" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateHypothesis_1" x="4" y="466" width="158" height="63" expanded="1" expx="4" expy="466" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateBoundarycyl_2_int" x="321.5" y="96" width="158" height="252" expanded="1" expx="321.5" expy="96" expWidth="158" expHeight="252" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateBoundarycyl_1_ext" x="163" y="96" width="158" height="252" expanded="1" expx="163" expy="96" expWidth="158" expHeight="252" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateCase" x="4" y="348.5" width="158" height="117" expanded="1" expx="4" expy="348.5" expWidth="158" expHeight="117" shownState="0"/>
+ <presentation name="Etude_Initialisation.CreateBoundarycyl_1_int" x="4" y="96" width="158" height="252" expanded="1" expx="4" expy="96" expWidth="158" expHeight="252" shownState="0"/>
+ <presentation name="ForLoop.HOMARD_2" x="7" y="62" width="158" height="171" expanded="1" expx="7" expy="62" expWidth="158" expHeight="171" shownState="0"/>
+ <presentation name="Etude_Initialisation.SetCurrentStudy" x="163" y="32" width="158" height="63" expanded="1" expx="163" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="Etude_Initialisation.StudyCreation" x="4" y="32" width="158" height="63" expanded="1" expx="4" expy="32" expWidth="158" expHeight="63" shownState="0"/>
+ <presentation name="ForLoop" x="163" y="738.933" width="169" height="237" expanded="1" expx="163" expy="738.933" expWidth="169" expHeight="237" shownState="0"/>
+ <presentation name="Etude_Initialisation" x="4" y="204" width="800.5" height="533.933" expanded="1" expx="4" expy="204" expWidth="800.5" expHeight="533.933" shownState="0"/>
+ <presentation name="__ROOT__" x="0" y="0" width="812.874" height="979.933" expanded="1" expx="0" expy="0" expWidth="812.874" expHeight="979.933" shownState="0"/>
+</proc>
#
"""
Python script for HOMARD
-Copyright EDF-R&D 2014, 2017
+Copyright EDF 2014, 2018
"""
-__revision__ = "V2.01"
+__revision__ = "V2.02"
import os
import sys
sys.path.append(REP_PYTHON)
from test_util import remove_dir
-#========================================================================
-#========================================================================
+#
+#========================= Debut de la fonction ==================================
+#
def gzip_gunzip(data_dir, num_tuto, option) :
"""
-Compression/Uncompression of the med files of a directory such as tutorial_x.nn.med
+Compression/Uncompression of the med(or xao) files of a directory such as tutorial_x.nn.med (or tutorial_x.nn.xao)
data_dir: directory
num_tuto: number of the tutorial
option : 1: compression, -1: uncompression
erreur = 1
break
#
- ficloc = ficloc_basis + ".fr.med"
- nomfic = os.path.join(data_dir, ficloc)
- if not os.path.isfile(nomfic) :
- ficloc += ".gz"
+ for suffixe in ( "xao", "fr.med" ) :
+ ficloc = ficloc_basis + "." + suffixe
nomfic = os.path.join(data_dir, ficloc)
- if os.path.isfile(nomfic) :
- os.system("gunzip "+nomfic)
+ if not os.path.isfile(nomfic) :
+ ficloc += ".gz"
+ nomfic = os.path.join(data_dir, ficloc)
+ if os.path.isfile(nomfic) :
+ os.system("gunzip "+nomfic)
#
# Compression
#
erreur = 2
break
#
- ficloc = ficloc_basis + ".fr.med.gz"
- nomfic = os.path.join(data_dir, ficloc)
- if not os.path.isfile(nomfic) :
- ficloc = ficloc_basis + ".fr.med"
+ for suffixe in ( "xao", "fr.med" ) :
+ ficloc = ficloc_basis + "." + suffixe + ".gz"
nomfic = os.path.join(data_dir, ficloc)
- if os.path.isfile(nomfic) :
- os.system("gzip "+nomfic)
+ if not os.path.isfile(nomfic) :
+ ficloc = ficloc_basis + ".fr.med"
+ nomfic = os.path.join(data_dir, ficloc)
+ if os.path.isfile(nomfic) :
+ os.system("gzip "+nomfic)
#
return
#
-#========================================================================
-#========================================================================
+#========================== Fin de la fonction ==================================
+#
+#========================= Debut de la fonction ==================================
+#
def creation_dircase(num_tuto) :
"""
Creation of a directory for the results of tutorial_x
os.mkdir (dircase)
#
return dircase
-#========================================================================
-#========================================================================
+#
+#========================== Fin de la fonction ==================================
#
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+Python script for HOMARD
+Test test_6
+"""
+__revision__ = "V1.02"
+
+#========================================================================
+TEST_NAME = "test_6"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#
+TAILLE = 10.
+LG_ARETE = TAILLE*2.5
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+from test_util import saveGeometry
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# Repertoire des resultats
+if DEBUG :
+ DIRCASE = os.path.join("/tmp", TEST_NAME)
+ if ( os.path.isdir(DIRCASE) ) :
+ remove_dir(DIRCASE)
+ os.mkdir(DIRCASE)
+else :
+ DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+
+salome.salome_init()
+import iparameters
+IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+IPAR.append("AP_MODULES_LIST", "Homard")
+#
+#========================= Debut de la fonction ==================================
+#
+def create_geom(nom_obj, taille, verbose=False) :
+ """
+Création de la géométrie
+ """
+#
+ erreur = 0
+#
+ if verbose :
+ texte = "Geometrie '%s'\n" % nom_obj
+ texte += "Taille de base = %f" % taille
+ print (texte)
+#
+ import GEOM
+ from salome.geom import geomBuilder
+ geompy = geomBuilder.New(salome.myStudy)
+#
+# 1. Les sommets et la première ligne
+#
+ vertex_1 = geompy.MakeVertex( 0.*taille, 0.*taille, 0.*taille, theName = "V1")
+ vertex_2 = geompy.MakeVertex( 5.*taille, 2.*taille, 0.*taille, theName = "V2")
+ vertex_3 = geompy.MakeVertex(10.*taille, 1.*taille, 0.*taille, theName = "V3")
+ vertex_4 = geompy.MakeVertex(16.*taille, 4.*taille, 0.*taille, theName = "V4")
+ vertex_5 = geompy.MakeVertex(16.*taille, 10.*taille, 0.*taille, theName = "V5")
+#
+ courbe_0 = geompy.MakeInterpol([vertex_1, vertex_2, vertex_3, vertex_4, vertex_5], False, False, theName="courbe_0")
+#
+# 2. Les sommets et la seconde ligne
+#
+ sommet_1 = geompy.MakeVertex( 0.*taille, 0.*taille, 20.*taille, theName = "S1")
+ sommet_2 = geompy.MakeVertex( 6.*taille, -5.*taille, 20.*taille, theName = "S2")
+ sommet_3 = geompy.MakeVertex(11.*taille, -2.*taille, 20.*taille, theName = "S3")
+ sommet_4 = geompy.MakeVertex(12.*taille, 3.*taille, 20.*taille, theName = "S4")
+ sommet_5 = geompy.MakeVertex(16.*taille, 10.*taille, 20.*taille, theName = "S5")
+#
+ courbe_1 = geompy.MakeInterpol([sommet_1, sommet_2, sommet_3, sommet_4, sommet_5], False, False, theName="courbe_1")
+#
+# 3. La face de base
+#
+ structure_g = geompy.MakeFilling([courbe_0, courbe_1], theName=nom_obj)
+#
+# 4. Groupes : on cherche les entites par des proximités avec des shapes bien choisies
+#
+ l_groupes_g = list()
+#
+ shape = geompy.GetFaceNearPoint (structure_g, vertex_2)
+ nom = "Voile"
+ groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["FACE"], nom)
+ geompy.UnionList ( groupe_g, [shape] )
+ l_groupes_g.append( (nom, groupe_g, 2) )
+#
+ shape = geompy.GetEdgeNearPoint (structure_g, vertex_2)
+ nom = "C_0"
+ groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+ geompy.UnionList ( groupe_g, [shape] )
+ l_groupes_g.append( (nom, groupe_g, 1) )
+#
+ shape = geompy.GetEdgeNearPoint (structure_g, sommet_2)
+ nom = "C_1"
+ groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+ geompy.UnionList ( groupe_g, [shape] )
+ l_groupes_g.append( (nom, groupe_g, 1) )
+#
+ shape = geompy.GetEdge (structure_g, vertex_1, sommet_1)
+ nom = "D_0"
+ groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+ geompy.UnionList ( groupe_g, [shape] )
+ l_groupes_g.append( (nom, groupe_g, 1) )
+#
+ shape = geompy.GetEdge (structure_g, vertex_5, sommet_5)
+ nom = "D_1"
+ groupe_g = geompy.CreateGroup(structure_g, geompy.ShapeType["EDGE"], nom)
+ geompy.UnionList ( groupe_g, [shape] )
+ l_groupes_g.append( (nom, groupe_g, 1) )
+#
+ return erreur, structure_g, l_groupes_g
+#
+#========================== Fin de la fonction ==================================
+#
+#========================= Debut de la fonction ==================================
+#
+def create_mail(lg_arete, structure_g, l_groupes_g, rep_mail, verbose=False) :
+ """
+Création du maillage
+ """
+#
+ erreur = 0
+ message = ""
+ ficmed = ""
+#
+ while not erreur :
+#
+ nom = structure_g.GetName()
+ if verbose :
+ texte = "Maillage de '%s'\n" % nom
+ texte += "lg_arete = %f\n" % lg_arete
+ texte += "rep_mail = '%s'" % rep_mail
+ print (texte)
+#
+ import SMESH
+ from salome.smesh import smeshBuilder
+ smesh = smeshBuilder.New(salome.myStudy)
+#
+# 2. Maillage de calcul
+#
+ maill_00 = smesh.Mesh(structure_g)
+ smesh.SetName(maill_00.GetMesh(), nom)
+#
+ MG_CADSurf = maill_00.Triangle(algo=smeshBuilder.MG_CADSurf)
+ smesh.SetName(MG_CADSurf.GetAlgorithm(), 'MG_CADSurf')
+#
+ MG_CADSurf_Parameters = MG_CADSurf.Parameters()
+ smesh.SetName(MG_CADSurf_Parameters, 'MG_CADSurf Triangles')
+ MG_CADSurf_Parameters.SetPhySize( lg_arete )
+ MG_CADSurf_Parameters.SetMinSize( lg_arete/20. )
+ MG_CADSurf_Parameters.SetMaxSize( lg_arete*5. )
+ MG_CADSurf_Parameters.SetChordalError( lg_arete )
+ MG_CADSurf_Parameters.SetAngleMesh( 12. )
+#
+# 3. Les groupes issus de la géométrie
+#
+ for taux in l_groupes_g :
+ groupe_m = maill_00.Group(taux[1])
+ smesh.SetName(groupe_m, taux[0])
+#
+# 4. Calcul
+#
+ isDone = maill_00.Compute()
+ if not isDone :
+ message += "Probleme dans le maillage de la surface."
+ erreur = 13
+ break
+#
+# 5. Export MED
+#
+ ficmed = os.path.join(rep_mail,'maill.00.med')
+ texte = "Ecriture du fichier '%s'" % ficmed
+ if verbose :
+ print (texte)
+ maill_00.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1 )
+#
+ break
+#
+ return erreur, message, ficmed
+#
+#========================== Fin de la fonction ==================================
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, xao_file, verbose=False):
+ """
+Python script for HOMARD
+ """
+ erreur = 0
+ message = ""
+#
+ while not erreur :
+ #
+ HOMARD.SetCurrentStudy(salome.myStudy)
+ #
+ # Frontière
+ # =========
+ if verbose :
+ print(". Frontière")
+ cao_name = "CAO_" + nom
+ la_frontiere = HOMARD.CreateBoundaryCAO(cao_name, xao_file)
+ #
+ # Hypotheses
+ # ==========
+ if verbose :
+ print(". Hypothèses")
+ hyponame = "hypo_" + nom
+ l_hypothese = HOMARD.CreateHypothesis(hyponame)
+ l_hypothese.SetUnifRefinUnRef(1)
+ #
+ # Cas
+ # ===
+ if verbose :
+ print(". Cas")
+ le_cas = HOMARD.CreateCase('case_'+nom, nom, ficmed)
+ le_cas.SetDirName(DIRCASE)
+ le_cas.AddBoundary(cao_name)
+ #
+ # Creation of the iterations
+ # ==========================
+ if verbose :
+ option = 2
+ else :
+ option = 1
+ #
+ for niter in range(1, N_ITER_TEST_FILE+1):
+ if verbose :
+ print(". Itération numéro %d" % niter)
+ iter_name = "I_" + nom + "_%02d" % niter
+ if ( niter == 1 ) :
+ l_iteration = le_cas.NextIteration(iter_name)
+ else :
+ l_iteration = l_iteration.NextIteration(iter_name)
+ l_iteration.SetMeshName(nom)
+ mesh_file = os.path.join(DIRCASE, "maill.%02d.med" % niter)
+ l_iteration.SetMeshFile(mesh_file)
+ l_iteration.AssociateHypo(hyponame)
+ erreur = l_iteration.Compute(1, option)
+ if erreur :
+ erreur = niter
+ break
+ #
+ break
+ #
+ if erreur :
+ message += "Erreur au calcul de l'itération %d" % erreur
+ #
+ return erreur, message
+#
+#========================== Fin de la fonction ==================================
+#
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
+ #
+ VERBOSE = DEBUG
+ #
+ # A. Geometry
+ #
+ ERREUR, STRUCTURE_G, L_GROUPES_G = create_geom(TEST_NAME, TAILLE, VERBOSE)
+ if ERREUR :
+ MESSAGE = "The construction of the geometry failed."
+ break
+ #
+ # B. Save the geometry
+ #
+ XAO_FILE = os.path.join(DIRCASE, TEST_NAME+".xao")
+ try :
+ ERREUR = saveGeometry(XAO_FILE, TEST_NAME, "test_salome_"+TEST_NAME)
+ except Exception, eee:
+ ERREUR = 2000
+ MESSAGE = eee.message
+ #
+ if ERREUR :
+ MESSAGE += "Pb in saveGeometry"
+ break
+ #
+ # C. Mesh
+ #
+ ERREUR, MESSAGE, FICMED = create_mail(LG_ARETE, STRUCTURE_G, L_GROUPES_G, DIRCASE, VERBOSE)
+ if ERREUR :
+ break
+ #
+ # D. Exec of HOMARD-SALOME
+ #
+ HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+ assert HOMARD is not None, "Impossible to load homard engine"
+ HOMARD.SetLanguageShort("fr")
+#
+ try:
+ ERREUR, MESSAGE = homard_exec(TEST_NAME, FICMED, XAO_FILE, VERBOSE)
+ except Exception, eee:
+ ERREUR = 4000
+ MESSAGE = eee.message
+ #
+ if ERREUR :
+ MESSAGE += "Pb in homard_exec"
+ break
+ #
+ # E. Test of the results
+ #
+ N_REP_TEST_FILE = N_ITER_TEST_FILE
+ DESTROY_DIR = not DEBUG
+ test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+ #
+ break
+#
+if ERREUR:
+ MESSAGE = "\nErreur numéro %d\n" % ERREUR + MESSAGE
+ raise Exception(MESSAGE)
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2011-2016 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+"""
+Python script for HOMARD
+Test tutorial_6 associe au tutorial 6
+"""
+__revision__ = "V4.02"
+
+#========================================================================
+TEST_NAME = "tutorial_6"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#========================================================================
+import os
+import tempfile
+import sys
+import HOMARD
+import salome
+#
+# ==================================
+PATH_HOMARD = os.getenv('HOMARD_ROOT_DIR')
+# Repertoire des scripts utilitaires
+REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
+REP_PYTHON = os.path.normpath(REP_PYTHON)
+sys.path.append(REP_PYTHON)
+from test_util import remove_dir
+from test_util import test_results
+# Repertoire des donnees du test
+REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
+REP_DATA = os.path.normpath(REP_DATA)
+# Repertoire des resultats
+if DEBUG :
+ DIRCASE = os.path.join("/tmp", TEST_NAME)
+ if ( os.path.isdir(DIRCASE) ) :
+ remove_dir(DIRCASE)
+ os.mkdir(DIRCASE)
+else :
+ DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+# Repertoire des donnees du tutorial
+DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+sys.path.append(DATA_TUTORIAL)
+from tutorial_util import gzip_gunzip
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 4, -1)
+gzip_gunzip(DATA_TUTORIAL, 6, -1)
+# ==================================
+
+salome.salome_init()
+import iparameters
+IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
+IPAR.append("AP_MODULES_LIST", "Homard")
+#
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, nomfr, ficfrmed, verbose=False):
+ """
+Python script for HOMARD
+ """
+ erreur = 0
+ message = ""
+#
+ while not erreur :
+ #
+ HOMARD.SetCurrentStudy(salome.myStudy)
+ #
+ # Frontières
+ # ==========
+ if verbose :
+ print(". Frontières")
+ boun_6_1 = HOMARD.CreateBoundaryDi('intersection', nomfr, ficfrmed)
+ #
+ boun_6_2 = HOMARD.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+ #
+ boun_6_3 = HOMARD.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+ #
+ boun_6_6 = HOMARD.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+ #
+ boun_6_5 = HOMARD.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+ #
+ # Hypotheses
+ # ==========
+ if verbose :
+ print(". Hypothèses")
+ # Creation of the hypothesis hypo_0_1
+ l_hypothese_0_1 = HOMARD.CreateHypothesis('hypo_6_0_1')
+ l_hypothese_0_1.SetUnifRefinUnRef(1)
+ l_hypothese_0_1.AddGroup('IN1')
+ l_hypothese_0_1.AddGroup('IN2')
+ l_hypothese_0_1.AddGroup('T1_INT_I')
+ l_hypothese_0_1.AddGroup('T1_INT_O')
+ l_hypothese_0_1.AddGroup('T2_INT')
+ # Creation of the hypothesis hypo_1_2
+ l_hypothese_1_2 = HOMARD.CreateHypothesis('hypo_6_1_2')
+ l_hypothese_1_2.SetUnifRefinUnRef(1)
+ l_hypothese_1_2.AddGroup('T1_EXT_I')
+ l_hypothese_1_2.AddGroup('T1_EXT_O')
+ l_hypothese_1_2.AddGroup('T2_EXT')
+ # Creation of the hypothesis hypo_2_3
+ l_hypothese_2_3 = HOMARD.CreateHypothesis('hypo_6_2_3')
+ l_hypothese_2_3.SetUnifRefinUnRef(1)
+ l_hypothese_2_3.AddGroup('INT_I')
+ l_hypothese_2_3.AddGroup('INT_E')
+ l_hypothese_2_3.AddGroup('IN1')
+ l_hypothese_2_3.AddGroup('IN2')
+ #
+ # Cas
+ # ===
+ if verbose :
+ print(". Cas")
+ le_cas = HOMARD.CreateCase('case_'+nom, nom, ficmed)
+ le_cas.SetDirName(DIRCASE)
+ le_cas.AddBoundary( 'intersection' )
+ le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_I' )
+ le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_I' )
+ le_cas.AddBoundaryGroup( 'cyl_1_int', 'T1_INT_O' )
+ le_cas.AddBoundaryGroup( 'cyl_1_ext', 'T1_EXT_O' )
+ le_cas.AddBoundaryGroup( 'cyl_2_int', 'T2_INT' )
+ le_cas.AddBoundaryGroup( 'cyl_2_ext', 'T2_EXT' )
+ #
+ # Itérations
+ # ==========
+ if verbose :
+ option = 2
+ else :
+ option = 1
+ if verbose :
+ print(". Itérations")
+ # Iteration iter_6_1 : raffinement selon les faces internes
+ iter_6_1 = le_cas.NextIteration('iter_6_1')
+ iter_6_1.SetMeshName('PIQUAGE_1')
+ iter_6_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+ iter_6_1.AssociateHypo('hypo_6_0_1')
+ erreur = iter_6_1.Compute(1, option)
+ print ("erreur = %d" % erreur)
+ if erreur :
+ break
+ # Iteration iter_6_2 : raffinement selon les faces externes
+ iter_6_2 = iter_6_1.NextIteration('iter_6_2')
+ iter_6_2.SetMeshName('PIQUAGE_2')
+ iter_6_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+ iter_6_2.AssociateHypo('hypo_6_1_2')
+ erreur = iter_6_2.Compute(1, option)
+ if erreur :
+ break
+ # Iteration iter_6_3 : second raffinement selon les faces externes
+ iter_6_3 = iter_6_2.NextIteration('iter_6_3')
+ iter_6_3.SetMeshName('PIQUAGE_3')
+ iter_6_3.SetMeshFile(os.path.join(DIRCASE, "maill.03.med"))
+ iter_6_3.AssociateHypo('hypo_6_2_3')
+ erreur = iter_6_3.Compute(1, option)
+ if erreur :
+ break
+ #
+ break
+ #
+ if erreur :
+ message += "Erreur au calcul de l'itération %d" % erreur
+ #
+ return erreur, message
+#
+#========================== Fin de la fonction ==================================
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
+ #
+ # A. Exec of HOMARD-SALOME
+ #
+ HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
+ assert HOMARD is not None, "Impossible to load homard engine"
+ HOMARD.SetLanguageShort("fr")
+#
+ FICMED = os.path.join(DATA_TUTORIAL, "tutorial_4.00.med")
+ FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
+ try:
+ ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, "COURBES", FICFRMED, DEBUG)
+ except Exception, eee:
+ ERREUR = 2
+ MESSAGE = eee.message
+ #
+ if ERREUR :
+ MESSAGE += "Pb in homard_exec"
+ break
+ #
+ # B. Test of the results
+ #
+ N_REP_TEST_FILE = N_ITER_TEST_FILE
+ DESTROY_DIR = not DEBUG
+ test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+ #
+ break
+#
+if ERREUR:
+ raise Exception(MESSAGE)
+#
+# ==================================
+gzip_gunzip(DATA_TUTORIAL, 4, 1)
+gzip_gunzip(DATA_TUTORIAL, 6, 1)
+# ==================================
+#
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
+ iparameters.getSession().restoreVisualState(1)
+