# List of targets in this project we want to make visible to the rest of the world.
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
SET(_${PROJECT_NAME}_exposed_targets
- HOMARDImpl HOMARDEngine HOMARD SalomeIDLHOMARD
+ HOMARDImpl HOMARDEngine HOMARD SalomeIDLHOMARD FrontTrack
)
# Add all targets to the build-tree export set
#
# - Config file for the @PROJECT_NAME@ package
-# It defines the following variables.
+# It defines the following variables.
# Specific to the pacakge @PROJECT_NAME@ itself:
# @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file
#
### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
@PACKAGE_INIT@
-# Load the dependencies for the libraries of @PROJECT_NAME@
-# (contains definitions for IMPORTED targets). This is only
+# Load the dependencies for the libraries of @PROJECT_NAME@
+# (contains definitions for IMPORTED targets). This is only
# imported if we are not built as a subproject (in this case targets are already there)
IF(NOT TARGET HOMARDEngine AND NOT @PROJECT_NAME@_BINARY_DIR)
INCLUDE("@PACKAGE_SALOME_INSTALL_CMAKE_LOCAL@/@PROJECT_NAME@Targets.cmake")
-ENDIF()
+ENDIF()
# Package root dir:
SET_AND_CHECK(HOMARD_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@")
SET(SALOME_INSTALL_SCRIPT_DATA "@SALOME_INSTALL_SCRIPT_DATA@")
SET(SALOME_INSTALL_SCRIPT_PYTHON "@SALOME_INSTALL_SCRIPT_PYTHON@")
SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "@SALOME_INSTALL_APPLISKEL_SCRIPTS@")
-SET(SALOME_INSTALL_APPLISKEL_PYTHON "@SALOME_INSTALL_APPLISKEL_PYTHON@")
+SET(SALOME_INSTALL_APPLISKEL_PYTHON "@SALOME_INSTALL_APPLISKEL_PYTHON@")
SET(SALOME_INSTALL_CMAKE_LOCAL "@SALOME_INSTALL_CMAKE_LOCAL@")
SET(SALOME_INSTALL_PYTHON "@SALOME_INSTALL_PYTHON@")
SET(SALOME_INSTALL_PYTHON_SHARED "@SALOME_INSTALL_PYTHON_SHARED@")
SET(SALOME_INSTALL_AMCONFIG_LOCAL "@SALOME_INSTALL_AMCONFIG_LOCAL@")
# Include SMESH targets if they were not already loaded:
-IF(NOT (TARGET SMESHEngine))
+IF(NOT (TARGET SMESHEngine))
INCLUDE("${SMESH_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE}/SalomeSMESHTargets.cmake")
ENDIF()
# Exposed HOMARD targets:
SET(HOMARD_HOMARDImpl HOMARDImpl)
+SET(HOMARD_FrontTrack FrontTrack)
SET(HOMARD_HOMARDEngine HOMARDEngine)
SET(HOMARD_HOMARD HOMARD)
SET(HOMARD_SalomeIDLHOMARD SalomeIDLHOMARD)
.. image:: images/intro_31.png
:align: center
-Two answers must be given: the directory that will contain the files produced by the further adaptations and the MED file from the initial calculation. In this case, the default options are left unchanged: conformity of the mesh and no curved boundaries. Validate by "Apply and close".
+Two answers must be given: the directory that will contain the files produced by the further adaptations and the MED file from the initial calculation. In this case, the default options are left unchanged: conformity of the mesh and no curved boundaries. Validate by "OK".
.. image:: images/intro_32.png
:align: center
.. image:: images/intro_36.png
:align: center
-The creation of the hypothesis is validated by "Apply and close"; the creation of the new iteration is validated too. The object browser is enriched by the description of this hypothesis and this iteration. The iteration can be seen with a specific icon "waiting".
+The creation of the hypothesis is validated by "OK"; the creation of the new iteration is validated too. The object browser is enriched by the description of this hypothesis and this iteration. The iteration can be seen with a specific icon "waiting".
The adaptation is launched by the selection of the iteration. "*Compute*" is choosen either in the menu, or with the mouse. The MED file of the new mesh, ``maill.01.med``, and some files for information are included into the object browser. Note that the MED file of the new mesh is located into the directory of the case.
############
.. index:: single: boundary
.. index:: single: frontière
+.. index:: single: CAO
The object boundary contains all the geometrical definitions allowing to describe a curved boundary to be followed.
There are two modes of description of a boundary:
- - Discrete: this mode is used to describe a curve 1D
- - Analytics: this mode is used to describe a surface
+ - CAO: the boundary comes from the geometry of the domain
+ - Non CAO: if the CAO is not available, the boundary can be approxaimted by its descriptions:
+ * Discrete: to describe the set of 1D curves that defines the boundary
+ * Analytics: to describe every surface that defines the boundary
+
+This choice is:
+
+.. image:: images/create_boundary_1.png
+ :align: center
+
+CAO boundary
+************
+
+The follow-up of a CAO boundary will be made by selecting a boundary chosen in the list of the existing CAO boundaries.
+
+In the starting up, the list is empty. It is necessary to create a first CAO boundary by activation of the button "*New*":
+
+.. image:: images/create_boundary_cao_1.png
+ :align: center
+
+The window invites in the choice of a file that contains the CAO with XAO format. This CAO is the one that is the basis for the initial mesh. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary, whatever its type.
+
+.. image:: images/create_boundary_cao_2.png
+ :align: center
+
+.. note::
+ The coherence between this CAO and the initial mesh is not checked.
Discrete boundary
*****************
The follow-up of a discrete boundary will be made by selecting a boundary chosen in the list of the existing discrete boundaries.
-In the starting up, the list is empty. It is necessary to create a first discrete boundary by activation of the button "*New*" :
+In the starting up, the list is empty. It is necessary to create a first discrete boundary by activation of the button "*New*":
.. image:: images/create_boundary_di_1.png
:align: center
-The window invites in the choice of a file of mesh. This mesh is the one of all the lines constituting the boundary. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary.
+The window invites in the choice of a file of mesh. This mesh is the one of all the lines constituting the boundary. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary, whatever its type.
.. image:: images/create_boundary_di_2.png
:align: center
========
.. index:: single: cylindre
-The cylinder is defined by a point of the axis, its axis and its radius. The axis is defined by a vector. The standard of this vector is not inevitably equal to 1; also, its orientation has no importance. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary.
+The cylinder is defined by a point of the axis, its axis and its radius. The axis is defined by a vector. The standard of this vector is not inevitably equal to 1; also, its orientation has no importance. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary, whatever its type.
.. image:: images/create_boundary_an_cy.png
:align: center
======
.. index:: single: sphere
-The sphere is defined by its center and its radius. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary.
+The sphere is defined by its center and its radius. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary, whatever its type.
.. image:: images/create_boundary_an_sp.png
:align: center
====
.. index:: single: cone
-A cone is defined by two different manners: the center, the axis and the angle of opening in degree or by two points centered on the axis and the associated radius. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary.
+A cone is defined by two different manners: the center, the axis and the angle of opening in degree or by two points centered on the axis and the associated radius. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary, whatever its type.
Creation by an origin, an axis and an angle of opening:
=====
.. index:: single: torus
-The torus is defined by its centre, its axis, the revolution radius and the primary radius. The axis is defined by a vector. The standard of this vector is not inevitably equal to 1; also, its orientation has no importance. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary.
+The torus is defined by its centre, its axis, the revolution radius and the primary radius. The axis is defined by a vector. The standard of this vector is not inevitably equal to 1; also, its orientation has no importance. A name of boundary is automatically proposed: Boun_1, Boun_2, etc. This name can be modified. It must not already have been used for another boundary, whatever its type.
.. image:: images/create_boundary_an_to.png
:align: center
**************
At the end of this creation of boundaries, the object browser was enriched. We find all the boundaries created, identified there by their name, with the possibility of editing them.
-.. image:: images/create_boundary_1.png
+.. image:: images/create_boundary.png
:align: center
Corresponding python functions
Two situations:
-* 1D curve: this curve may be defined into a plane, for example for a 2D calculation. It can also be defined into the 3D space, for example to describe the intersection of two surfaces. Such a line is defined with a discrete desription.
-* a surface: such a surface is defined with an analytical description.
+- CAO: the CAO of the domain is available. The computtion will rely on it to project the nodes.
+- No CAO: if no CAO is available, an approximative approach is possible:
+
+ * 1D curve: this curve may be defined into a plane, for example for a 2D calculation. It can also be defined into the 3D space, for example to describe the intersection of two surfaces. Such a line is defined with a discrete desription.
+ * a surface: such a surface is defined with an analytical description.
Check the button:
-.. image:: images/create_case_5.png
+.. image:: images/create_boundary_1.png
:align: center
The definition of the boundaries is described in :doc:`gui_create_boundary`.
+----------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------+
+| .. module:: CreateBoundaryCAO |
+| |
+| **CreateBoundaryCAO(boundary_name, xao_file)** |
+| Returns an instance of the class ``boundary``, type CAO after its creation |
+| |
+| - ``boundary_name``: the name of the CAO boundary |
+| - ``xao_file``: the name of the file for this CAO, with format XAO |
++----------------------------------------------------------------------------------------+
| .. module:: CreateBoundaryDi |
| |
| **CreateBoundaryDi(boundary_name, mesh_name, mesh_file)** |
| |
| - ``boundary_name``: the name of the discrete boundary |
| - ``mesh_name``: the name of the mesh of the boundary |
-| - ``mesh_file``: the name of the file for this mesh |
+| - ``mesh_file``: the name of the file for this mesh, with format MED |
+----------------------------------------------------------------------------------------+
| .. module:: CreateBoundaryCylinder |
| |
+---------------------------------------------------------------+
+---------------------------------------------------------------+
-| .. module:: AddBoundaryGroup |
+| .. module:: AddBoundary |
| |
-| **AddBoundaryGroup(boundary, group)** |
+| **AddBoundary(boundary)** |
| Add a boundary to the definition of a case |
| |
| - ``boundary``: name of the curved boundary |
++---------------------------------------------------------------+
+| .. module:: AddBoundaryGroup |
+| |
+| **AddBoundaryGroup(boundary, group)** |
+| Add a boundary to the definition of a case with a |
+| filtering by groups |
| |
-| Discrete boundary: |
+| - ``boundary``: name of the curved boundary |
| |
-| . if all the curved lines are involved, the second |
-| argument is an empty string. |
+| Discrete or CAO boundary: |
| |
-| . if only some curved lines are involved, ``group`` is |
-| the name of the group of segments |
+| - ``group``: the name of a group of meshes |
| |
| Analytical boundary: |
| |
-| - ``group``: name of the groupe of faces located on the |
+| - ``group``: name of the groups of faces located on the |
| boundary |
+---------------------------------------------------------------+
| **GetType()** |
| Returns the type of the boundary: |
| |
+| * -1: CAO |
| * 0: discrete |
| * 1: cylinder |
| * 2: sphere |
| **Delete()** |
| Deletes the boundary. |
| If the boundary is discrete, the file of the mesh is kept.|
+| If the boundary is CAO, the xao file of the geometry is |
+| kept. |
| |
| Returns an integer: |
| * 0: the destruction is done |
Example
*******
+Creation of a CAO boundary: ::
+
+ la_cao = homard.CreateBoundaryCAO("BLOC", dircase+'/tutorial_6.xao')
+
Creation of a discrete boundary, a spherical boundary, and a cylindrical boundary:
::
import HOMARD
homard = salome.lcc.FindOrLoadComponent('FactoryServer','HOMARD')
+ homard.UpdateStudy()
To use the module HOMARD within a distributed scheme YACS, the loading is made as follows:
import HOMARD
my_container.load_component_Library('HOMARD')
homard = my_container.create_component_instance('HOMARD',0)
+ homard.UpdateStudy()
Uniform refinement
******************
.. literalinclude:: ../files/tutorial_1.py
- :lines: 52-85
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Download the files
One proceeds here to refinement according to zones. To pass from the initial mesh to the mesh 'M_1', one uses a box framing the z=1 plane and a sphere centered on the origin with radius 1.05. Then to pass from the mesh 'M_1' to the mesh 'M_2', one replaces the sphere by a box framing the cube on side 0.5, pointing on the origin and the meshes in the very first zone are unrefined.
.. literalinclude:: ../files/tutorial_2.py
- :lines: 52-95
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Download the files
To adapt the H_1 mesh resulting from the Iter_1 iteration, two alternatives are applied. In the first, Iter_2, the field is a scalar field of indicators of error and one cuts out the 1.5% of elements where the error is largest. In the second alternative, Iter_2_bis, one is based on a vector field and one examines the jump of this vector between an element and its neighbors: one will cut out where the infinite standard of this jump is higher than the absolute threshold of 0.0001.
.. literalinclude:: ../files/tutorial_3.py
- :lines: 52-124
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Download the files
Non plane boundaries
********************
-.. index:: single: field
+.. index:: single: boundary
+.. index:: single: CAO
.. index:: single: YACS
-One tests the follow-up of the curved borders here: analytical borders to describe various surfaces of the pipes and a discrete border to describe the intersecting lines of the two pipes. The driving of refinement is the following: uniform refinement of all the elements contained in indicated groups. One starts by refining the inner faces with the pipes; then, one refines continuation twice the external faces with the pipes.
+One tests the follow-up of the curved borders here, giving the representation of the domain by its CAO. That CAO is given in a XAO format file.
+The driving of refinement is the following: uniform refinement of all the elements contained in indicated groups. One starts by refining the inner faces with the pipes; then, one refines continuation twice the external faces with the pipes.
Scheme YACS carrying out this adaptation is downloadable.
.. literalinclude:: ../files/tutorial_4.py
- :lines: 52-111
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
- Download the files
+ Téléchargement des fichiers
* :download:`initial mesh<../files/tutorial_4.00.med.gz>`
- * :download:`mesh of the discrete boundary<../files/tutorial_4.fr.med.gz>`
- * :download:`python script<../files/tutorial_4.py>`
+ * :download:`CAO<../files/tutorial_4.xao.gz>`
+ * :download:`python scrip<../files/tutorial_4.py>`
* :download:`python script for the compression<../files/tutorial_util.py>`
* :download:`YACS scheme<../files/tutorial_4.xml>`
+If the CAO is not available, the boundaries can be approximated: analytical borders to describe various surfaces of the pipes and a discrete border to describe the intersecting lines of the two pipes. Only the definition of the boundaries has to be modified.
+
+.. literalinclude:: ../files/tutorial_6.py
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
+
+.. note::
+ Download the files
+
+ * :download:`initial mesh<../files/tutorial_4.00.med.gz>`
+ * :download:`mesh of the discrete boundary<../files/tutorial_6.fr.med.gz>`
+ * :download:`python script<../files/tutorial_6.py>`
+ * :download:`python script for the compression<../files/tutorial_util.py>`
+ * :download:`YACS scheme<../files/tutorial_6.xml>`
+
Specific instructions for a 2D mesh
***********************************
In the case presented here, one for the first time refines all the elements contained in a bored disk, then in one second iteration, all the elements contained in a rectangle. One will note the use of the follow-up of the circular borders of the field.
.. literalinclude:: ../files/tutorial_5.py
- :lines: 52-95
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Download the files
.. toctree::
:maxdepth: 2
+
"""
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")
+homard.UpdateStudy()
+#
+#============================= 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")
+homard.UpdateStudy()
+#
+#============================= Début des commandes =============================
#
# Creation des zones
# ==================
#
# 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")
+homard.UpdateStudy()
+#
+#============================= Début des commandes =============================
#
# Hypothese "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")
+homard.UpdateStudy()
#
-# 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)
# ==================================
<?xml version='1.0' encoding='iso-8859-1' ?>
<proc name="tutorial_4">
+ <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">
<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>
clt = orbmodule.client()
CurrentStudy = clt.Resolve("/Study")
]]></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.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")
+homard.UpdateStudy()
#
-# 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)
+erreur = iter_5_1.Compute(1, 2)
#
# Iteration "iter_5_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)
-
+erreur = 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.4"
+#
+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', 'COURBES', 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('IN1')
+l_hypothese.AddGroup('IN2')
+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 ==================================
#
"""
Lancement d'un calcul ASTER
"""
-__revision__ = "V5.9"
+__revision__ = "V5.11"
#
import sys
import os
"""
Pseudo-lancement d'un calcul pour valider les tests
"""
-__revision__ = "V2.1"
+__revision__ = "V2.2"
#
import sys
import os
############
.. index:: single: boundary
.. index:: single: frontière
+.. index:: single: CAO
L'objet frontière contient toutes les définitions géométriques permettant de décrire une frontière courbe à suivre.
Il existe deux modes de description d'une frontière :
- - Discrète : ce mode est utilisé pour décrire une courbe 1D
- - Analytique : ce mode est utilisé pour décrire une surface
+ - CAO : la frontière est issue de la géométrie du domaine
+ - Non CAO : si on ne dispose pas de la géométrie, on peut approcher la frontière par des descriptions :
+ * Discrète : pour décrire l'ensemble des courbes 1D composant la frontière
+ * Analytique : pour décrire chaque surface composant la frontière
+
+Le choix est exclusif :
+
+.. image:: images/create_boundary_1.png
+ :align: center
+
+Frontière CAO
+*************
+
+Le suivi d'une frontière CAO se fera en sélectionnant une frontière choisie dans la liste des frontières CAO enregistrées.
+
+Au démarrage, la liste est vide. Il faut créer une première frontière CAO par activation du bouton "*Nouveau*" :
+
+.. image:: images/create_boundary_cao_1.png
+ :align: center
+
+La fenêtre proposée invite au choix d'un fichier contenant une CAO au format XAO. Cette est celle de la géométrie qui est le support du maillage. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière, quel que soit son type.
+
+.. image:: images/create_boundary_cao_2.png
+ :align: center
+
+.. note::
+ La cohérence entre cette CAO et le maillage initial n'est pas contrôlée.
Frontière discrète
******************
-Le suivi d'une frontière discrète se fera en sélectionnant une frontière choisie dans la liste des frontières discrètes existantes.
+Le suivi d'une frontière discrète se fera en sélectionnant une frontière choisie dans la liste des frontières discrètes enregistrées.
Au démarrage, la liste est vide. Il faut créer une première frontière discrète par activation du bouton "*Nouveau*" :
.. image:: images/create_boundary_di_1.png
:align: center
-La fenêtre proposée invite au choix d'un fichier de maillage. Ce maillage est celui de toutes les lignes constituant la frontière. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière.
+La fenêtre proposée invite au choix d'un fichier de maillage. Ce maillage est celui de toutes les lignes constituant la frontière. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière, quel que soit son type.
.. image:: images/create_boundary_di_2.png
:align: center
===========
.. index:: single: cylindre
-Le cylindre est défini par un point de l'axe, son axe et son rayon. L'axe est défini par un vecteur. La norme de ce vecteur n'est pas nécessairement égale à 1 ; de même, son orientation n'a aucune importance. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière.
+Le cylindre est défini par un point de l'axe, son axe et son rayon. L'axe est défini par un vecteur. La norme de ce vecteur n'est pas nécessairement égale à 1 ; de même, son orientation n'a aucune importance. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière, quel que soit son type.
.. image:: images/create_boundary_an_cy.png
:align: center
==========
.. index:: single: sphere
-La sphère est définie par son centre et son rayon. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière.
+La sphère est définie par son centre et son rayon. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière, quel que soit son type.
.. image:: images/create_boundary_an_sp.png
:align: center
=======
.. index:: single: cone
-Un cône est défini de deux manières différentes : le centre, l'axe et l'angle d'ouverture en degré ou par deux points centrés sur l'axe et le rayon associé. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière.
+Un cône est défini de deux manières différentes : le centre, l'axe et l'angle d'ouverture en degré ou par deux points centrés sur l'axe et le rayon associé. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière, quel que soit son type.
Création par une origine, un axe et un angle d'ouverture :
=======
.. index:: single: tore
-Le tore est défini par son centre, son axe, le rayon de révolution et le rayon primaire. L'axe est défini par un vecteur. La norme de ce vecteur n'est pas nécessairement égale à 1 ; de même, son orientation n'a aucune importance. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière.
+Le tore est défini par son centre, son axe, le rayon de révolution et le rayon primaire. L'axe est défini par un vecteur. La norme de ce vecteur n'est pas nécessairement égale à 1 ; de même, son orientation n'a aucune importance. Un nom de frontière est proposé automatiquement : Boun_1, Boun_2, etc. Ce nom peut être modifié. Il ne doit pas avoir déjà été utilisé pour une autre frontière, quel que soit son type.
.. image:: images/create_boundary_an_to.png
:align: center
A l'issue de cette création de frontières, l'arbre d'études a été enrichi. On y trouve toutes les frontières créées, identifiées par leur nom, avec la possibilité de les éditer.
-.. image:: images/create_boundary_1.png
+.. image:: images/create_boundary.png
:align: center
Deux cas de figure sont présents :
-* courbe 1D : cette courbe peut être définie dans un plan, par exemple pour un calcul 2D. Elle peut également être définie dans l'espace 3D, par exemple pour l'intersection de deux surfaces. Une ligne à suivre est décrite de manière discrète.
-* surface : une surface à suivre est décrite de manière analytique.
+- CAO : la CAO du domaine associé au maillage est disponible. Le calcul s'appuiera sur elle pour réaliser les projections.
+- Pas de CAO : en l'absence de CAO, il est possible d'avoir une version approchée des frontières :
-On cochera le ou les boutons voulus :
+ * courbe 1D : cette courbe peut être définie dans un plan, par exemple pour un calcul 2D. Elle peut également être définie dans l'espace 3D, par exemple pour l'intersection de deux surfaces. Une ligne à suivre est décrite de manière discrète.
+ * surface : une surface à suivre est décrite de manière analytique.
-.. image:: images/create_case_5.png
+On cochera le bouton voulu :
+
+.. image:: images/create_boundary_1.png
:align: center
La définition des frontières est décrite dans :doc:`gui_create_boundary`.
+----------------------------------------------------------------------------------------+
+----------------------------------------------------------------------------------------+
+| .. module:: CreateBoundaryCAO |
+| |
+| **CreateBoundaryCAO(boundary_name, xao_file)** |
+| Retourne une instance de la classe ``boundary`` de type CAO après sa création |
+| |
+| - ``boundary_name`` : le nom de la frontière CAO |
+| - ``xao_file`` : le nom du fichier contenant cette CAO, au format XAO |
++----------------------------------------------------------------------------------------+
| .. module:: CreateBoundaryDi |
| |
| **CreateBoundaryDi(boundary_name, mesh_name, mesh_file)** |
| |
| - ``boundary_name`` : le nom de la frontière discrète |
| - ``mesh_name`` : le nom du maillage de la frontière |
-| - ``mesh_file`` : le nom du fichier contenant ce maillage |
+| - ``mesh_file`` : le nom du fichier contenant ce maillage, au format MED |
+----------------------------------------------------------------------------------------+
| .. module:: CreateBoundaryCylinder |
| |
+---------------------------------------------------------------+
+---------------------------------------------------------------+
-| .. module:: AddBoundaryGroup |
+| .. module:: AddBoundary |
| |
-| **AddBoundaryGroup(boundary, group)** |
+| **AddBoundary(boundary)** |
| Ajoute une frontière à la définition du cas |
| |
| - ``boundary`` : nom d'une frontière courbe à suivre |
++---------------------------------------------------------------+
+| .. module:: AddBoundaryGroup |
+| |
+| **AddBoundaryGroup(boundary, group)** |
+| Ajoute une frontière à la définition du cas en précisant |
+| les groupes associés |
| |
-| Pour une frontière discrète : |
+| - ``boundary`` : nom d'une frontière courbe à suivre |
| |
-| . si toutes les lignes courbes sont suivies, le second |
-| argument est une chaîne vide. |
+| Pour une frontière discrète ou CAO : |
| |
-| . si seulement certaines lignes courbes sont suivies, |
-| ``group`` est le nom d'un groupe de segments à suivre. |
+| - ``group`` : nom d'un groupe de mailles à suivre |
| |
| Pour une frontière analytique : |
| |
| **GetType()** |
| Retourne le type de la frontière : |
| |
+| * -1 : CAO |
| * 0 : discrète |
| * 1 : cylindre |
| * 2 : sphère |
| .. module:: Delete |
| |
| **Delete()** |
-| Detruit la frontière. |
+| Détruit la frontière. |
| Pour une frontière discrète, le fichier du maillage |
| associé est conservé. |
+| Pour une frontière CAO, le fichier de la géométrie |
+| associée est conservé. |
| |
| Retourne un entier : |
| * 0 : destruction réussie |
Exemple
*******
-Création d'une frontière discrète, d'une frontière sphèrique, puis d'une frontière cylindrique : ::
+Création d'une frontière CAO : ::
+
+ la_cao = homard.CreateBoundaryCAO("BLOC", dircase+'/tutorial_6.xao')
+
+Création d'une frontière discrète, d'une frontière sphérique, puis d'une frontière cylindrique : ::
inter = homard.CreateBoundaryDi("INTERSECTION", 'PIQUAGE', dircase+'/tutorial_4.fr.med')
fron_1 = homard.CreateBoundarySphere("FRON_1", 12.3, 3.4, .56, 6.5)
| .. module:: SetDirName |
| |
| **SetDirName(dirname)** |
-| Affecte le répertoire des résutats associé au cas. Cela ne|
-| peut se faire qu'après la création du cas et avant le |
+| Affecte le répertoire des résultats associé au cas. Cela |
+| ne peut se faire qu'après la création du cas et avant le |
| premier calcul. |
| |
-| - ``dirname`` : le nom du répertoire des résutats |
+| - ``dirname`` : le nom du répertoire des résultats |
+---------------------------------------------------------------+
| .. module:: GetDirName |
| |
| **GetDirName()** |
-| Retourne le nom du répertoire des résutats associé au cas |
+| Retourne le nom du répertoire des résultats associé au cas|
+---------------------------------------------------------------+
| .. module:: SetConfType |
| |
| * 4 : moyenne + n fois l'écart-type |
| |
| - ``threshold`` : valeur numérique entrant dans la |
-| définition du seuil |
+| définition du seuil |
+---------------------------------------------------------------+
| .. module:: GetRefinThrType |
| |
| .. module:: GetDirName |
| |
| **GetDirName()** |
-| Retourne le nom du répertoire des résutats associé à |
+| Retourne le nom du répertoire des résultats associé à |
| l'itération |
+---------------------------------------------------------------+
| .. module:: Delete |
* le maillage produit porte toujours le même nom. Cela ne pose pas de problème car il est stocké dans des fichiers différents.
.. literalinclude:: ../files/tutorial_1.py
- :lines: 52-85
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Téléchargement des fichiers
On procède ici au raffinement selon des zones. Pour passer du maillage initial au maillage 'M_1', on utilise une boîte encadrant le plan z=1 et une sphère centrée sur l'origine de rayon 1.05. Puis pour passer du maillage 'M_1' au maillage 'M_2', on remplace la sphère par une boîte encadrant le cube de côté 0.5, pointant sur l'origine et on déraffine les mailles contenues dans la toute première zone.
.. literalinclude:: ../files/tutorial_2.py
- :lines: 52-95
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Téléchargement des fichiers
Pour adapter le maillage H_1 issu de l'itération Iter_1, deux variantes sont appliquées. Dans la première, Iter_2, le champ est un champ scalaire d'indicateurs d'erreur et on découpe les 1.5% de mailles où l'erreur est la plus grande. Dans la seconde variante, Iter_2_bis, on se base sur un champ vectoriel et on examine le saut de ce vecteur entre une maille et ses voisines : on découpera là où la norme infinie de ce saut est supérieure au seuil absolu de 0.0001.
.. literalinclude:: ../files/tutorial_3.py
- :lines: 52-124
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Téléchargement des fichiers
Suivi de frontières courbes
***************************
-.. index:: single: champ
+.. index:: single: frontière
+.. index:: single: CAO
.. index:: single: YACS
-On teste ici le suivi des frontières courbes : des frontières analytiques pour décrire les différentes surfaces des tuyaux et une frontière discrète pour décrire les lignes d'intersection des deux tuyaux. Le pilotage du raffinement est le suivant : raffinement uniforme de toutes les mailles contenues dans des groupes désignés. On commence par raffiner les faces internes aux tuyaux ; ensuite, on raffine deux fois de suite les faces externes aux tuyaux.
+On teste ici le suivi des frontières courbes en fournissant la géométrie représentée par la CAO de la pièce. Cette CAO est fournie dans un fichier au format XAO.
+Le pilotage du raffinement est le suivant : raffinement uniforme de toutes les mailles contenues dans des groupes désignés. On commence par raffiner les faces internes aux tuyaux ; ensuite, on raffine deux fois de suite les faces externes aux tuyaux.
Le schéma YACS réalisant cette adaptation est téléchargeable.
.. literalinclude:: ../files/tutorial_4.py
- :lines: 52-111
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Téléchargement des fichiers
* :download:`maillage initial<../files/tutorial_4.00.med.gz>`
- * :download:`maillage de la frontière discrète<../files/tutorial_4.fr.med.gz>`
+ * :download:`la frontière en CAO<../files/tutorial_4.xao.gz>`
* :download:`commandes python<../files/tutorial_4.py>`
* :download:`commandes python de l'utilitaire de compression<../files/tutorial_util.py>`
* :download:`schéma YACS<../files/tutorial_4.xml>`
+Si la géométrie sous forme de CAO n'est pas disponible, on peut l'approcher ainsi :
+des frontières analytiques pour décrire les différentes surfaces des tuyaux et une frontière discrète pour décrire les lignes d'intersection des deux tuyaux. Il suffit de remplacer la définition des frontières.
+
+.. literalinclude:: ../files/tutorial_6.py
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
+
+.. note::
+ Téléchargement des fichiers
+
+ * :download:`maillage initial<../files/tutorial_4.00.med.gz>`
+ * :download:`maillage de la frontière discrète<../files/tutorial_6.fr.med.gz>`
+ * :download:`commandes python<../files/tutorial_6.py>`
+ * :download:`commandes python de l'utilitaire de compression<../files/tutorial_util.py>`
+ * :download:`schéma YACS<../files/tutorial_6.xml>`
+
Instructions spécifiques au 2D
******************************
Dans le cas présenté ici, on raffine une première fois toutes les mailles contenues dans un disque percé, puis dans une seconde itération, toutes les mailles contenues dans un rectangle. On notera l'utilisation du suivi des frontières circulaires du domaine.
.. literalinclude:: ../files/tutorial_5.py
- :lines: 52-95
+ :start-after: Début des commandes
+ :end-before: Fin des commandes
.. note::
Téléchargement des fichiers
<component-username>HOMARD</component-username>
<component-type>OTHER</component-type>
<component-author>EDF</component-author>
- <component-version>1.6</component-version>
+ <component-version>1.7</component-version>
<component-comment>unknown</component-comment>
<component-impltype>1</component-impltype>
<component-icone>HOMARD_2.png</component-icone>
<component-interface-name>HOMARD_Gen</component-interface-name>
<component-interface-comment>unknown</component-interface-comment>
<component-service-list>
+ <component-service>
+ <service-name>CreateBoundaryCAO</service-name>
+ <service-author>EDF</service-author>
+ <service-version>1.7</service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list>
+ <inParameter>
+ <inParameter-name>BoundaryName</inParameter-name>
+ <inParameter-type>string</inParameter-type>
+ <inParameter-comment>unknown</inParameter-comment>
+ </inParameter>
+ <inParameter>
+ <inParameter-name>FileName</inParameter-name>
+ <inParameter-type>string</inParameter-type>
+ <inParameter-comment>unknown</inParameter-comment>
+ </inParameter>
+ </inParameter-list>
+ <outParameter-list>
+ <outParameter>
+ <outParameter-name>return</outParameter-name>
+ <outParameter-type>HOMARD/HOMARD_Boundary</outParameter-type>
+ <outParameter-comment>unknown</outParameter-comment>
+ </outParameter>
+ </outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
<component-service>
<service-name>CreateBoundaryDi</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateBoundaryCylinder</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateBoundarySphere</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateBoundaryConeR</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateBoundaryConeA</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateBoundaryTorus</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateCase</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateCaseFromIteration</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateCaseFromCaseLastIteration</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateCaseFromCaseIteration</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateHypothesis</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateZoneBox</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateZoneBox2D</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateZoneCylinder</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateZoneDisk</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateZoneDiskWithHole</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateZonePipe</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>CreateZoneSphere</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>GetBoundary</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>GetCase</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>GetHypothesis</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>GetIteration</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>GetZone</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>GetAllBoundarysName</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
<component-service>
<service-name>GetAllCasesName</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
<component-service>
<service-name>GetAllHypothesesName</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
<component-service>
<service-name>GetAllIterationsName</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
<component-service>
<service-name>GetAllZonesName</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
<component-service>
<service-name>MeshInfo</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>LastIteration</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
+ <component-service>
+ <service-name>UpdateStudy</service-name>
+ <service-author>EDF</service-author>
+ <service-version>1.7</service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list></inParameter-list>
+ <outParameter-list></outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
+ <component-service>
+ <service-name>SetLanguageShort</service-name>
+ <service-author>EDF</service-author>
+ <service-version>1.7</service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list>
+ <inParameter>
+ <inParameter-name>LanguageShort</inParameter-name>
+ <inParameter-type>string</inParameter-type>
+ <inParameter-comment>unknown</inParameter-comment>
+ </inParameter>
+ </inParameter-list>
+ <outParameter-list></outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
+ <component-service>
+ <service-name>GetLanguageShort</service-name>
+ <service-author>EDF</service-author>
+ <service-version>1.7</service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list></inParameter-list>
+ <outParameter-list>
+ <outParameter>
+ <outParameter-name>return</outParameter-name>
+ <outParameter-type>string</outParameter-type>
+ <outParameter-comment>unknown</outParameter-comment>
+ </outParameter>
+ </outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
<component-service>
<service-name>PublishFileUnderIteration</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>PublishBoundaryUnderCase</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>PublishResultInSmesh</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>PublishMeshIterInSmesh</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>SetLanguageShort</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<component-service>
<service-name>GetLanguageShort</service-name>
<service-author>EDF</service-author>
- <service-version>1.6</service-version>
+ <service-version>1.7</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list></inParameter-list>
void SetType (in long Type) raises (SALOME::SALOME_Exception);
long GetType() raises (SALOME::SALOME_Exception);
- void SetMeshFile(in string MeshFile) raises (SALOME::SALOME_Exception);
- string GetMeshFile() raises (SALOME::SALOME_Exception);
+ void SetDataFile(in string DataFile) raises (SALOME::SALOME_Exception);
+ string GetDataFile() raises (SALOME::SALOME_Exception);
void SetMeshName(in string MeshName) raises (SALOME::SALOME_Exception);
string GetMeshName() raises (SALOME::SALOME_Exception);
void SetGroups(in ListGroupType ListGroup) raises (SALOME::SALOME_Exception);
ListGroupType GetGroups() raises (SALOME::SALOME_Exception);
+ void AddBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception);
void AddBoundaryGroup(in string BoundaryName, in string Group)
raises (SALOME::SALOME_Exception);
ListBoundaryGroupType GetBoundaryGroup() raises (SALOME::SALOME_Exception);
//
// A.1. Les creations
//
+ HOMARD_Boundary CreateBoundaryCAO (in string BoundaryName, in string FileName)
+ raises(SALOME::SALOME_Exception);
HOMARD_Boundary CreateBoundaryDi (in string BoundaryName, in string MeshName, in string FileName)
raises(SALOME::SALOME_Exception);
HOMARD_Boundary CreateBoundaryCylinder (in string BoundaryName,
diskwithhole.png
diskwithhole_2.png
full_view.png
+ geometry.png
HOMARD.png
HOMARD_2.png
hypotheses.png
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
+ <component-service>
+ <service-name>UpdateStudy</service-name>
+ <service-author>HOMARD team - EDF RD</service-author>
+ <service-version>1.1</service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list></inParameter-list>
+ <outParameter-list></outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
<component-service>
<service-name>PublishBoundaryUnderCase</service-name>
<service-author>HOMARD team - EDF RD</service-author>
* \param [in] theInputMedFile - a MED file holding a mesh including nodes that will be
* moved onto the geometry
* \param [in] theOutputMedFile - a MED file to create, that will hold a modified mesh
- * \param [in] theNodeFiles - an array of names of files describing groups of nodes that
+ * \param [in] theInputNodeFiles - an array of names of files describing groups of nodes that
* will be moved onto the geometry
* \param [in] theXaoFileName - a path to a file in XAO format holding the geometry and
* the geometrical groups.
*/
void FrontTrack::track( const std::string& theInputMedFile,
const std::string& theOutputMedFile,
- const std::vector< std::string > & theNodeFiles,
+ const std::vector< std::string > & theInputNodeFiles,
const std::string& theXaoFileName,
bool theIsParallel )
{
// check arguments
+#ifdef _DEBUG_
+ std::cout << "FrontTrack::track" << std::endl;
+#endif
- if ( theNodeFiles.empty() )
+ if ( theInputNodeFiles.empty() )
return;
#ifdef _DEBUG_
- std::cout << "Input MED file:" << theInputMedFile << std::endl;
+ std::cout << "Input MED file: " << theInputMedFile << std::endl;
#endif
if ( !FT_Utils::fileExists( theInputMedFile ))
throw std::invalid_argument( "Input MED file does not exist: " + theInputMedFile );
#ifdef _DEBUG_
- std::cout << "Output MED file:" << theOutputMedFile << std::endl;
+ std::cout << "Output MED file: " << theOutputMedFile << std::endl;
#endif
if ( !FT_Utils::canWrite( theOutputMedFile ))
throw std::invalid_argument( "Can't create the output MED file: " + theOutputMedFile );
- for ( size_t i = 0; i < theNodeFiles.size(); ++i )
+ std::vector< std::string > theNodeFiles ;
+ for ( size_t i = 0; i < theInputNodeFiles.size(); ++i )
{
#ifdef _DEBUG_
- std::cout << "Input node file:" << theNodeFiles[i] << std::endl;
+ std::cout << "Initial input node file #"<<i<<": " << theInputNodeFiles[i] << std::endl;
#endif
- if ( !FT_Utils::fileExists( theNodeFiles[i] ))
- throw std::invalid_argument( "Input node file does not exist: " + theNodeFiles[i] );
+ if ( !FT_Utils::fileExists( theInputNodeFiles[i] ))
+ throw std::invalid_argument( "Input node file does not exist: " + theInputNodeFiles[i] );
+ // the name of the groupe on line #1, then the numbers of nodes on line #>1
+ // keep only files with more than 1 line:
+ std::ifstream fichier(theInputNodeFiles[i].c_str());
+ std::string s;
+ unsigned int nb_lines = 0;
+ while(std::getline(fichier,s)) ++nb_lines;
+// std::cout << ". nb_lines: " << nb_lines << std::endl;
+ if ( nb_lines >= 2 ) { theNodeFiles.push_back( theInputNodeFiles[i] ); }
}
+#ifdef _DEBUG_
+ for ( size_t i = 0; i < theNodeFiles.size(); ++i )
+ { std::cout << "Valid input node file #"<<i<<": " << theNodeFiles[i] << std::endl; }
+#endif
#ifdef _DEBUG_
- std::cout << "XAO file:" << theXaoFileName << std::endl;
+ std::cout << "XAO file: " << theXaoFileName << std::endl;
#endif
if ( !FT_Utils::fileExists( theXaoFileName ))
throw std::invalid_argument( "Input XAO file does not exist: " + theXaoFileName );
-
// read a mesh
#ifdef _DEBUG_
/*!
* \brief Relocate nodes to lie on geometry
- * \param [in] inputMedFile - a MED file holding a mesh including nodes that will be
+ * \param [in] theInputMedFile - a MED file holding a mesh including nodes that will be
* moved onto the geometry
- * \param [in] outputMedFile - a MED file to create, that will hold a modified mesh
- * \param [in] nodeFiles - an array of names of files describing groups of nodes that
+ * \param [in] theOutputMedFile - a MED file to create, that will hold a modified mesh
+ * \param [in] theInputNodeFiles - an array of names of files describing groups of nodes that
* will be moved onto the geometry
- * \param [in] xaoFileName - a path to a file in XAO format holding the geometry and
+ * \param [in] theXaoFileName - a path to a file in XAO format holding the geometry and
* the geometrical groups.
- * \param [in] isParallel - if \c true, all processors are used to treat boundary shapes
+ * \param [in] theIsParallel - if \c true, all processors are used to treat boundary shapes
* in parallel.
*/
- void track( const std::string& inputMedFile,
- const std::string& outputMedFile,
- const std::vector< std::string > & nodeFiles,
- const std::string& xaoFileName,
- bool isParallel=true);
+ void track( const std::string& theInputMedFile,
+ const std::string& theOutputMedFile,
+ const std::vector< std::string > & theInputNodeFiles,
+ const std::string& theXaoFileName,
+ bool theIsParallel=true);
};
// get shape dimension by the file name
// -------------------------------------
- // hope the file name is something like "fr2D.**"
+ // hope the file name is something like "frnD.**" with n in (1,2)
int dimPos = theNodeFile.size() - 5;
if ( theNodeFile[ dimPos ] == '2' )
_shapeDim = 2;
_shapeDim = 1;
else
throw std::invalid_argument( "Can't define dimension by node file name " + theNodeFile );
+#ifdef _DEBUG_
+ std::cout << ". Dimension of the file " << theNodeFile << ": " << _shapeDim << std::endl;
+#endif
// -------------------------------------
// read geom group names; several lines
while ( ::fgets( line, maxLineLen, file )) // read a line
{
if ( ::feof( file ))
+ {
return; // no nodes in the file
+ }
// check if the line describes node ids in format 3I10 (e.g. " 120 1 43\n")
size_t lineLen = strlen( line );
for ( size_t i = 0; i < geomNames.size(); ++i )
{
std::string & groupName = geomNames[i];
+#ifdef _DEBUG_
+ std::cout << ". Group name: " << groupName << std::endl;
+#endif
// remove trailing white spaces
for ( int iC = groupName.size() - 1; iC >= 0; --iC )
void FT_NodesOnGeom::projectAndMove()
{
_OK = true;
-
+//
+// 1. Préalables
+//
// check if all the shapes are planar
bool isAllPlanar = true;
for ( size_t i = 0; i < _projectors.size() && isAllPlanar; ++i )
std::cout << ".. _projectors.size() = " << _projectors.size() << std::endl;
std::cout << ".. _nodesOrder.size() = " << _nodesOrder.size() << std::endl;
#endif
+//
+// 2. Calculs
+// 2.1. Avec plusieurs shapes
+//
if ( _projectors.size() > 1 )
{
// the nodes are to be projected onto several boundary shapes;
}
}
}
+//
+// 2.2. Avec une seule shape
+//
else // one shape
{
for ( size_t i = 0; i < _nodesOrder.size(); ++i )
gp_Pnt xyz1 = getPoint( nn._neighborNodes[0] );
gp_Pnt xyz2 = getPoint( nn._neighborNodes[1] );
- // maxDist2 : le quart du carré de la distance entre les deux voisins du noued à bouger
+// maxDist2 : le quart du carré de la distance entre les deux voisins du noeud à bouger
double maxDist2 = xyz1.SquareDistance( xyz2 ) / 4.;
+#ifdef _DEBUG_
+ std::cout << "\n.. maxDist2 = " << maxDist2 << " entre " << nn._neighborNodes[0] << " et " << nn._neighborNodes[1] << " - milieu " << nn._nodeToMove << " - d/2 = " << sqrt(maxDist2) << " - d = " << sqrt(xyz1.SquareDistance( xyz2 )) << std::endl;
+#endif
if ( _projectors[ 0 ].project( xyz, maxDist2, newXyz,
nn._params, nn._nearParams ))
moveNode( nn._nodeToMove, newXyz );
notProjectedNodes.push_back( &nn );
}
}
-
-
+//
+// 3. Bilan
+//
if ( !notProjectedNodes.empty() )
{
// project nodes that are not projected by any of _projectors;
double* newSolution,
const double* prevSolution = 0)
{
+#ifdef _DEBUG_
+ std::cout << ".. project a point to the curve prevSolution = " << prevSolution << std::endl;
+#endif
gp_Pnt proj;
Standard_Real param;
{
_dist = _projector.Project( _curve, P, _tol, proj, param, false );
}
+#ifdef _DEBUG_
+ std::cout << ".. _dist : " << _dist << std::endl;
+#endif
proj = _curve.Value( param );
newSolution[0] = param;
double* newSolution,
const double* prevSolution = 0)
{
+#ifdef _DEBUG_
+ std::cout << ".. project a point to a curve and check " << std::endl;
+#endif
projection = project( point, newSolution, prevSolution );
return ( _uRange[0] < newSolution[0] && newSolution[0] < _uRange[1] &&
_dist * _dist < maxDist2 );
bool isStraight( const GeomAdaptor_Curve& curve, const double tol )
{
// rough check: evaluate how far from a straight line connecting the curve ends
- // stand several internal points of the curve
+ // stand several internal points of the curve
const double f = curve.FirstParameter();
const double l = curve.LastParameter();
//
switch (_Type)
{
+ case -1:
+ {
+ aScript << "CAO boundary " << _Name << "\n";
+ aScript << "\t" << _Name << " = homard.CreateBoundaryCAO(\"" << _Name << "\", ";
+ aScript << "\"" << _DataFile << "\")\n";
+ break ;
+ }
case 0:
{
aScript << "discrete boundary " << _Name << "\n";
aScript << "\t" << _Name << " = homard.CreateBoundaryDi(\"" << _Name << "\", ";
aScript << "\"" << _MeshName << "\", ";
- aScript << "\"" << _MeshFile << "\")\n";
+ aScript << "\"" << _DataFile << "\")\n";
break ;
}
case 1:
return _MeshName;
}
//=============================================================================
-void HOMARD_Boundary::SetMeshFile( const char* MeshFile )
+void HOMARD_Boundary::SetDataFile( const char* DataFile )
{
- _MeshFile = std::string( MeshFile );
+ _DataFile = std::string( DataFile );
}
//=============================================================================
-std::string HOMARD_Boundary::GetMeshFile() const
+std::string HOMARD_Boundary::GetDataFile() const
{
- return _MeshFile;
+ return _DataFile;
}
//=======================================================================================
void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2,
void SetMeshName( const char* MeshName );
std::string GetMeshName() const;
- void SetMeshFile( const char* MeshFile );
- std::string GetMeshFile() const;
+ void SetDataFile( const char* DataFile );
+ std::string GetDataFile() const;
void SetCylinder( double X0, double X1, double X2, double X3,
double X4, double X5, double X6 );
private:
std::string _Name;
std::string _NomCasCreation;
- std::string _MeshFile;
+ std::string _DataFile;
std::string _MeshName;
int _Type;
double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax;
//=============================================================================
int HOMARD_Cas::SetDirName( const char* NomDir )
{
- MESSAGE("SetDirName, NomDir : "<<NomDir);
- MESSAGE("SetDirName, _NomDir : "<<_NomDir);
+// MESSAGE("SetDirName, NomDir : "<<NomDir);
+// MESSAGE("SetDirName, _NomDir : "<<_NomDir);
int erreur = 0 ;
// On vérifie qu'aucun calcul n'a eu lieu pour ce cas
- MESSAGE("SetDirName, _ListIter.size() : "<<_ListIter.size());
+// MESSAGE("SetDirName, _ListIter.size() : "<<_ListIter.size());
if ( _ListIter.size() > 1 ) { erreur = 1 ; }
// Creation
if ( CHDIR(NomDir) == 0 )
// Les frontieres
//
//=============================================================================
+void HOMARD_Cas::AddBoundary( const char* Boundary )
+{
+// MESSAGE ( ". HOMARD_Cas::AddBoundary : Boundary = " << Boundary );
+ const char* Group = "";
+ AddBoundaryGroup( Boundary, Group );
+}
+//=============================================================================
void HOMARD_Cas::AddBoundaryGroup( const char* Boundary, const char* Group )
{
-// MESSAGE ( ". AddBoundaryGroup : Boundary = " << Boundary );
-// MESSAGE ( ". AddBoundaryGroup : Group = " << Group );
+// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary );
+// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group );
_ListBoundaryGroup.push_back( Boundary );
_ListBoundaryGroup.push_back( Group );
}
const std::list<std::string>& GetGroups() const;
void SupprGroups();
+ void AddBoundary( const char* Boundary );
void AddBoundaryGroup( const char* Boundary, const char* Group );
const std::list<std::string>& GetBoundaryGroup() const;
void SupprBoundaryGroup();
os << separator() << BoundaryType ;
os << separator() << boundary.GetCaseCreation() ;
- if ( BoundaryType == 0 )
+ if ( BoundaryType == -1 )
+ {
+ os << separator() << boundary.GetDataFile();
+ }
+ else if ( BoundaryType == 0 )
{
os << separator() << boundary.GetMeshName();
- os << separator() << boundary.GetMeshFile();
+ os << separator() << boundary.GetDataFile();
}
else {
std::vector<double> coor = boundary.GetCoords() ;
// Si analytique, les coordonnees des frontieres : le nombre depend du type
// Si discret, le maillage
+ // Si CAO, la géométrie
int lgcoords ;
- if ( BoundaryType == 1 ) { lgcoords = 7 ; }
+ if ( BoundaryType == -1 ) { lgcoords = -1 ; }
+ else if ( BoundaryType == 1 ) { lgcoords = 7 ; }
else if ( BoundaryType == 2 ) { lgcoords = 4 ; }
else { lgcoords = 0 ; }
//
- if ( lgcoords == 0 )
+ if ( lgcoords == -1 )
+ {
+ chunk = getNextChunk( stream, start, ok );
+ if ( !ok ) return false;
+ boundary.SetDataFile( chunk.c_str() );
+ }
+ else if ( lgcoords == 0 )
{
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
chunk = getNextChunk( stream, start, ok );
if ( !ok ) return false;
- boundary.SetMeshFile( chunk.c_str() );
+ boundary.SetDataFile( chunk.c_str() );
}
else
{ std::vector<double> coords;
else { _Texte += "CCAssoci saturne_2d\n" ; }
_Texte += "ModeHOMA 1\n" ;
_Texte += "NumeIter " + _siter + "\n" ;
+ _modeHOMARD = 1 ;
//
}
//===============================================================================
void HomardDriver::TexteInfo( int TypeBila, int NumeIter )
{
- MESSAGE("TexteInit, TypeBila ="<<TypeBila);
+ MESSAGE("TexteInfo: TypeBila ="<<TypeBila<<", NumeIter ="<<NumeIter);
//
_Texte += "ModeHOMA 2\n" ;
std::stringstream saux1 ;
_Texte += "Action info_ap\n" ;
_Texte += "CCAssoci homard\n" ;
}
+ _modeHOMARD = 2 ;
+//
+}
+//===============================================================================
+void HomardDriver::TexteMajCoords( int NumeIter )
+{
+ MESSAGE("TexteMajCoords: NumeIter ="<<NumeIter);
+//
+ _Texte += "ModeHOMA 5\n" ;
+ _Texte += "NumeIter " + _siterp1 + "\n" ;
+ _Texte += "Action homa\n" ;
+ _Texte += "CCAssoci med\n" ;
+ _Texte += "EcriFiHO N_SANS_FRONTIERE\n" ;
+ _modeHOMARD = 5 ;
//
}
//===============================================================================
std::string saux = saux1.str() ;
_Texte += "SuivFron " + saux + "\n" ;
//
+}//===============================================================================
+void HomardDriver::TexteBoundaryCAOGr( const std::string GroupName )
+{
+ MESSAGE("TexteBoundaryCAOGr, GroupName = "<<GroupName);
+//
+ _Texte += "GrFroCAO \"" + GroupName + "\"\n" ;
+//
}
+
//===============================================================================
void HomardDriver::TexteBoundaryDi( const std::string MeshName, const std::string MeshFile )
{
void HomardDriver::CreeFichier( )
{
//
- if ( _siter != _siterp1 )
+ if ( _modeHOMARD == 1 )
{ _NomFichierConf = _NomFichierConfBase + "." + _siter + ".vers." + _siterp1 ; }
- else
+ else if ( _modeHOMARD == 2 )
{ _NomFichierConf = _NomFichierConfBase + "." + _siter + ".info" ; }
+ else if ( _modeHOMARD == 5 )
+ { _NomFichierConf = _NomFichierConfBase + ".majc" ; }
//
std::ofstream Fic(_NomFichierConf.c_str(), std::ios::out ) ;
if (Fic.is_open() == true) { Fic << _Texte << std::endl ; }
//
void TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue );
void TexteInfo( int TypeBila, int NumeIter );
+ void TexteMajCoords( int NumeIter );
void CreeFichierDonn();
void TexteAdap( int ExtType );
void CreeFichier();
void TexteCompo( int NumeComp, const std::string NomCompo);
void TexteBoundaryOption( int BoundaryOption );
+ void TexteBoundaryCAOGr( const std::string GroupName );
void TexteBoundaryDi( const std::string MeshName, const std::string MeshFile );
void TexteBoundaryDiGr( const std::string GroupName );
void TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7 );
//
public:
+ int _modeHOMARD;
std::string _HOMARD_Exec;
std::string _NomDir;
std::string _NomFichierConfBase;
_noeud_1 = noeud_2 ;
// 3. Definition du service
_Texte += " <service name=\"" + noeud_2 + "\">\n" ;
- _Texte += " <node>Etude_Initialisation.UpdateStudy</node>\n" ;
+ _Texte += " <node>Etude_Initialisation.SetCurrentStudy</node>\n" ;
_Texte += " <method>" + methode + "</method>\n" ;
// 4. Les inports
// 4.1. Le nom de la zone
_noeud_1 = noeud_2 ;
// 3. Definition du service
_Texte += " <service name=\"" + noeud_2 + "\">\n" ;
- _Texte += " <node>Etude_Initialisation.UpdateStudy</node>\n" ;
+ _Texte += " <node>Etude_Initialisation.SetCurrentStudy</node>\n" ;
_Texte += " <method>" + methode + "</method>\n" ;
// 4. Les inports
// ATTENTION : les noms doivent etre les memes que dans Gen.xml, donc HOMARD_Gen.idl
HOMARD_msg_en.ts
HOMARD_msg_fr.ts
HOMARD_msg_ja.ts
-)
+)
# resource files / to be processed by uic
SET(_uic_FILES
+ CreateBoundaryCAO.ui
CreateBoundaryAn.ui
CreateBoundaryDi.ui
CreateCase.ui
# header files / to be processed by moc
SET(_moc_HEADERS
HOMARDGUI.h
+ MonCreateBoundaryCAO.h
MonCreateBoundaryAn.h
- MonEditBoundaryAn.h
MonCreateBoundaryDi.h
+ MonEditBoundaryCAO.h
+ MonEditBoundaryAn.h
MonEditBoundaryDi.h
MonCreateCase.h
MonEditCase.h
MonCreateHypothesis.h
MonEditHypothesis.h
MonCreateListGroup.h
+ MonCreateListGroupCAO.h
MonEditListGroup.h
+ MonEditListGroupCAO.h
MonCreateIteration.h
MonEditIteration.h
MonPursueIteration.h
# header files / uic wrappings
QT_WRAP_UIC(_uic_HEADERS ${_uic_FILES})
-
+
# header files / static
SET(_other_HEADERS
HOMARDGUI_Utils.h
SET(_other_SOURCES
HOMARDGUI.cxx
HOMARDGUI_Utils.cxx
+ MonCreateBoundaryCAO.cxx
MonCreateBoundaryAn.cxx
- MonEditBoundaryAn.cxx
MonCreateBoundaryDi.cxx
+ MonEditBoundaryCAO.cxx
+ MonEditBoundaryAn.cxx
MonEditBoundaryDi.cxx
MonCreateCase.cxx
MonEditCase.cxx
MonCreateHypothesis.cxx
MonEditHypothesis.cxx
MonCreateListGroup.cxx
+ MonCreateListGroupCAO.cxx
MonEditListGroup.cxx
+ MonEditListGroupCAO.cxx
MonCreateIteration.cxx
MonEditIteration.cxx
MonPursueIteration.cxx
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CreateBoundaryCAO</class>
+ <widget class="QDialog" name="CreateBoundaryCAO">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>566</width>
+ <height>195</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Get CAO</string>
+ </property>
+ <property name="autoFillBackground">
+ <bool>true</bool>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="3" column="0" colspan="3">
+ <widget class="QGroupBox" name="GBButtons">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="0" column="3">
+ <widget class="QPushButton" name="buttonHelp">
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="buttonCancel">
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="buttonApply">
+ <property name="text">
+ <string>Apply</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QPushButton" name="buttonOk">
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QCheckBox" name="CBGroupe">
+ <property name="text">
+ <string>Filtering with groups</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="LEFileName">
+ <property name="minimumSize">
+ <size>
+ <width>370</width>
+ <height>21</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="PushFichier">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="XAO">
+ <property name="text">
+ <string>XAO</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QLineEdit" name="LEName">
+ <property name="minimumSize">
+ <size>
+ <width>382</width>
+ <height>21</height>
+ </size>
+ </property>
+ <property name="maxLength">
+ <number>32</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="Name">
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
<x>0</x>
<y>0</y>
<width>600</width>
- <height>1026</height>
+ <height>1150</height>
</rect>
</property>
<property name="sizePolicy">
</layout>
</widget>
</item>
- <item row="5" column="0">
+ <item row="5" column="0" colspan="4">
+ <widget class="QGroupBox" name="GBTypeBoun">
+ <property name="title">
+ <string>Boundary type</string>
+ </property>
+ <layout class="QHBoxLayout" name="_3">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="RBBoundaryNo">
+ <property name="text">
+ <string>No boundary</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="RBBoundaryCAO">
+ <property name="text">
+ <string>CAO</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="RBBoundaryNonCAO">
+ <property name="text">
+ <string>Non CAO</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="6">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>1</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</item>
</layout>
</item>
- <item row="5" column="3">
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>1</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="6" column="2">
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>2</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="7" column="0" colspan="4">
- <widget class="QGroupBox" name="GBBoundaryD">
+ <item row="7" column="0" colspan="2">
+ <widget class="QGroupBox" name="GBBoundaryC">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
</sizepolicy>
</property>
<property name="title">
- <string>Discrete boundary</string>
+ <string>CAO</string>
</property>
- <layout class="QGridLayout">
+ <layout class="QGridLayout" name="_2">
<property name="margin">
<number>9</number>
</property>
<number>6</number>
</property>
<item row="0" column="3">
- <widget class="QPushButton" name="PBBoundaryDiEdit">
+ <widget class="QPushButton" name="PBBoundaryCAOEdit">
<property name="text">
<string>Edit</string>
</property>
</property>
</widget>
</item>
+ <item row="0" column="4">
+ <widget class="QPushButton" name="PBBoundaryCAOHelp">
+ <property name="text">
+ <string>Help</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QComboBox" name="CBBoundaryCAO">
+ <property name="currentIndex">
+ <number>-1</number>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>13</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item row="0" column="2">
- <widget class="QPushButton" name="PBBoundaryDiNew">
+ <widget class="QPushButton" name="PBBoundaryCAONew">
<property name="text">
<string>New</string>
</property>
</property>
</widget>
</item>
+ </layout>
+ </widget>
+ </item>
+ <item row="7" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>2</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="8" column="0" colspan="4">
+ <widget class="QGroupBox" name="GBBoundaryD">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Discrete boundary</string>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>9</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
<item row="0" column="0">
<widget class="QComboBox" name="CBBoundaryDi">
<property name="currentIndex">
</property>
</spacer>
</item>
+ <item row="0" column="3">
+ <widget class="QPushButton" name="PBBoundaryDiEdit">
+ <property name="text">
+ <string>Edit</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
<item row="0" column="4">
<widget class="QPushButton" name="PBBoundaryDiHelp">
<property name="text">
</property>
</widget>
</item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="PBBoundaryDiNew">
+ <property name="text">
+ <string>New</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
- <item row="8" column="0" colspan="6">
+ <item row="9" column="0" colspan="7">
<widget class="QGroupBox" name="GBBoundaryA">
<property name="minimumSize">
<size>
</layout>
</widget>
</item>
- <item row="9" column="0">
+ <item row="10" column="0">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
- <item row="10" column="0">
+ <item row="11" column="0">
<widget class="QCheckBox" name="CBAdvanced">
<property name="text">
<string>Advanced options</string>
</property>
</widget>
</item>
- <item row="11" column="0" colspan="3">
+ <item row="12" column="0" colspan="3">
<widget class="QGroupBox" name="GBAdvancedOptions">
<property name="title">
<string>Advanced options</string>
</item>
</layout>
</item>
- </layout>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QGroupBox" name="GBFormat">
- <property name="title">
- <string>Format</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QRadioButton" name="RBMED">
- <property name="text">
- <string>MED</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QRadioButton" name="RBSaturne">
- <property name="text">
- <string>Saturne</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QRadioButton" name="RBSaturne2D">
- <property name="text">
- <string>Saturne 2D</string>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="GBFormat">
+ <property name="title">
+ <string>Format</string>
</property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="RBMED">
+ <property name="text">
+ <string>MED</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="RBSaturne">
+ <property name="text">
+ <string>Saturne</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QRadioButton" name="RBSaturne2D">
+ <property name="text">
+ <string>Saturne 2D</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
</layout>
</widget>
</item>
- <item row="11" column="5">
+ <item row="12" column="4" colspan="3">
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
- <item row="12" column="0">
+ <item row="13" column="0">
<spacer name="spacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
- <item row="13" column="0">
+ <item row="14" column="0">
<widget class="QLabel" name="Comment">
<property name="text">
<string> No comment.</string>
</property>
</widget>
</item>
- <item row="14" column="0">
+ <item row="14" column="1">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>35</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="15" column="0" colspan="2">
<widget class="QGroupBox" name="GroupButtons">
<property name="title">
<string/>
</layout>
</widget>
</item>
- <item row="14" column="1">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>35</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="14" column="4" colspan="2">
+ <item row="15" column="3" colspan="2">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</spacer>
</item>
</layout>
+ <zorder>WName</zorder>
+ <zorder>GBTypeConf</zorder>
+ <zorder>GBBoundaryD</zorder>
+ <zorder>GBBoundaryA</zorder>
+ <zorder>CBAdvanced</zorder>
+ <zorder>GBAdvancedOptions</zorder>
+ <zorder>Comment</zorder>
+ <zorder>GroupButtons</zorder>
+ <zorder>GBBoundaryC</zorder>
+ <zorder>GBTypeBoun</zorder>
</widget>
<resources/>
<connections/>
#include "MonCreateIteration.h"
#include "MonPursueIteration.h"
#include "MonCreateYACS.h"
+#include "MonEditBoundaryCAO.h"
#include "MonEditBoundaryAn.h"
#include "MonEditBoundaryDi.h"
#include "MonEditCase.h"
_PTR(SObject) obj = chercheMonObjet();
if (obj)
{
+ // Edition d'une frontiere CAO
+ if (HOMARD_UTILS::isBoundaryCAO(obj))
+ {
+ MonEditBoundaryCAO *aDlg = new MonEditBoundaryCAO(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
+ aDlg->show();
+ }
// Edition d'une frontiere discrete
- if (HOMARD_UTILS::isBoundaryDi(obj))
+ else if (HOMARD_UTILS::isBoundaryDi(obj))
{
MonEditBoundaryDi *aDlg = new MonEditBoundaryDi(0, true, HOMARD::HOMARD_Gen::_duplicate(homardGen), QString(""), _ObjectName ) ;
aDlg->show();
if (obj)
{
// Suppression d'une frontiere
- if ( HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) )
+ if ( HOMARD_UTILS::isBoundaryCAO(obj) || HOMARD_UTILS::isBoundaryDi(obj) || HOMARD_UTILS::isBoundaryAn(obj) )
{
try
{ homardGen->DeleteBoundary(_ObjectName.toStdString().c_str()); }
bool DeleteObject = false ;
bool EditObject = false ;
//
- if ( HOMARD_UTILS::isBoundaryAn(obj) )
+ if ( HOMARD_UTILS::isBoundaryCAO(obj) )
+ {
+ EditObject = true ;
+ DeleteObject = true ;
+ }
+ else if ( HOMARD_UTILS::isBoundaryAn(obj) )
{
EditObject = true ;
DeleteObject = true ;
return bOK ;
}
//================================================================
+// Retourne vrai si l'objet est une frontiere CAO
+//================================================================
+bool HOMARD_UTILS::isBoundaryCAO(_PTR(SObject) MonObj)
+{
+ return isObject( MonObj, QString("BoundaryCAOHomard"), -1 ) ;
+}
+//================================================================
// Retourne vrai si l'objet est une frontiere analytique
//================================================================
bool HOMARD_UTILS::isBoundaryAn(_PTR(SObject) MonObj)
// Function returns the last selected object in the list
// of selected objects
+ HOMARD_EXPORT bool isBoundaryCAO(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isBoundaryAn(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isBoundaryDi(_PTR(SObject) MonObj);
HOMARD_EXPORT bool isCase(_PTR(SObject) MonObj);
<source>HOM_BOUN_MESH</source>
<translation>The file for the mesh of the boundary must be selected.</translation>
</message>
+ <message>
+ <source>HOM_BOUN_CAO</source>
+ <translation>The file for the CAO must be selected.</translation>
+ </message>
<message>
<source>HOM_BOUN_CASE</source>
<translation>The meshfile of the case is unknown.</translation>
<source>HOM_AXE</source>
<translation>The axis must be a non 0 vector.</translation>
</message>
+ <message>
+ <source>HOM_BOUN_C_EDIT_WINDOW_TITLE</source>
+ <translation>Edition of a CAO based boundary</translation>
+ </message>
<message>
<source>HOM_BOUN_A_EDIT_WINDOW_TITLE</source>
<translation>Edition of an analytical boundary</translation>
</message>
<message>
<source>HOM_MEN_PURSUE_ITERATION</source>
- <translation>Cas de poursuite d'une itération</translation>
+ <translation>Cas de poursuite d'une itération</translation>
</message>
<message>
<source>HOM_MEN_COMPUTE</source>
</message>
<message>
<source>HOM_TOP_PURSUE_ITERATION</source>
- <translation>Cas de poursuite d'une itération</translation>
+ <translation>Cas de poursuite d'une itération</translation>
</message>
<message>
<source>HOM_TOP_COMPUTE</source>
</message>
<message>
<source>HOM_STB_PURSUE_ITERATION</source>
- <translation>Cas de poursuite d'une itération</translation>
+ <translation>Cas de poursuite d'une itération</translation>
</message>
<message>
<source>HOM_STB_COMPUTE</source>
</message>
<message>
<source>HOM_SELECT_FILE_3</source>
- <translation>Impossible d'ouvrir ce fichier.</translation>
+ <translation>Impossible d'ouvrir ce fichier.</translation>
</message>
<message>
<source>HOM_SCRIPT_FILE</source>
</message>
<message>
<source>HOM_MED_FILE_3</source>
- <translation>Ce fichier MED contient plus d'un maillage.</translation>
+ <translation>Ce fichier MED contient plus d'un maillage.</translation>
</message>
<message>
<source>HOM_MED_FILE_4</source>
</message>
<message>
<source>Create a case</source>
- <translation>Création d'un cas</translation>
+ <translation>Création d'un cas</translation>
</message>
<message>
<source>HOM_CASE_NAME</source>
</message>
<message>
<source>HOM_START_DIRECTORY_1</source>
- <translation>Il faut choisir un répertoire contenant l'itération à poursuivre.</translation>
+ <translation>Il faut choisir un répertoire contenant l'itération à poursuivre.</translation>
</message>
<message>
<source>HOM_START_DIRECTORY_3</source>
- <translation>Un répertoire valide contenant l'itération à poursuivre doit être choisi.</translation>
+ <translation>Un répertoire valide contenant l'itération à poursuivre doit être choisi.</translation>
</message>
<message>
<source>HOM_CASE_MESH</source>
</message>
<message>
<source>HOM_CASE_GROUP</source>
- <translation>Le groupe "%1" ne peut pas être attribué à plus d'une frontière.</translation>
+ <translation>Le groupe "%1" ne peut pas être attribué à plus d'une frontière.</translation>
</message>
<message>
<source>HOM_CASE_EDIT_WINDOW_TITLE</source>
- <translation>Edition d'un cas</translation>
+ <translation>Edition d'un cas</translation>
</message>
<message>
<source>HOM_CASE_EDIT_STATE_0</source>
</message>
<message>
<source>HOM_CASE_EDIT_STATE</source>
- <translation>Poursuite d'une itération.</translation>
+ <translation>Poursuite d'une itération.</translation>
</message>
<message>
<source>HOM_CASE_PURSUE_WINDOW_TITLE</source>
- <translation>Cas de poursuite d'une itération</translation>
+ <translation>Cas de poursuite d'une itération</translation>
</message>
<message>
<source>The configuration file cannot be found.</source>
</message>
<message>
<source>HOM_ITER_NAME</source>
- <translation>Il faut donner un nom à l'itération.</translation>
+ <translation>Il faut donner un nom à l'itération.</translation>
</message>
<message>
<source>HOM_ITER_STARTING_POINT</source>
- <translation>Il faut désigner l'itération précédente.</translation>
+ <translation>Il faut désigner l'itération précédente.</translation>
</message>
<message>
<source>HOM_ITER_MESH</source>
</message>
<message>
<source>HOM_ITER_EDIT_WINDOW_TITLE</source>
- <translation>Edition d'une itération</translation>
+ <translation>Edition d'une itération</translation>
+ </message>
+ <message>
+ <source>Boundary type</source>
+ <translation>Type de frontière</translation>
+ </message>
+ <message>
+ <source>No boundary</source>
+ <translation>Pas de frontière</translation>
+ </message>
+ <message>
+ <source>Non CAO</source>
+ <translation>Autre que CAO</translation>
</message>
<message>
<source>Discrete boundary</source>
</message>
<message>
<source>Initialization of adaptation</source>
- <translation>Initialisation de l'adaptation</translation>
+ <translation>Initialisation de l'adaptation</translation>
</message>
<message>
<source>Maximal level</source>
</message>
<message>
<source>Create an iteration</source>
- <translation>Création d'une itération</translation>
+ <translation>Création d'une itération</translation>
</message>
<message>
<source>Iteration Name</source>
- <translation>Nom de l'itération</translation>
+ <translation>Nom de l'itération</translation>
</message>
<message>
<source>Previous iteration</source>
</message>
<message>
<source>The parent iteration is not defined.</source>
- <translation>L'itération parent n'est pas définie.</translation>
+ <translation>L'itération parent n'est pas définie.</translation>
</message>
<message>
<source>Unable to create the iteration.</source>
- <translation>Impossible de créer l'itération.</translation>
+ <translation>Impossible de créer l'itération.</translation>
</message>
<message>
<source>The directory for the computation cannot be created.</source>
- <translation>Impossible de créer le répertoire pour le calcul de l'itération.</translation>
+ <translation>Impossible de créer le répertoire pour le calcul de l'itération.</translation>
</message>
<message>
<source>This iteration is the first of the case and cannot be computed.</source>
</message>
<message>
<source>This iteration does not have any associated hypothesis.</source>
- <translation>Cette itération n'est associée à aucune hypothèse.</translation>
+ <translation>Cette itération n'est associée à aucune hypothèse.</translation>
</message>
<message>
<source>The mesh file does not exist.</source>
- <translation>Le fichier du maillage n'existe pas.</translation>
+ <translation>Le fichier du maillage n'existe pas.</translation>
</message>
<message>
<source>The mesh file cannot be deleted.</source>
</message>
<message>
<source>Rank</source>
- <translation>Numéro d'ordre</translation>
+ <translation>Numéro d'ordre</translation>
</message>
<message>
<source>Hypothesis</source>
</message>
<message>
<source>Create an hypothesis</source>
- <translation>Création d'une hypothèse</translation>
+ <translation>Création d'une hypothèse</translation>
</message>
<message>
<source>HOM_HYPO_NAME</source>
- <translation>Il faut donner un nom à l'hypothèse.</translation>
+ <translation>Il faut donner un nom à l'hypothèse.</translation>
</message>
<message>
<source>HOM_HYPO_FIELD_FILE</source>
</message>
<message>
<source>HOM_HYPO_EDIT_WINDOW_TITLE</source>
- <translation>Edition d'une hypothèse</translation>
+ <translation>Edition d'une hypothèse</translation>
</message>
<message>
<source>Type of adaptation</source>
- <translation>Type d'adaptation</translation>
+ <translation>Type d'adaptation</translation>
</message>
<message>
<source>Uniform</source>
</message>
<message>
<source>Governing field for the adaptation</source>
- <translation>Champ pilotant l'adaptation</translation>
+ <translation>Champ pilotant l'adaptation</translation>
</message>
<message>
<source>Field name</source>
</message>
<message>
<source>Create a zone</source>
- <translation>Création d'une zone</translation>
+ <translation>Création d'une zone</translation>
</message>
<message>
<source>HOM_ZONE_NAME</source>
</message>
<message>
<source>HOM_ZONE_EDIT_WINDOW_TITLE</source>
- <translation>Edition d'une zone</translation>
+ <translation>Edition d'une zone</translation>
</message>
<message>
<source>Type of zone</source>
<source>Coordinates</source>
<translation>Coordonnées</translation>
</message>
+ <message>
+ <source>Get CAO</source>
+ <translation>Acquisition de la CAO</translation>
+ </message>
<message>
<source>Create an analytical boundary</source>
- <translation>Création d'une frontière analytique</translation>
+ <translation>Création d'une frontière analytique</translation>
</message>
<message>
<source>Create a discrete boundary</source>
- <translation>Création d'une frontière discrète</translation>
+ <translation>Création d'une frontière discrète</translation>
</message>
<message>
<source>Type of boundary</source>
</message>
<message>
<source>HOM_BOUN_MESH</source>
- <translation>Il faut choisir le maillage qui contient la frontière.</translation>
+ <translation>Il faut choisir le fichier qui contient le maillage de la frontière discrète.</translation>
+ </message>
+ <message>
+ <source>HOM_BOUN_CAO</source>
+ <translation>Il faut choisir le fichier qui contient la CAO.</translation>
</message>
<message>
<source>HOM_BOUN_CASE</source>
</message>
<message>
<source>HOM_AXE</source>
- <translation>L'axe doit être un vecteur non nul.</translation>
+ <translation>L'axe doit être un vecteur non nul.</translation>
+ </message>
+ <message>
+ <source>HOM_BOUN_C_EDIT_WINDOW_TITLE</source>
+ <translation>Edition d'une frontière basée sur une CAO</translation>
</message>
<message>
<source>HOM_BOUN_A_EDIT_WINDOW_TITLE</source>
- <translation>Edition d'une frontière analytique</translation>
+ <translation>Edition d'une frontière analytique</translation>
</message>
<message>
<source>HOM_BOUN_D_EDIT_WINDOW_TITLE</source>
- <translation>Edition d'une frontière discrète</translation>
+ <translation>Edition d'une frontière discrète</translation>
</message>
<message>
<source>HOM_GROU_EDIT_WINDOW_TITLE</source>
</message>
<message>
<source>The axis must be a non 0 vector.</source>
- <translation>L'axe doit être un vecteur non nul.</translation>
+ <translation>L'axe doit être un vecteur non nul.</translation>
</message>
<message>
<source>The angle must be included higher than 0 degree and lower than 90 degrees.</source>
- <translation>L'angle doit être compris entre 0 et 90 degrés.</translation>
+ <translation>L'angle doit être compris entre 0 et 90 degrés.</translation>
</message>
<message>
<source>The radius must be different.</source>
</message>
<message>
<source>The orientation must be 1, 2 or 3.</source>
- <translation>L'orientation vaut 1, 2 ou 3.</translation>
+ <translation>L'orientation vaut 1, 2 ou 3.</translation>
</message>
<message>
<source>HOM_MESH_INFO_0</source>
</message>
<message>
<source>HOM_MESH_INFO_2</source>
- <translation>Bilan de l'analyse dans l'arbre d'études, fichier </translation>
+ <translation>Bilan de l'analyse dans l'arbre d'études, fichier </translation>
</message>
<message>
<source>Filtering with groups</source>
</message>
<message>
<source>Information on a mesh</source>
- <translation>Analyse d'un maillage</translation>
+ <translation>Analyse d'un maillage</translation>
</message>
<message>
<source>Group size</source>
</message>
<message>
<source>From an iteration</source>
- <translation>A partir d'une itération</translation>
+ <translation>A partir d'une itération</translation>
</message>
<message>
<source>From a case</source>
- <translation>A partir d'un cas</translation>
+ <translation>A partir d'un cas</translation>
</message>
<message>
<source>Iteration into the case</source>
- <translation>Choix d'une itération dans le cas</translation>
+ <translation>Choix d'une itération dans le cas</translation>
</message>
<message>
<source>Last iteration</source>
</message>
<message>
<source>Iteration number</source>
- <translation>A partir d'une itération numérotée</translation>
+ <translation>A partir d'une itération numérotée</translation>
</message>
<message>
<source>The directory of the case does not exist.</source>
- <translation>Le répertoire du cas n'existe pas.</translation>
+ <translation>Le répertoire du cas n'existe pas.</translation>
</message>
<message>
<source>The directory for the case cannot be modified because some iterations are already defined.</source>
</message>
<message>
<source>The directory for the case cannot be reached.</source>
- <translation>Impossible d'atteindre ce répertoire pour le cas.</translation>
+ <translation>Impossible d'atteindre ce répertoire pour le cas.</translation>
</message>
<message>
<source>The starting point for the case cannot be copied into the working directory.</source>
</message>
<message>
<source>The directory of the case for the pursuit does not exist.</source>
- <translation>Le répertoire du cas de reprise n'existe pas.</translation>
+ <translation>Le répertoire du cas de reprise n'existe pas.</translation>
</message>
<message>
<source>The directory of the iteration does not exist.</source>
- <translation>Le répertoire de l'itération de reprise n'existe pas.</translation>
+ <translation>Le répertoire de l'itération de reprise n'existe pas.</translation>
</message>
<message>
<source>The number of iteration must be positive.</source>
- <translation>Le numéro de l'itération doit etre positif.</translation>
+ <translation>Le numéro de l'itération doit etre positif.</translation>
</message>
<message>
<source>Number of iteration</source>
- <translation>Numéro de l'itération</translation>
+ <translation>Numéro de l'itération</translation>
</message>
<message>
<source>Case</source>
</message>
<message>
<source>Edit a file</source>
- <translation>Affichage d'un fichier</translation>
+ <translation>Affichage d'un fichier</translation>
</message>
<message>
<source>Print</source>
</message>
<message>
<source>HOM_YACS_EDIT_WINDOW_TITLE</source>
- <translation>Edition d'un schéma YACS</translation>
+ <translation>Edition d'un schéma YACS</translation>
</message>
<message>
<source>PREF_TAB_GENERAL</source>
</message>
<message>
<source>PREF_PUBLICATION_MAILLAGE_IN</source>
- <translation>Les maillages d'entrée</translation>
+ <translation>Les maillages d'entrée</translation>
</message>
<message>
<source>PREF_PUBLICATION_MAILLAGE_OUT</source>
--- /dev/null
+// 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
+//
+
+#include "MonCreateBoundaryCAO.h"
+#include "MonCreateListGroupCAO.h"
+#include "MonCreateCase.h"
+
+#include <QFileDialog>
+#include <QMessageBox>
+
+#include "SalomeApp_Tools.h"
+#include "HOMARDGUI_Utils.h"
+#include "HomardQtCommun.h"
+#include <utilities.h>
+
+using namespace std;
+
+// -------------------------------------------------------------------------------
+MonCreateBoundaryCAO::MonCreateBoundaryCAO(MonCreateCase* parent, bool modal,
+ HOMARD::HOMARD_Gen_var myHomardGen0,
+ QString caseName, QString aName)
+// ---------------------------------------------------------------------------------
+/* Constructs a MonCreateBoundaryCAO */
+ :
+ QDialog(0), Ui_CreateBoundaryCAO(),
+ _parent(parent), _aName(aName),
+ myHomardGen(HOMARD::HOMARD_Gen::_duplicate(myHomardGen0)),
+ _aCaseName(caseName)
+ {
+ MESSAGE("Constructeur") ;
+ setupUi(this);
+ setModal(modal);
+ InitConnect();
+
+ if ( _aName == QString("") ) {SetNewName();};
+ }
+
+// ------------------------------------------------------------------------
+MonCreateBoundaryCAO::~MonCreateBoundaryCAO()
+// ------------------------------------------------------------------------
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+// ------------------------------------------------------------------------
+void MonCreateBoundaryCAO::InitConnect()
+// ------------------------------------------------------------------------
+{
+ connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetCAOFile()));
+ connect( buttonOk, SIGNAL(pressed()), this, SLOT( PushOnOK()));
+ connect( buttonApply, SIGNAL(pressed()), this, SLOT( PushOnApply()));
+ connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
+ connect( buttonHelp, SIGNAL(pressed()), this, SLOT( PushOnHelp()));
+ connect( CBGroupe, SIGNAL(stateChanged(int)), this, SLOT( SetFiltrage()));
+}
+
+// ------------------------------------------------------------------------
+bool MonCreateBoundaryCAO::PushOnApply()
+// ------------------------------------------------------------------------
+// Appele lorsque l'un des boutons Ok ou Apply est presse
+//
+{
+// Verifications
+
+ QString aName=LEName->text().trimmed();
+ if (aName=="") {
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr("HOM_BOUN_NAME") );
+ return false;
+ }
+
+// La CAO
+ QString aCAOFile=LEFileName->text().trimmed();
+ if (aCAOFile ==QString(""))
+ {
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr("HOM_BOUN_CAO") );
+ return false;
+ }
+
+// Creation de l'objet CORBA si ce n'est pas deja fait sous le meme nom
+ if ( _aName != aName )
+ {
+ try
+ {
+ _aName=aName;
+ aBoundary=myHomardGen->CreateBoundaryCAO(CORBA::string_dup(_aName.toStdString().c_str()), aCAOFile.toStdString().c_str());
+ _parent->AddBoundaryCAO(_aName);
+ aBoundary->SetCaseCreation(_aCaseName.toStdString().c_str());
+ }
+ catch( SALOME::SALOME_Exception& S_ex )
+ {
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr(CORBA::string_dup(S_ex.details.text)) );
+ return false;
+ }
+ }
+
+// Les groupes
+ AssocieLesGroupes();
+
+ HOMARD_UTILS::updateObjBrowser();
+ return true;
+}
+
+
+// ------------------------------------------------------------------------
+void MonCreateBoundaryCAO::PushOnOK()
+// ------------------------------------------------------------------------
+{
+ if (PushOnApply()) this->close();
+ if ( _parent ) { _parent->raise(); _parent->activateWindow(); };
+}
+// ------------------------------------------------------------------------
+void MonCreateBoundaryCAO::PushOnHelp()
+// ------------------------------------------------------------------------
+{
+ std::string LanguageShort = myHomardGen->GetLanguageShort();
+ HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
+}
+// ------------------------------------------------------------------------
+void MonCreateBoundaryCAO::AssocieLesGroupes()
+// ------------------------------------------------------------------------
+{
+ HOMARD::ListGroupType_var aSeqGroupe = new HOMARD::ListGroupType;
+ aSeqGroupe->length(_listeGroupesBoundary.size());
+ QStringList::const_iterator it;
+ int i=0;
+ for (it = _listeGroupesBoundary.constBegin(); it != _listeGroupesBoundary.constEnd(); it++)
+ aSeqGroupe[i++]=(*it).toStdString().c_str();
+ aBoundary->SetGroups(aSeqGroupe);
+
+}
+
+// -------------------------------------------------
+void MonCreateBoundaryCAO::SetNewName()
+// --------------------------------------------------
+{
+
+ HOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName();
+ int num = 0; QString aName="";
+ while (aName == QString("") )
+ {
+ aName.setNum(num+1) ;
+ aName.insert(0, QString("Boun_")) ;
+ for ( int i=0; i<MyObjects->length(); i++)
+ {
+ if ( aName == QString(MyObjects[i]))
+ {
+ num ++ ;
+ aName = "" ;
+ break ;
+ }
+ }
+ }
+ LEName->setText(aName);
+}
+// ------------------------------------------------------------------------
+void MonCreateBoundaryCAO::SetCAOFile()
+// ------------------------------------------------------------------------
+{
+ QString aCAOFile = HOMARD_QT_COMMUN::PushNomFichier( false, QString("xao") );
+ if (!(aCAOFile.isEmpty())) LEFileName->setText(aCAOFile);
+}
+
+// ------------------------------------------------------------------------
+void MonCreateBoundaryCAO::setGroups (QStringList listGroup)
+// ------------------------------------------------------------------------
+{
+ _listeGroupesBoundary = listGroup;
+}
+// ------------------------------------------------------------------------
+void MonCreateBoundaryCAO::SetFiltrage()
+// // ------------------------------------------------------------------------
+{
+ if (!CBGroupe->isChecked()) return;
+ if (_aCaseName.toStdString().c_str() == QString()) {
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr("HOM_BOUN_CASE") );
+ return;
+ }
+
+ MonCreateListGroupCAO *aDlg = new MonCreateListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),
+ _aCaseName, _listeGroupesBoundary) ;
+ aDlg->show();
+}
+
--- /dev/null
+// 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
+//
+
+#ifndef MON_CREATEBOUNDARYCAO_H
+#define MON_CREATEBOUNDARYCAO_H
+
+#include "HOMARDGUI_Exports.hxx"
+
+#include <SALOMEconfig.h>
+#include <SalomeApp_Module.h>
+
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include CORBA_CLIENT_HEADER(HOMARD_Gen)
+#include CORBA_CLIENT_HEADER(HOMARD_Boundary)
+
+#include "ui_CreateBoundaryCAO.h"
+#include <QDialog>
+
+class MonCreateCase;
+class HOMARD_EXPORT MonCreateBoundaryCAO : public QDialog, public Ui_CreateBoundaryCAO
+{
+ Q_OBJECT
+
+public:
+ MonCreateBoundaryCAO( MonCreateCase* parent, bool modal,
+ HOMARD::HOMARD_Gen_var myHomardGen,
+ QString caseName, QString BoundaryName );
+ ~MonCreateBoundaryCAO();
+ virtual void setGroups (QStringList listGroup);
+
+protected :
+
+ MonCreateCase *_parent;
+
+ QString _aName;
+ QString _aCaseName;
+
+
+ HOMARD::HOMARD_Boundary_var aBoundary;
+ HOMARD::HOMARD_Gen_var myHomardGen;
+
+ QStringList _listeGroupesBoundary;
+
+ virtual void AssocieLesGroupes();
+ virtual void InitConnect();
+ virtual void SetNewName();
+
+public slots:
+
+ virtual void SetCAOFile();
+ virtual void SetFiltrage();
+ virtual void PushOnOK();
+ virtual bool PushOnApply();
+ virtual void PushOnHelp();
+};
+
+#endif // MON_CREATEBOUNDARYCAO_H
//
#include "MonCreateCase.h"
+#include "MonCreateBoundaryCAO.h"
+#include "MonEditBoundaryCAO.h"
#include "MonCreateBoundaryAn.h"
#include "MonEditBoundaryAn.h"
#include "MonCreateBoundaryDi.h"
InitConnect();
SetNewName() ;
+
+ GBBoundaryC->setVisible(0);
GBBoundaryA->setVisible(0);
GBBoundaryD->setVisible(0);
+
+ CBBoundaryA->setVisible(0);
+ CBBoundaryD->setVisible(0);
+
GBAdvancedOptions->setVisible(0);
Comment->setVisible(0);
CBPyramid->setChecked(false);
void MonCreateCase::InitConnect()
// ------------------------------------------------------------------------
{
- connect( LEName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
- connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName()));
- connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName()));
+ connect( LEName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
+ connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName()));
+ connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName()));
connect( RBConforme, SIGNAL(clicked()), this, SLOT(SetConforme()));
connect( RBNonConforme, SIGNAL(clicked()), this, SLOT(SetNonConforme()));
- connect( CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD()));
- connect( PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew()));
- connect( PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) );
- connect( PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) );
- connect( CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA()));
- connect( PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew()));
- connect( PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) );
- connect( PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) );
+ connect( RBBoundaryNo, SIGNAL(clicked()), this, SLOT(SetBoundaryNo()));
+ connect( RBBoundaryCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryCAO()));
+ connect( RBBoundaryNonCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO()));
+
+ connect( PBBoundaryCAONew, SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew()));
+ connect( PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) );
+ connect( PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) );
+ connect( CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD()));
+ connect( PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew()));
+ connect( PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) );
+ connect( PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) );
+ connect( CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA()));
+ connect( PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew()));
+ connect( PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) );
+ connect( PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) );
connect( CBAdvanced, SIGNAL(stateChanged(int)), this, SLOT(SetAdvanced()));
connect( RBStandard, SIGNAL(clicked()), this, SLOT(SetStandard()));
TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed()));
TWBoundary->item( i, 0 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
}
+// Pour les frontieres CAO : la liste a saisir
// Pour les frontieres discretes : la liste a saisir
// Pour les frontieres analytiques : les colonnes de chaque frontiere
HOMARD::HOMARD_Boundary_var myBoundary ;
{
myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]);
int type_obj = myBoundary->GetType() ;
- if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); }
- else { AddBoundaryAn(QString(mesBoundarys[i])); }
+ if ( type_obj==-1 ) { CBBoundaryCAO->addItem(QString(mesBoundarys[i])); }
+ else if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); }
+ else { AddBoundaryAn(QString(mesBoundarys[i])); }
}
// Ajustement
TWBoundary->resizeColumnsToContents();
// Enregistrement et publication dans l'arbre d'etudes a la sortie definitive
if ( option > 0 )
{
+ if (RBBoundaryCAO->isChecked())
+ {
+ QString monBoundaryCAOName=CBBoundaryCAO->currentText();
+ if (monBoundaryCAOName != "" )
+ {
+ aCase->AddBoundary(monBoundaryCAOName.toStdString().c_str());
+ }
+ }
if (CBBoundaryD->isChecked())
{
QString monBoundaryDiName=CBBoundaryDi->currentText();
if (monBoundaryDiName != "" )
{
- aCase->AddBoundaryGroup(monBoundaryDiName.toStdString().c_str(), "");
+ aCase->AddBoundary(monBoundaryDiName.toStdString().c_str());
}
}
if (CBBoundaryA->isChecked())
RBSaturne2D->setChecked(true);
}
// ------------------------------------------------------------------------
+void MonCreateCase::SetBoundaryNo()
+// ------------------------------------------------------------------------
+{
+//
+ GBBoundaryC->setVisible(0);
+ GBBoundaryA->setVisible(0);
+ GBBoundaryD->setVisible(0);
+ CBBoundaryD->setVisible(0);
+ CBBoundaryA->setVisible(0);
+//
+ adjustSize();
+}
+// ------------------------------------------------------------------------
+void MonCreateCase::SetBoundaryCAO()
+// ------------------------------------------------------------------------
+{
+//
+ GBBoundaryC->setVisible(1);
+ GBBoundaryA->setVisible(0);
+ GBBoundaryD->setVisible(0);
+ CBBoundaryD->setVisible(0);
+ CBBoundaryA->setVisible(0);
+//
+ adjustSize();
+}
+// ------------------------------------------------------------------------
+void MonCreateCase::SetBoundaryNonCAO()
+// ------------------------------------------------------------------------
+{
+//
+ GBBoundaryC->setVisible(0);
+ CBBoundaryD->setVisible(1);
+ CBBoundaryA->setVisible(1);
+//
+ adjustSize();
+}
+// ------------------------------------------------------------------------
+void MonCreateCase::AddBoundaryCAO(QString newBoundary)
+// ------------------------------------------------------------------------
+{
+ CBBoundaryCAO->insertItem(0,newBoundary);
+ CBBoundaryCAO->setCurrentIndex(0);
+}
+// ------------------------------------------------------------------------
+void MonCreateCase::PushBoundaryCAONew()
+// ------------------------------------------------------------------------
+{
+ MonCreateBoundaryCAO *BoundaryDlg = new MonCreateBoundaryCAO(this, true,
+ HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ;
+ BoundaryDlg->show();
+}
+// ------------------------------------------------------------------------
+void MonCreateCase::PushBoundaryCAOEdit()
+// ------------------------------------------------------------------------
+{
+ if (CBBoundaryCAO->currentText() == QString("")) return;
+ MonEditBoundaryCAO *BoundaryDlg = new MonEditBoundaryCAO(this, true,
+ HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryCAO->currentText() ) ;
+ BoundaryDlg->show();
+}
+// ------------------------------------------------------------------------
+void MonCreateCase::PushBoundaryCAOHelp()
+// ------------------------------------------------------------------------
+{
+ std::string LanguageShort = myHomardGen->GetLanguageShort();
+ HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("CAO"), QString(LanguageShort.c_str()));
+}
+// ------------------------------------------------------------------------
void MonCreateCase::SetBoundaryD()
// ------------------------------------------------------------------------
{
else { GBBoundaryA->setVisible(0); }
//
adjustSize();
-//
-// MESSAGE("Fin de SetBoundaryA ");
}
// ------------------------------------------------------------------------
void MonCreateCase::AddBoundaryAn(QString newBoundary)
MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen );
~MonCreateCase();
+ void AddBoundaryCAO(QString newBoundary);
void AddBoundaryAn(QString newBoundary);
void AddBoundaryDi(QString newBoundary);
virtual void SetSaturne();
virtual void SetSaturne2D();
+ virtual void SetBoundaryNo();
+ virtual void SetBoundaryCAO();
+ virtual void SetBoundaryNonCAO();
+ virtual void PushBoundaryCAONew();
+ virtual void PushBoundaryCAOEdit();
+ virtual void PushBoundaryCAOHelp();
virtual void SetBoundaryD();
virtual void PushBoundaryDiNew();
virtual void PushBoundaryDiEdit();
--- /dev/null
+// 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
+//
+
+#include "MonCreateListGroupCAO.h"
+#include "MonCreateHypothesis.h"
+#include "MonCreateBoundaryCAO.h"
+
+#include <QFileDialog>
+
+#include "SalomeApp_Tools.h"
+#include "HOMARDGUI_Utils.h"
+#include "HomardQtCommun.h"
+#include <utilities.h>
+
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+
+using namespace std;
+
+// --------------------------------------------------------------------------------------------------------------
+MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal,
+ HOMARD::HOMARD_Gen_var myHomardGen0, QString aCaseName, QStringList listeGroupesHypo) :
+// --------------------------------------------------------------------------------------------------------------
+//
+ QDialog(0), Ui_CreateListGroup(),
+ _aCaseName (aCaseName),
+ _listeGroupesHypo (listeGroupesHypo),
+ _parentHyp(parentHyp),
+ _parentBound(parentBound)
+{
+ MESSAGE("Debut de MonCreateListGroupCAO")
+ myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
+ setupUi(this);
+ setModal(modal);
+ InitConnect();
+ InitGroupes();
+}
+// --------------------------------------------------------------------------------------------------------------
+MonCreateListGroupCAO::MonCreateListGroupCAO(MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound,
+ HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo) :
+// --------------------------------------------------------------------------------------------------------------
+//
+ QDialog(0), Ui_CreateListGroup(),
+ _aCaseName (aCaseName),
+ _listeGroupesHypo (listeGroupesHypo),
+ _parentHyp(parentHyp),
+ _parentBound(parentBound)
+{
+ myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
+ setupUi(this);
+ InitConnect();
+}
+
+// ------------------------------------------------------------------------
+MonCreateListGroupCAO::~MonCreateListGroupCAO()
+// ------------------------------------------------------------------------
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+// ------------------------------------------------------------------------
+void MonCreateListGroupCAO::InitConnect()
+// ------------------------------------------------------------------------
+{
+ connect( buttonOk, SIGNAL( pressed() ), this, SLOT( PushOnOK() ) );
+ connect( buttonApply, SIGNAL( pressed() ), this, SLOT( PushOnApply() ) );
+ connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( close() ) );
+ connect( buttonHelp, SIGNAL( pressed() ), this, SLOT( PushOnHelp() ) );
+}
+// ------------------------------------------------------------------------
+bool MonCreateListGroupCAO::PushOnApply()
+// ------------------------------------------------------------------------
+// Appele lorsque l'un des boutons Ok ou Apply est presse
+//
+{
+ QStringList ListeGroup ;
+ for ( int row=0; row< TWGroupe->rowCount(); row++)
+ {
+ if ( TWGroupe->item( row, 0 )->checkState() == Qt::Checked )
+ ListeGroup.insert(0, QString(TWGroupe->item(row, 1)->text()) );
+ }
+ if ( _parentHyp ) { _parentHyp->setGroups(ListeGroup);};
+ if ( _parentBound ) { _parentBound->setGroups(ListeGroup);};
+ return true;
+}
+
+
+// ------------------------------------------------------------------------
+void MonCreateListGroupCAO::PushOnOK()
+// ------------------------------------------------------------------------
+{
+ if (PushOnApply()) this->close();
+ if ( _parentHyp ) { _parentHyp->raise(); _parentHyp->activateWindow(); };
+ if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); };
+}
+// ------------------------------------------------------------------------
+void MonCreateListGroupCAO::PushOnHelp()
+// ------------------------------------------------------------------------
+{
+ std::string LanguageShort = myHomardGen->GetLanguageShort();
+ HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
+}
+// ------------------------------------------------------------------------
+void MonCreateListGroupCAO::InitGroupes()
+// ------------------------------------------------------------------------
+{
+ MESSAGE("Debut de MonCreateListGroupCAO::InitGroupes ");
+ for ( int row=0; row< TWGroupe->rowCount(); row++)
+ TWGroupe->removeRow(row);
+ TWGroupe->setRowCount(0);
+ if (_aCaseName == QString("")) { return; };
+ HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str());
+ HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
+ for ( int i = 0; i < _listeGroupesCas->length(); i++ )
+ {
+ TWGroupe->insertRow(i);
+ TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) );
+ TWGroupe->item( i, 0 )->setFlags( 0 );
+ TWGroupe->item( i, 0 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled );
+ if (_listeGroupesHypo.contains (QString((_listeGroupesCas)[i])))
+ {TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );}
+ else
+ {TWGroupe->item( i, 0 )->setCheckState( Qt::Unchecked );}
+ TWGroupe->setItem( i, 1, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed()));
+ TWGroupe->item( i, 1 )->setFlags(Qt::ItemIsEnabled |Qt::ItemIsSelectable );
+ }
+ TWGroupe->resizeColumnsToContents();
+ TWGroupe->resizeRowsToContents();
+ TWGroupe->clearSelection();
+// MESSAGE("Fin de MonCreateListGroupCAO::InitGroupes ");
+}
+
--- /dev/null
+// 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
+//
+
+#ifndef MON_CREATELISTGROUPCAO_H
+#define MON_CREATELISTGROUPCAO_H
+
+#include "HOMARDGUI_Exports.hxx"
+
+#include <SALOMEconfig.h>
+#include <SalomeApp_Module.h>
+
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include CORBA_CLIENT_HEADER(HOMARD_Gen)
+
+#include "ui_CreateListGroup.h"
+#include <QDialog>
+
+class MonCreateHypothesis;
+class MonCreateBoundaryCAO;
+class HOMARD_EXPORT MonCreateListGroupCAO : public QDialog, public Ui_CreateListGroup
+{
+ Q_OBJECT
+
+public:
+ MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
+ MonCreateListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
+ virtual ~MonCreateListGroupCAO();
+
+protected :
+
+ HOMARD::HOMARD_Gen_var myHomardGen;
+
+ MonCreateHypothesis * _parentHyp;
+ MonCreateBoundaryCAO * _parentBound;
+ QString _aCaseName;
+ QStringList _listeGroupesHypo;
+
+ virtual void InitConnect();
+ virtual void InitGroupes();
+
+public slots:
+ virtual void PushOnOK();
+ virtual bool PushOnApply();
+ virtual void PushOnHelp();
+
+};
+
+#endif // MON_CREATELISTGROUPCAO_H
--- /dev/null
+// 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
+//
+
+#include "MonEditBoundaryCAO.h"
+#include "MonEditListGroupCAO.h"
+
+#include <QMessageBox>
+
+#include "SalomeApp_Tools.h"
+#include "HOMARDGUI_Utils.h"
+#include "HomardQtCommun.h"
+#include <utilities.h>
+
+using namespace std;
+
+// -------------------------------------------------------------------------------------------------------------------------------------
+MonEditBoundaryCAO::MonEditBoundaryCAO( MonCreateCase* parent, bool modal,
+ HOMARD::HOMARD_Gen_var myHomardGen,
+ QString caseName, QString Name):
+// -------------------------------------------------------------------------------------------------------------------------------------
+/* Constructs a MonEditBoundaryCAO
+ herite de MonCreateBoundaryCAO
+*/
+ MonCreateBoundaryCAO(parent, modal, myHomardGen, caseName, Name)
+{
+ MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str());
+ setWindowTitle(QObject::tr("HOM_BOUN_C_EDIT_WINDOW_TITLE"));
+ try
+ {
+ aBoundary=myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str()));
+ if (caseName==QString("")) { _aCaseName=aBoundary->GetCaseCreation();}
+ InitValEdit();
+ }
+ catch( SALOME::SALOME_Exception& S_ex )
+ {
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr(CORBA::string_dup(S_ex.details.text)) );
+ return;
+ }
+
+ HOMARD::ListGroupType_var maListe = aBoundary->GetGroups();
+ for ( int i = 0; i < maListe->length(); i++ )
+ _listeGroupesBoundary << QString(maListe[i]);
+
+}
+// ------------------------------
+MonEditBoundaryCAO::~MonEditBoundaryCAO()
+// ------------------------------
+{
+}
+// ------------------------------
+void MonEditBoundaryCAO::InitValEdit()
+// ------------------------------
+{
+ LEName->setText(_aName);
+ LEName->setReadOnly(true);
+
+ QString aDataFile = aBoundary->GetDataFile();
+ LEFileName->setText(aDataFile);
+ LEFileName->setReadOnly(1);
+ PushFichier->setVisible(0);
+//
+ adjustSize();
+}
+// ------------------------------
+bool MonEditBoundaryCAO::PushOnApply()
+// ------------------------------
+{
+ return true;
+}
+// ------------------------------------------------------------------------
+void MonEditBoundaryCAO::SetFiltrage()
+// // ------------------------------------------------------------------------
+{
+ if (!CBGroupe->isChecked()) return;
+ if (_aCaseName.toStdString().c_str() == QString())
+ {
+ QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
+ QObject::tr("HOM_BOUN_CASE") );
+ return;
+ }
+ HOMARD::HOMARD_Cas_var monCas= myHomardGen->GetCase(_aCaseName.toStdString().c_str());
+ HOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups();
+
+ MonEditListGroupCAO *aDlg = new MonEditListGroupCAO(NULL, this, true, HOMARD::HOMARD_Gen::_duplicate(myHomardGen),
+ _aCaseName, _listeGroupesBoundary) ;
+ aDlg->show();
+}
+
--- /dev/null
+// 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
+//
+
+#ifndef MON_EDITBOUNDARYCAO_H
+#define MON_EDITBOUNDARYCAO_H
+
+#include "HOMARDGUI_Exports.hxx"
+
+#include <SALOMEconfig.h>
+#include <SalomeApp_Module.h>
+
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include CORBA_CLIENT_HEADER(HOMARD_Gen)
+
+#include <MonCreateBoundaryCAO.h>
+
+class HOMARD_EXPORT MonEditBoundaryCAO : public MonCreateBoundaryCAO
+{
+ Q_OBJECT
+public:
+ MonEditBoundaryCAO( MonCreateCase* parent, bool modal,
+ HOMARD::HOMARD_Gen_var myHomardGen,
+ QString caseName, QString Name );
+ virtual ~MonEditBoundaryCAO();
+
+protected :
+ virtual void InitValEdit();
+ virtual bool PushOnApply();
+ virtual void SetFiltrage();
+
+public slots:
+
+};
+
+#endif
LEName->setText(_aName);
LEName->setReadOnly(true);
- QString aMeshFile = aBoundary->GetMeshFile();
- LEFileName->setText(aMeshFile);
+ QString aDataFile = aBoundary->GetDataFile();
+ LEFileName->setText(aDataFile);
LEFileName->setReadOnly(1);
PushFichier->setVisible(0);
//
RBNonConforme->setEnabled(false);
int ExtType=aCase->GetExtType();
-// Non affichage du mode de suivi de frontiere
- CBBoundaryA->setVisible(0);
- GBBoundaryA->setVisible(0);
+
+// Suivi de frontiere
+// A priori, aucun affichage
+ GBTypeBoun->setVisible(0);
CBBoundaryD->setVisible(0);
+ CBBoundaryA->setVisible(0);
+ GBBoundaryC->setVisible(0);
GBBoundaryD->setVisible(0);
-
+ GBBoundaryA->setVisible(0);
// On passe en revue tous les couples (frontiere,groupe) du cas
HOMARD::ListBoundaryGroupType_var mesBoundarys = aCase->GetBoundaryGroup();
if (mesBoundarys->length()>0)
{
QStringList ListeFron ;
QString NomFron ;
+ bool BounCAO = false ;
bool BounDi = false ;
bool BounAn = false ;
for (int i=0; i<mesBoundarys->length(); i++)
{
-// Nom de la frontiere
+// Nom de la frontiere
NomFron = mesBoundarys[i++];
MESSAGE("NomFron "<<NomFron.toStdString().c_str());
-// L'objet associe pour en deduire le type
+// L'objet associe pour en deduire le type
HOMARD::HOMARD_Boundary_var myBoundary = myHomardGen->GetBoundary(NomFron.toStdString().c_str());
int type_obj = myBoundary->GetType() ;
+ MESSAGE("type_obj "<<type_obj);
+// C'est une frontiere CAO
+// Remarque : on ne gere pas les groupes
+ if ( type_obj==-1 )
+ {
+ BounCAO = true ;
+ CBBoundaryCAO->addItem(NomFron);
+ }
// C'est une frontiere discrete
// Rermarque : on ne gere pas les groupes
- if ( type_obj==0 )
+ else if ( type_obj==0 )
{
BounDi = true ;
CBBoundaryDi->addItem(NomFron);
TWBoundary->item( 0, ok )->setCheckState( Qt::Checked );
}
}
- MESSAGE("BounDi "<<BounDi<<", BounAn "<<BounAn);
+ MESSAGE("BounCAO "<<BounCAO<<",BounDi "<<BounDi<<", BounAn "<<BounAn);
+ GBTypeBoun->setVisible(1);
+ if ( BounCAO )
+ { RBBoundaryCAO->setChecked(true);
+ GBBoundaryC->setVisible(1);
+ CBBoundaryCAO->setDisabled(true);
+ PBBoundaryCAONew->setVisible(0);
+ PBBoundaryCAOHelp->setVisible(0); }
+ if ( BounDi )
+ { RBBoundaryNonCAO->setChecked(true);
+ GBBoundaryD->setVisible(1);
+ CBBoundaryDi->setDisabled(true);
+ PBBoundaryDiNew->setVisible(0);
+ PBBoundaryDiHelp->setVisible(0); }
if ( BounAn )
- { GBBoundaryA->setVisible(1);
+ { RBBoundaryNonCAO->setChecked(true);
+ GBBoundaryA->setVisible(1);
// On rend les cases non modifiables.
// On ne peut pas le faire pour tout le tableau sinon on perd l'ascenseur !
int nbcol = TWBoundary->columnCount();
PBBoundaryAnNew->setVisible(0);
PBBoundaryAnHelp->setVisible(0);
}
- if ( BounDi )
- { GBBoundaryD->setVisible(1);
- CBBoundaryDi->setDisabled(true);
- PBBoundaryDiNew->setVisible(0);
- PBBoundaryDiHelp->setVisible(0); }
+ RBBoundaryNo->setEnabled(false);
+ RBBoundaryCAO->setEnabled(false);
+ RBBoundaryNonCAO->setEnabled(false);
}
//
// Les options avancees (non modifiables)
--- /dev/null
+// 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
+//
+
+#include "MonEditListGroupCAO.h"
+#include <utilities.h>
+
+using namespace std;
+//---------------------------------------------------------------------
+MonEditListGroupCAO::MonEditListGroupCAO( MonCreateHypothesis* parentHyp,
+ MonCreateBoundaryCAO* parentBound,
+ bool modal,
+ HOMARD::HOMARD_Gen_var myHomardGen,
+ QString aCaseName,
+ QStringList listeGroupesHypo):
+//---------------------------------------------------------------------
+MonCreateListGroupCAO(parentHyp,parentBound,myHomardGen,aCaseName,listeGroupesHypo)
+{
+ MESSAGE("Debut de MonEditListGroupCAO");
+ setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE"));
+ setModal(true);
+ InitGroupes();
+}
+
+//------------------------------------
+MonEditListGroupCAO:: ~MonEditListGroupCAO()
+//------------------------------------
+{
+}
+// -------------------------------------
+void MonEditListGroupCAO:: InitGroupes()
+// -------------------------------------
+{
+ for (int i = 0; i < _listeGroupesHypo.size(); i++ )
+ {
+ std::cerr << _listeGroupesHypo[i].toStdString().c_str() << std::endl;
+ TWGroupe->insertRow(i);
+ TWGroupe->setItem( i, 0, new QTableWidgetItem( QString ("") ) );
+ TWGroupe->item( i, 0 )->setFlags( 0 );
+ TWGroupe->item( i, 0 )->setCheckState( Qt::Checked );
+ TWGroupe->setItem( i, 1, new QTableWidgetItem(_listeGroupesHypo[i]));
+ }
+ TWGroupe->resizeRowsToContents();
+}
+
+
--- /dev/null
+// 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
+//
+
+#ifndef MON_EDITLISTGROUPCAO_H
+#define MON_EDITLISTGROUPCAO_H
+
+#include "HOMARDGUI_Exports.hxx"
+
+#include <SALOMEconfig.h>
+#include <SalomeApp_Module.h>
+
+#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
+#include CORBA_CLIENT_HEADER(HOMARD_Gen)
+
+#include <MonCreateListGroupCAO.h>
+
+class MonCreateHypothesis;
+class MonCreateBoundaryCAO;
+class HOMARD_EXPORT MonEditListGroupCAO : public MonCreateListGroupCAO
+{
+ Q_OBJECT
+
+public:
+ MonEditListGroupCAO( MonCreateHypothesis* parentHyp, MonCreateBoundaryCAO* parentBound, bool modal, HOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo);
+ virtual ~MonEditListGroupCAO();
+
+protected :
+
+ virtual void InitGroupes();
+
+};
+
+#endif // MON_EDITLISTGROUPCAO_H
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
${PROJECT_BINARY_DIR}/adm_local/unix
+ ${PROJECT_SOURCE_DIR}/src/FrontTrack
${PROJECT_SOURCE_DIR}/src/HOMARD
${PROJECT_SOURCE_DIR}/src/HOMARDGUI
)
${KERNEL_SalomeGenericObj}
${SMESH_SalomeIDLSMESH}
${SMESH_SMESHEngine}
+ FrontTrack
SalomeIDLHOMARD
HOMARDImpl
)
HOMARD_Boundary_i.hxx
HOMARD_YACS_i.hxx
HomardMedCommun.h
- HOMARD_i.hxx
+ HOMARD_i.hxx
)
# --- sources ---
return CORBA::string_dup( myHomardBoundary->GetMeshName().c_str() );
}
//=============================================================================
-void HOMARD_Boundary_i::SetMeshFile( const char* MeshFile )
+void HOMARD_Boundary_i::SetDataFile( const char* DataFile )
{
ASSERT( myHomardBoundary );
- myHomardBoundary->SetMeshFile( MeshFile );
+ myHomardBoundary->SetDataFile( DataFile );
int PublisMeshIN = _gen_i->GetPublisMeshIN () ;
- if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(MeshFile, 0); }
+ if ( PublisMeshIN != 0 ) { _gen_i->PublishResultInSmesh(DataFile, 0); }
}
//=============================================================================
-char* HOMARD_Boundary_i::GetMeshFile()
+char* HOMARD_Boundary_i::GetDataFile()
{
ASSERT( myHomardBoundary );
- return CORBA::string_dup( myHomardBoundary->GetMeshFile().c_str() );
+ return CORBA::string_dup( myHomardBoundary->GetDataFile().c_str() );
}
//=============================================================================
void HOMARD_Boundary_i::SetCylinder( double X0, double X1, double X2, double X3, double X4, double X5, double X6 )
void SetMeshName( const char* MeshName );
char* GetMeshName();
- void SetMeshFile( const char* MeshFile );
- char* GetMeshFile();
+ void SetDataFile( const char* DataFile );
+ char* GetDataFile();
void SetCylinder( double Xcentre, double Ycentre, double ZCentre,
double Xaxe, double Yaxe, double Zaxe,
return aResult._retn();
}
//=============================================================================
+void HOMARD_Cas_i::AddBoundary(const char* BoundaryName)
+{
+ MESSAGE ("HOMARD_Cas_i::AddBoundary : BoundaryName = "<< BoundaryName );
+ const char * Group = "" ;
+ AddBoundaryGroup( BoundaryName, Group) ;
+}
+//=============================================================================
void HOMARD_Cas_i::AddBoundaryGroup( const char* BoundaryName, const char* Group)
{
- MESSAGE ("AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group );
+ MESSAGE ("HOMARD_Cas_i::AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group );
ASSERT( myHomardCas );
- // A. La liste des frontiere+groupes
+ // A. Préalables
+ // A.1. Caractéristiques de la frontière à ajouter
+ HOMARD::HOMARD_Boundary_ptr myBoundary = _gen_i->GetBoundary(BoundaryName) ;
+ ASSERT(!CORBA::is_nil(myBoundary));
+ int BoundaryType = myBoundary->GetType();
+ MESSAGE ( ". BoundaryType = " << BoundaryType );
+ // A.2. La liste des frontiere+groupes
const std::list<std::string>& ListBoundaryGroup = myHomardCas->GetBoundaryGroup();
std::list<std::string>::const_iterator it;
- // B. La frontiere
- // B.1. La frontiere est-elle deja enregistree pour ce cas ?
- bool existe = false ;
- for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ // B. Controles
+ const char * boun ;
+ int erreur = 0 ;
+ while ( erreur == 0 )
{
-// MESSAGE (".. Frontiere : "<< *it );
- if ( *it == BoundaryName ) { existe = true ; }
- it++ ;
- }
- // B.2. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas
- if ( !existe )
- {
- char* CaseName = GetName() ;
- MESSAGE ( "AddBoundaryGroup : insertion de la frontiere dans l'arbre de " << CaseName );
- _gen_i->PublishBoundaryUnderCase(CaseName, BoundaryName) ;
+ // B.1. Si on ajoute une frontière CAO, elle doit être la seule frontière
+ if ( BoundaryType == -1 )
+ {
+ for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ {
+ boun = (*it).c_str() ;
+ MESSAGE (".. Frontiere enregistrée : "<< boun );
+ if ( *it != BoundaryName )
+ { erreur = 1 ;
+ break ; }
+ // On saute le nom du groupe
+ it++ ;
+ }
+ }
+ if ( erreur != 0 ) { break ; }
+ // B.2. Si on ajoute une frontière non CAO, il ne doit pas y avoir de frontière CAO
+ if ( BoundaryType != -1 )
+ {
+ for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ {
+ boun = (*it).c_str() ;
+ MESSAGE (".. Frontiere enregistrée : "<< boun );
+ HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ;
+ int BoundaryType_0 = myBoundary_0->GetType();
+ MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 );
+ if ( BoundaryType_0 == -1 )
+ { erreur = 2 ;
+ break ; }
+ // On saute le nom du groupe
+ it++ ;
+ }
+ if ( erreur != 0 ) { break ; }
+ }
+ // B.3. Si on ajoute une frontière discrète, il ne doit pas y avoir d'autre frontière discrète
+ if ( BoundaryType == 0 )
+ {
+ for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ {
+ boun = (*it).c_str() ;
+ MESSAGE (".. Frontiere enregistrée : "<< boun );
+ if ( boun != BoundaryName )
+ {
+ HOMARD::HOMARD_Boundary_ptr myBoundary_0 = _gen_i->GetBoundary(boun) ;
+ int BoundaryType_0 = myBoundary_0->GetType();
+ MESSAGE ( ".. BoundaryType_0 = " << BoundaryType_0 );
+ if ( BoundaryType_0 == 0 )
+ { erreur = 3 ;
+ break ; }
+ }
+ // On saute le nom du groupe
+ it++ ;
+ }
+ if ( erreur != 0 ) { break ; }
+ }
+ // B.4. Pour une nouvelle frontiere, publication dans l'arbre d'etudes sous le cas
+ bool existe = false ;
+ for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ {
+ MESSAGE (".. Frontiere : "<< *it );
+ if ( *it == BoundaryName ) { existe = true ; }
+ // On saute le nom du groupe
+ it++ ;
+ }
+ if ( !existe )
+ {
+ char* CaseName = GetName() ;
+ MESSAGE ( "AddBoundaryGroup : insertion de la frontiere dans l'arbre de " << CaseName );
+ _gen_i->PublishBoundaryUnderCase(CaseName, BoundaryName) ;
+ }
+ // B.5. Le groupe est-il deja enregistre pour une frontiere de ce cas ?
+ for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ {
+ boun = (*it).c_str() ;
+ it++ ;
+ MESSAGE (".. Groupe enregistré : "<< *it );
+ if ( *it == Group )
+ { erreur = 5 ;
+ break ; }
+ }
+ if ( erreur != 0 ) { break ; }
+ //
+ break ;
}
- // C. Le groupe est-il deja enregistre pour une frontiere de ce cas ?
- for ( it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++ )
+ // F. Si aucune erreur, enregistrement du couple (frontiere,groupe) dans la reference du cas
+ // Sinon, arrêt
+ if ( erreur == 0 )
+ { myHomardCas->AddBoundaryGroup( BoundaryName, Group ); }
+ else
{
- std::string boun = *it ;
- it++ ;
-// MESSAGE (".. Group : "<< *it );
- if ( *it == Group )
- { INFOS ("Frontiere " << boun << " Un groupe est deja associe " << Group ) ;
- SALOME::ExceptionStruct es;
- es.type = SALOME::BAD_PARAM;
- es.text = "Invalid AddBoundaryGroup";
- throw SALOME::SALOME_Exception(es);
- return ;
- }
+ std::stringstream ss;
+ ss << erreur;
+ std::string str = ss.str();
+ std::string texte ;
+ texte = "Erreur numéro " + str + " pour la frontière à enregistrer : " + std::string(BoundaryName) ;
+ if ( erreur == 1 ) { texte += "\nIl existe déjà la frontière " ; }
+ else if ( erreur == 2 ) { texte += "\nIl existe déjà la frontière CAO " ; }
+ else if ( erreur == 3 ) { texte += "\nIl existe déjà une frontière discrète : " ; }
+ else if ( erreur == 5 ) { texte += "\nLe groupe " + std::string(Group) + " est déjà enregistré pour la frontière " ; }
+ texte += std::string(boun) ;
+ //
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::BAD_PARAM;
+#ifdef _DEBUG_
+ texte += "\nInvalid AddBoundaryGroup";
+#endif
+ INFOS(texte) ;
+ es.text = CORBA::string_dup(texte.c_str());
+ throw SALOME::SALOME_Exception(es);
}
- // D. Enregistrement du couple (frontiere,groupe) dans la reference du cas
- myHomardCas->AddBoundaryGroup( BoundaryName, Group );
}
//=============================================================================
HOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup()
void SetGroups(const HOMARD::ListGroupType& ListGroup);
HOMARD::ListGroupType* GetGroups();
- void AddBoundaryGroup( const char* Boundary, const char* Group);
+ void AddBoundary(const char* Boundary);
+ void AddBoundaryGroup(const char* Boundary, const char* Group);
HOMARD::ListBoundaryGroupType* GetBoundaryGroup();
void SupprBoundaryGroup( );
#include "YACSDriver.hxx"
#include "HOMARD.hxx"
+#include "FrontTrack.hxx"
+
#include "HOMARD_version.h"
#include "utilities.h"
}
//=============================================================================
//=============================================================================
-// Utilitaires pour l'??tude
+// Utilitaires pour l'étude
//=============================================================================
//=============================================================================
void HOMARD_Gen_i::UpdateStudy()
myIteration->SetHypoName(nomHypo);
myHypo->LinkIteration(nomIter);
- // On stocke les noms des champ a interpoler pour le futur controle de la donnee des pas de temps
+ // On stocke les noms des champ a interpoler pour le futur controle de la donnée des pas de temps
myIteration->SupprFieldInterps() ;
HOMARD::listeFieldInterpsHypo* ListField = myHypo->GetFieldInterps();
int numberOfFieldsx2 = ListField->length();
HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromIteration(const char* nomCas, const char* DirNameStart)
//
// nomCas : nom du cas a creer
-// DirNameStart : nom du repertoire contenant l'iteration de reprise
+// DirNameStart : nom du répertoire contenant l'iteration de reprise
//
{
INFOS ( "CreateCaseFromIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart );
int codret ;
// A. Decodage du point de reprise
- // A.1. Controle du repertoire de depart de l'iteration
+ // A.1. Controle du répertoire de depart de l'iteration
codret = CHDIR(DirNameStart) ;
if ( codret != 0 )
{
throw SALOME::SALOME_Exception(es);
return 0;
};
- // A.2. Reperage des fichiers du repertoire de reprise
+ // A.2. Reperage des fichiers du répertoire de reprise
std::string file_configuration = "" ;
std::string file_maillage_homard = "" ;
int bilan ;
char* MeshFile ;
// le constructeur de ifstream permet d'ouvrir un fichier en lecture
std::ifstream fichier( file_configuration.c_str() );
- if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert
+ if ( fichier ) // ce test échoue si le fichier n'est pas ouvert
{
std::string ligne; // variable contenant chaque ligne lue
std::string mot_cle;
std::string argument;
int decalage;
- // cette boucle sur les lignes s'arr??te d??s qu'une erreur de lecture survient
+ // cette boucle sur les lignes s'arrête dès qu'une erreur de lecture survient
while ( std::getline( fichier, ligne ) )
{
// B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle
myCase->SetPyram (Pyram) ;
// E. Copie du fichier de maillage homard
- // E.1. Repertoire associe au cas
+ // E.1. Répertoire associe au cas
char* nomDirCase = myCase->GetDirName() ;
- // E.2. Repertoire associe a l'iteration de ce cas
+ // E.2. Répertoire associe a l'iteration de ce cas
char* IterName ;
IterName = myCase->GetIter0Name() ;
HOMARD::HOMARD_Iteration_var Iter = GetIteration(IterName) ;
HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseLastIteration(const char* nomCas, const char* DirNameStart)
//
// nomCas : nom du cas a creer
-// DirNameStart : nom du repertoire du cas contenant l'iteration de reprise
+// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise
//
{
INFOS ( "CreateCaseFromCaseLastIteration : nomCas = " << nomCas << ", DirNameStart = " << DirNameStart );
HOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseFromCaseIteration(const char* nomCas, const char* DirNameStart, CORBA::Long Number)
//
// nomCas : nom du cas a creer
-// DirNameStart : nom du repertoire du cas contenant l'iteration de reprise
+// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise
// Number : numero de l'iteration de depart
//
{
//=============================================================================
std::string HOMARD_Gen_i::CreateCase1(const char* DirNameStart, CORBA::Long Number)
//
-// Retourne le nom du repertoire ou se trouve l'iteration voulue.
-// DirNameStart : nom du repertoire du cas contenant l'iteration de reprise
+// Retourne le nom du répertoire ou se trouve l'iteration voulue.
+// DirNameStart : nom du répertoire du cas contenant l'iteration de reprise
// Number : numero de l'iteration de depart ou -1 si on cherche la derniere
//
{
int codret ;
int NumeIterMax = -1 ;
- // A.1. Controle du repertoire de depart du cas
+ // A.1. Controle du répertoire de depart du cas
codret = CHDIR(DirNameStart) ;
if ( codret != 0 )
{
throw SALOME::SALOME_Exception(es);
return 0;
};
- // A.2. Reperage des sous-repertoire du repertoire de reprise
+ // A.2. Reperage des sous-répertoire du répertoire de reprise
bool existe = false ;
#ifndef WIN32
DIR *dp;
{
if ( CHDIR(DirName_1.c_str()) == 0 )
{
-// On cherche le fichier de configuration dans ce sous-repertoire
+// On cherche le fichier de configuration dans ce sous-répertoire
codret = CHDIR(DirNameStart);
#ifndef WIN32
DIR *dp_1;
CHDIR(DirName_1.c_str()) ;
std::ifstream fichier( file_name_1.c_str() );
- if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert
+ if ( fichier ) // ce test échoue si le fichier n'est pas ouvert
{
int NumeIter ;
std::string ligne; // variable contenant chaque ligne lue
std::string mot_cle;
- // cette boucle sur les lignes s'arr??te d??s qu'une erreur de lecture survient
+ // cette boucle sur les lignes s'arrête dès qu'une erreur de lecture survient
while ( std::getline( fichier, ligne ) )
{
// B.1. Pour la ligne courante, on identifie le premier mot : le mot-cle
// C. Caracteristiques du maillage
if ( existeMeshFile != 0 )
{
- // Les valeurs extremes des coordonnees
-// MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnees" );
+ // Les valeurs extremes des coordonnées
+// MESSAGE ( "CreateCase0 : Les valeurs extremes des coordonnées" );
std::vector<double> LesExtremes =GetBoundingBoxInMedFile(MeshFile) ;
HOMARD::extrema_var aSeq = new HOMARD::extrema() ;
if (LesExtremes.size()!=10) { return 0; }
myIteration->SetNumber(numero);
// Nombre d'iterations deja connues pour le cas, permettant
-// la creation d'un sous-repertoire unique
+// la creation d'un sous-répertoire unique
int nbitercase = myCase->GetNumberofIter();
char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase );
myIteration->SetDirNameLoc(nomDirIter);
return HOMARD::HOMARD_Boundary::_duplicate(myBoundary);
}
//=============================================================================
+HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCAO(const char* BoundaryName, const char* CAOFile)
+{
+ INFOS ("CreateBoundaryCAO : BoundaryName = " << BoundaryName << ", CAOFile = " << CAOFile );
+ HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, -1);
+ myBoundary->SetDataFile( CAOFile ) ;
+
+ return HOMARD::HOMARD_Boundary::_duplicate(myBoundary);
+}
+//=============================================================================
HOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryDi(const char* BoundaryName, const char* MeshName, const char* MeshFile)
{
- INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName );
+ INFOS ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile );
HOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0);
- myBoundary->SetMeshFile( MeshFile ) ;
+ myBoundary->SetDataFile( MeshFile ) ;
myBoundary->SetMeshName( MeshName ) ;
return HOMARD::HOMARD_Boundary::_duplicate(myBoundary);
//=============================================================================
//=============================================================================
// Traitement d'une iteration
-// etatMenage = 1 : destruction du repertoire d'execution
+// etatMenage = 1 : destruction du répertoire d'execution
// modeHOMARD = 1 : adaptation
// != 1 : information avec les options modeHOMARD
// Option1 >0 : appel depuis python
HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[nomCas];
ASSERT(!CORBA::is_nil(myCase));
- // B. Les repertoires
- // B.1. Le repertoire courant
+ // B. Les répertoires
+ // B.1. Le répertoire courant
std::string nomDirWork = getenv("PWD") ;
- // B.2. Le sous-repertoire de l'iteration a traiter
+ // B.2. Le sous-répertoire de l'iteration a traiter
char* DirCompute = ComputeDirManagement(myCase, myIteration, etatMenage);
MESSAGE( ". DirCompute = " << DirCompute );
FileInfo += "." + siterp1 + ".bilan" ;
myIteration->SetFileInfo(FileInfo.c_str());
- // D. On passe dans le repertoire de l'iteration a calculer
+ // D. On passe dans le répertoire de l'iteration a calculer
MESSAGE ( ". On passe dans DirCompute = " << DirCompute );
CHDIR(DirCompute);
- // E. Les donnees de l'execution HOMARD
+ // E. Les données de l'exécution HOMARD
// E.1. L'objet du texte du fichier de configuration
HomardDriver* myDriver = new HomardDriver(siter, siterp1);
myDriver->TexteInit(DirCompute, LogFile, _Langue);
const char* MeshFile = myIteration->GetMeshFile();
MESSAGE ( ". MeshFile = " << MeshFile );
- // E.3. Les donnees du traitement HOMARD
+ // E.3. Les données du traitement HOMARD
int iaux ;
if ( modeHOMARD == 1 )
{
}
// E.4. Ajout des informations liees a l'eventuel suivi de frontiere
- DriverTexteBoundary(myCase, myDriver) ;
+ int BoundaryOption = DriverTexteBoundary(myCase, myDriver) ;
// E.5. Ecriture du texte dans le fichier
MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<<codret );
// G. Execution
//
- int codretexec = 12 ;
+ int codretexec = 1789 ;
if (codret == 0)
{
codretexec = myDriver->ExecuteHomard(Option1);
text = "Error during the adaptation.\n" ;
bool stopvu = false ;
std::ifstream fichier( LogFile.c_str() );
- if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert
+ if ( fichier ) // ce test échoue si le fichier n'est pas ouvert
{
std::string ligne; // variable contenant chaque ligne lue
while ( std::getline( fichier, ligne ) )
}
}
- // I. Menage et retour dans le repertoire du cas
+ // I. Menage et retour dans le répertoire du cas
if (codret == 0)
{
delete myDriver;
CHDIR(nomDirWork.c_str());
}
+ // J. Suivi de la frontière CAO
+// std::cout << "- codret : " << codret << std::endl;
+// std::cout << "- modeHOMARD : " << modeHOMARD << std::endl;
+// std::cout << "- BoundaryOption : " << BoundaryOption << std::endl;
+// std::cout << "- codretexec : " << codretexec << std::endl;
+ if (codret == 0)
+ {
+ if ( ( modeHOMARD == 1 ) && ( BoundaryOption % 5 == 0 ) && (codretexec == 0) )
+ {
+ INFOS ( "Suivi de frontière CAO" );
+ codret = ComputeCAO(myCase, myIteration, Option1, Option2) ;
+ }
+ }
+
return codretexec ;
}
//=============================================================================
-// Calcul d'une iteration : partie specifique a l'adaptation
+// Calcul d'une iteration : partie spécifique à l'adaptation
//=============================================================================
CORBA::Long HOMARD_Gen_i::ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2)
{
- MESSAGE ( "ComputeAdap" );
+ MESSAGE ( "ComputeAdap avec Option1 = " << Option1 << ", Option2 = " << Option2 );
// A. Prealable
// A.1. Bases
}
};
- // C. Le sous-repertoire de l'iteration precedente
+ // C. Le sous-répertoire de l'iteration precedente
char* DirComputePa = ComputeDirPaManagement(myCase, myIteration);
MESSAGE( ". DirComputePa = " << DirComputePa );
- // D. Les donnees de l'adaptation HOMARD
+ // D. Les données de l'adaptation HOMARD
// D.1. Le type de conformite
int ConfType = myCase->GetConfType();
MESSAGE ( ". ConfType = " << ConfType );
return codret ;
}
//=============================================================================
-// Creation d'un nom de sous-repertoire pour l'iteration au sein d'un repertoire parent
-// nomrep : nom du repertoire parent
-// num : le nom du sous-repertoire est sous la forme 'In', n est >= num
+// Calcul d'une iteration : partie spécifique au suivi de frontière CAO
+//=============================================================================
+CORBA::Long HOMARD_Gen_i::ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2)
+{
+ MESSAGE ( "ComputeCAO avec Option1 = " << Option1 << ", Option2 = " << Option2 );
+
+ // A. Prealable
+ // A.1. Bases
+ int codret = 0;
+ // A.2. Le sous-répertoire de l'iteration en cours de traitement
+ char* DirCompute = myIteration->GetDirName();
+ // A.3. Le maillage résultat de l'iteration en cours de traitement
+ char* MeshFile = myIteration->GetMeshFile();
+
+ // B. Les données pour FrontTrack
+ // B.1. Le maillage à modifier
+ const std::string theInputMedFile = MeshFile;
+ MESSAGE ( ". theInputMedFile = " << theInputMedFile );
+
+ // B.2. Le maillage après modification : fichier identique
+ const std::string theOutputMedFile = MeshFile ;
+ MESSAGE ( ". theOutputMedFile = " << theInputMedFile );
+
+ // B.3. La liste des fichiers contenant les numéros des noeuds à bouger
+ std::vector< std::string > theInputNodeFiles ;
+ MESSAGE ( ". DirCompute = " << DirCompute );
+ int bilan ;
+ int icpt = 0 ;
+#ifndef WIN32
+ DIR *dp;
+ struct dirent *dirp;
+ dp = opendir(DirCompute);
+ while ( (dirp = readdir(dp)) != NULL )
+ {
+ std::string file_name(dirp->d_name);
+ bilan = file_name.find("fr") ;
+ if ( bilan != string::npos )
+ {
+ std::stringstream filename_total ;
+ filename_total << DirCompute << "/" << file_name ;
+ theInputNodeFiles.push_back(filename_total.str()) ;
+ icpt += 1 ;
+ }
+ }
+#else
+ HANDLE hFind = INVALID_HANDLE_VALUE;
+ WIN32_FIND_DATA ffd;
+ hFind = FindFirstFile(DirNameStart, &ffd);
+ if (INVALID_HANDLE_VALUE != hFind) {
+ while (FindNextFile(hFind, &ffd) != 0) {
+ std::string file_name(ffd.cFileName);
+ bilan = file_name.find("fr") ;
+ if ( bilan != string::npos )
+ {
+ std::stringstream filename_total ;
+ filename_total << DirCompute << "/" << file_name ;
+ theInputNodeFiles.push_back(filename_total.str()) ;
+ icpt += 1 ;
+ }
+ }
+ FindClose(hFind);
+ }
+#endif
+ for ( int i = 0; i < icpt; i++ )
+ { MESSAGE ( ". theInputNodeFiles["<< i << "] = " << theInputNodeFiles[i] ); }
+
+ // B.4. Le fichier de la CAO
+ HOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup();
+ std::string BoundaryName = std::string((*ListBoundaryGroupType)[0]);
+ MESSAGE ( ". BoundaryName = " << BoundaryName );
+ HOMARD::HOMARD_Boundary_var myBoundary = myStudyContext._mesBoundarys[BoundaryName];
+ const std::string theXaoFileName = myBoundary->GetDataFile();
+ MESSAGE ( ". theXaoFileName = " << theXaoFileName );
+
+ // B.5. Parallélisme
+ bool theIsParallel = false;
+
+ // C. Lancement des projections
+ MESSAGE ( ". Lancement des projections" );
+ FrontTrack* myFrontTrack = new FrontTrack();
+ myFrontTrack->track(theInputMedFile, theOutputMedFile, theInputNodeFiles, theXaoFileName, theIsParallel);
+
+ // D. Transfert des coordonnées modifiées dans le fichier historique de HOMARD
+ // On lance une exécution spéciale de HOMARD en attendant de savoir le faire avec MEDCoupling
+ MESSAGE ( ". Transfert des coordonnées" );
+ codret = ComputeCAObis(myIteration, Option1, Option2) ;
+
+ return codret ;
+}
+//=============================================================================
+//=============================================================================
+// Transfert des coordonnées en suivi de frontière CAO
+// Option1 >0 : appel depuis python
+// <0 : appel depuis GUI
+// Option2 : multiple de nombres premiers
+// 1 : aucune option
+// x2 : publication du maillage dans SMESH
+//=============================================================================
+CORBA::Long HOMARD_Gen_i::ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2)
+{
+ MESSAGE ( "ComputeCAObis, avec Option1 = " << Option1 << ", Option2 = " << Option2 );
+
+ // A. Prealable
+ int codret = 0;
+
+ // A.1. Controle de la possibilite d'agir
+ // A.1.1. Etat de l'iteration
+ int etat = myIteration->GetState();
+ MESSAGE ( "etat = "<<etat );
+ // A.1.2. L'iteration doit être calculee
+ if ( etat == 1 )
+ {
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::BAD_PARAM;
+ es.text = "This iteration is not computed.";
+ throw SALOME::SALOME_Exception(es);
+ return 1 ;
+ }
+ // A.2. Numero de l'iteration
+ // siterp1 : numero de l'iteration a traiter
+ int NumeIter = myIteration->GetNumber();
+ std::string siterp1 ;
+ std::stringstream saux1 ;
+ saux1 << NumeIter ;
+ siterp1 = saux1.str() ;
+ if (NumeIter < 10) { siterp1 = "0" + siterp1 ; }
+ MESSAGE ( "siterp1 = "<<siterp1 );
+
+ // A.3. Le cas
+ const char* CaseName = myIteration->GetCaseName();
+ HOMARD::HOMARD_Cas_var myCase = myStudyContext._mesCas[CaseName];
+ ASSERT(!CORBA::is_nil(myCase));
+
+ // A.4. Le sous-répertoire de l'iteration a traiter
+ char* DirCompute = myIteration->GetDirName();
+ MESSAGE( ". DirCompute = " << DirCompute );
+
+ // C. Le fichier des messages
+ std::string LogFile = DirCompute ;
+ LogFile += "/Liste." + siterp1 + ".maj_coords.log" ;
+ MESSAGE (". LogFile = " << LogFile);
+ myIteration->SetFileInfo(LogFile.c_str());
+
+ // D. On passe dans le répertoire de l'iteration a calculer
+ MESSAGE ( ". On passe dans DirCompute = " << DirCompute );
+ CHDIR(DirCompute);
+
+ // E. Les données de l'exécution HOMARD
+ // E.1. L'objet du texte du fichier de configuration
+ HomardDriver* myDriver = new HomardDriver("", siterp1);
+ myDriver->TexteInit(DirCompute, LogFile, _Langue);
+
+ // E.2. Le maillage associe a l'iteration
+ const char* NomMesh = myIteration->GetMeshName();
+ MESSAGE ( ". NomMesh = " << NomMesh );
+ const char* MeshFile = myIteration->GetMeshFile();
+ MESSAGE ( ". MeshFile = " << MeshFile );
+
+ // E.3. Les données du traitement HOMARD
+ int iaux ;
+ myDriver->TexteMajCoords( NumeIter ) ;
+ iaux = 0 ;
+ myDriver->TexteMaillageHOMARD( DirCompute, siterp1, iaux ) ;
+ myDriver->TexteMaillage(NomMesh, MeshFile, 0);
+//
+ // E.4. Ecriture du texte dans le fichier
+ MESSAGE ( ". Ecriture du texte dans le fichier de configuration ; codret = "<<codret );
+ if (codret == 0)
+ { myDriver->CreeFichier(); }
+
+// F. Execution
+//
+ int codretexec = 1789 ;
+ if (codret == 0)
+ {
+ codretexec = myDriver->ExecuteHomard(Option1);
+ MESSAGE ( "Erreur en executant HOMARD : " << codretexec );
+ }
+
+ // G. Gestion des resultats
+ if (codret == 0)
+ {
+ // G.1. Le fichier des messages, dans tous les cas
+ const char* NomIteration = myIteration->GetName();
+ std::string Commentaire = "logmaj_coords" ;
+ PublishFileUnderIteration(NomIteration, LogFile.c_str(), Commentaire.c_str());
+ // G.2 Message d'erreur
+ if (codretexec != 0)
+ {
+ std::string text = "\n\nSee the file " + LogFile + "\n" ;
+ INFOS ( text ) ;
+ SALOME::ExceptionStruct es;
+ es.type = SALOME::BAD_PARAM;
+ es.text = CORBA::string_dup(text.c_str());
+ throw SALOME::SALOME_Exception(es);
+
+ // On force le succes pour pouvoir consulter le fichier log
+ codretexec = 0 ;
+ }
+ }
+
+ // H. Menage et retour dans le répertoire du cas
+ if (codret == 0) { delete myDriver; }
+
+ return codret ;
+}
+//=============================================================================
+// Creation d'un nom de sous-répertoire pour l'iteration au sein d'un répertoire parent
+// nomrep : nom du répertoire parent
+// num : le nom du sous-répertoire est sous la forme 'In', n est >= num
//=============================================================================
char* HOMARD_Gen_i::CreateDirNameIter(const char* nomrep, CORBA::Long num )
{
MESSAGE ( "CreateDirNameIter : nomrep ="<< nomrep << ", num = "<<num);
- // On verifie que le repertoire parent existe
+ // On verifie que le répertoire parent existe
int codret = CHDIR(nomrep) ;
if ( codret != 0 )
{
};
std::string nomDirActuel = getenv("PWD") ;
std::string DirName ;
- // On boucle sur tous les noms possibles jusqu'a trouver un nom correspondant a un repertoire inconnu
+ // On boucle sur tous les noms possibles jusqu'a trouver un nom correspondant a un répertoire inconnu
bool a_chercher = true ;
while ( a_chercher )
{
- // On passe dans le repertoire parent
+ // On passe dans le répertoire parent
CHDIR(nomrep);
// On recherche un nom sous la forme Iabc, avec abc representant le numero
iaux << std::setw(jaux) << std::setfill('0') << num ;
std::ostringstream DirNameA ;
DirNameA << "I" << iaux.str();
- // Si on ne pas peut entrer dans le repertoire, on doit verifier
+ // Si on ne pas peut entrer dans le répertoire, on doit verifier
// que c'est bien un probleme d'absence
if ( CHDIR(DirNameA.str().c_str()) != 0 )
{
return CORBA::string_dup( DirName.c_str() );
}
//=============================================================================
-// Calcul d'une iteration : gestion du repertoire de calcul
-// Si le sous-repertoire existe :
-// etatMenage = 0 : on sort en erreur si le repertoire n'est pas vide
-// etatMenage = 1 : on fait le menage du repertoire
+// Calcul d'une iteration : gestion du répertoire de calcul
+// Si le sous-répertoire existe :
+// etatMenage = 0 : on sort en erreur si le répertoire n'est pas vide
+// etatMenage = 1 : on fait le menage du répertoire
// etatMenage = -1 : on ne fait rien
//=============================================================================
char* HOMARD_Gen_i::ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage)
{
- MESSAGE ( "ComputeDirManagement : repertoires pour le calcul" );
- // B.2. Le repertoire du cas
+ MESSAGE ( "ComputeDirManagement : répertoires pour le calcul" );
+ // B.2. Le répertoire du cas
const char* nomDirCase = myCase->GetDirName();
MESSAGE ( ". nomDirCase = " << nomDirCase );
- // B.3. Le sous-repertoire de l'iteration a calculer, puis le repertoire complet a creer
- // B.3.1. Le nom du sous-repertoire
+ // B.3. Le sous-répertoire de l'iteration a calculer, puis le répertoire complet a creer
+ // B.3.1. Le nom du sous-répertoire
const char* nomDirIt = myIteration->GetDirNameLoc();
- // B.3.2. Le nom complet du sous-repertoire
+ // B.3.2. Le nom complet du sous-répertoire
std::stringstream DirCompute ;
DirCompute << nomDirCase << "/" << nomDirIt;
MESSAGE (". DirCompute = " << DirCompute.str() );
- // B.3.3. Si le sous-repertoire n'existe pas, on le cree
+ // B.3.3. Si le sous-répertoire n'existe pas, on le cree
if (CHDIR(DirCompute.str().c_str()) != 0)
{
#ifndef WIN32
#endif
{
// GERALD -- QMESSAGE BOX
- std::cerr << "Pb Creation du repertoire DirCompute = " << DirCompute.str() << std::endl;
- VERIFICATION("Pb a la creation du repertoire" == 0);
+ std::cerr << "Pb Creation du répertoire DirCompute = " << DirCompute.str() << std::endl;
+ VERIFICATION("Pb a la creation du répertoire" == 0);
}
}
else
{
-// Le repertoire existe
+// Le répertoire existe
// On demande de faire le menage de son contenu :
if (etatMenage == 1)
{
- MESSAGE (". Menage du repertoire DirCompute = " << DirCompute.str());
+ MESSAGE (". Menage du répertoire DirCompute = " << DirCompute.str());
std::string commande = "rm -rf " + DirCompute.str()+"/*" ;
int codret = system(commande.c_str());
if (codret != 0)
{
// GERALD -- QMESSAGE BOX
- std::cerr << ". Menage du repertoire de calcul" << DirCompute.str() << std::endl;
- VERIFICATION("Pb au menage du repertoire de calcul" == 0);
+ std::cerr << ". Menage du répertoire de calcul" << DirCompute.str() << std::endl;
+ VERIFICATION("Pb au menage du répertoire de calcul" == 0);
}
}
// On n'a pas demande de faire le menage de son contenu : on sort en erreur :
return CORBA::string_dup( DirCompute.str().c_str() );
}
//=============================================================================
-// Calcul d'une iteration : gestion du repertoire de calcul de l'iteration parent
+// Calcul d'une iteration : gestion du répertoire de calcul de l'iteration parent
//=============================================================================
char* HOMARD_Gen_i::ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration)
{
- MESSAGE ( "ComputeDirPaManagement : repertoires pour le calcul" );
- // Le repertoire du cas
+ MESSAGE ( "ComputeDirPaManagement : répertoires pour le calcul" );
+ // Le répertoire du cas
const char* nomDirCase = myCase->GetDirName();
MESSAGE ( ". nomDirCase = " << nomDirCase );
- // Le sous-repertoire de l'iteration precedente
+ // Le sous-répertoire de l'iteration precedente
const char* nomIterationParent = myIteration->GetIterParentName();
HOMARD::HOMARD_Iteration_var myIterationParent = myStudyContext._mesIterations[nomIterationParent];
for (int NumeComp = 0; NumeComp< numberOfCompos; NumeComp++)
{
std::string nomCompo = std::string((*mescompo)[NumeComp]);
- if ((system(nomCompo.c_str())) != 0)
- {
- MESSAGE( "... nomCompo = " << nomCompo );
- myDriver->TexteCompo(NumeComp, nomCompo);
- }
+ MESSAGE( "... nomCompo = " << nomCompo );
+ myDriver->TexteCompo(NumeComp, nomCompo);
}
return ;
}
// 2. les liens avec les groupes
// 3. un entier resumant le type de comportement pour les frontieres
//=============================================================================
-void HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver)
+int HOMARD_Gen_i::DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver)
{
MESSAGE ( "... DriverTexteBoundary" );
// 1. Recuperation des frontieres
int BoundaryType = myBoundary->GetType();
MESSAGE ( "... BoundaryType = " << BoundaryType );
// 2.2.2. Ecriture selon le type
- // 2.2.2.1. Cas d une frontiere discrete
- if (BoundaryType == 0)
+ // 2.2.2.1. Cas d une frontiere CAO
+ if (BoundaryType == -1)
+ {
+// const char* CAOFile = myBoundary->GetDataFile() ;
+// MESSAGE ( ". CAOFile = " << CAOFile );
+ if ( BoundaryOption % 5 != 0 ) { BoundaryOption = BoundaryOption*5 ; }
+ }
+ // 2.2.2.2. Cas d une frontiere discrete
+ else if (BoundaryType == 0)
{
const char* MeshName = myBoundary->GetMeshName() ;
MESSAGE ( ". MeshName = " << MeshName );
- const char* MeshFile = myBoundary->GetMeshFile() ;
+ const char* MeshFile = myBoundary->GetDataFile() ;
MESSAGE ( ". MeshFile = " << MeshFile );
myDriver->TexteBoundaryDi( MeshName, MeshFile);
if ( BoundaryOption % 2 != 0 ) { BoundaryOption = BoundaryOption*2 ; }
}
- // 2.2.2.1. Cas d une frontiere analytique
+ // 2.2.2.3. Cas d une frontiere analytique
else
{
NumBoundaryAnalytical++ ;
// 3.1. Recuperation du nom du groupe
std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]);
MESSAGE ( "... GroupName = " << GroupName);
- // 3.2. Cas d une frontiere discrete
- if ( BoundaryType == 0 )
+ // 3.2. Cas d une frontiere CAO
+ if ( BoundaryType == -1 )
+ {
+ if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryCAOGr ( GroupName ) ; }
+ }
+ // 3.3. Cas d une frontiere discrete
+ else if ( BoundaryType == 0 )
{
if ( GroupName.size() > 0 ) { myDriver->TexteBoundaryDiGr ( GroupName ) ; }
}
- // 3.3. Cas d une frontiere analytique
+ // 3.4. Cas d une frontiere analytique
else
{
NumBoundaryAnalytical++ ;
// 4. Ecriture de l'option finale
myDriver->TexteBoundaryOption(BoundaryOption);
//
- return ;
+ return BoundaryOption ;
}
//=============================================================================
// Calcul d'une iteration : ecriture des interpolations dans le fichier de configuration
}
jaux += 2 ;
}
- // Si aucun instant n'a ??t?? d??fini
+ // Si aucun instant n'a été défini
if ( tsrvu == 0 )
{
NumField += 1 ;
// Creation d'un schema YACS
// nomCas : nom du cas a traiter
// FileName : nom du fichier contenant le script de lancement du calcul
-// DirName : le repertoire de lancement des calculs du sch??ma
+// DirName : le répertoire de lancement des calculs du schéma
//=============================================================================
HOMARD::HOMARD_YACS_ptr HOMARD_Gen_i::CreateYACSSchema (const char* nomYACS, const char* nomCas, const char* ScriptFile, const char* DirName, const char* MeshFile)
{
myYACS->SetMaxNode( defaut_i ) ;
defaut_i = GetYACSMaxElem() ;
myYACS->SetMaxElem( defaut_i ) ;
- // D.3. Fichier de sauvegarde dans le repertoire du cas
+ // D.3. Fichier de sauvegarde dans le répertoire du cas
HOMARD::HOMARD_Cas_ptr caseyacs = GetCase(nomCas) ;
std::string dirnamecase = caseyacs->GetDirName() ;
std::string XMLFile ;
CORBA::Long HOMARD_Gen_i::YACSWrite(const char* nomYACS)
{
INFOS ( "YACSWrite : Ecriture de " << nomYACS );
-// Le repertoire du cas
+// Le répertoire du cas
HOMARD::HOMARD_YACS_var myYACS = myStudyContext._mesYACSs[nomYACS];
ASSERT(!CORBA::is_nil(myYACS));
// Le nom du fichier du schema
MESSAGE ("pythonHypo :\n"<<pythonHypo<<"\n");
// F. Le fichier du schema de reference
- // HOMARD_ROOT_DIR : repertoire ou se trouve le module HOMARD
+ // HOMARD_ROOT_DIR : répertoire ou se trouve le module HOMARD
std::string XMLFile_base ;
if ( getenv("HOMARD_ROOT_DIR") != NULL ) { XMLFile_base = getenv("HOMARD_ROOT_DIR") ; }
else
// if ( _Langue ==
MESSAGE("XMLFile_base ="<<XMLFile_base);
- // G. Lecture du schema de reference et insertion des donnees propres au fil de la rencontre des mots-cles
+ // G. Lecture du schema de reference et insertion des données propres au fil de la rencontre des mots-cles
YACSDriver* myDriver = new YACSDriver(XMLFile, DirName);
std::ifstream fichier( XMLFile_base.c_str() );
- if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert
+ if ( fichier ) // ce test échoue si le fichier n'est pas ouvert
{
- // G.1. Lecture du schema de reference et insertion des donnees propres au fil de la rencontre des mots-cles
+ // G.1. Lecture du schema de reference et insertion des données propres au fil de la rencontre des mots-cles
std::string ligne; // variable contenant chaque ligne lue
std::string mot_cle;
while ( std::getline( fichier, ligne ) )
// G.1.4. Les options du cas
else if ( mot_cle == "Iter_1_Case_Options" )
{ myDriver->Texte_Iter_1_Case_Options(pythonCas); }
- // G.1.5. Execution de HOMARD : le repertoire du cas
+ // G.1.5. Execution de HOMARD : le répertoire du cas
else if ( mot_cle == "HOMARD_Exec_DirName" )
{ myDriver->Texte_HOMARD_Exec_DirName(); }
// G.1.6. Execution de HOMARD : le nom du maillage
int BoundaryType = myBoundary->GetType();
MESSAGE ( "... BoundaryType = " << BoundaryType);
const char* MeshName ;
- const char* MeshFile ;
- if (BoundaryType == 0)
+ const char* DataFile ;
+ if (BoundaryType == -1)
+ {
+ DataFile = myBoundary->GetDataFile() ;
+ MESSAGE ( ". CAOFile = " << DataFile );
+ }
+ else if (BoundaryType == 0)
{
MeshName = myBoundary->GetMeshName() ;
MESSAGE ( ". MeshName = " << MeshName );
- MeshFile = myBoundary->GetMeshFile() ;
- MESSAGE ( ". MeshFile = " << MeshFile );
+ DataFile = myBoundary->GetDataFile() ;
+ MESSAGE ( ". MeshFile = " << DataFile );
}
std::string texte_control_0 ;
- texte_control_0 = myDriver->Texte_Iter_1_Boundary(BoundaryType, pythonStructure, methode, BoundaryName, MeshName, MeshFile );
+ texte_control_0 = myDriver->Texte_Iter_1_Boundary(BoundaryType, pythonStructure, methode, BoundaryName, MeshName, DataFile );
texte_control += texte_control_0 ;
// 5. Memorisation du traitement
ListeBoundaryTraitees.push_back( BoundaryName );
File += "/bin/salome/VERSION" ;
MESSAGE ( "File = "<<File ) ;
std::ifstream fichier0( File.c_str() ) ;
- if ( fichier0 ) // ce test ??choue si le fichier n'est pas ouvert
+ if ( fichier0 ) // ce test échoue si le fichier n'est pas ouvert
{
std::string ligne; // variable contenant chaque ligne lue
while ( std::getline( fichier0, ligne ) )
MESSAGE ( "PrefFile = "<<PrefFile ) ;
std::ifstream fichier( PrefFile.c_str() );
- if ( fichier ) // ce test ??choue si le fichier n'est pas ouvert
+ if ( fichier ) // ce test échoue si le fichier n'est pas ouvert
{
bool section_langue = false ;
bool section_homard = false ;
#include "HOMARD_Gen.hxx"
#include "HomardDriver.hxx"
#include "YACSDriver.hxx"
+#include "FrontTrack.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
#include "Utils_CorbaException.hxx"
-
#include <string>
#include <map>
// Les creations
HOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, CORBA::Long typeBoundary);
+ HOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO(const char* nomBoundary,
+ const char* DataFile);
HOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary,
- const char* MeshName, const char* FileName);
+ const char* MeshName, const char* DataFile);
HOMARD::HOMARD_Boundary_ptr CreateBoundaryCylinder (const char* nomBoundary,
CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre,
CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis,
CORBA::Long Compute(const char* nomIteration, CORBA::Long etatMenage, CORBA::Long modeHOMARD, CORBA::Long Option1, CORBA::Long Option2);
CORBA::Long ComputeAdap(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage, HomardDriver* myDriver, CORBA::Long Option1, CORBA::Long Option2);
+ CORBA::Long ComputeCAO(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2);
+ CORBA::Long ComputeCAObis(HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long Option1, CORBA::Long Option2);
char* ComputeDirManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration, CORBA::Long etatMenage);
char* ComputeDirPaManagement(HOMARD::HOMARD_Cas_var myCase, HOMARD::HOMARD_Iteration_var myIteration);
void DriverTexteZone(HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
void DriverTexteField(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
- void DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver);
+ int DriverTexteBoundary(HOMARD::HOMARD_Cas_var myCase, HomardDriver* myDriver);
void DriverTexteFieldInterp(HOMARD::HOMARD_Iteration_var myIteration, HOMARD::HOMARD_Hypothesis_var myHypo, HomardDriver* myDriver);
char* VerifieDir(const char* nomDir);
test_3.py
test_4.py
test_5.py
+ test_6.py
tutorial_1.py
tutorial_2.py
tutorial_3.py
tutorial_4.py
tutorial_5.py
+ tutorial_6.py
test_util.py
)
test_3
test_4
test_5
+test_6
tutorial_1
tutorial_2
tutorial_3
tutorial_4
tutorial_5
+tutorial_6
)
FOREACH(tfile ${HOMARD_TEST_FILES})
Python script for HOMARD
Test test_1
"""
-__revision__ = "V4.01"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "test_1"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_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()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
zones_1_et_2.AddZone('Zone_1_2', 1)
laux = zones_1_et_2.GetZones()
nbzone = len(laux) // 2
- jaux = 0
- for iaux in range(nbzone) :
- print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
- jaux += 2
+ iaux = 0
+ for _ in range(nbzone) :
+ print(hyponame_2, " : ", dico[laux[iaux+1]], "sur la zone", laux[iaux])
+ iaux += 2
print(hyponame_2, " : champ utilisé :", zones_1_et_2.GetFieldName())
if ( len (zones_1_et_2.GetFieldName()) > 0 ) :
print(".. caractéristiques de l'adaptation :", zones_1_et_2.GetField())
ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
+except RuntimeError as eee:
raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
Python script for HOMARD
Test test_2
"""
-__revision__ = "V4.01"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "test_2"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_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()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
#
Python script for HOMARD
Test test_3
"""
-__revision__ = "V4.01"
+__revision__ = "V4.04"
#========================================================================
TEST_NAME = "test_3"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_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()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
mesh_file = os.path.join(REP_DATA, TEST_NAME + '.00.med')
case_test_3 = HOMARD.CreateCase(TEST_NAME, 'MOYEU', mesh_file)
case_test_3.SetDirName(DIRCASE)
- case_test_3.AddBoundaryGroup('courbes', '')
+ case_test_3.AddBoundary('courbes')
case_test_3.AddBoundaryGroup('cyl_ext', 'EXT')
case_test_3.AddBoundaryGroup('cyl_int', 'INT')
case_test_3.AddBoundaryGroup('sphere_1', 'END_1')
ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
#
Python script for HOMARD
Test test_4
"""
-__revision__ = "V3.01"
+__revision__ = "V3.03"
#========================================================================
TEST_NAME = "test_4"
DZ = 200.
#========================================================================
import os
-import tempfile
import sys
import numpy as np
import salome
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 get_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()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
try:
ficmed = os.path.join(DIRCASE, 'maill.00.med')
box_m.ExportMED(ficmed)
- except Exception as eee:
+ except IOError as eee:
error = 2
raise Exception('ExportMED() failed. ' + str(eee))
#
laux = hypo_4_1.GetZones()
nbzone = len(laux) // 2
jaux = 0
- for iaux in range(nbzone) :
+ for _ in range(nbzone) :
print(hyponame_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
jaux += 2
# Creation of the hypothesis hypo_4_2
laux = hypo_4_2.GetZones()
nbzone = len(laux) // 2
jaux = 0
- for iaux in range(nbzone) :
+ for _ in range(nbzone) :
print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
jaux += 2
# Creation of the hypothesis DISTANCE INVERSE
ERROR = geom_smesh_exec()
if ERROR :
raise Exception('Pb in geom_smesh_exec')
-except Exception as eee:
+except RuntimeError as eee:
raise Exception('Pb in geom_smesh_exec: '+str(eee.message))
HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
+except RuntimeError as eee:
raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
Specific conditions for Code_Saturne
Test test_5
"""
-__revision__ = "V2.01"
+__revision__ = "V2.03"
#========================================================================
TEST_NAME = "test_5"
MESH_NAME = "MESH"
#========================================================================
import os
-import tempfile
import sys
import numpy as np
import salome
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 get_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()
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
#
coordinates = list()
coo_z = -0.5*LG_Z
- for kaux in range(nbno_z) :
+ for _ in range(nbno_z) :
coo_y = -0.5*LG_Y
- for jaux in range(nbno_y) :
+ for _ in range(nbno_y) :
coo_x = -0.5*LG_X
- for iaux in range(nbno_x) :
+ for _ in range(nbno_x) :
coordinates.append(coo_x)
coordinates.append(coo_y)
coordinates.append(coo_z)
ficmed = os.path.join(DIRCASE, 'maill.00.med')
#print "Ecriture du maillage dans le fichier", ficmed
meshMEDFile3D.write(ficmed, 2)
- except Exception as eee:
+ except IOError as eee:
error = 2
raise Exception('MEDFileUMesh.write() failed. ' + str(eee))
#
ERROR = mesh_exec()
if ERROR :
raise Exception('Pb in mesh_exec')
-except Exception as eee:
+except RuntimeError as eee:
raise Exception('Pb in mesh_exec: '+str(eee.message))
HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
ERROR = homard_exec()
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
+except RuntimeError as eee:
raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
--- /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.04"
+
+#========================================================================
+TEST_NAME = "test_6"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#
+TAILLE = 10.
+LG_ARETE = TAILLE*2.5
+#========================================================================
+import os
+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 saveGeometry
+from test_util import get_dir
+from test_util import test_results
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
+
+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)
+#
+ from salome.geom import geomBuilder
+ geompy = geomBuilder.New()
+#
+# 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)
+#
+ from salome.smesh import smeshBuilder
+ smesh = smeshBuilder.New()
+#
+# 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)
+ try:
+ maill_00.ExportMED(ficmed)
+ except IOError as eee:
+ error = 2
+ raise Exception('ExportMED() failed. ' + str(eee))
+#
+ 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.UpdateStudy()
+ #
+ # 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 IOError as eee:
+ ERREUR = os.error
+ MESSAGE = str(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 RuntimeError as eee:
+ ERREUR = os.error
+ MESSAGE = str(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()
+ iparameters.getSession().restoreVisualState(1)
+
Python script for HOMARD
Utilitaires pour les tests
"""
-__revision__ = "V3.01"
+__revision__ = "V4.02"
import os
+import tempfile
import MEDLoader as ml
import shutil
#========================================================================
#========================================================================
+def get_dir(path_homard, test_name, debug=False) :
+ """
+Get directories for the test.
+Copyright EDF 2018
+ """
+#
+# Répertoire des données du test
+ rep_data = os.path.join(path_homard, "share", "salome", "homardsamples")
+ rep_data = os.path.normpath(rep_data)
+#
+# Répertoire des résultats
+ 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)
+#
+ return rep_data, dircase
+#
+#========================================================================
+#========================================================================
+def get_dir_tutorial(path_homard) :
+ """
+Get directory for the tutorial.
+Copyright EDF 2018
+ """
+#
+# Répertoire des données du tutorial
+ data_tutorial = os.path.join(path_homard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+ data_tutorial = os.path.normpath(data_tutorial)
+#
+ return data_tutorial
+#========================================================================
+#========================================================================
def remove_dir(directory) :
"""
Empties, then removes a directory.
#
test_file_suff = "apad.%02d.bilan" % n_iter_test_file
rep_test_file = "I%02d" % n_rep_test_file
+#
+# Existence du fichier de référence
#
test_file = os.path.join(rep_test, test_name + "." + test_file_suff)
mess_error_ref = "\nReference file: " + test_file
-#
-# Existence du fichier de référence
-#
+ #print ("test_file = %s" % test_file)
try :
- file = open (test_file, "r")
- les_lignes_ref = file.readlines()
- file.close()
+ with open (test_file, "r") as fichier :
+ les_lignes_ref = fichier.readlines()
except :
mess_error = mess_error_ref + "\nThis file does not exist.\n"
destroy_dir = False
#
test_file = os.path.join(dircase, rep_test_file, test_file_suff)
if os.path.isfile (test_file) :
- file = open (test_file, "r")
- les_lignes = file.readlines()
- file.close()
+ with open (test_file, "r") as fichier :
+ les_lignes = fichier.readlines()
else :
mess_error = "\nResult file: " + test_file
mess_error += "\nThis file does not exist.\n"
#========================================================================
#========================================================================
#
-def repositionnement (rep_calc, fic_med_brut, fic_med_new, xao_file, verbose=False) :
+def repositionnement (rep_calc, fic_med_brut, fic_med_new, xao_file, menage=True, verbose=False) :
#
"""
Pilote le repositionnement des noeuds qui ont bougé
fic_med_brut : fichier MED du calcul avec les coordonnées avant projection
fic_med_new : fichier MED du calcul avec les coordonnées après projection
xao_file : fichier XAO de la géométrie
+ menage : Suppression du fichier fic_med_brut
"""
if verbose :
ligne = "rep_calc = %s" % rep_calc
ligne += "\nfic_med_brut = %s" % fic_med_brut
ligne += "\nfic_med_new = %s" % fic_med_new
ligne += "\nxao_file = %s" % xao_file
+ ligne += "\nmenage = %d" % menage
print(ligne)
message = ""
while not erreur :
#
# 1. l_fr = liste des fichiers des lignes/surfaces a suivre
-# Les fichiers des numéros de groupes par frontière sont renommés selon le support
-# à condition de ne pas être vide.
#
fic_hom_med = None
laux = os.listdir(rep_calc)
icpt_2D = 0
for fic in laux :
#print "\t" + fic
- if ( fic[:5] == 'fort.' ) :
- fic_fort = os.path.join(rep_calc, fic)
- fichier = open (fic_fort, "r")
- les_lignes = fichier.readlines()
- fichier.close()
- os.remove(fic_fort)
- a_faire = False
- for ligne in les_lignes[1:] :
- laux1 = ligne.split()
- if ( len(laux1) >= 3 ) :
- a_faire = True
- break
- if a_faire :
- if ( "1D" in les_lignes[0] ) :
- nomfic_bis = "fr1D.%02d" % icpt_1D
- icpt_1D += 1
- else :
- nomfic_bis = "fr2D.%02d" % icpt_2D
- icpt_2D += 1
- fic_1 = os.path.join(rep_calc, nomfic_bis)
- fichier = open (fic_1, "w")
- for ligne in les_lignes[1:] :
- if ( ( "1D" not in ligne ) and ( "2D" not in ligne ) ) :
- fichier.write(ligne)
- fichier.close()
- #print "\t\tajout de %s" % fic_1
- l_fr.append(fic_1)
+ if ( fic[:2] == 'fr' ) :
+ l_fr.append(os.path.join(rep_calc, fic))
elif ( fic[-4:] == '.med' ) :
fic_hom_med = os.path.join(rep_calc, fic)
#print "\t\treperage de fic_hom_med =", fic_hom_med
#if erreur :
#break
#
-# 2.3. Ménage de l'ancien fichier MED
+# 2.3. Ménage éventuel de l'ancien fichier MED
#
- if ( fic_med_brut != fic_med_new ) :
- print("Suppression du fichier %s" % fic_med_new)
- os.remove(fic_med_brut)
+ if menage :
+#
+ if ( fic_med_brut != fic_med_new ) :
+ if verbose :
+ print("Suppression du fichier %s" % fic_med_brut)
+ os.remove(fic_med_brut)
#
# 3. Renommage du fichier si aucun noeud n'est concerné
#
# 1. Recherche des inforamtions permanentes dans le fichier de configuration
#
fic_conf = os.path.join(rep_calc, "HOMARD.Configuration")
- fichier = open (fic_conf, "r")
- les_lignes = fichier.readlines()
- fichier.close()
+ with open (fic_conf, "r") as fichier :
+ les_lignes = fichier.readlines()
#
ligne0 = ""
icpt = 0
# 2. Création du fichier de configuration
#
fic_conf_sv = os.path.join(rep_calc, "HOMARD.Configuration.majc")
- fichier = open (fic_conf_sv, "w")
-#
- ligne = ligne0
- ligne += "ModeHOMA 5\n"
- fic = os.path.join(rep_calc, "Liste.%s.maj_coords.log" % s_iter)
- ligne += "ListeStd %s\n" % fic
- ligne += "CCMaiN__ %s\n" % fic_med_calc
- ligne += "RepeTrav %s\n" % rep_calc
- ligne += "RepeInfo %s\n" % rep_calc
- ligne += "Action homa\n"
- ligne += "CCAssoci med\n"
- ligne += "EcriFiHO N_SANS_FRONTIERE\n"
- ligne += "MessInfo 10\n"
-#
- fichier.write(ligne)
- fichier.close()
+#
+ with open (fic_conf_sv, "w") as fichier :
+#
+ ligne = ligne0
+ ligne += "ModeHOMA 5\n"
+ fic = os.path.join(rep_calc, "Liste.%s.maj_coords.log" % s_iter)
+ ligne += "ListeStd %s\n" % fic
+ ligne += "CCMaiN__ %s\n" % fic_med_calc
+ ligne += "RepeTrav %s\n" % rep_calc
+ ligne += "RepeInfo %s\n" % rep_calc
+ ligne += "Action homa\n"
+ ligne += "CCAssoci med\n"
+ ligne += "EcriFiHO N_SANS_FRONTIERE\n"
+ ligne += "MessInfo 10\n"
+#
+ fichier.write(ligne)
#
# 3. Mise à jour
# 3.1. Détermination de l'exécutable
Python script for HOMARD
Test tutorial_1 associe au tutorial 1
"""
-__revision__ = "V4.01"
+__revision__ = "V4.04"
#========================================================================
TEST_NAME = "tutorial_1"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_dir
+from test_util import get_dir_tutorial
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()
-# 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)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
IPAR.append("AP_MODULES_LIST", "Homard")
#
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, verbose=False):
"""
Python script for HOMARD
"""
+ erreur = 0
+ message = ""
#
- homard.UpdateStudy()
- #
- # Hypotheses
- # ==========
- hypo_1 = homard.CreateHypothesis('hypo_1')
- hypo_1.SetUnifRefinUnRef(1)
- #
- # Cas
- # ===
- case_1 = homard.CreateCase('case_1', 'MAILL', DATA_TUTORIAL+'/tutorial_1.00.med')
- case_1.SetDirName(DIRCASE)
+ while not erreur :
#
- # Iterations
- # ==========
- # Iteration "iter_1_1"
- iter_1_1 = case_1.NextIteration('iter_1_1')
- iter_1_1.SetMeshName('MESH')
- iter_1_1.SetMeshFile(DIRCASE+'/maill.01.med')
- iter_1_1.AssociateHypo('hypo_1')
- error = iter_1_1.Compute(1, 2)
+ HOMARD.UpdateStudy()
+ #
+ # Hypotheses
+ # ==========
+ if verbose :
+ print(". Hypothèses")
+ hypo_1 = HOMARD.CreateHypothesis('hypo_1')
+ hypo_1.SetUnifRefinUnRef(1)
+ #
+ # Cas
+ # ===
+ if verbose :
+ print(". Cas")
+ le_cas = HOMARD.CreateCase('case_1', nom, ficmed)
+ le_cas.SetDirName(DIRCASE)
+ #
+ # Itérations
+ # ==========
+ if verbose :
+ option = 2
+ else :
+ option = 1
+ if verbose :
+ print(". Itérations")
+ # Iteration "iter_1_1"
+ iter_1_1 = le_cas.NextIteration('iter_1_1')
+ iter_1_1.SetMeshName('MESH')
+ iter_1_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+ iter_1_1.AssociateHypo('hypo_1')
+ erreur = iter_1_1.Compute(1, option)
+ if erreur :
+ break
- # 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.AssociateHypo('hypo_1')
- error = iter_1_2.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(os.path.join(DIRCASE, "maill.01.med"))
+ iter_1_2.AssociateHypo('hypo_1')
+ erreur = iter_1_2.Compute(1, option)
+ if erreur :
+ break
- # 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.AssociateHypo('hypo_1')
- error = iter_1_3.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(os.path.join(DIRCASE, "maill.03.med"))
+ iter_1_3.AssociateHypo('hypo_1')
+ erreur = iter_1_3.Compute(1, option)
+ if erreur :
+ break
#
- return error
-
-#========================================================================
-
-homard = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert homard is not None, "Impossible to load homard engine"
-homard.SetLanguageShort("fr")
+ break
+ #
+ if erreur :
+ message += "Erreur au calcul de l'itération %d" % erreur
+ #
+ return erreur, message
#
-# Exec of HOMARD-SALOME
+#========================== Fin de la fonction ==================================
#
-try :
- ERROR = homard_exec()
- if ERROR :
- raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+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")
#
-# Test of the results
+ FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
+ try:
+ ERREUR, MESSAGE = homard_exec("MAILL", FICMED, DEBUG)
+ except RuntimeError as eee:
+ ERREUR = 2
+ MESSAGE = str(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
#
-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)
+if ERREUR:
+ raise Exception(MESSAGE)
#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 1, 1)
Python script for HOMARD
Test tutorial_2 associe au tutorial 2
"""
-__revision__ = "V4.01"
+__revision__ = "V4.04"
#========================================================================
TEST_NAME = "tutorial_2"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_dir
+from test_util import get_dir_tutorial
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()
-# 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)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
IPAR.append("AP_MODULES_LIST", "Homard")
#
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, verbose=False):
"""
Python script for HOMARD
"""
+ erreur = 0
+ message = ""
#
- HOMARD.UpdateStudy()
+ while not erreur :
+ #
+ HOMARD.UpdateStudy()
+ #
+ # Creation des zones
+ # ==================
+ if verbose :
+ print(". Zones")
+ # Box "Zone_12_0"
+ zone_12_0 = HOMARD.CreateZoneBox ('Zone_12_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
+ #
+ # Sphere "Zone_12_1"
+ zone_12_1 = HOMARD.CreateZoneSphere ('Zone_12_1', 0., 0., 0., 1.05)
+ #
+ # Box "Zone_12_2"
+ zone_12_2 = HOMARD.CreateZoneBox ('Zone_12_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
+ #
+ # Hypotheses
+ # ==========
+ if verbose :
+ print(". Hypothèses")
+ # Hypothese "hypo_2"
+ # ==================
+ hypo_2 = HOMARD.CreateHypothesis('hypo_2')
+ hypo_2.AddZone('Zone_12_1', 1)
+ hypo_2.AddZone('Zone_12_0', 1)
+ #
+ # Hypothese "hypo_2_bis"
+ # ======================
+ hypo_2_bis = HOMARD.CreateHypothesis('hypo_2_bis')
+ hypo_2_bis.AddZone('Zone_12_0', -1)
+ hypo_2_bis.AddZone('Zone_12_2', 1)
+ #
+ # Cas
+ # ===
+ if verbose :
+ print(". Cas")
+ le_cas = HOMARD.CreateCase('case_2', nom, ficmed)
+ le_cas.SetDirName(DIRCASE)
+ #
+ # Itérations
+ # ==========
+ if verbose :
+ option = 2
+ else :
+ option = 1
+ if verbose :
+ print(". Itérations")
+ #
+ # Iteration "iter_2_1"
+ # ====================
+ iter_2_1 = le_cas.NextIteration('iter_2_1')
+ iter_2_1.SetMeshName('M_1')
+ iter_2_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+ iter_2_1.AssociateHypo('hypo_2')
+ erreur = iter_2_1.Compute(1, option)
+ if erreur :
+ break
+ #
+ # Iteration "iter_2_2"
+ # ====================
+ iter_2_2 = iter_2_1.NextIteration('iter_2_2')
+ iter_2_2.SetMeshName('M_2')
+ iter_2_2.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+ iter_2_2.AssociateHypo('hypo_2_bis')
+ erreur = iter_2_2.Compute(1, option)
+ if erreur :
+ break
#
- # Creation des zones
- # ==================
- # Box "Zone_12_0"
- zone_12_0 = HOMARD.CreateZoneBox ('Zone_12_0', -0.1, 1.1, -0.1, 1.1, 0.9, 1.1)
+ break
#
- # Sphere "Zone_12_1"
- zone_12_1 = HOMARD.CreateZoneSphere ('Zone_12_1', 0., 0., 0., 1.05)
+ if erreur :
+ message += "Erreur au calcul de l'itération %d" % erreur
#
- # Box "Zone_12_2"
- zone_12_2 = HOMARD.CreateZoneBox ('Zone_12_2', -0.1, 0.51, -0.1, 0.51, -0.1, 0.51)
+ return erreur, message
+#
+#========================== Fin de la fonction ==================================
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
#
- # Hypothese "hypo_2"
- # ==================
- hypo_2 = HOMARD.CreateHypothesis('hypo_2')
- hypo_2.AddZone('Zone_12_1', 1)
- hypo_2.AddZone('Zone_12_0', 1)
+ # A. Exec of HOMARD-SALOME
#
- # Hypothese "hypo_2_bis"
- # ======================
- hypo_2_bis = HOMARD.CreateHypothesis('hypo_2_bis')
- hypo_2_bis.AddZone('Zone_12_0', -1)
- hypo_2_bis.AddZone('Zone_12_2', 1)
+ 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, TEST_NAME+".00.med")
+ try:
+ ERREUR, MESSAGE = homard_exec("MZERO", FICMED, DEBUG)
+ except RuntimeError as eee:
+ ERREUR = 2
+ MESSAGE = str(eee.message)
#
- # Cas
- # ===
- case_2 = HOMARD.CreateCase('case_2', 'MZERO', DATA_TUTORIAL+'/tutorial_2.00.med')
- case_2.SetDirName(DIRCASE)
+ if ERREUR :
+ MESSAGE += "Pb in homard_exec"
+ break
#
- # Iteration "iter_2_1"
- # ====================
- iter_2_1 = case_2.NextIteration('iter_2_1')
- iter_2_1.SetMeshName('M_1')
- iter_2_1.SetMeshFile(DIRCASE+'/maill.01.med')
- iter_2_1.AssociateHypo('hypo_2')
- error = iter_2_1.Compute(1, 2)
+ # B. Test of the results
#
- # 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.AssociateHypo('hypo_2_bis')
- error = iter_2_2.Compute(1, 2)
+ 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)
#
- return error
-
-#========================================================================
-
-HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert HOMARD is not None, "Impossible to load HOMARD engine"
-HOMARD.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- ERROR = homard_exec()
- if ERROR :
- raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
-#
-# Test of the results
+ break
#
-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)
+if ERREUR:
+ raise Exception(MESSAGE)
#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 2, 1)
Python script for HOMARD
Test tutorial_3 associe au tutorial 3
"""
-__revision__ = "V4.01"
+__revision__ = "V4.04"
#========================================================================
TEST_NAME = "tutorial_3"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_dir
+from test_util import get_dir_tutorial
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()
-# 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)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
IPAR.append("AP_MODULES_LIST", "Homard")
#
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, verbose=False):
"""
Python script for HOMARD
"""
+ erreur = 0
+ message = ""
#
- HOMARD.UpdateStudy()
+ while not erreur :
+ #
+ HOMARD.UpdateStudy()
+ #
+ # Hypotheses
+ # ==========
+ if verbose :
+ print(". Hypothèses")
+ # Hypothese "hypo_0vers1"
+ # =======================
+ hypo_0vers1 = HOMARD.CreateHypothesis('hypo_0vers1')
+ # Characterization of the field
+ hypo_0vers1.SetField('SOLU_0__QIRE_ELEM_SIGM__________')
+ hypo_0vers1.SetUseComp(0)
+ hypo_0vers1.AddComp('ERREST ')
+ hypo_0vers1.SetRefinThr(3, 1.0)
+ hypo_0vers1.SetTypeFieldInterp(2)
+ hypo_0vers1.AddFieldInterp('SOLU_0__DEPL____________________')
+ hypo_0vers1.AddFieldInterp('SOLU_0__ERRE_ELEM_SIGM__________')
+ #
+ # Hypothese "hypo_1vers2"
+ # =======================
+ hypo_1vers2 = HOMARD.CreateHypothesis('hypo_1vers2')
+ # Characterization of the field
+ hypo_1vers2.SetField('SOLU_1__QIRE_ELEM_SIGM__________')
+ hypo_1vers2.SetUseComp(0)
+ hypo_1vers2.AddComp('ERREST ')
+ hypo_1vers2.SetRefinThr(3, 1.5)
+ hypo_1vers2.SetUnRefThr(3, 6.)
+ hypo_1vers2.SetTypeFieldInterp(2)
+ hypo_1vers2.AddFieldInterp('SOLU_1__DEPL____________________')
+ hypo_1vers2.AddFieldInterp('SOLU_1__QIRE_ELEM_SIGM__________')
+ #
+ # Hypothese "hypo_1vers2_bis"
+ # ===========================
+ hypo_1vers2_bis = HOMARD.CreateHypothesis('hypo_1vers2_bis')
+ # Characterization of the field
+ hypo_1vers2_bis.SetField('SOLU_1__DEPL____________________')
+ hypo_1vers2_bis.SetUseComp(1)
+ hypo_1vers2_bis.AddComp('DX')
+ hypo_1vers2_bis.AddComp('DY')
+ hypo_1vers2_bis.AddComp('DZ')
+ hypo_1vers2_bis.SetRefinThr(1, 0.0001)
+ hypo_1vers2_bis.SetUnRefThr(1, 0.000001)
+ hypo_1vers2_bis.SetTypeFieldInterp(0)
+ #
+ # Cas
+ # ===
+ if verbose :
+ print(". Cas")
+ le_cas = HOMARD.CreateCase('case_3', nom, ficmed)
+ le_cas.SetDirName(DIRCASE)
+ #
+ # Itérations
+ # ==========
+ if verbose :
+ option = 2
+ else :
+ option = 1
+ if verbose :
+ print(". Itérations")
+ # Iteration "iter_3_1"
+ # ====================
+ iter_3_1 = le_cas.NextIteration('iter_3_1')
+ iter_3_1.SetMeshName('H_1')
+ 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')
+ erreur = iter_3_1.Compute(1, option)
+ if erreur :
+ break
+ #
+ # Iteration "iter_3_2"
+ # ====================
+ iter_3_2 = iter_3_1.NextIteration('iter_3_2')
+ iter_3_2.SetMeshName('H_2')
+ 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')
+ erreur = iter_3_2.Compute(1, option)
+ if erreur :
+ break
+ #
+ # 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(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')
+ erreur = iter_3_2_bis.Compute(1, option)
+ if erreur :
+ break
#
- # Hypothese "hypo_0vers1"
- # =======================
- hypo_0vers1 = HOMARD.CreateHypothesis('hypo_0vers1')
- # Characterization of the field
- hypo_0vers1.SetField('SOLU_0__QIRE_ELEM_SIGM__________')
- hypo_0vers1.SetUseComp(0)
- hypo_0vers1.AddComp('ERREST ')
- hypo_0vers1.SetRefinThr(3, 1.0)
- hypo_0vers1.SetTypeFieldInterp(2)
- hypo_0vers1.AddFieldInterp('SOLU_0__DEPL____________________')
- hypo_0vers1.AddFieldInterp('SOLU_0__ERRE_ELEM_SIGM__________')
+ break
#
- # Hypothese "hypo_1vers2"
- # =======================
- hypo_1vers2 = HOMARD.CreateHypothesis('hypo_1vers2')
- # Characterization of the field
- hypo_1vers2.SetField('SOLU_1__QIRE_ELEM_SIGM__________')
- hypo_1vers2.SetUseComp(0)
- hypo_1vers2.AddComp('ERREST ')
- hypo_1vers2.SetRefinThr(3, 1.5)
- hypo_1vers2.SetUnRefThr(3, 6.)
- hypo_1vers2.SetTypeFieldInterp(2)
- hypo_1vers2.AddFieldInterp('SOLU_1__DEPL____________________')
- hypo_1vers2.AddFieldInterp('SOLU_1__QIRE_ELEM_SIGM__________')
+ 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 :
#
- # Hypothese "hypo_1vers2_bis"
- # ===========================
- hypo_1vers2_bis = HOMARD.CreateHypothesis('hypo_1vers2_bis')
- # Characterization of the field
- hypo_1vers2_bis.SetField('SOLU_1__DEPL____________________')
- hypo_1vers2_bis.SetUseComp(1)
- hypo_1vers2_bis.AddComp('DX')
- hypo_1vers2_bis.AddComp('DY')
- hypo_1vers2_bis.AddComp('DZ')
- hypo_1vers2_bis.SetRefinThr(1, 0.0001)
- hypo_1vers2_bis.SetUnRefThr(1, 0.000001)
- hypo_1vers2_bis.SetTypeFieldInterp(0)
+ # A. Exec of HOMARD-SALOME
#
- # Cas
- # ===
- case_3 = HOMARD.CreateCase('case_3', 'G_0', DATA_TUTORIAL+'/tutorial_3.00.med')
- case_3.SetDirName(DIRCASE)
+ 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, TEST_NAME+".00.med")
+ try:
+ ERREUR, MESSAGE = homard_exec("G_0", FICMED, DEBUG)
+ except RuntimeError as eee:
+ ERREUR = 2
+ MESSAGE = str(eee.message)
#
- # Iteration "iter_3_1"
- # ====================
- iter_3_1 = case_3.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.SetTimeStepRank( 1, 1)
- iter_3_1.AssociateHypo('hypo_0vers1')
- error = iter_3_1.Compute(1, 2)
+ if ERREUR :
+ MESSAGE += "Pb in homard_exec"
+ break
#
- # 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.SetTimeStepRank(1, 1)
- iter_3_2.AssociateHypo('hypo_1vers2')
- error = iter_3_2.Compute(1, 2)
+ # B. Test of the results
#
- # 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.SetTimeStepRank(1, 1)
- iter_3_2_bis.AssociateHypo('hypo_1vers2_bis')
- error = iter_3_2_bis.Compute(1, 2)
+ N_REP_TEST_FILE = 3
+ DESTROY_DIR = not DEBUG
+ test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
#
- return error
-
-#========================================================================
-
-HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert HOMARD is not None, "Impossible to load HOMARD engine"
-HOMARD.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- ERROR = homard_exec()
- if ERROR :
- raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
-#
-# Test of the results
+ break
#
-N_REP_TEST_FILE = 3
-DESTROY_DIR = not DEBUG
-test_results(REP_DATA, TEST_NAME, DIRCASE, N_ITER_TEST_FILE, N_REP_TEST_FILE, DESTROY_DIR)
+if ERREUR:
+ raise Exception(MESSAGE)
#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 3, 1)
Python script for HOMARD
Test tutorial_4 associe au tutorial 4
"""
-__revision__ = "V4.01"
+__revision__ = "V5.03"
#========================================================================
TEST_NAME = "tutorial_4"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_dir
+from test_util import get_dir_tutorial
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()
-# 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)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
IPAR.append("AP_MODULES_LIST", "Homard")
#
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, xao_file, verbose=True):
"""
Python script for HOMARD
"""
- #
- HOMARD.UpdateStudy()
+ erreur = 0
+ message = ""
#
- # Frontieres
- # ==========
- boun_4_1 = HOMARD.CreateBoundaryDi('intersection', 'PIQUAGE', DATA_TUTORIAL+'/tutorial_4.fr.med')
+ while not erreur :
+ #
+ HOMARD.UpdateStudy()
+ #
+ # Frontières
+ # ==========
+ if verbose :
+ print(". Frontières")
+ cao_name = "CAO_" + nom
+ la_frontiere = HOMARD.CreateBoundaryCAO(cao_name, xao_file)
+ #
+ # Hypotheses
+ # ==========
+ if verbose :
+ print(". Hypothèses")
+ # Creation of the hypothesis hypo_0_1
+ l_hypothese_0_1 = HOMARD.CreateHypothesis('hypo_4_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_4_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_4_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(cao_name)
+ #
+ # Itérations
+ # ==========
+ if verbose :
+ option = 2
+ else :
+ option = 1
+ if verbose :
+ print(". Itérations")
+ # Iteration iter_4_1 : raffinement selon les faces internes
+ iter_4_1 = le_cas.NextIteration('iter_4_1')
+ iter_4_1.SetMeshName('PIQUAGE_1')
+ iter_4_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+ iter_4_1.AssociateHypo('hypo_4_0_1')
+ erreur = iter_4_1.Compute(1, option)
+ print ("erreur = %d" % erreur)
+ if erreur :
+ break
+ # 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(os.path.join(DIRCASE, "maill.02.med"))
+ iter_4_2.AssociateHypo('hypo_4_1_2')
+ erreur = iter_4_2.Compute(1, option)
+ if erreur :
+ break
+ # 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(os.path.join(DIRCASE, "maill.03.med"))
+ iter_4_3.AssociateHypo('hypo_4_2_3')
+ erreur = iter_4_3.Compute(1, option)
+ if erreur :
+ break
#
- boun_4_2 = HOMARD.CreateBoundaryCylinder('cyl_1_ext', 0.0, 25., -25., 25., 50., 75., 100.)
+ break
#
- boun_4_3 = HOMARD.CreateBoundaryCylinder('cyl_2_ext', 17.5, -2.5, -12.5, -100., -75., -25., 50.)
+ if erreur :
+ message += "Erreur au calcul de l'itération %d" % erreur
#
- boun_4_4 = HOMARD.CreateBoundaryCylinder('cyl_1_int', 0.0, 25., -25., 25., 50., 75., 75.)
+ return erreur, message
+#
+#========================== Fin de la fonction ==================================
+#
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
#
- boun_4_5 = HOMARD.CreateBoundaryCylinder('cyl_2_int', 17.5, -2.5, -12.5, -100., -75., -25., 25.)
+ # A. Exec of HOMARD-SALOME
#
- # 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')
- # 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')
+ 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")
+ XAO_FILE = os.path.join(DATA_TUTORIAL, TEST_NAME+".xao")
+ try:
+ ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, XAO_FILE, DEBUG)
+ except RuntimeError as eee:
+ ERREUR = 2
+ MESSAGE = str(eee.message)
#
- # 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' )
+ if ERREUR :
+ MESSAGE += "Pb in homard_exec"
+ break
#
- # Iterations
- # ==========
- # Iteration iter_4_1 : raffinement selon les faces internes
- iter_4_1 = case_4.NextIteration('iter_4_1')
- iter_4_1.SetMeshName('PIQUAGE_1')
- iter_4_1.SetMeshFile(DIRCASE+'/maill.01.med')
- iter_4_1.AssociateHypo('hypo_4')
- error = 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.AssociateHypo('hypo_4_bis')
- error = 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.AssociateHypo('hypo_4_bis')
- error = iter_4_3.Compute(1, 2)
+ # B. Test of the results
#
- return error
-
-#========================================================================
-
-HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert HOMARD is not None, "Impossible to load HOMARD engine"
-HOMARD.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- ERROR = homard_exec()
- if ERROR :
- raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
-#
-# 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
#
-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)
+if ERREUR:
+ raise Exception(MESSAGE)
#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 4, 1)
Python script for HOMARD
Test tutorial_5 associe au tutorial 5
"""
-__revision__ = "V4.01"
+__revision__ = "V4.04"
#========================================================================
TEST_NAME = "tutorial_5"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
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 get_dir
+from test_util import get_dir_tutorial
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()
-# 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)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
IPAR = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1))
IPAR.append("AP_MODULES_LIST", "Homard")
#
-#========================================================================
-#========================================================================
-def homard_exec():
+#
+#========================= Debut de la fonction ==================================
+#
+def homard_exec(nom, ficmed, nomfr, ficfrmed, verbose=False):
"""
Python script for HOMARD
"""
+ erreur = 0
+ message = ""
+#
+ while not erreur :
+ #
+ HOMARD.UpdateStudy()
+ #
+ # Frontiere
+ # =========
+ if verbose :
+ print(". Frontière")
+ # Creation of the discrete boundary Boun_5_1
+ boun_5_1 = HOMARD.CreateBoundaryDi('Boun_5_1', nomfr, ficfrmed)
+ #
+ # Creation des zones
+ # ==================
+ if verbose :
+ print(". Zones")
+ # Creation of the disk with hole enveloppe
+ enveloppe = HOMARD.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
+ # Creation of the rectangle quart_sup
+ quart_sup = HOMARD.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
+ #
+ # Hypotheses
+ # ==========
+ if verbose :
+ print(". Hypothèses")
+ # 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)
+ #
+ # Cas
+ # ===
+ if verbose :
+ print(". Cas")
+ le_cas = HOMARD.CreateCase('case_5', nom, ficmed)
+ le_cas.SetDirName(DIRCASE)
+ le_cas.SetConfType(1)
+ le_cas.AddBoundary('Boun_5_1')
+ #
+ # Itérations
+ # ==========
+ if verbose :
+ option = 2
+ else :
+ option = 1
+ if verbose :
+ print(". Itérations")
+ #
+ # Iteration "iter_5_1"
+ # ====================
+ iter_5_1 = le_cas.NextIteration('iter_5_1')
+ iter_5_1.SetMeshName('COEUR_2D_01')
+ iter_5_1.SetMeshFile(os.path.join(DIRCASE, "maill.01.med"))
+ iter_5_1.AssociateHypo('hypo_5')
+ erreur = iter_5_1.Compute(1, option)
+ if erreur :
+ break
+ #
+ # Iteration "iter_5_2"
+ # ====================
+ iter_5_2 = iter_5_1.NextIteration('iter_5_2')
+ iter_5_2.SetMeshName('COEUR_2D_02')
+ iter_5_2.SetMeshFile(os.path.join(DIRCASE, "maill.02.med"))
+ iter_5_2.AssociateHypo('hypo_5_bis')
+ erreur = iter_5_2.Compute(1, option)
+ if erreur :
+ break
+ #
+ break
+ #
+ if erreur :
+ message += "Erreur au calcul de l'itération %d" % erreur
#
- HOMARD.UpdateStudy()
+ return erreur, message
+
+#========================== Fin de la fonction ==================================
#
- # Frontiere
- # =========
- # Creation of the discrete boundary Boun_5_1
- boun_5_1 = HOMARD.CreateBoundaryDi('Boun_5_1', 'MAIL_EXT', DATA_TUTORIAL+'/tutorial_5.fr.med')
+ERREUR = 0
+MESSAGE = ""
+while not ERREUR :
#
- # Creation des zones
- # ==================
- # Creation of the disk with hole enveloppe
- enveloppe = HOMARD.CreateZoneDiskWithHole( 'enveloppe', 0., 0., 250., 193., 1 )
- # Creation of the rectangle quart_sup
- quart_sup = HOMARD.CreateZoneBox2D( 'quart_sup', 0., 250., 0., 250., 1 )
+ # A. Exec of HOMARD-SALOME
#
- # 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)
+ 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, TEST_NAME+".00.med")
+ FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
+ try:
+ ERREUR, MESSAGE = homard_exec("COEUR_2D", FICMED, "MAIL_EXT", FICFRMED, DEBUG)
+ except RuntimeError as eee:
+ ERREUR = 2
+ MESSAGE = str(eee.message)
#
- # Cas
- # ===
- case_5 = HOMARD.CreateCase('case_5', 'COEUR_2D', DATA_TUTORIAL+'/tutorial_5.00.med')
- case_5.SetDirName(DIRCASE)
- case_5.SetConfType(1)
- case_5.AddBoundaryGroup('Boun_5_1', '')
+ if ERREUR :
+ MESSAGE += "Pb in homard_exec"
+ break
#
- # Iteration "iter_5_1"
- # ====================
- iter_5_1 = case_5.NextIteration('iter_5_1')
- iter_5_1.SetMeshName('COEUR_2D_01')
- iter_5_1.SetMeshFile(DIRCASE+'/maill.01.med')
- iter_5_1.AssociateHypo('hypo_5')
- error = iter_5_1.Compute(1, 2)
+ # B. Test of the results
#
- # Iteration "iter_5_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.AssociateHypo('hypo_5_bis')
- error = iter_5_2.Compute(1, 2)
+ 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)
#
- return error
-
-#========================================================================
-
-HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
-assert HOMARD is not None, "Impossible to load HOMARD engine"
-HOMARD.SetLanguageShort("fr")
-#
-# Exec of HOMARD-SALOME
-#
-try :
- ERROR = homard_exec()
- if ERROR :
- raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
-#
-# Test of the results
+ break
#
-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)
+if ERREUR:
+ raise Exception(MESSAGE)
#
# ==================================
gzip_gunzip(DATA_TUTORIAL, 5, 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.04"
+
+#========================================================================
+TEST_NAME = "tutorial_6"
+DEBUG = False
+N_ITER_TEST_FILE = 3
+#========================================================================
+import os
+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 get_dir
+from test_util import get_dir_tutorial
+from test_util import test_results
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+DATA_TUTORIAL = get_dir_tutorial(PATH_HOMARD)
+# ==================================
+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.UpdateStudy()
+ #
+ # 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 RuntimeError as eee:
+ ERREUR = 2
+ MESSAGE = str(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()
+ iparameters.getSession().restoreVisualState(1)
+
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ test_6
+ Date de creation : jeudi 4 janvier 2018 a 14 h 20 mn 19 s
+ Dimension : 3
+ Degre : 1
+ C'est un maillage obtenu apres 3 adaptations.
+ Le niveau minimum actif est : 3
+ Le niveau maximum atteint est : 3
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ | | 0.0000 | 169.52
+ | | -50.434 | 100.00
+ | | 0.0000 | 200.00
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 6441 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 336 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 336 *
+ * . dont aretes internes aux faces/volumes * 0 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 12544 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 0 *
+ * . du niveau 1.5 * 0 *
+ * . du niveau 2 * 0 *
+ * . du niveau 2.5 * 0 *
+ * . du niveau 3 * 12544 *
+ ************************************************************
Maillage apres adaptation
PIQUAGE
- Date de creation : lundi 2 novembre 2015 a 9 h 13 mn 13 s
+ Date de creation : jeudi 4 janvier 2018 a 14 h 7 mn 55 s
Dimension : 3
Degre : 1
C'est un maillage obtenu apres 3 adaptations.
Direction | Unite | Minimum | Maximum
---------------------------------------------------------------
- | | -230.00 | 136.45
- | | -250.62 | 189.69
- | | -285.21 | 155.03
+ | | -230.00 | 136.04
+ | | -250.19 | 188.38
+ | | -285.20 | 154.14
NOMBRE D'ENTITES DU CALCUL
************************************************************
* Noeuds *
************************************************************
- * Nombre total * 12825 *
+ * Nombre total * 3040 *
************************************************************
************************************************************
* Segments *
************************************************************
- * Nombre total * 758 *
+ * Nombre total * 452 *
* . dont aretes isolees * 0 *
* . dont aretes de bord de regions 2D * 0 *
- * . dont aretes internes aux faces/volumes * 758 *
+ * . dont aretes internes aux faces/volumes * 452 *
************************************************************
************************************************************
* Triangles *
************************************************************
- * Nombre total * 20838 *
+ * Nombre total * 4562 *
* . dont triangles de regions 2D * 0 *
- * . dont triangles de bord * 20560 *
- * . dont triangles internes aux volumes * 278 *
+ * . dont triangles de bord * 4418 *
+ * . dont triangles internes aux volumes * 144 *
************************************************************
* . du niveau 0 * 0 *
* . du niveau 0.5 * 0 *
- * . du niveau 1 * 3530 *
- * . du niveau 1.5 * 380 *
- * . du niveau 2 * 16928 *
+ * . du niveau 1 * 3526 *
+ * . du niveau 1.5 * 316 *
+ * . du niveau 2 * 720 *
************************************************************
************************************************************
* Tetraedres *
************************************************************
- * Nombre total * 43490 *
+ * Nombre total * 11214 *
************************************************************
* . du niveau 0 * 0 *
* . du niveau 0.5 * 0 *
- * . du niveau 1 * 18174 *
- * . du niveau 1.5 * 25316 *
+ * . du niveau 1 * 9930 *
+ * . du niveau 1.5 * 1284 *
************************************************************
--- /dev/null
+
+
+ANALYSE DU MAILLAGE
+===================
+
+ Maillage apres adaptation
+ PIQUAGE
+ Date de creation : lundi 25 septembre 2017 a 13 h 52 mn 40 s
+ Dimension : 3
+ Degre : 1
+ C'est un maillage obtenu apres 3 adaptations.
+ Le niveau minimum actif est : 1
+ Le niveau maximum atteint est : 2
+
+ Direction | Unite | Minimum | Maximum
+ ---------------------------------------------------------------
+ | | -230.00 | 136.04
+ | | -250.52 | 189.69
+ | | -285.20 | 155.02
+
+
+ NOMBRE D'ENTITES DU CALCUL
+ ==========================
+
+
+ ************************************************************
+ * Noeuds *
+ ************************************************************
+ * Nombre total * 3040 *
+ ************************************************************
+
+ ************************************************************
+ * Segments *
+ ************************************************************
+ * Nombre total * 452 *
+ * . dont aretes isolees * 0 *
+ * . dont aretes de bord de regions 2D * 0 *
+ * . dont aretes internes aux faces/volumes * 452 *
+ ************************************************************
+
+ ************************************************************
+ * Triangles *
+ ************************************************************
+ * Nombre total * 4562 *
+ * . dont triangles de regions 2D * 0 *
+ * . dont triangles de bord * 4418 *
+ * . dont triangles internes aux volumes * 144 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 3526 *
+ * . du niveau 1.5 * 316 *
+ * . du niveau 2 * 720 *
+ ************************************************************
+
+ ************************************************************
+ * Tetraedres *
+ ************************************************************
+ * Nombre total * 11214 *
+ ************************************************************
+ * . du niveau 0 * 0 *
+ * . du niveau 0.5 * 0 *
+ * . du niveau 1 * 9930 *
+ * . du niveau 1.5 * 1284 *
+ ************************************************************