From: vsr Date: Mon, 17 Jan 2022 12:26:24 +0000 (+0300) Subject: bos #26453 Merge branch 'jfa/uniform_refinement' X-Git-Tag: V9_9_0a1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=261931b593c549d5676c084e4a5293fab4a81e13;hp=f4ffdc72f1381ce1cacca10a96f75e588683524e;p=modules%2Fsmesh.git bos #26453 Merge branch 'jfa/uniform_refinement' --- diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index df54d5a08..54215c734 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -42,7 +42,7 @@ SALOME_INSTALL_SCRIPTS("${EXAMPLES_TESTS}" ${SALOME_INSTALL_DOC}/examples/SMESH) SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test) INSTALL(FILES ${GOOD_TESTS} ${BAD_TESTS} ${SESSION_FREE_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY}) -INSTALL(FILES Mesh_tri.med DESTINATION ${TEST_INSTALL_DIRECTORY}) +INSTALL(FILES Mesh_tri.med test_homard_adapt.med tutorial_4.00.med tutorial_4.xao tutorial_5.00.med tutorial_5.fr.med DESTINATION ${TEST_INSTALL_DIRECTORY}) INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} diff --git a/doc/salome/examples/test_homard_adapt.med b/doc/salome/examples/test_homard_adapt.med new file mode 100644 index 000000000..1dae05c2a Binary files /dev/null and b/doc/salome/examples/test_homard_adapt.med differ diff --git a/doc/salome/examples/test_homard_adapt.py b/doc/salome/examples/test_homard_adapt.py new file mode 100644 index 000000000..030bb6f62 --- /dev/null +++ b/doc/salome/examples/test_homard_adapt.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 + + + +import salome +salome.salome_init_without_session() + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +import SMESHHOMARD + +smesh = smeshBuilder.New() + +import os, inspect, tempfile, shutil + +data_dir = os.path.abspath(os.path.dirname(inspect.getfile(lambda: None))) +working_dir = tempfile.mkdtemp() + +input_med = os.path.join (data_dir, "test_homard_adapt.med") +output_med_1 = os.path.join (working_dir, "test_1.00_Uniform_R_01.med") +output_med_2 = os.path.join (working_dir, "test_1.00_Uniform_R_02.med") +log_file_1 = os.path.join (working_dir, "test_1.00_Uniform_R_01.med.log") +log_file_2 = os.path.join (working_dir, "test_1.00_Uniform_R_02.med.log") + +# Case 1: input: med file +# output: med file, log file, published mesh +if os.path.isfile(output_med_1): + os.remove(output_med_1) +if os.path.isfile(log_file_1): + os.remove(log_file_1) + +smeshhomard = smesh.Adaptation("Uniform") +smeshhomard.CreateCase("MAILL", input_med, working_dir) +smeshhomard.SetConfType(0) +smeshhomard.SetKeepMedOUT(True) +smeshhomard.SetPublishMeshOUT(True) +smeshhomard.SetMeshNameOUT("MAILL_Uniform_R_01") +smeshhomard.SetMeshFileOUT(output_med_1) +smeshhomard.SetKeepWorkingFiles(False) +smeshhomard.SetLogInFile(True) +smeshhomard.SetLogFile(log_file_1) +smeshhomard.SetRemoveLogOnSuccess(False) +smeshhomard.SetVerboseLevel(3) +smeshhomard.Compute() + +if os.path.isfile(output_med_1): + os.remove(output_med_1) +else: + print("Test Uniform refinement Case 1: Error: no output med file") + assert(False) + +if os.path.isfile(log_file_1): + os.remove(log_file_1) +else: + print("Test Uniform refinement Case 1: Error: no log file") + assert(False) + +# Case 2: input: mesh, boundaries +# output: published mesh +if os.path.isfile(output_med_2): + os.remove(output_med_2) +if os.path.isfile(log_file_2): + os.remove(log_file_2) + +# prepare input mesh +([MAILL], status) = smesh.CreateMeshesFromMED( input_med ) + +#smeshhomard = smesh.Adaptation("Uniform") +Boun_1 = smeshhomard.CreateBoundaryCylinder("Boun_1", 0.5, 0.5, 0.5, 0, 0, 1, 0.25) +smeshhomard.CreateCaseOnMesh("MAILL", MAILL.GetMesh(), working_dir) +smeshhomard.SetConfType(0) +smeshhomard.AddBoundaryGroup("Boun_1", "BORD_EXT") +smeshhomard.AddBoundaryGroup("Boun_1", "MOITIE1") +smeshhomard.SetKeepMedOUT(False) +smeshhomard.SetPublishMeshOUT(True) +smeshhomard.SetMeshNameOUT("MAILL_Uniform_R_02") +smeshhomard.SetMeshFileOUT(output_med_2) +smeshhomard.SetKeepWorkingFiles(False) +smeshhomard.SetLogInFile(True) +smeshhomard.SetLogFile(log_file_2) +smeshhomard.SetRemoveLogOnSuccess(True) +smeshhomard.SetVerboseLevel(0) +smeshhomard.Compute() + +if os.path.isfile(output_med_2): + print("Test Uniform refinement Case 2: Error: output med file has not been removed") + assert(False) + +if os.path.isfile(log_file_2): + print("Test Uniform refinement Case 2: Error: log file has not been removed") + assert(False) + +shutil.rmtree(working_dir) + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser() diff --git a/doc/salome/examples/test_uniform_refinement.py b/doc/salome/examples/test_uniform_refinement.py new file mode 100644 index 000000000..9ce353477 --- /dev/null +++ b/doc/salome/examples/test_uniform_refinement.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 + +import salome +salome.salome_init_without_session() + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +import SMESHHOMARD + +smesh = smeshBuilder.New() + +import os, inspect, tempfile, shutil + +data_dir = os.path.abspath(os.path.dirname(inspect.getfile(lambda: None))) +working_dir = tempfile.mkdtemp() + +input_med_1 = os.path.join (data_dir, "tutorial_4.00.med") +input_xao_1 = os.path.join (data_dir, "tutorial_4.xao") +output_med_1 = os.path.join (working_dir, "tutorial_4.00_Uniform_R.med") +log_file_1 = os.path.join (working_dir, "tutorial_4.00_Uniform_R.log") + +# Case 1: input: med file +# output: med file, log file, published mesh +if os.path.isfile(output_med_1): + os.remove(output_med_1) +if os.path.isfile(log_file_1): + os.remove(log_file_1) + +cao_name = "CAO_PIQUAGE" +smeshhomard = smesh.Adaptation("Uniform") +smeshhomard.CreateBoundaryCAO(cao_name, input_xao_1) +smeshhomard.CreateCase("PIQUAGE", input_med_1, working_dir) +smeshhomard.AddBoundary(cao_name) +smeshhomard.SetConfType(0) +smeshhomard.SetKeepMedOUT(True) +smeshhomard.SetPublishMeshOUT(True) +smeshhomard.SetMeshNameOUT("PIQUAGE_Uniform_R_01") +smeshhomard.SetMeshFileOUT(output_med_1) +smeshhomard.SetKeepWorkingFiles(False) +smeshhomard.SetLogInFile(True) +smeshhomard.SetLogFile(log_file_1) +smeshhomard.SetRemoveLogOnSuccess(False) +smeshhomard.SetVerboseLevel(3) +smeshhomard.Compute() + +if os.path.isfile(output_med_1): + os.remove(output_med_1) +else: + print("Test Uniform refinement Case 1: Error: no output med file") + assert(False) + +if os.path.isfile(log_file_1): + os.remove(log_file_1) +else: + print("Test Uniform refinement Case 1: Error: no log file") + assert(False) + +# Case 2: input: mesh, boundaries +# output: published mesh +input_med_2 = os.path.join (data_dir, "tutorial_5.00.med") +input_fr = os.path.join (data_dir, "tutorial_5.fr.med") +output_med_2 = os.path.join (working_dir, "tutorial_5.00_Uniform_R.med") +log_file_2 = os.path.join (working_dir, "tutorial_5.00_Uniform_R.log") + +if os.path.isfile(output_med_2): + os.remove(output_med_2) +if os.path.isfile(log_file_2): + os.remove(log_file_2) + +# prepare input mesh +([MAILL], status) = smesh.CreateMeshesFromMED( input_med_2 ) + +smeshhomard = smesh.Adaptation("Uniform") +smeshhomard.CreateBoundaryDi("Boun_5_1", "MAIL_EXT", input_fr) +smeshhomard.CreateCaseOnMesh("COEUR_2D", MAILL.GetMesh(), working_dir) +smeshhomard.AddBoundary("Boun_5_1") +smeshhomard.SetConfType(1) +smeshhomard.SetKeepMedOUT(False) +smeshhomard.SetPublishMeshOUT(True) +smeshhomard.SetMeshNameOUT("COEUR_2D_Uniform_R") +smeshhomard.SetMeshFileOUT(output_med_2) +smeshhomard.SetKeepWorkingFiles(False) +smeshhomard.SetLogInFile(True) +smeshhomard.SetLogFile(log_file_2) +smeshhomard.SetRemoveLogOnSuccess(True) +smeshhomard.SetVerboseLevel(0) +smeshhomard.Compute() + +if os.path.isfile(output_med_2): + print("Test Uniform refinement Case 2: Error: output med file has not been removed") + assert(False) + +if os.path.isfile(log_file_2): + print("Test Uniform refinement Case 2: Error: log file has not been removed") + assert(False) + +shutil.rmtree(working_dir) + +if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser() diff --git a/doc/salome/examples/tests.set b/doc/salome/examples/tests.set index 5382b5e9f..bf759ea13 100644 --- a/doc/salome/examples/tests.set +++ b/doc/salome/examples/tests.set @@ -56,6 +56,8 @@ SET(BAD_TESTS IF(NOT WIN32) LIST(APPEND BAD_TESTS MGAdaptTests_without_session.py + test_homard_adapt.py + test_uniform_refinement.py test_smeshplugin_mg_tetra_parallele.py ) ENDIF(NOT WIN32) diff --git a/doc/salome/examples/tutorial_4.00.med b/doc/salome/examples/tutorial_4.00.med new file mode 100644 index 000000000..9a70e0c87 Binary files /dev/null and b/doc/salome/examples/tutorial_4.00.med differ diff --git a/doc/salome/examples/tutorial_4.xao b/doc/salome/examples/tutorial_4.xao new file mode 100644 index 000000000..415904a64 --- /dev/null +++ b/doc/salome/examples/tutorial_4.xao @@ -0,0 +1,652 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/salome/examples/tutorial_5.00.med b/doc/salome/examples/tutorial_5.00.med new file mode 100644 index 000000000..9c1893a76 Binary files /dev/null and b/doc/salome/examples/tutorial_5.00.med differ diff --git a/doc/salome/examples/tutorial_5.fr.med b/doc/salome/examples/tutorial_5.fr.med new file mode 100644 index 000000000..d4faa4c73 Binary files /dev/null and b/doc/salome/examples/tutorial_5.fr.med differ diff --git a/doc/salome/gui/SMESH/images/adaptation_with_homard_advanced.png b/doc/salome/gui/SMESH/images/adaptation_with_homard_advanced.png new file mode 100644 index 000000000..dc05826c6 Binary files /dev/null and b/doc/salome/gui/SMESH/images/adaptation_with_homard_advanced.png differ diff --git a/doc/salome/gui/SMESH/images/adaptation_with_homard_arguments.png b/doc/salome/gui/SMESH/images/adaptation_with_homard_arguments.png new file mode 100644 index 000000000..2bdd411cd Binary files /dev/null and b/doc/salome/gui/SMESH/images/adaptation_with_homard_arguments.png differ diff --git a/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_analytical.png b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_analytical.png new file mode 100644 index 000000000..2beb58dff Binary files /dev/null and b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_analytical.png differ diff --git a/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_cao.png b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_cao.png new file mode 100644 index 000000000..8d823b916 Binary files /dev/null and b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_cao.png differ diff --git a/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_discrete.png b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_discrete.png new file mode 100644 index 000000000..31d2cdf95 Binary files /dev/null and b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_discrete.png differ diff --git a/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_groups.png b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_groups.png new file mode 100644 index 000000000..815591e30 Binary files /dev/null and b/doc/salome/gui/SMESH/images/adaptation_with_homard_boundary_groups.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_1.png b/doc/salome/gui/SMESH/images/create_boundary_1.png new file mode 100644 index 000000000..f6e34b625 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_1.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_1.png b/doc/salome/gui/SMESH/images/create_boundary_an_1.png new file mode 100644 index 000000000..2e634da03 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_1.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_2.png b/doc/salome/gui/SMESH/images/create_boundary_an_2.png new file mode 100644 index 000000000..25c6e9b1d Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_2.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_3.png b/doc/salome/gui/SMESH/images/create_boundary_an_3.png new file mode 100644 index 000000000..6f38d9f8f Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_3.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_4.png b/doc/salome/gui/SMESH/images/create_boundary_an_4.png new file mode 100644 index 000000000..abf104213 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_4.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_co_1.png b/doc/salome/gui/SMESH/images/create_boundary_an_co_1.png new file mode 100644 index 000000000..7212cba31 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_co_1.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_co_2.png b/doc/salome/gui/SMESH/images/create_boundary_an_co_2.png new file mode 100644 index 000000000..017b56d94 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_co_2.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_cy.png b/doc/salome/gui/SMESH/images/create_boundary_an_cy.png new file mode 100644 index 000000000..2efc3fdc0 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_cy.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_sp.png b/doc/salome/gui/SMESH/images/create_boundary_an_sp.png new file mode 100644 index 000000000..be7b28b7b Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_sp.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_an_to.png b/doc/salome/gui/SMESH/images/create_boundary_an_to.png new file mode 100644 index 000000000..38e39409b Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_an_to.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_cao_1.png b/doc/salome/gui/SMESH/images/create_boundary_cao_1.png new file mode 100644 index 000000000..96c2382e7 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_cao_1.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_cao_2.png b/doc/salome/gui/SMESH/images/create_boundary_cao_2.png new file mode 100644 index 000000000..94da749c3 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_cao_2.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_di_1.png b/doc/salome/gui/SMESH/images/create_boundary_di_1.png new file mode 100644 index 000000000..8f5770be1 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_di_1.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_di_2.png b/doc/salome/gui/SMESH/images/create_boundary_di_2.png new file mode 100644 index 000000000..33ed85f34 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_di_2.png differ diff --git a/doc/salome/gui/SMESH/images/create_boundary_di_3.png b/doc/salome/gui/SMESH/images/create_boundary_di_3.png new file mode 100644 index 000000000..e682a3974 Binary files /dev/null and b/doc/salome/gui/SMESH/images/create_boundary_di_3.png differ diff --git a/doc/salome/gui/SMESH/input/adaptation.rst b/doc/salome/gui/SMESH/input/adaptation.rst index 624851d75..ceac1c998 100644 --- a/doc/salome/gui/SMESH/input/adaptation.rst +++ b/doc/salome/gui/SMESH/input/adaptation.rst @@ -5,9 +5,58 @@ Adaptation ********** Mesh module provides the possibility to perform different adaptations of a mesh. +To refine the mesh means to cut out elements indicated according to indications provided by the user. + +.. _homard_adapt_anchor: + +HOMARD +###### + +HOMARD can treat meshes into 2 or 3 dimensions and comprising the following elements: + - mesh-points + - segments + - triangles + - quadrangles + - tetrahedra + - hexahedra + - prisms + +These elements can be present simultaneously. For example, HOMARD will be able to adapt a comprising mesh of the triangles and the quadrangles. + +To start operation, select **Remesh with HOMARD** item in **Adaptation** menu. + +.. image:: ../images/adaptation_with_homard_arguments.png + :align: center + +* **Mesh In** is the initial mesh to remesh. +* **Mesh Out** is the resulting mesh after remeshing. By default, the name of the initial mesh is kept and the file name is based on the name of the initial mesh. +* **Conformity type** is a choice between **Conformal** and **Non conformal**. +* **Boundary type** is a choice between **No boundary**, **CAO** and **Non CAO**. + +- If the choice is **CAO**, a XAO file is required for each CAO boundary creation. + +.. image:: ../images/adaptation_with_homard_boundary_cao.png + :align: center + +**See more** at :ref:`homard_create_boundary_CAO`. + +- If the choice is **Non CAO**, some discrete and/or analytical boundaries can be created. + +.. image:: ../images/adaptation_with_homard_boundary_discrete.png + :align: center + +**See more** at :ref:`homard_create_boundary_Di`. + +.. image:: ../images/adaptation_with_homard_boundary_analytical.png + :align: center + +**See more** at :ref:`homard_create_boundary_An`. .. note:: - A mesh adaptation based on splitting is available by the HOMARD module. + The exhaustive description of HOMARD can be read into its documentation. It can be reached by the general help button. + +**See Also** a sample TUI Script of adaptation with :ref:`tui_homard_adapt`. + .. _mg_adapt_anchor: @@ -16,7 +65,7 @@ MG_Adapt For meshes made of triangles and/or tetrahedra, remeshing operations are available with the MG-Adapt plugin. The remeshing is based on wanted mesh sizes defined over the mesh or as a constant. The boundaries are dedeuced from the initial mesh. -To start **Remeshing** operation, select **MG Adapt** tab in **Adaptation** dialog. +To start **Remeshing** operation, select **Remesh with MG_Adapt** item in **Adaptation** menu. .. image:: ../images/adaptation_01.png :align: center diff --git a/doc/salome/gui/SMESH/input/homard_create_boundary.rst b/doc/salome/gui/SMESH/input/homard_create_boundary.rst new file mode 100644 index 000000000..230ce001d --- /dev/null +++ b/doc/salome/gui/SMESH/input/homard_create_boundary.rst @@ -0,0 +1,169 @@ +.. _homard_create_boundary: + +The boundary +############ +.. 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: + + - CAO: the boundary comes from the geometry of the domain + - Non CAO: if the CAO is not available, the boundary can be approximated 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 + +.. _homard_create_boundary_CAO: + +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. + +Filtering by the groups +*********************** +.. index:: single: group + +We can restrict the application of the boundary to groups. So elements not belonging to these groups will not be affected. We check the associated button **Filtering with groups**. The list of the present groups of elements in the mesh is shown. It is enough to check those wanted to restrict the boundary. + +.. image:: ../images/adaptation_with_homard_boundary_groups.png + :align: center + +.. _homard_create_boundary_Di: + +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*": + +.. 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, whatever its type. + +.. image:: ../images/create_boundary_di_2.png + :align: center + +.. note:: + The file has to contain only a single mesh. + +If discrete boundaries were already defined for another case, we can select one of them. We can also create a new discrete boundary by activation of the button "*New*", as explained previously. + +.. image:: ../images/create_boundary_di_3.png + :align: center + + + +.. _homard_create_boundary_An: + +Analytical boundary +******************* +In the starting up, SALOME shows a table with one only one column. This column contains the list of all the groups of the initial mesh defining the case. + +.. image:: ../images/create_boundary_an_1.png + :align: center + +It is necessary to create a first analytical boundary by activation of the button "*New*". We shall have the choice between cylinder, sphere, cone or torus. When the boundary will be validated, its name will appear in header of the second column. + +.. image:: ../images/create_boundary_an_2.png + :align: center + +It is now necessary to establish the link enter the mesh defining the case and this boundary described analytically. It is made by checking the groups of the faces which have to be on the boundary. + +.. image:: ../images/create_boundary_an_3.png + :align: center + +This operation is repeated as often as we wish to place faces of meshs on a curved surface: + +.. image:: ../images/create_boundary_an_4.png + :align: center + +.. note:: + + A group can be checked very well never: it means that the elements which it defines belong to none of the described boundaries. + + A group can be checked only once. Indeed, surface elements cannot belong to more than one surface. + + Several groups can be checked for the same boundary. It occurs if the initial mesh of the zone was subdivided into several groups: all the surface elements belong to this surface but were distributed in several groups. + + Conversely, a boundary can be very well retained by no group. It occurs if it was defined for a previous case and if it is groundless for the case in the course of definition. + + +There are four types of analytical boundary: + + - Cylindre + - Sphere + - Cone, described by an axis and an angle or by two radius + - Torus + +.. note:: + The numerical values proposed by default take into account the geometry of the mesh. + + +Cylindre +======== +.. 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, whatever its type. + +.. image:: ../images/create_boundary_an_cy.png + :align: center + +Sphere +====== +.. 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, whatever its type. + +.. image:: ../images/create_boundary_an_sp.png + :align: center + +Cone +==== +.. 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, whatever its type. + +Creation by an origin, an axis and an angle of opening: + +.. image:: ../images/create_boundary_an_co_1.png + :align: center + +Creation by two points centered on the axis and the associated radius: + +.. image:: ../images/create_boundary_an_co_2.png + :align: center + +.. index:: single: object browser + +Torus +===== +.. 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, whatever its type. + +.. image:: ../images/create_boundary_an_to.png + :align: center diff --git a/doc/salome/gui/SMESH/input/tui_adaptation.rst b/doc/salome/gui/SMESH/input/tui_adaptation.rst index e0bf7d0da..2e90aad82 100644 --- a/doc/salome/gui/SMESH/input/tui_adaptation.rst +++ b/doc/salome/gui/SMESH/input/tui_adaptation.rst @@ -4,6 +4,21 @@ Adaptation ********** +.. _tui_homard_adapt: + +HOMARD +====== + +.. literalinclude:: ../../../examples/test_uniform_refinement.py + :language: python + +:download:`Download this script <../../../examples/test_uniform_refinement.py>` + +.. literalinclude:: ../../../examples/test_homard_adapt.py + :language: python + +:download:`Download this script <../../../examples/test_homard_adapt.py>` + .. _tui_mg_adapt: MG_Adapt diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index bd2569e2a..bc5326b53 100644 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -40,6 +40,7 @@ SET(SalomeIDLSMESH_IDLSOURCES SMESH_Measurements.idl ${CMAKE_CURRENT_BINARY_DIR}/SMESH_smIdType.idl MG_ADAPT.idl + SMESH_Homard.idl ) SET(_idl_include_dirs diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl index cfdca30f1..532c86122 100644 --- a/idl/SMESH_Gen.idl +++ b/idl/SMESH_Gen.idl @@ -35,6 +35,11 @@ #include "SMESH_Hypothesis.idl" #include "SMESH_smIdType.idl" +module SMESHHOMARD +{ + interface HOMARD_Gen; +}; + module SMESH { typedef sequence sobject_list; @@ -581,7 +586,9 @@ module SMESH in double theTolerance ); MG_ADAPT CreateMG_ADAPT(); - MG_ADAPT_OBJECT Adaptation(in string adaptType); + SMESHHOMARD::HOMARD_Gen CreateHOMARD_ADAPT() raises ( SALOME::SALOME_Exception ); + //MG_ADAPT_OBJECT Adaptation(in string adaptType); + SALOME::GenericObj Adaptation(in string adaptType) raises ( SALOME::SALOME_Exception ); MG_ADAPT CreateAdaptationHypothesis(); }; diff --git a/idl/SMESH_Homard.idl b/idl/SMESH_Homard.idl new file mode 100644 index 000000000..ff25358ec --- /dev/null +++ b/idl/SMESH_Homard.idl @@ -0,0 +1,183 @@ +// Copyright (C) 2011-2021 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 _SMESH_HOMARD_IDL +#define _SMESH_HOMARD_IDL + +#include "SMESH_Mesh.idl" + +#include "SALOME_Exception.idl" +#include "SALOMEDS.idl" + +module SMESHHOMARD +{ + typedef sequence double_array; + typedef sequence extrema; + typedef sequence ListGroupType; + typedef sequence ListBoundaryGroupType; + typedef sequence listeBoundarys; + + interface HOMARD_Boundary : SALOME::GenericObj + { + // Generalites + void SetName(in string Name) raises (SALOME::SALOME_Exception); + string GetName() raises (SALOME::SALOME_Exception); + + // Caracteristiques + void SetType (in long Type) raises (SALOME::SALOME_Exception); + long GetType() 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 SetCylinder (in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxe, in double Yaxe, in double Zaxe, in double rayon) + raises (SALOME::SALOME_Exception); + + void SetSphere (in double Xcentre, in double Ycentre, in double Zcentre, in double rayon) + raises (SALOME::SALOME_Exception); + + void SetConeR (in double Xcentre1, in double Ycentre1, in double Zcentre1, + in double Rayon1, + in double Xcentre2, in double Ycentre2, in double Zcentre2, + in double Rayon2) raises (SALOME::SALOME_Exception); + + void SetConeA(in double Xaxe, in double Yaxe, in double Zaxe, in double Angle, + in double Xcentre, in double Ycentre, in double ZCentre) + raises (SALOME::SALOME_Exception); + + void SetTorus (in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxe, in double Yaxe, in double Zaxe, + in double rayonRev, in double rayonPri) + raises (SALOME::SALOME_Exception); + + SMESHHOMARD::double_array GetCoords() raises (SALOME::SALOME_Exception); + + void SetLimit (in double Xincr, in double Yincr, in double Zincr) + raises (SALOME::SALOME_Exception); + SMESHHOMARD::double_array GetLimit() raises (SALOME::SALOME_Exception); + + void AddGroup(in string LeGroupe) raises (SALOME::SALOME_Exception); + void SetGroups(in ListGroupType ListGroup) raises (SALOME::SALOME_Exception); + ListGroupType GetGroups() raises (SALOME::SALOME_Exception); + + string GetDumpPython() raises (SALOME::SALOME_Exception); + }; + + interface HOMARD_Cas : SALOME::GenericObj + { + void SetDirName(in string NomDir) raises (SALOME::SALOME_Exception); + string GetDirName() raises (SALOME::SALOME_Exception); + + void SetBoundingBox(in extrema LesExtremes) raises (SALOME::SALOME_Exception); + extrema GetBoundingBox() raises (SALOME::SALOME_Exception); + + void AddGroup(in string Group) 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); + void SupprBoundaryGroup() raises (SALOME::SALOME_Exception); + + string GetDumpPython() raises (SALOME::SALOME_Exception); + }; + + interface HOMARD_Gen : SALOME::GenericObj + { + // Create boundaries + 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, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxis, in double Yaxis, in double Zaxis, + in double Radius) + raises (SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundarySphere (in string BoundaryName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Radius) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryConeR (in string BoundaryName, + in double Xcentre1, in double Ycentre1, in double Zcentre1, + in double Radius1, + in double Xcentre2, in double Ycentre2, in double Zcentre2, + in double Radius2) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryConeA (in string BoundaryName, + in double Xaxis, in double Yaxis, in double Zaxis, + in double Angle, + in double Xcentre, in double Ycentre, in double Zcentre) + raises(SALOME::SALOME_Exception); + HOMARD_Boundary CreateBoundaryTorus (in string BoundaryName, + in double Xcentre, in double Ycentre, in double Zcentre, + in double Xaxis, in double Yaxis, in double Zaxis, + in double RadiusRev, in double RadiusPri) + raises (SALOME::SALOME_Exception); + + // Set mesh (SMESH_Mesh object or MED file) and working directory + HOMARD_Cas CreateCaseOnMesh(in string MeshName, + in SMESH::SMESH_Mesh smeshMesh, + in string theWorkingDir) raises(SALOME::SALOME_Exception); + HOMARD_Cas CreateCase(in string MeshName, + in string FileName, + in string theWorkingDir) raises(SALOME::SALOME_Exception); + + // Associate boundaries to groups + void AddBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception); + void AddBoundaryGroup(in string BoundaryName, + in string Group) raises (SALOME::SALOME_Exception); + + // Information + HOMARD_Boundary GetBoundary(in string BoundaryName) raises (SALOME::SALOME_Exception); + HOMARD_Cas GetCase() raises (SALOME::SALOME_Exception); + listeBoundarys GetAllBoundarysName() raises (SALOME::SALOME_Exception); + + // Preferences + void SetConfType(in long ConfType) raises (SALOME::SALOME_Exception); + void SetKeepMedOUT (in boolean theKeepMedOUT); + void SetPublishMeshOUT (in boolean thePublishMeshOUT); + void SetMeshNameOUT (in string theMeshName) raises (SALOME::SALOME_Exception); + void SetMeshFileOUT (in string theFileName) raises (SALOME::SALOME_Exception); + + void SetVerboseLevel (in long theLevel); + void SetKeepWorkingFiles (in boolean theKeepWorkingFiles); + void SetLogInFile (in boolean theLogInFile); + void SetLogFile (in string theFileName) raises (SALOME::SALOME_Exception); + void SetRemoveLogOnSuccess (in boolean theRemoveLogOnSuccess); + + // Computation + long Compute() raises (SALOME::SALOME_Exception); + + // Clean data + void InvalideBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); + long DeleteBoundary (in string BoundaryName) raises (SALOME::SALOME_Exception); + void DeleteCase() raises (SALOME::SALOME_Exception); + }; + +}; // module SMESHHOMARD + +#endif diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 7e0d62012..d1436578a 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -23,6 +23,7 @@ SET(SMESH_RESOURCES_FILES ModuleMesh.png adapt_mg_adapt.png + adapt_homard.png advanced_mesh_info.png bare_border_face.png bare_border_volume.png diff --git a/resources/adapt_homard.png b/resources/adapt_homard.png new file mode 100644 index 000000000..95b4c139b Binary files /dev/null and b/resources/adapt_homard.png differ diff --git a/src/SMESH/CMakeLists.txt b/src/SMESH/CMakeLists.txt index ad34d18d8..9dd4e5fb2 100644 --- a/src/SMESH/CMakeLists.txt +++ b/src/SMESH/CMakeLists.txt @@ -89,6 +89,7 @@ SET(SMESHimpl_HEADERS SMESH_ProxyMesh.hxx SMESH_SMESH.hxx MG_ADAPT.hxx + SMESH_Homard.hxx ) # --- sources --- @@ -108,6 +109,7 @@ SET(SMESHimpl_SOURCES SMESH_ProxyMesh.cxx SMESH_MesherHelper.cxx MG_ADAPT.cxx + SMESH_Homard.cxx ) # --- rules --- diff --git a/src/SMESH/SMESH_Homard.cxx b/src/SMESH/SMESH_Homard.cxx new file mode 100644 index 000000000..3bc4bd651 --- /dev/null +++ b/src/SMESH/SMESH_Homard.cxx @@ -0,0 +1,1184 @@ +// SMESH HOMARD : implementation of SMESHHOMARD idl descriptions +// +// Copyright (C) 2011-2021 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 "SMESH_Homard.hxx" + +#include +#include + +#include +#include +#include +#include + +#ifndef WIN32 +#include +#else +#include +#endif + +// La gestion des repertoires +#ifndef CHDIR + #ifdef WIN32 + #define CHDIR _chdir + #else + #define CHDIR chdir + #endif +#endif + +namespace SMESHHOMARDImpl +{ + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= +HOMARD_Boundary::HOMARD_Boundary(): + _Name( "" ),_Type( 1 ), + _Xmin( 0 ), _Xmax( 0 ), _Ymin( 0 ), _Ymax( 0 ), _Zmin( 0 ), _Zmax( 0 ), + _Xaxe( 0 ), _Yaxe( 0 ), _Zaxe( 0 ), + _Xcentre( 0 ), _Ycentre( 0 ), _Zcentre( 0 ), _rayon( 0 ), + _Xincr( 0 ), _Yincr( 0 ), _Zincr( 0 ) +{ + MESSAGE("HOMARD_Boundary"); +} + +//============================================================================= +HOMARD_Boundary::~HOMARD_Boundary() +{ + MESSAGE("~HOMARD_Boundary"); +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Boundary::SetName( const char* Name ) +{ + _Name = std::string( Name ); +} +//============================================================================= +std::string HOMARD_Boundary::GetName() const +{ + return _Name; +} +//============================================================================= +std::string HOMARD_Boundary::GetDumpPython() const +{ + std::ostringstream aScript; + switch (_Type) { + case -1: + { + aScript << _Name << " = smeshhomard.CreateBoundaryCAO(\"" << _Name << "\", "; + aScript << "\"" << _DataFile << "\")\n"; + break ; + } + case 0: + { + aScript << _Name << " = smeshhomard.CreateBoundaryDi(\"" << _Name << "\", "; + aScript << "\"" << _MeshName << "\", "; + aScript << "\"" << _DataFile << "\")\n"; + break ; + } + case 1: + { + aScript << _Name << " = smeshhomard.CreateBoundaryCylinder(\"" << _Name << "\", "; + aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _rayon << ")\n"; + break ; + } + case 2: + { + aScript << _Name << " = smeshhomard.CreateBoundarySphere(\"" << _Name << "\", "; + aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _rayon << ")\n"; + break ; + } + case 3: + { + aScript << _Name << " = smeshhomard.CreateBoundaryConeA(\"" << _Name << "\", "; + aScript << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Angle << ", " << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ")\n"; + break ; + } + case 4: + { + aScript << _Name << " = smeshhomard.CreateBoundaryConeR(\"" << _Name << "\", "; + aScript << _Xcentre1 << ", " << _Ycentre1 << ", " << _Zcentre1 << ", " << _Rayon1 << ", " << _Xcentre2 << ", " << _Ycentre2 << ", " << _Zcentre2 << ", " << _Rayon2 << ")\n"; + break ; + } + case 5: + { + aScript << _Name << " = smeshhomard.CreateBoundaryTorus(\"" << _Name << "\", "; + aScript << _Xcentre << ", " << _Ycentre << ", " << _Zcentre << ", " << _Xaxe << ", " << _Yaxe << ", " << _Zaxe << ", " << _Rayon1 << ", " << _Rayon2 << ")\n"; + break ; + } + } + + return aScript.str(); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Boundary::SetType( int Type ) +{ + _Type = Type; +} +//============================================================================= +int HOMARD_Boundary::GetType() const +{ + return _Type; +} +//============================================================================= +void HOMARD_Boundary::SetMeshName( const char* MeshName ) +{ + _MeshName = std::string( MeshName ); +} +//============================================================================= +std::string HOMARD_Boundary::GetMeshName() const +{ + return _MeshName; +} +//============================================================================= +void HOMARD_Boundary::SetDataFile( const char* DataFile ) +{ + _DataFile = std::string( DataFile ); +} +//============================================================================= +std::string HOMARD_Boundary::GetDataFile() const +{ + return _DataFile; +} +//======================================================================================= +void HOMARD_Boundary::SetCylinder( double X0, double X1, double X2, + double X3, double X4, double X5, double X6 ) +{ + _Xcentre = X0; _Ycentre = X1; _Zcentre = X2; + _Xaxe = X3; _Yaxe = X4; _Zaxe = X5; + _rayon = X6; +} +//====================================================================== +void HOMARD_Boundary::SetSphere( double X0, double X1, double X2, double X3 ) +{ + _Xcentre = X0; _Ycentre = X1; _Zcentre = X2; + _rayon = X3; +} +//====================================================================== +void HOMARD_Boundary::SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, + double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2) +{ + _Xcentre1 = Xcentre1; _Ycentre1 = Ycentre1; _Zcentre1 = Zcentre1; + _Rayon1 = Rayon1; + _Xcentre2 = Xcentre2; _Ycentre2 = Ycentre2; _Zcentre2 = Zcentre2; + _Rayon2 = Rayon2; +} +//====================================================================== +void HOMARD_Boundary::SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, + double Xcentre, double Ycentre, double Zcentre) +{ + _Xaxe = Xaxe; _Yaxe = Yaxe; _Zaxe = Zaxe; + _Angle = Angle; + _Xcentre = Xcentre; _Ycentre = Ycentre; _Zcentre = Zcentre; +} +//======================================================================================= +void HOMARD_Boundary::SetTorus( double X0, double X1, double X2, + double X3, double X4, double X5, double X6, double X7 ) +{ + _Xcentre = X0; _Ycentre = X1; _Zcentre = X2; + _Xaxe = X3; _Yaxe = X4; _Zaxe = X5; + _Rayon1 = X6; + _Rayon2 = X7; +} +//======================================================================================= +std::vector HOMARD_Boundary::GetCoords() const +{ + std::vector mesCoor; + switch (_Type) + { + // Cylindre + case 1: + { + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + mesCoor.push_back( _Xaxe ); + mesCoor.push_back( _Yaxe ); + mesCoor.push_back( _Zaxe ); + mesCoor.push_back( _rayon ); + break ; + } + // Sphere + case 2: + { + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + mesCoor.push_back( _rayon ); + break ; + } + // Cone defini par un axe et un angle + case 3: + { + mesCoor.push_back( _Xaxe ); + mesCoor.push_back( _Yaxe ); + mesCoor.push_back( _Zaxe ); + mesCoor.push_back( _Angle ); + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + break ; + } + // Cone defini par les 2 rayons + case 4: + { + mesCoor.push_back( _Xcentre1 ); + mesCoor.push_back( _Ycentre1 ); + mesCoor.push_back( _Zcentre1 ); + mesCoor.push_back( _Rayon1 ); + mesCoor.push_back( _Xcentre2 ); + mesCoor.push_back( _Ycentre2 ); + mesCoor.push_back( _Zcentre2 ); + mesCoor.push_back( _Rayon2 ); + break ; + } + // Tore + case 5: + { + mesCoor.push_back( _Xcentre ); + mesCoor.push_back( _Ycentre ); + mesCoor.push_back( _Zcentre ); + mesCoor.push_back( _Xaxe ); + mesCoor.push_back( _Yaxe ); + mesCoor.push_back( _Zaxe ); + mesCoor.push_back( _Rayon1 ); + mesCoor.push_back( _Rayon2 ); + break ; + } + default: + break ; + } + return mesCoor; +} +//====================================================================== +void HOMARD_Boundary::SetLimit( double X0, double X1, double X2 ) +{ + _Xincr = X0; _Yincr = X1; _Zincr = X2; +} +//======================================================================================= +std::vector HOMARD_Boundary::GetLimit() const +{ + std::vector mesLimit; + mesLimit.push_back( _Xincr ); + mesLimit.push_back( _Yincr ); + mesLimit.push_back( _Zincr ); + return mesLimit; +} +//============================================================================= +void HOMARD_Boundary::AddGroup( const char* Group) +{ + _ListGroupSelected.push_back(Group); +} +//============================================================================= +void HOMARD_Boundary::SetGroups( const std::list& ListGroup ) +{ + _ListGroupSelected.clear(); + std::list::const_iterator it = ListGroup.begin(); + while(it != ListGroup.end()) + _ListGroupSelected.push_back((*it++)); +} +//============================================================================= +const std::list& HOMARD_Boundary::GetGroups() const +{ + return _ListGroupSelected; +} +//============================================================================= + +//============================================================================= +/*! + * default constructor: + * Par defaut, l'adaptation est conforme, sans suivi de frontiere + */ +//============================================================================= +HOMARD_Cas::HOMARD_Cas(): + _NomDir("/tmp") +{ + MESSAGE("HOMARD_Cas"); +} +//============================================================================= +HOMARD_Cas::~HOMARD_Cas() +//============================================================================= +{ + MESSAGE("~HOMARD_Cas"); +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +std::string HOMARD_Cas::GetDumpPython() const +{ + std::ostringstream aScript; + // Suivi de frontieres + std::list::const_iterator it = _ListBoundaryGroup.begin(); + while (it != _ListBoundaryGroup.end()) { + aScript << "smeshhomard.AddBoundaryGroup(\"" << *it << "\", \""; + it++; + aScript << *it << "\")\n"; + it++; + } + + return aScript.str(); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +int HOMARD_Cas::SetDirName( const char* NomDir ) +{ + int erreur = 0 ; + // On vérifie qu'aucun calcul n'a eu lieu pour ce cas + if ( _ListIter.size() > 1 ) { erreur = 1 ; } + // Creation + if ( CHDIR(NomDir) == 0 ) { + _NomDir = std::string( NomDir ); + } + else { +#ifndef WIN32 + if ( mkdir(NomDir, S_IRWXU|S_IRGRP|S_IXGRP) == 0 ) +#else + if ( _mkdir(NomDir) == 0 ) +#endif + { + if ( CHDIR(NomDir) == 0 ) { _NomDir = std::string( NomDir ); } + else { erreur = 2 ; } + } + else { erreur = 2 ; } + } + return erreur; +} +//============================================================================= +std::string HOMARD_Cas::GetDirName() const +{ + return _NomDir; +} +// +// La boite englobante +// +//============================================================================= +void HOMARD_Cas::SetBoundingBox( const std::vector& extremas ) +{ + _Boite.clear(); + _Boite.resize( extremas.size() ); + for ( unsigned int i = 0; i < extremas.size(); i++ ) + _Boite[i] = extremas[i]; +} +//============================================================================= +const std::vector& HOMARD_Cas::GetBoundingBox() const +{ + return _Boite; +} +// +// Les groupes +// +//============================================================================= +void HOMARD_Cas::AddGroup( const char* Group ) +{ + _ListGroup.push_back(Group); +} +//============================================================================= +void HOMARD_Cas::SetGroups( const std::list& ListGroup ) +{ + _ListGroup.clear(); + std::list::const_iterator it = ListGroup.begin(); + while(it != ListGroup.end()) + { + _ListGroup.push_back((*it++)); + } +} +//============================================================================= +const std::list& HOMARD_Cas::GetGroups() const +{ + return _ListGroup; +} +//============================================================================= +void HOMARD_Cas::SupprGroups() +{ + _ListGroup.clear(); +} +// +// 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 ( ". HOMARD_Cas::AddBoundaryGroup : Boundary = " << Boundary ); +// MESSAGE ( ". HOMARD_Cas::AddBoundaryGroup : Group = " << Group ); + _ListBoundaryGroup.push_back( Boundary ); + _ListBoundaryGroup.push_back( Group ); +} +//============================================================================= +const std::list& HOMARD_Cas::GetBoundaryGroup() const +{ + return _ListBoundaryGroup; +} +//============================================================================= +void HOMARD_Cas::SupprBoundaryGroup() +{ + _ListBoundaryGroup.clear(); +} +//============================================================================= +//============================================================================= +// Liens avec les autres structures +//============================================================================= +//============================================================================= +void HOMARD_Cas::AddIteration( const char* NomIteration ) +{ + _ListIter.push_back( std::string( NomIteration ) ); +} + +//============================================================================= +//============================================================================= +HomardDriver::HomardDriver(const std::string siter, const std::string siterp1): + _HOMARD_Exec( "" ), _NomDir( "" ), _NomFichierConfBase( "HOMARD.Configuration" ), + _NomFichierConf( "" ), _NomFichierDonn( "" ), _siter( "" ), _siterp1( "" ), + _Texte( "" ), _bLu( false ) +{ + MESSAGE("siter = "< _HOMARD_Exec ="<<_HOMARD_Exec) ; + // + _siter = siter ; + _siterp1 = siterp1 ; +} +//============================================================================= +//============================================================================= +HomardDriver::~HomardDriver() +{ +} +//=============================================================================== +// A. Generalites +//=============================================================================== +void HomardDriver::TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue ) +{ + MESSAGE("TexteInit, DirCompute ="< 0 ) + { + _Texte += "# Diametre minimal\n" ; + { std::stringstream saux1 ; + saux1 << DiamMin ; + _Texte += "DiametMi " + saux1.str() + "\n" ; + } + } + if ( AdapInit != 0 ) + { + if ( AdapInit > 0 ) + { _Texte += "# Raffinement" ; } + else + { _Texte += "# Deraffinement" ; } + _Texte += " des regions sans indicateur\n" ; + { std::stringstream saux1 ; + saux1 << AdapInit ; + _Texte += "AdapInit " + saux1.str() + "\n" ; + } + } + if ( ExtraOutput % 2 == 0 ) + { + _Texte += "# Sortie des niveaux de raffinement\n" ; + _Texte += "NCNiveau NIVEAU\n" ; + } + if ( ExtraOutput % 3 == 0 ) + { + _Texte += "# Sortie des qualités des mailles\n" ; + _Texte += "NCQualit QUAL\n" ; + } + if ( ExtraOutput % 5 == 0 ) + { + _Texte += "# Sortie des diamètres des mailles\n" ; + _Texte += "NCDiamet DIAM\n" ; + } + if ( ExtraOutput % 7 == 0 ) + { + _Texte += "# Sortie des parents des mailles\n" ; + _Texte += "NCParent PARENT\n" ; + } + if ( ExtraOutput % 11 == 0 ) + { + _Texte += "# Volumes voisins par recollement\n" ; + _Texte += "NCVoisRc Voisin-Recollement\n" ; + } +} +//=============================================================================== +// G. Les messages +//=============================================================================== +void HomardDriver::TexteInfoCompute( int MessInfo ) +{ + MESSAGE("TexteAdvanced, MessInfo ="< +#include +#include + +#include +#include + +#if defined WIN32 +#pragma warning ( disable: 4251 ) +#endif + +namespace SMESHHOMARDImpl +{ + +class SMESH_EXPORT HOMARD_Boundary +{ +public: + HOMARD_Boundary(); + ~HOMARD_Boundary(); + + // Generalites + void SetName( const char* Name ); + std::string GetName() const; + + std::string GetDumpPython() const; + + // Caracteristiques + void SetType( int Type ); + int GetType() const; + + void SetMeshName( const char* MeshName ); + std::string GetMeshName() 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 ); + void SetSphere( double X0, double X1, double X2, double X3 ); + void SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, + double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2); + void SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle, + double Xcentre, double Ycentre, double ZCentre); + void SetTorus( double X0, double X1, double X2, double X3, + double X4, double X5, double X6, double X7 ); + + std::vector GetCoords() const; + + void SetLimit( double X0, double X1, double X2 ); + std::vector GetLimit() const; + + void AddGroup( const char* LeGroupe); + void SetGroups(const std::list& ListGroup ); + const std::list& GetGroups() const; + +private: + std::string _Name; + std::string _DataFile; + std::string _MeshName; + int _Type; + double _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax; + double _Xaxe, _Yaxe, _Zaxe; + double _Xcentre, _Ycentre, _Zcentre, _rayon; + double _Xincr, _Yincr, _Zincr; + double _Xcentre1, _Ycentre1, _Zcentre1, _Rayon1; + double _Xcentre2, _Ycentre2, _Zcentre2, _Rayon2; + double _Angle; + + std::list _ListGroupSelected; +}; + +class SMESH_EXPORT HOMARD_Cas +{ +public: + HOMARD_Cas(); + ~HOMARD_Cas(); + + // Generalites + std::string GetDumpPython() const; + + // Caracteristiques + int SetDirName( const char* NomDir ); + std::string GetDirName() const; + + void SetBoundingBox( const std::vector& extremas ); + const std::vector& GetBoundingBox() const; + + void AddGroup( const char* Group); + void SetGroups( const std::list& ListGroup ); + const std::list& GetGroups() const; + void SupprGroups(); + + void AddBoundary( const char* Boundary ); + void AddBoundaryGroup( const char* Boundary, const char* Group ); + const std::list& GetBoundaryGroup() const; + void SupprBoundaryGroup(); + + void AddIteration( const char* NomIteration ); + +private: + std::string _NomDir; + int _Etat; + + std::vector _Boite; // cf HomardQTCommun pour structure du vecteur + std::list _ListGroup; + std::list _ListBoundaryGroup; + + typedef std::string IterName; + typedef std::list IterNames; + IterNames _ListIter; +}; + +class SMESH_EXPORT HomardDriver +{ +public: + HomardDriver(const std::string siter, const std::string siterp1); + ~HomardDriver(); + // + 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(); + void CreeFichier(); + void TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres ); + void TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres ); + void TexteConfRaffDera( int ConfType ); + + 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 ); + void TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName ); + + void TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int LevelOutput ); + void TexteInfoCompute( int MessInfo ); + // + int ExecuteHomard(); + +public: + int _modeHOMARD; + std::string _HOMARD_Exec; + std::string _NomDir; + std::string _NomFichierConfBase; + std::string _NomFichierConf; + std::string _NomFichierDonn; + std::string _siter; + std::string _siterp1; + std::string _Texte; + bool _bLu; +}; + +class HOMARD_Iteration; + +class SMESH_EXPORT HOMARD_Gen +{ +public : + HOMARD_Gen(); + ~HOMARD_Gen(); +}; + +class SMESH_EXPORT HOMARD_Iteration +{ +public: + HOMARD_Iteration(); + ~HOMARD_Iteration(); + + // Generalites + void SetName( const char* Name ); + std::string GetName() const; + + // Caracteristiques + void SetDirNameLoc( const char* NomDir ); + std::string GetDirNameLoc() const; + + void SetNumber( int NumIter ); + int GetNumber() const; + + void SetState( int etat ); + int GetState() const; + + void SetMeshName( const char* NomMesh ); + std::string GetMeshName() const; + + void SetMeshFile( const char* MeshFile ); + std::string GetMeshFile() const; + + void SetLogFile( const char* LogFile ); + std::string GetLogFile() const; + + void SetFileInfo( const char* FileInfo ); + std::string GetFileInfo() const; + + // Divers + void SetInfoCompute( int MessInfo ); + int GetInfoCompute() const; + +private: + std::string _Name; + int _Etat; + int _NumIter; + std::string _NomMesh; + std::string _MeshFile; + std::string _LogFile; + std::string _NomDir; + std::string _FileInfo; + int _MessInfo; +}; + +}; // namespace SMESHHOMARDImpl + +#endif diff --git a/src/SMESHGUI/CMakeLists.txt b/src/SMESHGUI/CMakeLists.txt index 587ee89bd..30179b73a 100644 --- a/src/SMESHGUI/CMakeLists.txt +++ b/src/SMESHGUI/CMakeLists.txt @@ -150,6 +150,9 @@ SET(_moc_HEADERS SMESHGUI_PreVisualObj.h SMESHGUI_MG_ADAPTDRIVER.h SMESHGUI_MgAdaptDlg.h + SMESHGUI_HomardAdaptDlg.h + SMESHGUI_HomardBoundaryDlg.h + SMESHGUI_HomardListGroup.h ) # header files / no moc processing @@ -172,6 +175,7 @@ SET(_other_HEADERS SMESHGUI_FileValidator.h SMESHGUI_SelectionProxy.h SMESH_SMESHGUI.hxx + SMESHGUI_HomardUtils.h ) # header files / to install @@ -267,6 +271,10 @@ SET(_other_SOURCES SMESHGUI_IdPreview.cxx SMESHGUI_MG_ADAPTDRIVER.cxx SMESHGUI_MgAdaptDlg.cxx + SMESHGUI_HomardUtils.cxx + SMESHGUI_HomardAdaptDlg.cxx + SMESHGUI_HomardBoundaryDlg.cxx + SMESHGUI_HomardListGroup.cxx ) # sources / to compile @@ -280,6 +288,9 @@ SET(_ts_RESOURCES SMESH_msg_en.ts SMESH_msg_fr.ts SMESH_msg_ja.ts + SMESHGUI_Homard_msg_en.ts + SMESHGUI_Homard_msg_fr.ts + SMESHGUI_Homard_msg_ja.ts ) # --- rules --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index d7b4ed744..3bcce1287 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -61,6 +61,7 @@ #include "SMESHGUI_Hypotheses.h" #include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_MG_ADAPTDRIVER.h" +#include "SMESHGUI_HomardAdaptDlg.h" #include "SMESHGUI_Make2DFrom3DOp.h" #include "SMESHGUI_MakeNodeAtPointDlg.h" #include "SMESHGUI_Measurements.h" @@ -145,6 +146,7 @@ #include CORBA_CLIENT_HEADER(SMESH_MeshEditor) #include CORBA_CLIENT_HEADER(SMESH_Measurements) #include CORBA_CLIENT_HEADER(SMESH_Mesh) +#include CORBA_CLIENT_HEADER(SMESH_Homard) // Qt includes // #define INCLUDE_MENUITEM_DEF // VSR commented ???????? @@ -3028,6 +3030,27 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) break; } #endif + case SMESHOp::OpHomardAdapt: + { + if ( isStudyLocked() ) + break; + EmitSignalDeactivateDialog(); + + SALOME::GenericObj_wrap< SMESHHOMARD::HOMARD_Gen > homardGen; + try { + homardGen = GetSMESHGen()->CreateHOMARD_ADAPT(); + } + catch ( const SALOME::SALOME_Exception& S_ex ) { + SUIT_MessageBox::critical(SMESHGUI::desktop(), + QObject::tr("SMESH_ERROR"), + QObject::tr(S_ex.details.text.in())); + } + if (!homardGen->_is_nil()) { + SMESHGUI_HomardAdaptDlg *aDlg = new SMESHGUI_HomardAdaptDlg(homardGen); + aDlg->show(); + } + break; + } // Adaptation - end case SMESHOp::OpSplitBiQuadratic: case SMESHOp::OpConvertMeshToQuadratic: @@ -4266,6 +4289,7 @@ void SMESHGUI::initialize( CAM_Application* app ) #ifndef DISABLE_MG_ADAPT createSMESHAction( SMESHOp::OpMGAdapt, "MG_ADAPT", "ICON_MG_ADAPT" ); #endif + createSMESHAction( SMESHOp::OpHomardAdapt, "HOMARD_ADAPT", "ICON_HOMARD_ADAPT" ); // Adaptation - end createSMESHAction( SMESHOp::OpMinimumDistance, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" ); @@ -4486,6 +4510,7 @@ void SMESHGUI::initialize( CAM_Application* app ) #ifndef DISABLE_MG_ADAPT createMenu( SMESHOp::OpMGAdapt, adaptId, -1 ); #endif + createMenu( SMESHOp::OpHomardAdapt, adaptId, -1 ); // Adaptation - end createMenu( SMESHOp::OpMinimumDistance, measureId, -1 ); @@ -4636,6 +4661,7 @@ void SMESHGUI::initialize( CAM_Application* app ) int adaptTb = createTool( tr( "TB_ADAPTATION" ), QString( "SMESHAdaptationToolbar" ) ) ; createTool( SMESHOp::OpMGAdapt, adaptTb ); #endif + createTool( SMESHOp::OpHomardAdapt, adaptTb ); // Adaptation - end int measuremTb = createTool( tr( "TB_MEASUREM" ), QString( "SMESHMeasurementsToolbar" ) ) ; @@ -4719,11 +4745,12 @@ void SMESHGUI::initialize( CAM_Application* app ) createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh_group, "&& selcount=1 && dim>=2"); // Adaptation - begin -#ifndef DISABLE_MG_ADAPT popupMgr()->insert( separator(), -1, 0 ); +#ifndef DISABLE_MG_ADAPT createPopupItem( SMESHOp::OpMGAdapt, OB, mesh ); - popupMgr()->insert( separator(), -1, 0 ); #endif + createPopupItem( SMESHOp::OpHomardAdapt, OB, mesh ); + popupMgr()->insert( separator(), -1, 0 ); // Adaptation - end QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc ); diff --git a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx new file mode 100644 index 000000000..4e25a0ac1 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.cxx @@ -0,0 +1,1213 @@ +// Copyright (C) 2011-2021 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 "SMESHGUI_HomardAdaptDlg.h" + +#include "SMESHGUI.h" +#include "SMESHGUI_HomardBoundaryDlg.h" +#include "SMESHGUI_HomardUtils.h" +#include "SMESHGUI_Utils.h" +#include "SMESHGUI_VTKUtils.h" +#include "SMESHGUI_MeshUtils.h" +#include "SMESH_TryCatch.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#ifdef WIN32 +#include +#endif + +using namespace std; + +// La gestion des repertoires +#ifndef CHDIR + #ifdef WIN32 + #define CHDIR _chdir + #else + #define CHDIR chdir + #endif +#endif + +const int SPACING = 6; // layout spacing +const int MARGIN = 9; // layout margin + +//================================================================================ +/*! + * \brief Constructor + */ +//================================================================================ +SMESHGUI_HomardAdaptDlg::SMESHGUI_HomardAdaptDlg(SMESHHOMARD::HOMARD_Gen_ptr myHomardGen0) + : QDialog(SMESHGUI::desktop()) +{ + MESSAGE("Debut du constructeur de SMESHGUI_HomardAdaptDlg"); + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + //myHomardGen = SMESHGUI::GetSMESHGen()->CreateHOMARD_ADAPT(); + myHomardGen->Register(); + + setModal(false); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle( tr( "ADAPT_WITH_HOMARD" ) ); + setSizeGripEnabled( true ); + + QTabWidget* myTabWidget = new QTabWidget( this ); + + // Arguments + myArgs = new SMESHGUI_HomardAdaptArguments(myTabWidget); + + // Advanced options + myAdvOpt = new SMESHGUI_HomardAdaptAdvanced(myTabWidget); + + myTabWidget->addTab( myArgs, tr( "Args" ) ); + myTabWidget->addTab( myAdvOpt, tr( "ADVOP" ) ); + + myAdvOpt->logGroupBox ->setTitle(tr( "LOG_GROUP_TITLE" )); + myAdvOpt->workingDirectoryLabel ->setText (tr( "WORKING_DIR" )); + myAdvOpt->workingDirectoryPushButton->setText (tr( "SELECT_DIR" )); + myAdvOpt->verboseLevelLabel ->setText (tr( "VERBOSE_LEVEL" )); + myAdvOpt->logInFileCheck ->setText (tr( "LOG_IN_FILE" )); + myAdvOpt->removeLogOnSuccessCheck ->setText (tr( "REMOVE_LOG_ON_SUCCESS" )); + myAdvOpt->keepWorkingFilesCheck ->setText (tr( "KEEP_WORKING_FILES" )); + + //myAdvOpt->logInFileCheck->setChecked(true); + //myAdvOpt->removeLogOnSuccessCheck->setChecked(false); + + // Working directory + QString aWorkingDir = QDir::tempPath(); + char *aTmp_dir = getenv("SALOME_TMP_DIR"); + if (aTmp_dir != NULL) { + QDir aTmpDir (aTmp_dir); + if (aTmpDir.exists()) { + aWorkingDir = aTmpDir.absolutePath(); + } + } + myAdvOpt->workingDirectoryLineEdit->setText(aWorkingDir); + + // Out med file and/or mesh publication + myArgs->myOutMedFileChk->setChecked(true); + myArgs->myOutPublishChk->setChecked(true); + + // buttons + QHBoxLayout* btnLayout = new QHBoxLayout; + btnLayout->setSpacing( 6 ); + btnLayout->setMargin( 0 ); + + buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), this); + buttonOk->setAutoDefault(false); + btnLayout->addWidget(buttonOk); + btnLayout->addStretch( 10 ); + + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), this); + buttonApply->setAutoDefault(false); + btnLayout->addWidget(buttonApply); + btnLayout->addStretch( 10 ); + + buttonCancel = new QPushButton(tr( "SMESH_BUT_CANCEL" ), this); + buttonCancel->setAutoDefault(false); + btnLayout->addWidget(buttonCancel); + btnLayout->addStretch( 10 ); + + buttonHelp = new QPushButton(tr( "SMESH_BUT_HELP" ), this); + buttonHelp->setAutoDefault(false); + btnLayout->addWidget(buttonHelp); + + // dialog layout + QVBoxLayout* l = new QVBoxLayout ( this ); + l->setMargin( 9 ); + l->setSpacing( 6 ); + l->addWidget( myTabWidget ); + l->addStretch(); + l->addLayout( btnLayout ); + + // dialog name and size + resize(600, 1000); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth()); + setSizePolicy(sizePolicy); + setMinimumSize(QSize(500, 320)); + setSizeIncrement(QSize(1, 1)); + setBaseSize(QSize(600, 600)); + setAutoFillBackground(true); + + SetBoundaryNo(); + InitConnect(); + + myArgs->GBBoundaryC->setVisible(0); + myArgs->GBBoundaryN->setVisible(0); + myArgs->GBBoundaryA->setVisible(0); + myArgs->GBBoundaryD->setVisible(0); + + adjustSize(); + + //MESSAGE("Fin du constructeur de SMESHGUI_HomardAdaptDlg"); +} + +//================================================================================= +// function : ~SMESHGUI_HomardAdaptDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +SMESHGUI_HomardAdaptDlg::~SMESHGUI_HomardAdaptDlg() +{ + // no need to delete child widgets, Qt does it all for us + myHomardGen->DeleteCase(); +} + +//================================================================================= +// function : InitConnect +// purpose : +//================================================================================= +void SMESHGUI_HomardAdaptDlg::InitConnect() +{ + connect( myArgs->mySelectInMedFileButton, SIGNAL(pressed()), this, SLOT(SetFileName())); + + connect( myArgs->RBBoundaryNo, SIGNAL(clicked()), this, SLOT(SetBoundaryNo())); + connect( myArgs->RBBoundaryCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryCAO())); + connect( myArgs->RBBoundaryNonCAO, SIGNAL(clicked()), this, SLOT(SetBoundaryNonCAO())); + + connect( myArgs->PBBoundaryCAONew, SIGNAL(pressed()), this, SLOT(PushBoundaryCAONew())); + connect( myArgs->PBBoundaryCAOEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOEdit()) ); + connect( myArgs->PBBoundaryCAOHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryCAOHelp()) ); + connect( myArgs->CBBoundaryD, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryD())); + connect( myArgs->PBBoundaryDiNew, SIGNAL(pressed()), this, SLOT(PushBoundaryDiNew())); + connect( myArgs->PBBoundaryDiEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryDiEdit()) ); + connect( myArgs->PBBoundaryDiHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryDiHelp()) ); + connect( myArgs->CBBoundaryA, SIGNAL(stateChanged(int)), this, SLOT(SetBoundaryA())); + connect( myArgs->PBBoundaryAnNew, SIGNAL(pressed()), this, SLOT(PushBoundaryAnNew())); + connect( myArgs->PBBoundaryAnEdit, SIGNAL(pressed()), this, SLOT(PushBoundaryAnEdit()) ); + connect( myArgs->PBBoundaryAnHelp, SIGNAL(pressed()), this, SLOT(PushBoundaryAnHelp()) ); + + 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(myArgs, SIGNAL(updateSelection()), this, SLOT(updateSelection())); +} + +//================================================================================= +// function : InitBoundarys +// purpose : Initialisation des menus avec les frontieres deja enregistrees +//================================================================================= +void SMESHGUI_HomardAdaptDlg::InitBoundarys() +{ + MESSAGE("InitBoundarys"); + //myArgs->TWBoundary->clearContents(); + //myArgs->TWBoundary->clear(); + // Pour les frontieres analytiques : la colonne des groupes + SMESHHOMARD::ListGroupType_var _listeGroupesCas = myCase->GetGroups(); + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem->setText(tr("")); + myArgs->TWBoundary->setHorizontalHeaderItem(0, __colItem); + for ( int i = 0; i < (int)_listeGroupesCas->length(); i++ ) { + myArgs->TWBoundary->insertRow(i); + myArgs->TWBoundary->setItem( i, 0, new QTableWidgetItem(QString((_listeGroupesCas)[i]).trimmed())); + myArgs->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 + SMESHHOMARD::HOMARD_Boundary_var myBoundary ; + SMESHHOMARD::listeBoundarys_var mesBoundarys = myHomardGen->GetAllBoundarysName(); + //MESSAGE("Nombre de frontieres enregistrees : "<length()); + for (int i=0; i < (int)mesBoundarys->length(); i++) { + myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]); + int type_obj = myBoundary->GetType() ; + if ( type_obj==-1 ) { myArgs->CBBoundaryCAO->addItem(QString(mesBoundarys[i])); } + else if ( type_obj==0 ) { myArgs->CBBoundaryDi->addItem(QString(mesBoundarys[i])); } + else { AddBoundaryAn(QString(mesBoundarys[i])); } + } + // Ajustement + myArgs->TWBoundary->resizeColumnsToContents(); + myArgs->TWBoundary->resizeRowsToContents(); + myArgs->TWBoundary->clearSelection(); +} + +//================================================================================= +// function : CheckCase +// purpose : +//================================================================================= +bool SMESHGUI_HomardAdaptDlg::CheckCase(bool fixCase) +{ + MESSAGE("CheckCase"); + + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + if (aWorkingDir == QString("")) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_1") ); + return false; + } + + if (CHDIR(aWorkingDir.toStdString().c_str()) != 0) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_DIRECTORY_3") ); + return false; + } + + QString aMeshName, aFileName; + if (myArgs->myInMedFileRadio->isChecked()) { + aFileName = myArgs->mySelectInMedFileLineEdit->text().trimmed(); + if (aFileName == QString("")) { + QMessageBox::critical(0, QObject::tr("HOM_ERROR"), QObject::tr("HOM_CASE_MESH")); + return false; + } + + // In mesh name + aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(aFileName); + if (aMeshName == "") { + QMessageBox::critical(0, QObject::tr("HOM_ERROR"), QObject::tr("HOM_MED_FILE_2")); + return false; + } + } + else { + aMeshName = myArgs->myInBrowserObject->text(); + if (aMeshName == "" || myMesh->_is_nil()) { + QMessageBox::critical(0, QObject::tr("HOM_ERROR"), + QObject::tr("Mesh object is not selected")); + return false; + } + } + + // On verifie qu'un groupe n'est pas associe a deux frontieres differentes + if (myArgs->CBBoundaryA->isChecked()) { + QStringList ListeGroup; + QString NomGroup; + int nbcol = myArgs->TWBoundary->columnCount(); + int nbrow = myArgs->TWBoundary->rowCount(); + for ( int col=1; col< nbcol; col++) { + for ( int row=0; row< nbrow; row++) { + if ( myArgs->TWBoundary->item( row, col )->checkState() == Qt::Checked ) { + // Group name + NomGroup = QString(myArgs->TWBoundary->item(row, 0)->text()) ; + for ( int nugr = 0 ; nugr < ListeGroup.size(); nugr++) { + if ( NomGroup == ListeGroup[nugr] ) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_CASE_GROUP").arg(NomGroup) ); + return false; + } + } + ListeGroup.insert(0, NomGroup ); + } + } + } + } + + if (!fixCase) return true; + + // Creation du cas + if (myCase->_is_nil()) { + try { + if (myArgs->myInMedFileRadio->isChecked()) { + // create case from MED file + myCase = myHomardGen->CreateCase + (CORBA::string_dup(aMeshName.toStdString().c_str()), + CORBA::string_dup(aFileName.toStdString().c_str()), + aWorkingDir.toStdString().c_str()); + } + else { + // create case from SMESH_Mesh + myCase = myHomardGen->CreateCaseOnMesh + (CORBA::string_dup(aMeshName.toStdString().c_str()), + myMesh, + aWorkingDir.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; + } + // Prevent changing case data + myArgs->myInMedFileRadio->setEnabled(false); + myArgs->myInBrowserRadio->setEnabled(false); + myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + myArgs->mySelectInMedFileButton->setEnabled(false); + myArgs->myInBrowserObject->setReadOnly(true); + myAdvOpt->workingDirectoryLineEdit->setReadOnly(true); + myAdvOpt->workingDirectoryPushButton->setEnabled(false); + InitBoundarys(); + } + + // Menage des eventuelles frontieres deja enregistrees + myCase->SupprBoundaryGroup(); + + return true; +} + +//================================================================================= +// function : PushOnApply +// purpose : +//================================================================================= +bool SMESHGUI_HomardAdaptDlg::PushOnApply() +{ + MESSAGE("PushOnApply"); + + // Check data, create Case if not yet + if (!CheckCase(true)) + return false; + + // Create boundaries + if (myArgs->RBBoundaryCAO->isChecked()) { + QString monBoundaryCAOName = myArgs->CBBoundaryCAO->currentText(); + if (monBoundaryCAOName != "" ) { + myCase->AddBoundary(monBoundaryCAOName.toStdString().c_str()); + } + } + if (myArgs->CBBoundaryD->isChecked()) { + QString monBoundaryDiName = myArgs->CBBoundaryDi->currentText(); + if (monBoundaryDiName != "" ) { + myCase->AddBoundary(monBoundaryDiName.toStdString().c_str()); + } + } + if (myArgs->CBBoundaryA->isChecked()) { + QString NomGroup; + int nbcol = myArgs->TWBoundary->columnCount(); + int nbrow = myArgs->TWBoundary->rowCount(); + for ( int col = 1; col < nbcol; col++) { + for ( int row = 0; row < nbrow; row++) { + if ( myArgs->TWBoundary->item( row, col )->checkState() == Qt::Checked ) { + // Nom du groupe + NomGroup = QString(myArgs->TWBoundary->item(row, 0)->text()) ; + // Nom de la frontiere + QTableWidgetItem *__colItem = myArgs->TWBoundary->horizontalHeaderItem(col); + myCase->AddBoundaryGroup(QString(__colItem->text()).toStdString().c_str(), + NomGroup.toStdString().c_str()); + } + } + } + } + + // Output MED and MESH parameters + myHomardGen->SetKeepMedOUT(myArgs->myOutMedFileChk->isChecked()); + myHomardGen->SetPublishMeshOUT(myArgs->myOutPublishChk->isChecked()); + QString anOutMeshName = myArgs->myOutMeshNameLineEdit->text(); + if (anOutMeshName.isEmpty()) anOutMeshName = "DEFAULT_MESH_NAME"; + myHomardGen->SetMeshNameOUT(anOutMeshName.toStdString().c_str()); + + std::string aMeshFileOUT; + if (myArgs->myOutMedFileChk->isChecked()) { + QString anOutMed = myArgs->mySelectOutMedFileLineEdit->text(); + if (anOutMed.isEmpty()) { + // store in working directory and with default name + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + QFileInfo aFileInfo (QDir(aWorkingDir), "Uniform_R.med"); + anOutMed = aFileInfo.absoluteFilePath(); + // show it + myArgs->mySelectOutMedFileLineEdit->setText(anOutMed); + } + else { + QFileInfo aFileInfo (anOutMed); + anOutMed = aFileInfo.absoluteFilePath(); + } + aMeshFileOUT = anOutMed.toStdString(); + } + else { + // Set file name without path for it to be created in current directory + // (it will be iteration's dir, and it will be destroyed after) + aMeshFileOUT = "Uniform_R.med"; + } + myHomardGen->SetMeshFileOUT(aMeshFileOUT.c_str()); + + // Conformity type + myHomardGen->SetConfType(myArgs->RBConforme->isChecked() ? 0 : 1); + + // Advanced options + myHomardGen->SetVerboseLevel(myAdvOpt->verboseLevelSpin->value()); + myHomardGen->SetKeepWorkingFiles(myAdvOpt->keepWorkingFilesCheck->isChecked()); + myHomardGen->SetLogInFile(myAdvOpt->logInFileCheck->isChecked()); + myHomardGen->SetRemoveLogOnSuccess(myAdvOpt->removeLogOnSuccessCheck->isChecked()); + + // Log file + if (myAdvOpt->logInFileCheck->isChecked()) { + // Write log file in the working dir + QString aLogBaseName; + if (myArgs->myInMedFileRadio->isChecked()) { + // Name of log file will be "_Uniform_R.log" + QString aMedFileIn = myArgs->mySelectInMedFileLineEdit->text().trimmed(); + QFileInfo aFileInfoIn (aMedFileIn); + aLogBaseName = aFileInfoIn.fileName(); + } + else { + // Name of log file will be "SMESH_Mesh__Uniform_R.log" + aLogBaseName = "SMESH_Mesh_"; + aLogBaseName += myArgs->myInBrowserObject->text(); + } + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + QFileInfo aFileInfo (QDir(aWorkingDir), aLogBaseName + "_Uniform_R.log"); + QString anOutLog = aFileInfo.absoluteFilePath(); + MESSAGE("myHomardGen->SetLogFile(" << anOutLog.toStdString().c_str() << ")"); + myHomardGen->SetLogFile(anOutLog.toStdString().c_str()); + } + + // Compute and publish + bool isSuccess = true; + try { + SUIT_OverrideCursor aWaitCursor; + isSuccess = myHomardGen->Compute() == 0; + } + catch( SALOME::SALOME_Exception& S_ex ) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + isSuccess = false; + } + + // Update Object Browser + if (isSuccess) { + SMESHGUI::GetSMESHGUI()->updateObjBrowser(); + + // Clean case, as it is deleted after successful Compute + myCase = SMESHHOMARD::HOMARD_Cas::_nil(); + } + + // Enable new case data selection + myArgs->myInMedFileRadio->setEnabled(true); + myArgs->myInBrowserRadio->setEnabled(true); + myArgs->mySelectInMedFileLineEdit->setReadOnly(false); + myArgs->mySelectInMedFileButton->setEnabled(true); + myArgs->myInBrowserObject->setReadOnly(false); + myAdvOpt->workingDirectoryLineEdit->setReadOnly(false); + myAdvOpt->workingDirectoryPushButton->setEnabled(true); + + return isSuccess; +} + +//================================================================================= +// function : PushOnOK +// purpose : +//================================================================================= +void SMESHGUI_HomardAdaptDlg::PushOnOK() +{ + bool bOK = PushOnApply(); + if ( bOK ) this->close(); +} + +void SMESHGUI_HomardAdaptDlg::PushOnHelp() +{ + SMESH::ShowHelpFile("adaptation.html#_homard_adapt_anchor"); +} + +void SMESHGUI_HomardAdaptDlg::updateSelection() +{ + LightApp_SelectionMgr *selMgr = SMESHGUI::selectionMgr(); + disconnect(selMgr, 0, this, 0); + selMgr->clearFilters(); + + if (!myArgs->myInBrowserRadio->isChecked()) + return; + + SMESH::SetPointRepresentation(false); + if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow()) + aViewWindow->SetSelectionMode(ActorSelection); + if (myArgs->myInBrowserRadio->isChecked()) { + connect(selMgr, SIGNAL(currentSelectionChanged()), this, SLOT(selectionChanged())); + selectionChanged(); + } +} + +void SMESHGUI_HomardAdaptDlg::selectionChanged() +{ + if (!myArgs->myInBrowserRadio->isChecked()) + return; + + //SUIT_OverrideCursor aWaitCursor; + LightApp_SelectionMgr *selMgr = SMESHGUI::selectionMgr(); + + // get selected mesh + SALOME_ListIO aList; + selMgr->selectedObjects(aList); + QString aMeshName = ""; + + if (aList.Extent() == 1) { + Handle(SALOME_InteractiveObject) IO = aList.First(); + myMesh = SMESH::GetMeshByIO(IO); + SMESH::GetNameOfSelectedIObjects(selMgr, aMeshName); + if (aMeshName.isEmpty()) aMeshName = " "; + else aMeshName = aMeshName.trimmed(); + } + else { + myMesh = SMESH::SMESH_Mesh::_nil(); + } + + myArgs->myInBrowserObject->setText(aMeshName); + + // Out mesh name default value + myArgs->myOutMeshNameLineEdit->setText(aMeshName + "_Uniform_R"); + + // Output med file default value + // Construct it from Input mesh name and working directory + //if (myArgs->myOutMedFileChk->isChecked()) { + if (aMeshName.isEmpty()) { + myArgs->mySelectOutMedFileLineEdit->setText(""); + } + else { + QString aWorkingDir = myAdvOpt->workingDirectoryLineEdit->text().trimmed(); + QFileInfo aFileInfo (QDir(aWorkingDir), aMeshName + QString("_Uniform_R.med")); + for (int ii = 1; aFileInfo.exists(); ii++) { + QString anUniqueName = QString("%1_Uniform_R_%2.med").arg(aMeshName).arg(ii); + aFileInfo.setFile(QDir(aWorkingDir), anUniqueName); + } + myArgs->mySelectOutMedFileLineEdit->setText(aFileInfo.absoluteFilePath()); + } + //} + + // Check data + if (!aMeshName.isEmpty()) + CheckCase(false); +} + +void SMESHGUI_HomardAdaptDlg::SetFileName() +{ + // Input med file + QString fileName0 = myArgs->mySelectInMedFileLineEdit->text().trimmed(); + QString fileName = SMESH_HOMARD_QT_COMMUN::PushNomFichier(false, QString("med")); + //SUIT_OverrideCursor aWaitCursor; + if (fileName.isEmpty()) { + fileName = fileName0; + if (fileName.isEmpty()) return; + } + QFileInfo aFileInInfo (fileName); + fileName = aFileInInfo.absoluteFilePath(); + myArgs->mySelectInMedFileLineEdit->setText(fileName); + + // Out mesh name default value + QString aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(fileName); + myArgs->myOutMeshNameLineEdit->setText(aMeshName + "_Uniform_R"); + + // Output med file default value + // Construct it from Input med file name and path + //if (myArgs->myOutMedFileChk->isChecked()) { + std::string fname = fileName.toStdString(); + size_t lastdot = fname.find_last_of("."); + if (lastdot != std::string::npos) + fname = fname.substr(0, lastdot); + QString fileNameOut = fname.c_str(); + QFileInfo aFileInfo (fileNameOut + QString("_Uniform_R.med")); + for (int ii = 1; aFileInfo.exists(); ii++) { + QString anUniqueName = QString("%1_Uniform_R_%2.med").arg(fileNameOut).arg(ii); + aFileInfo.setFile(anUniqueName); + } + myArgs->mySelectOutMedFileLineEdit->setText(aFileInfo.absoluteFilePath()); + //} + + // Check data + CheckCase(false); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryNo() +{ + myArgs->GBBoundaryC->setVisible(0); + myArgs->GBBoundaryN->setVisible(0); + adjustSize(); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryCAO() +{ + if (CheckCase(true)) { + myArgs->GBBoundaryC->setVisible(1); + myArgs->GBBoundaryN->setVisible(0); + resize(600, 550); + //adjustSize(); + } + else { + myArgs->RBBoundaryNo->click(); + } +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryNonCAO() +{ + myArgs->GBBoundaryC->setVisible(0); + myArgs->GBBoundaryN->setVisible(1); + int aH = 550; + if (myArgs->GBBoundaryD->isVisible()) aH += 50; + if (myArgs->GBBoundaryA->isVisible()) aH += 150; + resize(600, aH); + //adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::AddBoundaryCAO(QString newBoundary) +// ------------------------------------------------------------------------ +{ + myArgs->CBBoundaryCAO->insertItem(0,newBoundary); + myArgs->CBBoundaryCAO->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryCAONew() +// ------------------------------------------------------------------------ +{ + SMESH_CreateBoundaryCAO *BoundaryDlg = new SMESH_CreateBoundaryCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), "Case_1", ""); + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryCAOEdit() +// ------------------------------------------------------------------------ +{ + if (myArgs->CBBoundaryCAO->currentText() == QString("")) return; + SMESH_EditBoundaryCAO *BoundaryDlg = new SMESH_EditBoundaryCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", myArgs->CBBoundaryCAO->currentText()); + BoundaryDlg->show(); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryCAOHelp() +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#cao-boundary")); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryD() +{ + MESSAGE("Debut de SetBoundaryD "); + if (myArgs->CBBoundaryD->isChecked()) { + bool bOK = CheckCase(true); + if (bOK) { + myArgs->GBBoundaryD->setVisible(1); + } + else { + myArgs->GBBoundaryD->setVisible(0); + myArgs->CBBoundaryD->setChecked(0); + myArgs->CBBoundaryD->setCheckState(Qt::Unchecked); + } + } + else { + myArgs->GBBoundaryD->setVisible(0); + } + + //myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + //myArgs->mySelectInMedFileButton->hide(); + + int aH = 550; + if (myArgs->GBBoundaryD->isVisible()) aH += 50; + if (myArgs->GBBoundaryA->isVisible()) aH += 150; + resize(600, aH); + //adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::AddBoundaryDi(QString newBoundary) +// ------------------------------------------------------------------------ +{ + myArgs->CBBoundaryDi->insertItem(0,newBoundary); + myArgs->CBBoundaryDi->setCurrentIndex(0); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryDiNew() +// ------------------------------------------------------------------------ +{ + SMESH_CreateBoundaryDi *BoundaryDlg = new SMESH_CreateBoundaryDi(this, true, + SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), "Case_1", ""); + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryDiEdit() +// ------------------------------------------------------------------------ +{ + if (myArgs->CBBoundaryDi->currentText() == QString("")) return; + SMESH_EditBoundaryDi *BoundaryDlg = new SMESH_EditBoundaryDi + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", myArgs->CBBoundaryDi->currentText()); + BoundaryDlg->show(); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryDiHelp() +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#discrete-boundary")); +} + +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::SetBoundaryA() +{ + MESSAGE("Debut de SetBoundaryA "); + if (myArgs->CBBoundaryA->isChecked()) { + bool bOK = CheckCase(true); + if (bOK) { + myArgs->GBBoundaryA->setVisible(1); + } + else { + myArgs->GBBoundaryA->setVisible(0); + myArgs->CBBoundaryA->setChecked(0); + myArgs->CBBoundaryA->setCheckState(Qt::Unchecked); + } + } + else { + myArgs->GBBoundaryA->setVisible(0); + } + + //myArgs->mySelectInMedFileLineEdit->setReadOnly(true); + //myArgs->mySelectInMedFileButton->hide(); + + int aH = 550; + if (myArgs->GBBoundaryD->isVisible()) aH += 50; + if (myArgs->GBBoundaryA->isVisible()) aH += 150; + resize(600, aH); + //adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::AddBoundaryAn(QString newBoundary) +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de AddBoundaryAn "); +// Ajout d'une nouvelle colonne + int nbcol = myArgs->TWBoundary->columnCount(); +// MESSAGE("nbcol " << nbcol); + nbcol += 1 ; + myArgs->TWBoundary->setColumnCount ( nbcol ) ; + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem->setText(tr(newBoundary.toStdString().c_str())); + myArgs->TWBoundary->setHorizontalHeaderItem(nbcol-1, __colItem); +/* TWBoundary->horizontalHeaderItem(nbcol-1)->setFlags( Qt::ItemIsSelectable|Qt::ItemIsEnabled );*/ +// Chaque case est a cocher + int nbrow = myArgs->TWBoundary->rowCount(); +// MESSAGE("nbrow " << nbrow); + for ( int i = 0; i < nbrow; i++ ) + { + myArgs->TWBoundary->setItem( i, nbcol-1, new QTableWidgetItem( QString ("") ) ); + myArgs->TWBoundary->item( i, nbcol-1 )->setFlags( 0 ); + myArgs->TWBoundary->item( i, nbcol-1 )->setFlags( Qt::ItemIsUserCheckable|Qt::ItemIsEnabled ); + myArgs->TWBoundary->item( i, nbcol-1 )->setCheckState( Qt::Unchecked ); + } + myArgs->TWBoundary->resizeColumnToContents(nbcol-1); +// TWBoundary->resizeRowsToContents(); +// MESSAGE("Fin de AddBoundaryAn "); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryAnNew() +// ------------------------------------------------------------------------ +{ + SMESH_CreateBoundaryAn *BoundaryDlg = new SMESH_CreateBoundaryAn + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), "Case_1"); + BoundaryDlg->show(); +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryAnEdit() +// ------------------------------------------------------------------------ +{ + QString nom=""; + int nbcol = myArgs->TWBoundary->columnCount(); + for ( int i = 1; i < nbcol; i++ ) { + QTableWidgetItem *__colItem = new QTableWidgetItem(); + __colItem = myArgs->TWBoundary->horizontalHeaderItem(i); + nom = QString(__colItem->text()) ; + MESSAGE("nom "<show(); + } + } +} +// ------------------------------------------------------------------------ +void SMESHGUI_HomardAdaptDlg::PushBoundaryAnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#analytical-boundary")); +} + +//================================================================================= +// function : SMESHGUI_HomardAdaptArguments() +// purpose : +//================================================================================= +SMESHGUI_HomardAdaptArguments::SMESHGUI_HomardAdaptArguments(QWidget* parent) + : QWidget(parent) +{ + setupUi(); +} + +SMESHGUI_HomardAdaptArguments::~SMESHGUI_HomardAdaptArguments() +{ +} + +void SMESHGUI_HomardAdaptArguments::setupUi() +{ + // Mesh in + QGroupBox* aMeshIn = new QGroupBox( tr( "MeshIn" ), this ); + myInMedFileRadio = new QRadioButton( tr( "MEDFile" ), aMeshIn ); + myInBrowserRadio = new QRadioButton( tr( "Browser" ), aMeshIn ); + myInBrowserObject = new QLineEdit( aMeshIn ); + mySelectInMedFileButton = new QPushButton("...", aMeshIn); + mySelectInMedFileLineEdit = new QLineEdit( aMeshIn ); + + QGridLayout* meshIn = new QGridLayout( aMeshIn ); + + meshIn->setMargin( 9 ); + meshIn->setSpacing( 6 ); + meshIn->addWidget( myInMedFileRadio, 0, 0, 1, 1 ); + meshIn->addWidget( myInBrowserRadio, 0, 1, 1, 1 ); + meshIn->addWidget( mySelectInMedFileButton, 1, 0, 1, 1 ); + meshIn->addWidget( mySelectInMedFileLineEdit, 1, 1, 1, 2 ); + meshIn->addWidget( myInBrowserObject, 0, 2, 1, 1 ); + + myInMeshGroup = new QButtonGroup( this ); + myInMeshGroup->addButton( myInMedFileRadio, 0 ); + myInMeshGroup->addButton( myInBrowserRadio, 1 ); + + // Mesh out + QGroupBox* aMeshOut = new QGroupBox( tr( "MeshOut" ), this ); + QLabel* meshName = new QLabel(tr("MeshName"), aMeshOut); + QSpacerItem* secondHspacer = new QSpacerItem(100, 30); + myOutMeshNameLineEdit = new QLineEdit(aMeshOut); + myOutMedFileChk = new QCheckBox(tr("MEDFile"), aMeshOut); + mySelectOutMedFileButton = new QPushButton("...", aMeshOut); + mySelectOutMedFileLineEdit = new QLineEdit(aMeshOut); + myOutPublishChk = new QCheckBox(tr("Publish_MG_ADAPT"), aMeshOut); + + QGridLayout* meshOut = new QGridLayout( aMeshOut ); + + meshOut->setMargin( 9 ); + meshOut->setSpacing( 6 ); + meshOut->addWidget( meshName, 0, 0, 1,1 ); + meshOut->addItem( secondHspacer, 0, 1, 1, 1 ); + meshOut->addWidget( myOutMeshNameLineEdit, 0, 2,1,1); + meshOut->addWidget( myOutMedFileChk, 1, 0,1,1 ); + meshOut->addWidget( mySelectOutMedFileButton, 1, 1,1,1 ); + meshOut->addWidget( mySelectOutMedFileLineEdit, 1, 2,1,1); + meshOut->addWidget( myOutPublishChk, 2, 0,1,1 ); + + // Conformity type + QGroupBox *GBTypeConf = new QGroupBox(tr("Conformity type"), this); + RBConforme = new QRadioButton(tr("Conformal"), GBTypeConf); + RBNonConforme = new QRadioButton(tr("Non conformal"), GBTypeConf); + RBConforme->setChecked(true); + + QHBoxLayout *hboxLayout2 = new QHBoxLayout(GBTypeConf); + hboxLayout2->setSpacing(6); + hboxLayout2->setContentsMargins(9, 9, 9, 9); + hboxLayout2->addWidget(RBConforme); + hboxLayout2->addWidget(RBNonConforme); + + // Boundary type + GBTypeBoun = new QGroupBox(tr("Boundary type"), this); + + RBBoundaryNo = new QRadioButton(tr("No boundary"), GBTypeBoun); + RBBoundaryCAO = new QRadioButton(tr("CAO"), GBTypeBoun); + RBBoundaryNonCAO = new QRadioButton(tr("Non CAO"), GBTypeBoun); + RBBoundaryNo->setChecked(true); + + // CAO + GBBoundaryC = new QGroupBox(tr("CAO"), GBTypeBoun); + /* + QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(GBBoundaryC->sizePolicy().hasHeightForWidth()); + GBBoundaryC->setSizePolicy(sizePolicy1); + */ + GBBoundaryC->setMinimumSize(QSize(450, 50)); + + CBBoundaryCAO = new QComboBox(GBBoundaryC); + CBBoundaryCAO->setSizeAdjustPolicy(QComboBox::AdjustToContents); + + PBBoundaryCAONew = new QPushButton(tr("New"), GBBoundaryC); + PBBoundaryCAOEdit = new QPushButton(tr("Edit"), GBBoundaryC); + PBBoundaryCAOHelp = new QPushButton(tr("Help"), GBBoundaryC); + + PBBoundaryCAONew->setAutoDefault(false); + PBBoundaryCAOEdit->setAutoDefault(false); + PBBoundaryCAOHelp->setAutoDefault(false); + + QGridLayout* gridLayout2 = new QGridLayout(GBBoundaryC); + gridLayout2->setSpacing(6); + gridLayout2->setContentsMargins(9, 9, 9, 9); + gridLayout2->addWidget(CBBoundaryCAO, 0, 0, 1, 1); + QSpacerItem* spacerItem3 = new QSpacerItem(40, 13, QSizePolicy::Fixed, QSizePolicy::Minimum); + gridLayout2->addItem(spacerItem3, 0, 1, 1, 1); + gridLayout2->addWidget(PBBoundaryCAONew, 0, 2, 1, 1); + gridLayout2->addWidget(PBBoundaryCAOEdit, 0, 3, 1, 1); + gridLayout2->addWidget(PBBoundaryCAOHelp, 0, 4, 1, 1); + gridLayout2->setRowMinimumHeight(0, 80); + + // Non CAO (discrete / analytical) + GBBoundaryN = new QGroupBox(tr("Non CAO"), GBTypeBoun); + GBBoundaryN->setMinimumSize(QSize(450, 80)); + + CBBoundaryD = new QCheckBox(tr("Discrete boundary"), GBBoundaryN); + CBBoundaryA = new QCheckBox(tr("Analytical boundary"), GBBoundaryN); + + // discrete + GBBoundaryD = new QGroupBox(tr("Discrete boundary"), GBBoundaryN); + //sizePolicy1.setHeightForWidth(GBBoundaryD->sizePolicy().hasHeightForWidth()); + //GBBoundaryD->setSizePolicy(sizePolicy1); + QGridLayout* gridLayoutD = new QGridLayout(GBBoundaryD); + gridLayoutD->setSpacing(6); + gridLayoutD->setContentsMargins(9, 9, 9, 9); + CBBoundaryDi = new QComboBox(GBBoundaryD); + CBBoundaryDi->setSizeAdjustPolicy(QComboBox::AdjustToContents); + + gridLayoutD->addWidget(CBBoundaryDi, 0, 0, 1, 1); + + QSpacerItem* spacerItem5 = new QSpacerItem(40, 13, QSizePolicy::Fixed, QSizePolicy::Minimum); + gridLayoutD->addItem(spacerItem5, 0, 1, 1, 1); + + PBBoundaryDiNew = new QPushButton(tr("New"), GBBoundaryD); + PBBoundaryDiEdit = new QPushButton(tr("Edit"), GBBoundaryD); + PBBoundaryDiHelp = new QPushButton(tr("Help"), GBBoundaryD); + + PBBoundaryDiNew->setAutoDefault(false); + PBBoundaryDiEdit->setAutoDefault(false); + PBBoundaryDiHelp->setAutoDefault(false); + + gridLayoutD->addWidget(PBBoundaryDiNew, 0, 2, 1, 1); + gridLayoutD->addWidget(PBBoundaryDiEdit, 0, 3, 1, 1); + gridLayoutD->addWidget(PBBoundaryDiHelp, 0, 4, 1, 1); + + // analytical + GBBoundaryA = new QGroupBox(tr("Analytical boundary"), GBBoundaryN); + GBBoundaryA->setMinimumSize(QSize(548, 200)); + formLayout = new QFormLayout(GBBoundaryA); + TWBoundary = new QTableWidget(GBBoundaryA); + if (TWBoundary->columnCount() < 1) + TWBoundary->setColumnCount(1); + QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); + TWBoundary->setHorizontalHeaderItem(0, __qtablewidgetitem); + TWBoundary->setEditTriggers(QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked); + TWBoundary->setShowGrid(true); + TWBoundary->setRowCount(0); + TWBoundary->setColumnCount(1); + + formLayout->setWidget(0, QFormLayout::LabelRole, TWBoundary); + + QGridLayout* gridLayout1 = new QGridLayout(); + gridLayout1->setSpacing(6); + gridLayout1->setContentsMargins(0, 0, 0, 0); + + PBBoundaryAnNew = new QPushButton(tr("New"), GBBoundaryA); + PBBoundaryAnEdit = new QPushButton(tr("Edit"), GBBoundaryA); + PBBoundaryAnHelp = new QPushButton(tr("Help"), GBBoundaryA); + + PBBoundaryAnNew->setAutoDefault(false); + PBBoundaryAnEdit->setAutoDefault(false); + PBBoundaryAnHelp->setAutoDefault(false); + + gridLayout1->addWidget(PBBoundaryAnNew, 0, 0, 1, 1); + gridLayout1->addWidget(PBBoundaryAnEdit, 1, 0, 1, 1); + gridLayout1->addWidget(PBBoundaryAnHelp, 2, 0, 1, 1); + + formLayout->setLayout(0, QFormLayout::FieldRole, gridLayout1); + + // Boundary No Layout + QGridLayout* aBoundaryNoLayout = new QGridLayout(GBBoundaryN); + //aBoundaryNoLayout->addLayout(hboxLayout3, 0, 0); + aBoundaryNoLayout->addWidget(CBBoundaryD, 0, 0); + aBoundaryNoLayout->addWidget(CBBoundaryA, 0, 1); + aBoundaryNoLayout->addWidget(GBBoundaryD, 1, 0, 1, 2); + aBoundaryNoLayout->addWidget(GBBoundaryA, 2, 0, 1, 2); + + // Boundary type Layout + QGridLayout* aBoundTypeLayout = new QGridLayout(GBTypeBoun); + aBoundTypeLayout->addWidget(RBBoundaryNo, 0, 0); + aBoundTypeLayout->addWidget(RBBoundaryCAO, 0, 1); + aBoundTypeLayout->addWidget(RBBoundaryNonCAO, 0, 2); + + aBoundTypeLayout->addWidget(GBBoundaryC, 1, 0, 1, 3); + aBoundTypeLayout->addWidget(GBBoundaryN, 2, 0, 1, 3); + + // Arguments layout + QGridLayout *argumentsLayout = new QGridLayout(this); + argumentsLayout->addWidget(aMeshIn, 0, 0, 1, 3); + argumentsLayout->addWidget(aMeshOut, 1, 0, 1, 3); + argumentsLayout->addWidget(GBTypeConf, 2, 0, 1, 3); + argumentsLayout->addWidget(GBTypeBoun, 3, 0, 1, 3); + argumentsLayout->setColumnStretch( 1, 5 ); + argumentsLayout->setRowStretch( 4, 5 ); + + QTableWidgetItem *___qtablewidgetitem = TWBoundary->horizontalHeaderItem(0); + ___qtablewidgetitem->setText(tr("a_virer")); + + // Initial state + myInMedFileRadio->setChecked( true ); + modeInChanged( MedFile ); + RBBoundaryNo->setChecked( true ); + //SetBoundaryNo(); + + myOutMedFileChk->setChecked(true); + CBBoundaryCAO->setCurrentIndex(-1); + CBBoundaryDi->setCurrentIndex(-1); + + // Connections + connect(myInMeshGroup, SIGNAL(buttonClicked(int)), this, SLOT(modeInChanged(int))); + connect(myOutMedFileChk, SIGNAL(stateChanged(int)), this, SLOT(onOutMedFileChk(int))); + connect(myOutPublishChk, SIGNAL(stateChanged(int)), this, SLOT(onOutPublishChk(int))); + connect(mySelectOutMedFileButton, SIGNAL(pressed()), this, SLOT(onSelectOutMedFileButton())); + emit updateSelection(); +} + +void SMESHGUI_HomardAdaptArguments::modeInChanged( int theMode ) +{ + clear(); + if (theMode == MedFile) { + mySelectInMedFileLineEdit->show(); + mySelectInMedFileButton->show(); + myInBrowserObject->hide(); + } + else { + mySelectInMedFileLineEdit->hide(); + mySelectInMedFileButton->hide(); + myInBrowserObject->show(); + emit updateSelection(); + } +} + +void SMESHGUI_HomardAdaptArguments::onSelectOutMedFileButton() +{ + // Current value + QString fileName0 = mySelectOutMedFileLineEdit->text().trimmed(); + + // Ask user for the new value + QString filtre = QString("Med"); + filtre += QString(" files (*.") + QString("med") + QString(");;"); + QString fileName = QFileDialog::getSaveFileName(this, tr("SAVE_MED"), QString(""), filtre); + + // Check the new value + if (fileName.isEmpty()) fileName = fileName0; + + QFileInfo aFileInfo (fileName); + mySelectOutMedFileLineEdit->setText(aFileInfo.absoluteFilePath()); +} + +void SMESHGUI_HomardAdaptArguments::clear() +{ + mySelectInMedFileLineEdit->clear(); + myInBrowserObject->clear(); + + myOutMeshNameLineEdit->clear(); + mySelectOutMedFileLineEdit->clear(); +} + +void SMESHGUI_HomardAdaptArguments::onOutMedFileChk(int state) +{ + if (state == Qt::Checked) { + mySelectOutMedFileButton->show(); + mySelectOutMedFileLineEdit->show(); + mySelectOutMedFileButton->setEnabled(true); + mySelectOutMedFileLineEdit->setEnabled(true); + } + else { + mySelectOutMedFileButton->setEnabled(false); + mySelectOutMedFileLineEdit->setEnabled(false); + myOutPublishChk->setChecked(true); + } +} + +void SMESHGUI_HomardAdaptArguments::onOutPublishChk(int state) +{ + if (state == Qt::Unchecked) { + myOutMedFileChk->setChecked(true); + } +} + +////////////////////////////////////////// +// SMESHGUI_HomardAdaptAdvanced +////////////////////////////////////////// + +SMESHGUI_HomardAdaptAdvanced::SMESHGUI_HomardAdaptAdvanced(QWidget* parent) + : QWidget(parent) +{ + setupWidget(); + connect(workingDirectoryPushButton, SIGNAL(pressed()), + this, SLOT(onWorkingDirectoryPushButton())); +} + +SMESHGUI_HomardAdaptAdvanced::~SMESHGUI_HomardAdaptAdvanced() +{ +} + +void SMESHGUI_HomardAdaptAdvanced::setupWidget() +{ + //this->resize(337, 369); + + // Logs and debug + logGroupBox = new QGroupBox(this); + QGridLayout* logGroupBoxLayout = new QGridLayout(this); + logGroupBoxLayout->setMargin( 9 ); + logGroupBoxLayout->setSpacing( 6 ); + logGroupBoxLayout->addWidget(logGroupBox, 0, 0, 1, 1); + + QGridLayout* logsLayout = new QGridLayout(logGroupBox); + logsLayout->setMargin( 9 ); + logsLayout->setSpacing( 6 ); + + // Working directory + Verbose level layout + QGridLayout* gridLayout = new QGridLayout(); + + // Working directory + workingDirectoryLabel = new QLabel(logGroupBox); + workingDirectoryLineEdit = new QLineEdit(logGroupBox); + workingDirectoryPushButton = new QPushButton(logGroupBox); + + gridLayout->addWidget(workingDirectoryLabel, 0, 0, 1, 1); + gridLayout->addWidget(workingDirectoryLineEdit, 0, 1, 1, 1); + gridLayout->addWidget(workingDirectoryPushButton, 0, 2, 1, 1); + + // Verbose level + verboseLevelLabel = new QLabel(logGroupBox); + verboseLevelSpin = new QSpinBox(logGroupBox); + + gridLayout->addWidget(verboseLevelLabel, 1, 0, 1, 1); + gridLayout->addWidget(verboseLevelSpin, 1, 1, 1, 1); + + logsLayout->addLayout(gridLayout, 0, 0, 1, 1); + + // logInFileCheck + removeLogOnSuccessCheck + QHBoxLayout* horizontalLayout = new QHBoxLayout(); + + logInFileCheck = new QCheckBox(logGroupBox); + removeLogOnSuccessCheck = new QCheckBox(logGroupBox); + + logInFileCheck->setChecked(true); + removeLogOnSuccessCheck->setChecked(true); + + horizontalLayout->addWidget(logInFileCheck); + horizontalLayout->addWidget(removeLogOnSuccessCheck); + + logsLayout->addLayout(horizontalLayout, 1, 0, 1, 1); + + // Keep Working Files Check + keepWorkingFilesCheck = new QCheckBox(logGroupBox); + keepWorkingFilesCheck->setAutoExclusive(false); + keepWorkingFilesCheck->setChecked(false); + + logsLayout->addWidget(keepWorkingFilesCheck, 2, 0, 1, 1); + + //logsLayout->setColumnStretch( 1, 5 ); + logsLayout->setRowStretch( 3, 5 ); +} + +void SMESHGUI_HomardAdaptAdvanced::onWorkingDirectoryPushButton() +{ + QString aWorkingDir = QFileDialog::getExistingDirectory(); + if (!(aWorkingDir.isEmpty())) workingDirectoryLineEdit->setText(aWorkingDir); +} diff --git a/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h new file mode 100644 index 000000000..63046ed36 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardAdaptDlg.h @@ -0,0 +1,233 @@ +// Copyright (C) 2011-2021 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 SMESHGUI_HOMARDADAPTDLG_HXX +#define SMESHGUI_HOMARDADAPTDLG_HXX + +#include "SMESH_SMESHGUI.hxx" + +#include +#include CORBA_CLIENT_HEADER(SMESH_Homard) +#include CORBA_SERVER_HEADER(SMESH_Mesh) +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SMESHGUI_HomardAdaptArguments; +class SMESHGUI_HomardAdaptAdvanced; + +//================================================================================= +// class : SMESHGUI_HomardAdaptDlg +// purpose : +//================================================================================= +class SMESHGUI_EXPORT SMESHGUI_HomardAdaptDlg : public QDialog +{ + Q_OBJECT + + public: + SMESHGUI_HomardAdaptDlg(SMESHHOMARD::HOMARD_Gen_ptr theHomardGen); + ~SMESHGUI_HomardAdaptDlg(); + + void AddBoundaryCAO(QString newBoundary); + void AddBoundaryAn(QString newBoundary); + void AddBoundaryDi(QString newBoundary); + + protected: + QString myWorkingDir; + + SMESHHOMARD::HOMARD_Cas_var myCase; + SALOME::GenericObj_wrap< SMESHHOMARD::HOMARD_Gen > myHomardGen; + + virtual void InitConnect(); + virtual void InitBoundarys(); + + public slots: + virtual void SetFileName(); + + 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(); + virtual void PushBoundaryDiHelp(); + + virtual void SetBoundaryA(); + virtual void PushBoundaryAnNew(); + virtual void PushBoundaryAnEdit(); + virtual void PushBoundaryAnHelp(); + + bool CheckCase(bool fixCase); + + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + + void selectionChanged(); + void updateSelection(); + + private: + SMESHGUI_HomardAdaptArguments* myArgs; + SMESHGUI_HomardAdaptAdvanced* myAdvOpt; + + SMESH::SMESH_Mesh_var myMesh; + + QPushButton *buttonHelp; + QPushButton *buttonApply; + QPushButton *buttonOk; + QPushButton *buttonCancel; +}; + +//================================================================================= +// class : SMESHGUI_HomardAdaptArguments +// purpose : +//================================================================================= +class SMESHGUI_HomardAdaptArguments : public QWidget +{ + Q_OBJECT + +public: + enum ModeIn { MedFile, Browser }; + + SMESHGUI_HomardAdaptArguments (QWidget* parent); + ~SMESHGUI_HomardAdaptArguments(); + + void setupUi(); + +public: + // Mesh In + QButtonGroup* myInMeshGroup; + QRadioButton* myInMedFileRadio; + QRadioButton* myInBrowserRadio; + + QPushButton* mySelectInMedFileButton; + QLineEdit* mySelectInMedFileLineEdit; // LEFileName + + QLineEdit* myInBrowserObject; + + // Mesh Out + QLineEdit* myOutMeshNameLineEdit; + QCheckBox* myOutMedFileChk; + + QPushButton* mySelectOutMedFileButton; + QLineEdit* mySelectOutMedFileLineEdit; + + QCheckBox* myOutPublishChk; + + // Conformity type + QRadioButton *RBConforme; + QRadioButton *RBNonConforme; + + // Boundary type + QGroupBox *GBTypeBoun; + QRadioButton *RBBoundaryNo; + QRadioButton *RBBoundaryCAO; + QRadioButton *RBBoundaryNonCAO; + QHBoxLayout *hboxLayout3; + QCheckBox *CBBoundaryD; + QCheckBox *CBBoundaryA; + + QGroupBox *GBBoundaryC; // CAO boundary + QPushButton *PBBoundaryCAOEdit; + QPushButton *PBBoundaryCAOHelp; + QComboBox *CBBoundaryCAO; + QPushButton *PBBoundaryCAONew; + QGroupBox *GBBoundaryN; // Non CAO boundary + QGroupBox *GBBoundaryD; + QComboBox *CBBoundaryDi; + QPushButton *PBBoundaryDiEdit; + QPushButton *PBBoundaryDiHelp; + QPushButton *PBBoundaryDiNew; + QGroupBox *GBBoundaryA; + QFormLayout *formLayout; + QTableWidget *TWBoundary; + QPushButton *PBBoundaryAnEdit; + QPushButton *PBBoundaryAnNew; + QPushButton *PBBoundaryAnHelp; + +signals: + void updateSelection(); + +private slots: + void modeInChanged(int); + void clear(); + void onOutMedFileChk(int); + void onOutPublishChk(int); + void onSelectOutMedFileButton(); +}; + +//================================================================================= +// class : SMESHGUI_HomardAdaptAdvanced +// purpose : +//================================================================================= +class SMESHGUI_HomardAdaptAdvanced : public QWidget +{ + Q_OBJECT + +public: + SMESHGUI_HomardAdaptAdvanced(QWidget* = 0); + ~SMESHGUI_HomardAdaptAdvanced(); + + void setupWidget(); + +public: + QGroupBox *logGroupBox; + + QLabel *workingDirectoryLabel; + QLineEdit *workingDirectoryLineEdit; + QPushButton *workingDirectoryPushButton; + + QLabel *verboseLevelLabel; + QSpinBox *verboseLevelSpin; + + QCheckBox *logInFileCheck; + QCheckBox *removeLogOnSuccessCheck; + + QCheckBox *keepWorkingFilesCheck; + +private slots: + void onWorkingDirectoryPushButton(); +}; + +#endif // SMESHGUI_HOMARDADAPTDLG_HXX diff --git a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx new file mode 100644 index 000000000..029a86350 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.cxx @@ -0,0 +1,1641 @@ +// Copyright (C) 2011-2021 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 "SMESHGUI_HomardBoundaryDlg.h" + +#include "SMESHGUI_HomardAdaptDlg.h" +#include "SMESHGUI_HomardListGroup.h" + +#include "SMESHGUI_Utils.h" + +#include +#include + +#include "SalomeApp_Tools.h" +#include "SMESHGUI_HomardUtils.h" +#include + +#include +#include +#include +#include +#include + +#include "math.h" +#define PI 3.141592653589793 + +using namespace std; + +// ---------------------------------------------------------------------------------- +SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName) : +/* Constructs a SMESH_CreateBoundaryAn + appele pour une vraie creation + initialise un cylindre et non une sphere +*/ + QDialog(0), SMESH_Ui_CreateBoundaryAn(), + _parent(parent), + _Name (""), + _Type(1), + _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0), + _BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0), + _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0), + _Xmin(0), _Xmax(0), _Xincr(0), _Ymin(0), _Ymax(0), _Yincr(0), _Zmin(0), _Zmax(0), _Zincr(0), _DMax(0), + _BoundaryAnXcone1(0), _BoundaryAnYcone1(0), _BoundaryAnZcone1(0), _BoundaryAnRayon1(0), + _BoundaryAnXcone2(0), _BoundaryAnYcone2(0), _BoundaryAnZcone2(0), _BoundaryAnRayon2(0), + _BoundaryAnXaxisCone(0), _BoundaryAnYaxisCone(0), _BoundaryAnZaxisCone(0), + _BoundaryAnXorigCone(0), _BoundaryAnYorigCone(0), _BoundaryAnZorigCone(0), + _BoundaryAngle(0), + _BoundaryAnToreXcentre(0), _BoundaryAnToreYcentre(0), _BoundaryAnToreZcentre(0), + _BoundaryAnToreXaxe(0), _BoundaryAnToreYaxe(0), _BoundaryAnToreZaxe(0), + _BoundaryAnToreRRev(0), _BoundaryAnToreRPri(0), + Chgt (false) + { + MESSAGE("Constructeur") ; + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + + // Gestion des icones + QPixmap pix ; + QIcon IS ; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" ); + IS=QIcon(pix); + RBSphere->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" ); + IS=QIcon(pix); + RBCylindre->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "cone.png" ); + IS=QIcon(pix); + RBCone->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "conepointvector.png" ); + IS=QIcon(pix); + RB_Def_angle->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "conedxyz.png" ); + IS=QIcon(pix); + RB_Def_radius->setIcon(IS); + pix = resMgr->loadPixmap( "HOMARD", "toruspointvector.png" ); + IS=QIcon(pix); + RBTore->setIcon(IS); + + InitConnect( ); + + SetNewName() ; + InitValBoundaryAn(); // Cherche les valeurs de la boite englobante le maillage + InitMinMax(); // Initialise les bornes des boutons + SetCylinder(); // Propose un cylindre en premier choix + } + +// ------------------------------------------------------------------------------- +SMESH_CreateBoundaryAn::SMESH_CreateBoundaryAn(SMESHGUI_HomardAdaptDlg* parent, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName): + QDialog(0), SMESH_Ui_CreateBoundaryAn(), + _parent(parent), + _Name (""), + _Type(1), + _BoundaryAnXcentre(0), _BoundaryAnYcentre(0), _BoundaryAnZcentre(0), _BoundaryAnRayon(0), + _BoundaryAnXaxis(0), _BoundaryAnYaxis(0), _BoundaryAnZaxis(0), + // Pour affichage lors de l edition d une BoundaryAn sans nom de Cas + _Xcentre(0), _Ycentre(0), _Zcentre(0), _Rayon(0), + _Xmin(1), _Xmax(1), _Xincr(1), _Ymin(1), _Ymax(1), _Yincr(1), _Zmin(1), _Zmax(1), _Zincr(1), _DMax(1), + Chgt (false) + { + // MESSAGE("Debut de SMESH_CreateBoundaryAn") + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + QPixmap pix = resMgr->loadPixmap( "HOMARD", "spherepoint.png" ); + QIcon IS=QIcon(pix); + RBSphere->setIcon(IS); + QPixmap pix2 = resMgr->loadPixmap( "HOMARD", "cylinderpointvector.png" ); + QIcon IS2=QIcon(pix2); + RBCylindre->setIcon(IS2); + QPixmap pix3 = resMgr->loadPixmap( "HOMARD", "cone.png" ); + QIcon IS3=QIcon(pix3); + RBCone->setIcon(IS3); + QPixmap pix4 = resMgr->loadPixmap( "HOMARD", "conepointvector.png" ); + QIcon IS4=QIcon(pix4); + RB_Def_angle->setIcon(IS4); + QPixmap pix5 = resMgr->loadPixmap( "HOMARD", "conedxyz.png" ); + QIcon IS5=QIcon(pix5); + RB_Def_radius->setIcon(IS5); + setModal(true); + InitConnect(); + } + +// ------------------------------------------------------------------------ +SMESH_CreateBoundaryAn::~SMESH_CreateBoundaryAn() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( RBCylindre, SIGNAL(clicked()) , this, SLOT(SetCylinder()) ) ; + connect( RBSphere, SIGNAL(clicked()) , this, SLOT(SetSphere()) ) ; + connect( RBCone, SIGNAL(clicked()) , this, SLOT(SetCone()) ) ; + connect( RB_Def_radius, SIGNAL(clicked()) , this, SLOT(SetConeR()) ); + connect( RB_Def_angle, SIGNAL(clicked()) , this, SLOT(SetConeA()) ); + connect( RBTore, SIGNAL(clicked()) , this, SLOT(SetTore()) ) ; + 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() ) ); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::InitValBoundaryAn() +// ------------------------------------------------------------------------ +{ + // + // 1. Les coordonnees extremes du maillage + // + SMESHHOMARD::HOMARD_Cas_var aCas = myHomardGen->GetCase(); + SMESHHOMARD::extrema_var MesExtremes = aCas->GetBoundingBox(); + int num = MesExtremes->length() ; + ASSERT(num == 10); + _Xmin=MesExtremes[0]; _Xmax=MesExtremes[1]; _Xincr=MesExtremes[2]; + _Ymin=MesExtremes[3]; _Ymax=MesExtremes[4]; _Yincr=MesExtremes[5]; + _Zmin=MesExtremes[6]; _Zmax=MesExtremes[7]; _Zincr=MesExtremes[8]; + _DMax=MesExtremes[9]; + MESSAGE ("_Xmin : " << _Xmin << " _Xmax : " << _Xmax << " _Xincr : " << _Xincr ) ; + MESSAGE ("_Ymin : " << _Ymin << " _Ymax : " << _Ymax << " _Yincr : " << _Yincr ) ; + MESSAGE ("_Zmin : " << _Zmin << " _Zmax : " << _Zmax << " _Zincr : " << _Zincr) ; + MESSAGE ("_DMax : " << _DMax); + +// 2. Caracteristiques des frontieres +// en X + _Xcentre=(_Xmin + _Xmax)/2.; +// en Y + _Ycentre=(_Ymin + _Ymax)/2.; +// en Z + _Zcentre=(_Zmin + _Zmax)/2.; +// Rayon + _Rayon= _DMax/4.; +} + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::InitMinMax() +// ------------------------------------------------------------------------ +{ + // Cylindre + // . X du centre + SpinBox_Xcent->setValue(_Xcentre); + SpinBox_Xcent->setSingleStep(_Xincr); + // . Y du centre + SpinBox_Ycent->setValue(_Ycentre); + SpinBox_Ycent->setSingleStep(_Yincr); + // . Z du centre + SpinBox_Zcent->setValue(_Zcentre); + SpinBox_Zcent->setSingleStep(_Zincr); + // . X de l'axe + SpinBox_Xaxis->setValue(0.); + SpinBox_Xaxis->setSingleStep(0.1); + // . Y de l'axe + SpinBox_Yaxis->setValue(0.); + SpinBox_Yaxis->setSingleStep(0.1); + // . Z de l'axe + SpinBox_Zaxis->setValue(1.); + SpinBox_Zaxis->setSingleStep(0.1); + // . Rayon + SpinBox_Radius->setValue(_Rayon); + SpinBox_Radius->setSingleStep(_Rayon/10.); + + // Sphere + // . X du centre + SpinBox_Xcentre->setValue(_Xcentre); + SpinBox_Xcentre->setSingleStep(_Xincr); + // . Y du centre + SpinBox_Ycentre->setValue(_Ycentre); + SpinBox_Ycentre->setSingleStep(_Yincr); + // . Z du centre + SpinBox_Zcentre->setValue(_Zcentre); + SpinBox_Zcentre->setSingleStep(_Zincr); + // . Rayon + SpinBox_Rayon->setValue(_Rayon); + SpinBox_Rayon->setSingleStep(_Rayon/10.); + + // Cone en rayons + // . X des centres + _BoundaryAnXcone1 = _Xcentre ; + SpinBox_Cone_X1->setSingleStep(_Xincr); + _BoundaryAnXcone2 = _Xcentre ; + SpinBox_Cone_X2->setSingleStep(_Xincr); + // . Y des centres + _BoundaryAnYcone1 = _Ycentre ; + SpinBox_Cone_Y1->setSingleStep(_Yincr); + _BoundaryAnYcone2 = _Ycentre ; + SpinBox_Cone_Y2->setSingleStep(_Yincr); + // . Z des centres + _BoundaryAnZcone1 = _Zmin ; + SpinBox_Cone_Z1->setSingleStep(_Zincr); + _BoundaryAnZcone2 = _Zmax ; + SpinBox_Cone_Z2->setSingleStep(_Zincr); + // . Rayons/Angles + _BoundaryAnRayon1 = 0. ; + _BoundaryAnRayon2 = _Rayon ; + SpinBox_Cone_V2->setSingleStep(_Rayon/10.); + + // Cone en angle + convertRayonAngle(1) ; + SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone); + SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone); + SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone); + SpinBox_Cone_V1->setValue(_BoundaryAngle); + SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone); + SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone); + SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone); + + // Tore + // . X du centre + SpinBoxToreXcent->setValue(_Xcentre); + SpinBoxToreXcent->setSingleStep(_Xincr); + // . Y du centre + SpinBoxToreYcent->setValue(_Ycentre); + SpinBoxToreYcent->setSingleStep(_Yincr); + // . Z du centre + SpinBoxToreZcent->setValue(_Zcentre); + SpinBoxToreZcent->setSingleStep(_Zincr); + // . X de l'axe + SpinBoxToreXaxe->setValue(0.); + SpinBoxToreXaxe->setSingleStep(0.1); + // . Y de l'axe + SpinBoxToreYaxe->setValue(0.); + SpinBoxToreYaxe->setSingleStep(0.1); + // . Z de l'axe + SpinBoxToreZaxe->setValue(1.); + SpinBoxToreZaxe->setSingleStep(0.1); + // . Rayon de revolution + SpinBoxToreRRev->setValue(_Rayon); + SpinBoxToreRRev->setSingleStep(_Rayon/10.); + // . Rayon primaire + SpinBoxToreRPri->setValue(_Rayon/3.); + SpinBoxToreRPri->setSingleStep(_Rayon/20.); +} +// ------------------------------------------------------------------------ +bool SMESH_CreateBoundaryAn::PushOnApply() +// ------------------------------------------------------------------------ +// Appele lorsque l'un des boutons Ok ou Apply est presse +// +{ + if (LEName->text().trimmed()=="") + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_NAME") ); + return false; + } + + switch (_Type) + { + case 1 : // il s agit d un cylindre + { + if ((_BoundaryAnXcentre != SpinBox_Xcent->value()) || + (_BoundaryAnYcentre != SpinBox_Ycent->value()) || + (_BoundaryAnZcentre != SpinBox_Zcent->value()) || + (_BoundaryAnRayon != SpinBox_Radius->value()) || + (_BoundaryAnXaxis != SpinBox_Xaxis->value()) || + (_BoundaryAnYaxis != SpinBox_Yaxis->value()) || + (_BoundaryAnZaxis != SpinBox_Zaxis->value()) ) + { + Chgt = true; + _BoundaryAnXaxis= SpinBox_Xaxis->value(); + _BoundaryAnYaxis= SpinBox_Yaxis->value(); + _BoundaryAnZaxis= SpinBox_Zaxis->value(); + _BoundaryAnXcentre=SpinBox_Xcent->value(); + _BoundaryAnYcentre=SpinBox_Ycent->value(); + _BoundaryAnZcentre=SpinBox_Zcent->value(); + _BoundaryAnRayon=SpinBox_Radius->value(); + } + break; + } + + case 2 : // il s agit d une sphere + { + if ((_BoundaryAnXcentre != SpinBox_Xcentre->value()) || + (_BoundaryAnYcentre != SpinBox_Ycentre->value()) || + (_BoundaryAnZcentre != SpinBox_Zcentre->value()) || + (_BoundaryAnRayon != SpinBox_Rayon->value()) ) + { + Chgt = true; + _BoundaryAnXcentre=SpinBox_Xcentre->value(); + _BoundaryAnYcentre=SpinBox_Ycentre->value(); + _BoundaryAnZcentre=SpinBox_Zcentre->value(); + _BoundaryAnRayon=SpinBox_Rayon->value(); + } + break; + } + + case 3 : // il s agit d un cone defini par un axe et un angle + { + if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value()) || + (_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value()) || + (_BoundaryAnXorigCone != SpinBox_Cone_X2->value()) || + (_BoundaryAnYorigCone != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZorigCone != SpinBox_Cone_Z2->value()) || + (_BoundaryAngle != SpinBox_Cone_V1->value()) ) + { + Chgt = true; + _BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ; + _BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ; + _BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ; + _BoundaryAnXorigCone = SpinBox_Cone_X2->value() ; + _BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ; + _BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ; + _BoundaryAngle = SpinBox_Cone_V1->value() ; + } + break; + } + + case 4 : // il s agit d un cone defini par les 2 rayons + { + if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value()) || + (_BoundaryAnYcone1 != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZcone1 != SpinBox_Cone_Z1->value()) || + (_BoundaryAnRayon1 != SpinBox_Cone_V1->value()) || + (_BoundaryAnXcone2 != SpinBox_Cone_X2->value()) || + (_BoundaryAnYcone2 != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZcone2 != SpinBox_Cone_Z2->value()) || + (_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) ) + { + Chgt = true; + _BoundaryAnXcone1 = SpinBox_Cone_X1->value() ; + _BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ; + _BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ; + _BoundaryAnRayon1 = SpinBox_Cone_V1->value() ; + _BoundaryAnXcone2 = SpinBox_Cone_X2->value() ; + _BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ; + _BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ; + _BoundaryAnRayon2 = SpinBox_Cone_V2->value() ; + } + break; + } + case 5 : // il s agit d un tore + { + if ((_BoundaryAnToreXcentre != SpinBoxToreXcent->value()) || + (_BoundaryAnToreYcentre != SpinBoxToreYcent->value()) || + (_BoundaryAnToreZcentre != SpinBoxToreZcent->value()) || + (_BoundaryAnToreRRev != SpinBoxToreRRev->value()) || + (_BoundaryAnToreRPri != SpinBoxToreRPri->value()) || + (_BoundaryAnToreXaxe != SpinBoxToreXaxe->value()) || + (_BoundaryAnToreYaxe != SpinBoxToreYaxe->value()) || + (_BoundaryAnToreZaxe != SpinBoxToreZaxe->value()) ) + { + Chgt = true; + _BoundaryAnToreXcentre= SpinBoxToreXcent->value(); + _BoundaryAnToreYcentre= SpinBoxToreYcent->value(); + _BoundaryAnToreZcentre= SpinBoxToreZcent->value(); + _BoundaryAnToreRRev=SpinBoxToreRRev->value(); + _BoundaryAnToreRPri=SpinBoxToreRPri->value(); + _BoundaryAnToreXaxe=SpinBoxToreXaxe->value(); + _BoundaryAnToreYaxe=SpinBoxToreYaxe->value(); + _BoundaryAnToreZaxe=SpinBoxToreZaxe->value(); + } + break; + } + + } + +// Controles +// L'axe pour un cylindre + if ( _Type == 5 ) + { + double daux = _BoundaryAnXaxis*_BoundaryAnXaxis + _BoundaryAnYaxis*_BoundaryAnYaxis + _BoundaryAnZaxis*_BoundaryAnZaxis ; + if ( daux < 0.0000001 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_AXE") ); + return false; + } + } + + // + // Création ou mise à jour de la frontière + // + bool bOK = CreateOrUpdateBoundaryAn(); + + //if ( bOK ) { HOMARD_UTILS::updateObjBrowser() ; } + + return bOK; + +} +// --------------------------------------------------- +bool SMESH_CreateBoundaryAn::CreateOrUpdateBoundaryAn() +//---------------------------------------------------- +// Creation de l'objet boundary +{ + MESSAGE("Debut de CreateOrUpdateBoundaryAn avec _Type ="<<_Type<<", _Name ="<<_Name.toStdString().c_str()<<" et LEName ="<text().trimmed().toStdString().c_str()); +// + if (_Name != LEName->text().trimmed()) + { + _Name = LEName->text().trimmed() ; + try + { + switch (_Type) + { + case 1 : // il s agit d un cylindre + { aBoundaryAn = myHomardGen->CreateBoundaryCylinder(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon ); + break; + } + case 2 : // il s agit d une sphere + { aBoundaryAn = myHomardGen->CreateBoundarySphere(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon); + break; + } + case 3 : // il s agit d un cone defini par un axe et un angle + { aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \ + _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone); + break; + } + case 4 : // il s agit d un cone defini par les 2 rayons + { aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \ + _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2); + break; + } + case 5 : // il s agit d un tore + { aBoundaryAn = myHomardGen->CreateBoundaryTorus(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre, _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe, _BoundaryAnToreRRev, _BoundaryAnToreRPri ); + break; + } + } + } + catch( SALOME::SALOME_Exception& S_ex ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return false ; + } + _parent->AddBoundaryAn(_Name); + + return true; + } + else { + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_OBJECT_4") ); + return false ; + } + MESSAGE("Fin de CreateOrUpdateBoundaryAn"); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#analytical-boundary")); +} + +// ----------------------------------- +void SMESH_CreateBoundaryAn::SetNewName() +// ----------------------------------- +{ +// Recherche d'un nom par defaut qui n'existe pas encore + + SMESHHOMARD::listeBoundarys_var MyObjects = myHomardGen->GetAllBoundarysName(); + int num = 0; QString aName=""; + while (aName=="" ) + { + aName.setNum(num+1) ; + aName.insert(0, QString("Boun_")) ; + for ( int i=0; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetCylinder() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetCylinder") + gBCylindre->setVisible(1); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(0); +// + _Type=1; +// + adjustSize(); +// MESSAGE("Fin de SetCylinder") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetSphere() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetSphere") + gBCylindre->setVisible(0); + gBSphere->setVisible(1); + gBCone->setVisible(0); + gBTore->setVisible(0); +// + _Type=2; +// + adjustSize(); +// MESSAGE("Fin de SetSphere") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetConeR() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConeR") +// +// Stockage et conversion des valeurs si elles ont change + if ((_BoundaryAnXaxisCone != SpinBox_Cone_X1->value()) || + (_BoundaryAnYaxisCone != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZaxisCone != SpinBox_Cone_Z1->value()) || + (_BoundaryAnXorigCone != SpinBox_Cone_X2->value()) || + (_BoundaryAnYorigCone != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZorigCone != SpinBox_Cone_Z2->value()) || + (_BoundaryAngle != SpinBox_Cone_V1->value()) ) + { + MESSAGE("Stockage et conversion") + _BoundaryAnXaxisCone = SpinBox_Cone_X1->value() ; + _BoundaryAnYaxisCone = SpinBox_Cone_Y1->value() ; + _BoundaryAnZaxisCone = SpinBox_Cone_Z1->value() ; + _BoundaryAnXorigCone = SpinBox_Cone_X2->value() ; + _BoundaryAnYorigCone = SpinBox_Cone_Y2->value() ; + _BoundaryAnZorigCone = SpinBox_Cone_Z2->value() ; + _BoundaryAngle = SpinBox_Cone_V1->value() ; + convertRayonAngle(-1) ; + } +// + _Type=4; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXcone1); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0)); + SpinBox_Cone_V1->setSingleStep(_Rayon/10.); + SpinBox_Cone_V1->setMaximum(100000.*_DMax); + SpinBox_Cone_V1->setValue(_BoundaryAnRayon1); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXcone2); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2); +// + TLCone_V2->setVisible(1); + SpinBox_Cone_V2->setVisible(1); + TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0)); + SpinBox_Cone_V2->setValue(_BoundaryAnRayon2); +// +// MESSAGE("Fin de SetConeR") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetConeA() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetConeA") +// Stockage et conversion des valeurs si elles ont change + if ((_BoundaryAnXcone1 != SpinBox_Cone_X1->value()) || + (_BoundaryAnYcone1 != SpinBox_Cone_Y1->value()) || + (_BoundaryAnZcone1 != SpinBox_Cone_Z1->value()) || + (_BoundaryAnRayon1 != SpinBox_Cone_V1->value()) || + (_BoundaryAnXcone2 != SpinBox_Cone_X2->value()) || + (_BoundaryAnYcone2 != SpinBox_Cone_Y2->value()) || + (_BoundaryAnZcone2 != SpinBox_Cone_Z2->value()) || + (_BoundaryAnRayon2 != SpinBox_Cone_V2->value()) ) + { + MESSAGE("Stockage et conversion") + _BoundaryAnXcone1 = SpinBox_Cone_X1->value() ; + _BoundaryAnYcone1 = SpinBox_Cone_Y1->value() ; + _BoundaryAnZcone1 = SpinBox_Cone_Z1->value() ; + _BoundaryAnRayon1 = SpinBox_Cone_V1->value() ; + _BoundaryAnXcone2 = SpinBox_Cone_X2->value() ; + _BoundaryAnYcone2 = SpinBox_Cone_Y2->value() ; + _BoundaryAnZcone2 = SpinBox_Cone_Z2->value() ; + _BoundaryAnRayon2 = SpinBox_Cone_V2->value() ; + convertRayonAngle(1) ; + } +// + _Type=3; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0)); + SpinBox_Cone_V1->setValue(_BoundaryAngle); + SpinBox_Cone_V1->setSingleStep(1.); + SpinBox_Cone_V1->setMaximum(90.); +// + TLCone_V2->setVisible(0); + SpinBox_Cone_V2->setVisible(0); +// MESSAGE("Fin de SetConeA") +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetCone() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetCone") + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(1); + gBTore->setVisible(0); +// + if ( RB_Def_radius->isChecked() ) + { + SetConeR(); + } + else + { + SetConeA(); + } +// + adjustSize(); +// MESSAGE("Fin de SetCone") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::SetTore() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SetTore") + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(1); +// + _Type=5; +// + adjustSize(); +// MESSAGE("Fin de SetTore") +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryAn::convertRayonAngle(int option) +// ------------------------------------------------------------------------ +// Conversion entre les deux formulations du cone : +// par deux rayons ou avec un axe et un angle. +// Voir sfcoi1 de HOMARD +{ + MESSAGE("Debut de convertRayonAngle, option = "< BO = AB*RB/(RA-RB) +// Angle : tg(alpha) = RA/AO +// + double daux ; +// De rayon vers angle : + if ( option == 1 ) + { + double xa, ya, za, ra ; + double xb, yb, zb, rb ; +// Positionnement de A vers B, avec RA>RB + if ( _BoundaryAnRayon1 > _BoundaryAnRayon2 ) + { + xa = _BoundaryAnXcone1 ; + ya = _BoundaryAnYcone1 ; + za = _BoundaryAnZcone1 ; + ra = _BoundaryAnRayon1 ; + xb = _BoundaryAnXcone2 ; + yb = _BoundaryAnYcone2 ; + zb = _BoundaryAnZcone2 ; + rb = _BoundaryAnRayon2 ; + } + else + { + xa = _BoundaryAnXcone2 ; + ya = _BoundaryAnYcone2 ; + za = _BoundaryAnZcone2 ; + ra = _BoundaryAnRayon2 ; + xb = _BoundaryAnXcone1 ; + yb = _BoundaryAnYcone1 ; + zb = _BoundaryAnZcone1 ; + rb = _BoundaryAnRayon1 ; + } +// Axe : relie les deux centres, de A vers B. L'axe est normalise + _BoundaryAnXaxisCone = xb - xa ; + _BoundaryAnYaxisCone = yb - ya ; + _BoundaryAnZaxisCone = zb - za ; + daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ; + _BoundaryAnXaxisCone = _BoundaryAnXaxisCone/daux ; + _BoundaryAnYaxisCone = _BoundaryAnYaxisCone/daux ; + _BoundaryAnZaxisCone = _BoundaryAnZaxisCone/daux ; +// Origine + daux = daux * rb / (ra-rb) ; + _BoundaryAnXorigCone = xb + daux*_BoundaryAnXaxisCone ; + _BoundaryAnYorigCone = yb + daux*_BoundaryAnYaxisCone ; + _BoundaryAnZorigCone = zb + daux*_BoundaryAnZaxisCone ; +// Angle en degre + daux = ra / sqrt((_BoundaryAnXorigCone-xa)*(_BoundaryAnXorigCone-xa) + (_BoundaryAnYorigCone-ya)*(_BoundaryAnYorigCone-ya) + (_BoundaryAnZorigCone-za)*(_BoundaryAnZorigCone-za) ) ; + _BoundaryAngle = atan(daux)*180./PI ; + } +// D'angle vers rayon : + else + { + double xax, yax, zax ; +// L'axe est normalise + daux = sqrt ( _BoundaryAnXaxisCone*_BoundaryAnXaxisCone + _BoundaryAnYaxisCone*_BoundaryAnYaxisCone + _BoundaryAnZaxisCone*_BoundaryAnZaxisCone ) ; + xax = _BoundaryAnXaxisCone/daux ; + yax = _BoundaryAnYaxisCone/daux ; + zax = _BoundaryAnZaxisCone/daux ; +// Centre 1 : l'origine + _BoundaryAnXcone1 = _BoundaryAnXorigCone ; + _BoundaryAnYcone1 = _BoundaryAnYorigCone ; + _BoundaryAnZcone1 = _BoundaryAnZorigCone ; +// Rayon 1 : nul + _BoundaryAnRayon1 = 0. ; +// Centre 2 : l'origine decalee d'une longueur arbitraire le long de l'axe + _BoundaryAnXcone2 = _BoundaryAnXorigCone + _DMax*xax ; + _BoundaryAnYcone2 = _BoundaryAnYorigCone + _DMax*yax ; + _BoundaryAnZcone2 = _BoundaryAnZorigCone + _DMax*zax ; +// Rayon 2 : a calculer + _BoundaryAnRayon2 = _DMax*tan(_BoundaryAngle*PI/180.) ; + } +// MESSAGE("Fin de convertRayonAngle") +} + +// ------------------------------------------------------------------------------- +SMESH_CreateBoundaryCAO::SMESH_CreateBoundaryCAO(SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString aName) +// --------------------------------------------------------------------------------- +/* Constructs a SMESH_CreateBoundaryCAO */ + : + QDialog(0), SMESH_Ui_CreateBoundaryCAO(), + _parent(parent), _aName(aName), + myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)) + { + MESSAGE("Constructeur") ; + setupUi(this); + setModal(modal); + InitConnect(); + + if ( _aName == QString("") ) {SetNewName();}; + } + +// ------------------------------------------------------------------------ +SMESH_CreateBoundaryCAO::~SMESH_CreateBoundaryCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::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 SMESH_CreateBoundaryCAO::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); + } + 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 SMESH_CreateBoundaryCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#cao-boundary")); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::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 SMESH_CreateBoundaryCAO::SetNewName() +// -------------------------------------------------- +{ + + SMESHHOMARD::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; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::SetCAOFile() +// ------------------------------------------------------------------------ +{ + QString aCAOFile = SMESH_HOMARD_QT_COMMUN::PushNomFichier( false, QString("xao") ); + if (!(aCAOFile.isEmpty())) LEFileName->setText(aCAOFile); +} + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::setGroups (QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _listeGroupesBoundary = listGroup; +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryCAO::SetFiltrage() +// ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + + SMESH_CreateListGroupCAO *aDlg = new SMESH_CreateListGroupCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", _listeGroupesBoundary); + aDlg->show(); +} + +// ------------------------------------------------------------------------------- +SMESH_CreateBoundaryDi::SMESH_CreateBoundaryDi(SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString aName) +// --------------------------------------------------------------------------------- +/* Constructs a SMESH_CreateBoundaryDi */ + : + QDialog(0), SMESH_Ui_CreateBoundaryDi(), + _parent(parent), _aName(aName), + myHomardGen(SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0)) + { + MESSAGE("Constructeur") ; + setupUi(this); + setModal(modal); + InitConnect(); + + if ( _aName == QString("") ) {SetNewName();}; + } + +// ------------------------------------------------------------------------ +SMESH_CreateBoundaryDi::~SMESH_CreateBoundaryDi() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::InitConnect() +// ------------------------------------------------------------------------ +{ + connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetMeshFile())); + 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 SMESH_CreateBoundaryDi::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; + } + +// Le maillage de la frontiere discrete + QString aMeshFile=LEFileName->text().trimmed(); + if (aMeshFile ==QString("")) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_BOUN_MESH") ); + return false; + } + + // Le nom du maillage de la frontiere discrete + QString aMeshName = SMESH_HOMARD_QT_COMMUN::LireNomMaillage(aMeshFile); + if (aMeshName == "" ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + 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->CreateBoundaryDi(CORBA::string_dup(_aName.toStdString().c_str()), aMeshName.toStdString().c_str(), aMeshFile.toStdString().c_str()); + _parent->AddBoundaryDi(_aName); + } + 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 SMESH_CreateBoundaryDi::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parent ) { _parent->raise(); _parent->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#discrete-boundary")); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::AssocieLesGroupes() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::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 SMESH_CreateBoundaryDi::SetNewName() +// -------------------------------------------------- +{ + + SMESHHOMARD::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; ilength(); i++) + { + if ( aName == QString(MyObjects[i])) + { + num ++ ; + aName = "" ; + break ; + } + } + } + LEName->setText(aName); +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::SetMeshFile() +// ------------------------------------------------------------------------ +{ + QString aMeshFile = SMESH_HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ); + if (!(aMeshFile.isEmpty())) LEFileName->setText(aMeshFile); +} + +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::setGroups (QStringList listGroup) +// ------------------------------------------------------------------------ +{ + _listeGroupesBoundary = listGroup; +} +// ------------------------------------------------------------------------ +void SMESH_CreateBoundaryDi::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + + SMESH_CreateListGroup *aDlg = new SMESH_CreateListGroup + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", _listeGroupesBoundary); + aDlg->show(); +} + +// ------------------------------------------------------------------------ +SMESH_EditBoundaryAn::SMESH_EditBoundaryAn( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString Name ): +// ------------------------------------------------------------------------ +/* Constructs a SMESH_EditBoundaryAn + herite de SMESH_CreateBoundaryAn +*/ + SMESH_CreateBoundaryAn(parent, myHomardGen0, caseName) +{ + MESSAGE("Debut de SMESH_EditBoundaryAn pour " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_BOUN_A_EDIT_WINDOW_TITLE")); + _Name=Name; + aBoundaryAn = myHomardGen->GetBoundary(_Name.toStdString().c_str()); + InitValEdit(); +} +// ------------------------------------------------------------------------ +SMESH_EditBoundaryAn::~SMESH_EditBoundaryAn() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValEdit() +// ------------------------------------------------------------------------ +{ + LEName->setText(_Name); + LEName->setReadOnly(true); + _Type = aBoundaryAn->GetType(); + MESSAGE("_Type : "<<_Type); + InitValBoundaryAnLimit(); + InitValBoundaryAn(); + switch (_Type) + { + case 1 : // il s agit d un cylindre + { + InitValBoundaryAnCylindre(); + SetCylinder(); + break; + } + case 2: // il s agit d une sphere + { + InitValBoundaryAnSphere(); + SetSphere(); + break; + } + case 3: // il s agit d un cone defini par un axe et un angle + { + InitValBoundaryAnConeA(); + SetConeA(); + break; + } + case 4: // il s agit d un cone defini par les 2 rayons + { + InitValBoundaryAnConeR(); + SetConeR(); + break; + } + case 5: // il s agit d un tore + { + InitValBoundaryAnTore(); + SetTore(); + break; + } + }; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnLimit() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordLimits = aBoundaryAn->GetLimit(); + ASSERT(mesCoordLimits->length() == 3 ); + _Xincr=mesCoordLimits[0]; + _Yincr=mesCoordLimits[1]; + _Zincr=mesCoordLimits[2]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnCylindre() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 7 ); + _BoundaryAnXcentre=mesCoordBoundary[0]; + _BoundaryAnYcentre=mesCoordBoundary[1]; + _BoundaryAnZcentre=mesCoordBoundary[2]; + _BoundaryAnXaxis=mesCoordBoundary[3]; + _BoundaryAnYaxis=mesCoordBoundary[4]; + _BoundaryAnZaxis=mesCoordBoundary[5]; + _BoundaryAnRayon=mesCoordBoundary[6]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnSphere() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 4 ); + _BoundaryAnXcentre=mesCoordBoundary[0]; + _BoundaryAnYcentre=mesCoordBoundary[1]; + _BoundaryAnZcentre=mesCoordBoundary[2]; + _BoundaryAnRayon=mesCoordBoundary[3]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnConeA() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 7 ); + _BoundaryAnXaxisCone=mesCoordBoundary[0]; + _BoundaryAnYaxisCone=mesCoordBoundary[1]; + _BoundaryAnZaxisCone=mesCoordBoundary[2]; + _BoundaryAngle=mesCoordBoundary[3]; + _BoundaryAnXorigCone=mesCoordBoundary[4]; + _BoundaryAnYorigCone=mesCoordBoundary[5]; + _BoundaryAnZorigCone=mesCoordBoundary[6]; + convertRayonAngle(-1) ; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnConeR() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 8 ); + _BoundaryAnXcone1=mesCoordBoundary[0]; + _BoundaryAnYcone1=mesCoordBoundary[1]; + _BoundaryAnZcone1=mesCoordBoundary[2]; + _BoundaryAnRayon1=mesCoordBoundary[3]; + _BoundaryAnXcone2=mesCoordBoundary[4]; + _BoundaryAnYcone2=mesCoordBoundary[5]; + _BoundaryAnZcone2=mesCoordBoundary[6]; + _BoundaryAnRayon2=mesCoordBoundary[7]; + convertRayonAngle(1) ; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::InitValBoundaryAnTore() +// ------------------------------------------------------------------------ +{ + SMESHHOMARD::double_array_var mesCoordBoundary = aBoundaryAn->GetCoords(); + ASSERT(mesCoordBoundary->length() == 8 ); + _BoundaryAnXcentre=mesCoordBoundary[0]; + _BoundaryAnYcentre=mesCoordBoundary[1]; + _BoundaryAnZcentre=mesCoordBoundary[2]; + _BoundaryAnXaxis=mesCoordBoundary[3]; + _BoundaryAnYaxis=mesCoordBoundary[4]; + _BoundaryAnZaxis=mesCoordBoundary[5]; + _BoundaryAnRayon1=mesCoordBoundary[6]; + _BoundaryAnRayon2=mesCoordBoundary[7]; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetCylinder() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(1); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(0); + RBCylindre->setChecked(1); + _Type=1; + RBSphere->setDisabled(true); + RBCone->setDisabled(true); + RBTore->setDisabled(true); + + SpinBox_Xcent->setValue(_BoundaryAnXcentre); + SpinBox_Ycent->setValue(_BoundaryAnYcentre); + SpinBox_Zcent->setValue(_BoundaryAnZcentre); + + SpinBox_Xaxis->setValue(_BoundaryAnXaxis); + SpinBox_Yaxis->setValue(_BoundaryAnYaxis); + SpinBox_Zaxis->setValue(_BoundaryAnZaxis); + + + SpinBox_Xaxis->setSingleStep(0.1); + SpinBox_Xcentre->setSingleStep(_Xincr); + SpinBox_Yaxis->setSingleStep(0.1); + SpinBox_Ycentre->setSingleStep(_Yincr); + SpinBox_Zaxis->setSingleStep(0.1); + SpinBox_Zcentre->setSingleStep(_Zincr); +// Rayon + SpinBox_Radius->setValue(_BoundaryAnRayon); + SpinBox_Radius->setSingleStep(_BoundaryAnRayon/10.); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetSphere() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(1); + RBSphere->setChecked(1); + gBCone->setVisible(0); + gBTore->setVisible(0); + RBCylindre->setDisabled(true); + RBCone->setDisabled(true); + RBTore->setDisabled(true); + _Type=2 ; + + SpinBox_Xcentre->setValue(_BoundaryAnXcentre); + if ( _Xincr > 0) { SpinBox_Xcentre->setSingleStep(_Xincr); } + else { SpinBox_Xcentre->setSingleStep(1) ; } + + SpinBox_Ycentre->setValue(_BoundaryAnYcentre); + if ( _Yincr > 0) { SpinBox_Ycentre->setSingleStep(_Yincr); } + else { SpinBox_Ycentre->setSingleStep(1) ; } + + SpinBox_Zcentre->setValue(_BoundaryAnZcentre); + if ( _Zincr > 0) { SpinBox_Zcentre->setSingleStep(_Zincr); } + else { SpinBox_Zcentre->setSingleStep(1);} + + SpinBox_Rayon->setValue(_BoundaryAnRayon); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetConeA() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(1); + RBCone->setChecked(1); + gBTore->setVisible(0); + RB_Def_angle->setChecked(1); + RBCylindre->setDisabled(true); + RBSphere->setDisabled(true); + RBTore->setDisabled(true); + _Type=3; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X axis", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXaxisCone); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y axis", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYaxisCone); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z axis", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZaxisCone); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXorigCone); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYorigCone); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZorigCone); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Angle", 0)); + SpinBox_Cone_V1->setValue(_BoundaryAngle); + SpinBox_Cone_V1->setSingleStep(1.); + SpinBox_Cone_V1->setMaximum(90.); +// + TLCone_V2->setVisible(0); + SpinBox_Cone_V2->setVisible(0); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetConeR() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(1); + gBTore->setVisible(0); + RBCone->setChecked(1); + RB_Def_radius->setChecked(1); + RBCylindre->setDisabled(true); + RBSphere->setDisabled(true); + RBTore->setDisabled(true); + _Type=4; +// + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X centre 1", 0)); + SpinBox_Cone_X1->setValue(_BoundaryAnXcone1); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y centre 1", 0)); + SpinBox_Cone_Y1->setValue(_BoundaryAnYcone1); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z centre 1", 0)); + SpinBox_Cone_Z1->setValue(_BoundaryAnZcone1); +// + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "Radius 1", 0)); + SpinBox_Cone_V1->setSingleStep(_Rayon/10.); + SpinBox_Cone_V1->setMaximum(100000.*_DMax); + SpinBox_Cone_V1->setValue(_BoundaryAnRayon1); +// + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X centre 2", 0)); + SpinBox_Cone_X2->setValue(_BoundaryAnXcone2); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y centre 2", 0)); + SpinBox_Cone_Y2->setValue(_BoundaryAnYcone2); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z centre 2", 0)); + SpinBox_Cone_Z2->setValue(_BoundaryAnZcone2); +// + TLCone_V2->setVisible(1); + SpinBox_Cone_V2->setVisible(1); + TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "Radius 2", 0)); + SpinBox_Cone_V2->setValue(_BoundaryAnRayon2); +// + adjustSize(); +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryAn::SetTore() +// ------------------------------------------------------------------------ +{ + gBCylindre->setVisible(0); + gBSphere->setVisible(0); + gBCone->setVisible(0); + gBTore->setVisible(1); + RBTore->setChecked(1); + _Type=5; + RBCylindre->setDisabled(true); + RBSphere->setDisabled(true); + RBCone->setDisabled(true); + + SpinBoxToreXcent->setValue(_BoundaryAnXcentre); + SpinBoxToreYcent->setValue(_BoundaryAnYcentre); + SpinBoxToreZcent->setValue(_BoundaryAnZcentre); + + SpinBoxToreXaxe->setValue(_BoundaryAnXaxis); + SpinBoxToreYaxe->setValue(_BoundaryAnYaxis); + SpinBoxToreZaxe->setValue(_BoundaryAnZaxis); + + + SpinBoxToreXaxe->setSingleStep(0.1); + SpinBoxToreXcent->setSingleStep(_Xincr); + SpinBoxToreYaxe->setSingleStep(0.1); + SpinBoxToreYcent->setSingleStep(_Yincr); + SpinBoxToreZaxe->setSingleStep(0.1); + SpinBoxToreZcent->setSingleStep(_Zincr); +// Rayon de revolution + SpinBoxToreRRev->setValue(_BoundaryAnRayon1); + SpinBoxToreRRev->setSingleStep(_BoundaryAnRayon1/10.); +// Rayon primaire + SpinBoxToreRPri->setValue(_BoundaryAnRayon2); + SpinBoxToreRPri->setSingleStep(_BoundaryAnRayon2/10.); +// + adjustSize(); +} +// --------------------------------------------------- +bool SMESH_EditBoundaryAn::CreateOrUpdateBoundaryAn() +//---------------------------------------------------- +// Mise a jour des attributs de la BoundaryAn +{ + switch (_Type) + { + case 1 : // il s agit d un cylindre + { + aBoundaryAn->SetCylinder(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon ); + break; + } + case 2 : // il s agit d une sphere + { + aBoundaryAn->SetSphere(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon); + break; + } + case 3 : // il s agit d un cone defini par un axe et un angle + { + aBoundaryAn = myHomardGen->CreateBoundaryConeA(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone, _BoundaryAngle, \ + _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnYorigCone); + break; + } + case 4 : // il s agit d un cone defini par les 2 rayons + { + aBoundaryAn = myHomardGen->CreateBoundaryConeR(CORBA::string_dup(_Name.toStdString().c_str()), \ + _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1, \ + _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2); + break; + } + case 5 : // il s agit d un tore + { + aBoundaryAn->SetTorus(_BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis, _BoundaryAnRayon1, _BoundaryAnRayon2 ); + break; + } + } + if (Chgt) myHomardGen->InvalideBoundary(_Name.toStdString().c_str()); + //HOMARD_UTILS::updateObjBrowser(); + return true; +} + +// -------------------------------------------------------------------------------------- +/* Constructs a SMESH_EditBoundaryCAO + herite de SMESH_CreateBoundaryCAO +*/ +// -------------------------------------------------------------------------------------- +SMESH_EditBoundaryCAO::SMESH_EditBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString Name): + SMESH_CreateBoundaryCAO(parent, modal, myHomardGen0, 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())); + InitValEdit(); + } + catch( SALOME::SALOME_Exception& S_ex ) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return; + } + + SMESHHOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _listeGroupesBoundary << QString(maListe[i]); + +} +// ------------------------------ +SMESH_EditBoundaryCAO::~SMESH_EditBoundaryCAO() +// ------------------------------ +{ +} +// ------------------------------ +void SMESH_EditBoundaryCAO::InitValEdit() +// ------------------------------ +{ + LEName->setText(_aName); + LEName->setReadOnly(true); + + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); + LEFileName->setReadOnly(1); + PushFichier->setVisible(0); +// + adjustSize(); +} +// ------------------------------ +bool SMESH_EditBoundaryCAO::PushOnApply() +// ------------------------------ +{ + return true; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryCAO::SetFiltrage() +// ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + //SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); + //SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + + SMESH_EditListGroupCAO *aDlg = new SMESH_EditListGroupCAO + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", _listeGroupesBoundary) ; + aDlg->show(); +} + +// ------------------------------------------------------------------------------------ +/* Constructs a SMESH_EditBoundaryDi + herite de SMESH_CreateBoundaryDi +*/ +// ------------------------------------------------------------------------------------ +SMESH_EditBoundaryDi::SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString Name): + SMESH_CreateBoundaryDi(parent, modal, myHomardGen0, caseName, Name) +{ + MESSAGE("Debut de Boundary pour " << Name.toStdString().c_str()); + setWindowTitle(QObject::tr("HOM_BOUN_D_EDIT_WINDOW_TITLE")); + try { + aBoundary = myHomardGen->GetBoundary(CORBA::string_dup(_aName.toStdString().c_str())); + InitValEdit(); + } + catch( SALOME::SALOME_Exception& S_ex ) { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr(CORBA::string_dup(S_ex.details.text)) ); + return; + } + + SMESHHOMARD::ListGroupType_var maListe = aBoundary->GetGroups(); + for ( int i = 0; i < maListe->length(); i++ ) + _listeGroupesBoundary << QString(maListe[i]); + +} +// ------------------------------ +SMESH_EditBoundaryDi::~SMESH_EditBoundaryDi() +// ------------------------------ +{ +} +// ------------------------------ +void SMESH_EditBoundaryDi::InitValEdit() +// ------------------------------ +{ + LEName->setText(_aName); + LEName->setReadOnly(true); + + QString aDataFile = aBoundary->GetDataFile(); + LEFileName->setText(aDataFile); + LEFileName->setReadOnly(1); + PushFichier->setVisible(0); +// + adjustSize(); +} +// ------------------------------ +bool SMESH_EditBoundaryDi::PushOnApply() +// ------------------------------ +{ + return true; +} +// ------------------------------------------------------------------------ +void SMESH_EditBoundaryDi::SetFiltrage() +// // ------------------------------------------------------------------------ +{ + if (!CBGroupe->isChecked()) return; + SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); + SMESHHOMARD::ListGroupType_var _listeGroupesCas = monCas->GetGroups(); + + SMESH_EditListGroup *aDlg = new SMESH_EditListGroup + (this, true, SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen), + "Case_1", _listeGroupesBoundary); + aDlg->show(); +} diff --git a/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h new file mode 100644 index 000000000..b327ec646 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardBoundaryDlg.h @@ -0,0 +1,1244 @@ +// Copyright (C) 2011-2021 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_CREATEBOUNDARY_H +#define MON_CREATEBOUNDARY_H + +#include "SMESH_SMESHGUI.hxx" + +#include +#include + +#include CORBA_CLIENT_HEADER(SMESH_Homard) + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SMESHGUI_HomardAdaptDlg; + +class SMESH_Ui_CreateBoundaryAn +{ +public: + QGridLayout *gridLayout_5; + QLabel *Name; + QLineEdit *LEName; + QGroupBox *TypeBoundary; + QGridLayout *gridLayout; + QRadioButton *RBCylindre; + QRadioButton *RBSphere; + QRadioButton *RBCone; + QRadioButton *RBTore; + QGroupBox *gBCylindre; + QGridLayout *gridLayout1; + QDoubleSpinBox *SpinBox_Xcent; + QLabel *TLXcent; + QDoubleSpinBox *SpinBox_Radius; + QDoubleSpinBox *SpinBox_Zcent; + QLabel *TLradius; + QLabel *TLZcent; + QLabel *TLYcent; + QDoubleSpinBox *SpinBox_Ycent; + QLabel *TLXaxis; + QLabel *TLYaxis; + QLabel *TLZaxis; + QDoubleSpinBox *SpinBox_Zaxis; + QDoubleSpinBox *SpinBox_Yaxis; + QDoubleSpinBox *SpinBox_Xaxis; + QGroupBox *gBSphere; + QGridLayout *gridLayout2; + QDoubleSpinBox *SpinBox_Rayon; + QDoubleSpinBox *SpinBox_Zcentre; + QLabel *TLRayon; + QLabel *TLZcentre; + QLabel *TLYcentre; + QDoubleSpinBox *SpinBox_Ycentre; + QDoubleSpinBox *SpinBox_Xcentre; + QLabel *TLXcentre; + QGroupBox *gBCone; + QGridLayout *gridLayout_3; + QGroupBox *groupBox; + QGridLayout *gridLayout_2; + QRadioButton *RB_Def_radius; + QRadioButton *RB_Def_angle; + QLabel *TLCone_X1; + QDoubleSpinBox *SpinBox_Cone_X1; + QLabel *TLCone_X2; + QDoubleSpinBox *SpinBox_Cone_X2; + QLabel *TLCone_Y1; + QDoubleSpinBox *SpinBox_Cone_Y1; + QLabel *TLCone_Y2; + QDoubleSpinBox *SpinBox_Cone_Y2; + QLabel *TLCone_Z1; + QDoubleSpinBox *SpinBox_Cone_Z1; + QLabel *TLCone_Z2; + QDoubleSpinBox *SpinBox_Cone_Z2; + QLabel *TLCone_V1; + QDoubleSpinBox *SpinBox_Cone_V1; + QLabel *TLCone_V2; + QDoubleSpinBox *SpinBox_Cone_V2; + QGroupBox *gBTore; + QGridLayout *gridLayout_4; + QLabel *TLToreXcent; + QDoubleSpinBox *SpinBoxToreXcent; + QLabel *TLToreXaxe; + QDoubleSpinBox *SpinBoxToreXaxe; + QLabel *TLToreYcent; + QDoubleSpinBox *SpinBoxToreYcent; + QLabel *TLToreYaxe; + QDoubleSpinBox *SpinBoxToreYaxe; + QLabel *TLToreZcent; + QDoubleSpinBox *SpinBoxToreZcent; + QLabel *TLToreZaxe; + QDoubleSpinBox *SpinBoxToreZaxe; + QLabel *TLToreRayRev; + QDoubleSpinBox *SpinBoxToreRRev; + QLabel *TLToreRayPri; + QDoubleSpinBox *SpinBoxToreRPri; + QGroupBox *GBButtons; + QGridLayout *gridLayout3; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + + void setupUi(QDialog *CreateBoundaryAn) + { + if (CreateBoundaryAn->objectName().isEmpty()) + CreateBoundaryAn->setObjectName(QString::fromUtf8("CreateBoundaryAn")); + CreateBoundaryAn->resize(522, 835); + CreateBoundaryAn->setAutoFillBackground(true); + CreateBoundaryAn->setSizeGripEnabled(true); + gridLayout_5 = new QGridLayout(CreateBoundaryAn); + gridLayout_5->setObjectName(QString::fromUtf8("gridLayout_5")); + Name = new QLabel(CreateBoundaryAn); + Name->setObjectName(QString::fromUtf8("Name")); + + gridLayout_5->addWidget(Name, 0, 0, 1, 1); + + LEName = new QLineEdit(CreateBoundaryAn); + LEName->setObjectName(QString::fromUtf8("LEName")); + LEName->setMaxLength(32); + + gridLayout_5->addWidget(LEName, 0, 1, 1, 1); + + TypeBoundary = new QGroupBox(CreateBoundaryAn); + TypeBoundary->setObjectName(QString::fromUtf8("TypeBoundary")); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(TypeBoundary->sizePolicy().hasHeightForWidth()); + TypeBoundary->setSizePolicy(sizePolicy); + TypeBoundary->setMinimumSize(QSize(340, 0)); + gridLayout = new QGridLayout(TypeBoundary); + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + RBCylindre = new QRadioButton(TypeBoundary); + RBCylindre->setObjectName(QString::fromUtf8("RBCylindre")); + QIcon icon; + icon.addFile(QString::fromUtf8("../../resources/cylinderpointvector.png"), QSize(), QIcon::Normal, QIcon::Off); + RBCylindre->setIcon(icon); + RBCylindre->setCheckable(true); + RBCylindre->setChecked(true); + + gridLayout->addWidget(RBCylindre, 0, 0, 1, 1); + + RBSphere = new QRadioButton(TypeBoundary); + RBSphere->setObjectName(QString::fromUtf8("RBSphere")); + QIcon icon1; + icon1.addFile(QString::fromUtf8("../../resources/zone_spherepoint.png"), QSize(), QIcon::Normal, QIcon::Off); + RBSphere->setIcon(icon1); + + gridLayout->addWidget(RBSphere, 0, 1, 1, 1); + + RBCone = new QRadioButton(TypeBoundary); + RBCone->setObjectName(QString::fromUtf8("RBCone")); + QIcon icon2; + icon2.addFile(QString::fromUtf8("../../resources/cone.png"), QSize(), QIcon::Normal, QIcon::Off); + RBCone->setIcon(icon2); + + gridLayout->addWidget(RBCone, 0, 2, 1, 1); + + RBTore = new QRadioButton(TypeBoundary); + RBTore->setObjectName(QString::fromUtf8("RBTore")); + QIcon icon3; + icon3.addFile(QString::fromUtf8("../../resources/toruspointvector.png"), QSize(), QIcon::Normal, QIcon::Off); + RBTore->setIcon(icon3); + RBTore->setCheckable(true); + RBTore->setChecked(false); + + gridLayout->addWidget(RBTore, 0, 3, 1, 1); + + + gridLayout_5->addWidget(TypeBoundary, 1, 0, 1, 2); + + gBCylindre = new QGroupBox(CreateBoundaryAn); + gBCylindre->setObjectName(QString::fromUtf8("gBCylindre")); + sizePolicy.setHeightForWidth(gBCylindre->sizePolicy().hasHeightForWidth()); + gBCylindre->setSizePolicy(sizePolicy); + gridLayout1 = new QGridLayout(gBCylindre); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + SpinBox_Xcent = new QDoubleSpinBox(gBCylindre); + SpinBox_Xcent->setObjectName(QString::fromUtf8("SpinBox_Xcent")); + SpinBox_Xcent->setDecimals(5); + SpinBox_Xcent->setMinimum(-999999999.000000000000000); + SpinBox_Xcent->setMaximum(999999999.000000000000000); + SpinBox_Xcent->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Xcent, 0, 1, 1, 1); + + TLXcent = new QLabel(gBCylindre); + TLXcent->setObjectName(QString::fromUtf8("TLXcent")); + sizePolicy.setHeightForWidth(TLXcent->sizePolicy().hasHeightForWidth()); + TLXcent->setSizePolicy(sizePolicy); + TLXcent->setWordWrap(false); + + gridLayout1->addWidget(TLXcent, 0, 0, 1, 1); + + SpinBox_Radius = new QDoubleSpinBox(gBCylindre); + SpinBox_Radius->setObjectName(QString::fromUtf8("SpinBox_Radius")); + SpinBox_Radius->setDecimals(5); + SpinBox_Radius->setMaximum(1000000000.000000000000000); + + gridLayout1->addWidget(SpinBox_Radius, 3, 1, 1, 2); + + SpinBox_Zcent = new QDoubleSpinBox(gBCylindre); + SpinBox_Zcent->setObjectName(QString::fromUtf8("SpinBox_Zcent")); + SpinBox_Zcent->setDecimals(5); + SpinBox_Zcent->setMinimum(-999999999.000000000000000); + SpinBox_Zcent->setMaximum(999999999.000000000000000); + SpinBox_Zcent->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Zcent, 2, 1, 1, 1); + + TLradius = new QLabel(gBCylindre); + TLradius->setObjectName(QString::fromUtf8("TLradius")); + sizePolicy.setHeightForWidth(TLradius->sizePolicy().hasHeightForWidth()); + TLradius->setSizePolicy(sizePolicy); + TLradius->setWordWrap(false); + + gridLayout1->addWidget(TLradius, 3, 0, 1, 1); + + TLZcent = new QLabel(gBCylindre); + TLZcent->setObjectName(QString::fromUtf8("TLZcent")); + sizePolicy.setHeightForWidth(TLZcent->sizePolicy().hasHeightForWidth()); + TLZcent->setSizePolicy(sizePolicy); + TLZcent->setWordWrap(false); + + gridLayout1->addWidget(TLZcent, 2, 0, 1, 1); + + TLYcent = new QLabel(gBCylindre); + TLYcent->setObjectName(QString::fromUtf8("TLYcent")); + sizePolicy.setHeightForWidth(TLYcent->sizePolicy().hasHeightForWidth()); + TLYcent->setSizePolicy(sizePolicy); + TLYcent->setWordWrap(false); + + gridLayout1->addWidget(TLYcent, 1, 0, 1, 1); + + SpinBox_Ycent = new QDoubleSpinBox(gBCylindre); + SpinBox_Ycent->setObjectName(QString::fromUtf8("SpinBox_Ycent")); + SpinBox_Ycent->setDecimals(5); + SpinBox_Ycent->setMinimum(-999999999.000000000000000); + SpinBox_Ycent->setMaximum(999999999.000000000000000); + SpinBox_Ycent->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Ycent, 1, 1, 1, 1); + + TLXaxis = new QLabel(gBCylindre); + TLXaxis->setObjectName(QString::fromUtf8("TLXaxis")); + sizePolicy.setHeightForWidth(TLXaxis->sizePolicy().hasHeightForWidth()); + TLXaxis->setSizePolicy(sizePolicy); + TLXaxis->setWordWrap(false); + + gridLayout1->addWidget(TLXaxis, 0, 2, 1, 1); + + TLYaxis = new QLabel(gBCylindre); + TLYaxis->setObjectName(QString::fromUtf8("TLYaxis")); + sizePolicy.setHeightForWidth(TLYaxis->sizePolicy().hasHeightForWidth()); + TLYaxis->setSizePolicy(sizePolicy); + TLYaxis->setWordWrap(false); + + gridLayout1->addWidget(TLYaxis, 1, 2, 1, 1); + + TLZaxis = new QLabel(gBCylindre); + TLZaxis->setObjectName(QString::fromUtf8("TLZaxis")); + sizePolicy.setHeightForWidth(TLZaxis->sizePolicy().hasHeightForWidth()); + TLZaxis->setSizePolicy(sizePolicy); + TLZaxis->setWordWrap(false); + + gridLayout1->addWidget(TLZaxis, 2, 2, 1, 1); + + SpinBox_Zaxis = new QDoubleSpinBox(gBCylindre); + SpinBox_Zaxis->setObjectName(QString::fromUtf8("SpinBox_Zaxis")); + SpinBox_Zaxis->setDecimals(5); + SpinBox_Zaxis->setMinimum(-999999999.000000000000000); + SpinBox_Zaxis->setMaximum(999999999.000000000000000); + SpinBox_Zaxis->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Zaxis, 2, 3, 1, 1); + + SpinBox_Yaxis = new QDoubleSpinBox(gBCylindre); + SpinBox_Yaxis->setObjectName(QString::fromUtf8("SpinBox_Yaxis")); + SpinBox_Yaxis->setDecimals(5); + SpinBox_Yaxis->setMinimum(-999999999.000000000000000); + SpinBox_Yaxis->setMaximum(999999999.000000000000000); + SpinBox_Yaxis->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Yaxis, 1, 3, 1, 1); + + SpinBox_Xaxis = new QDoubleSpinBox(gBCylindre); + SpinBox_Xaxis->setObjectName(QString::fromUtf8("SpinBox_Xaxis")); + SpinBox_Xaxis->setDecimals(5); + SpinBox_Xaxis->setMinimum(-999999999.000000000000000); + SpinBox_Xaxis->setMaximum(999999999.000000000000000); + SpinBox_Xaxis->setValue(0.000000000000000); + + gridLayout1->addWidget(SpinBox_Xaxis, 0, 3, 1, 1); + + + gridLayout_5->addWidget(gBCylindre, 2, 0, 1, 2); + + gBSphere = new QGroupBox(CreateBoundaryAn); + gBSphere->setObjectName(QString::fromUtf8("gBSphere")); + sizePolicy.setHeightForWidth(gBSphere->sizePolicy().hasHeightForWidth()); + gBSphere->setSizePolicy(sizePolicy); + gridLayout2 = new QGridLayout(gBSphere); +#ifndef Q_OS_MAC + gridLayout2->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout2->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout2->setObjectName(QString::fromUtf8("gridLayout2")); + SpinBox_Rayon = new QDoubleSpinBox(gBSphere); + SpinBox_Rayon->setObjectName(QString::fromUtf8("SpinBox_Rayon")); + SpinBox_Rayon->setDecimals(5); + SpinBox_Rayon->setMinimum(0.000000000000000); + SpinBox_Rayon->setMaximum(999999999.000000000000000); + SpinBox_Rayon->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Rayon, 1, 3, 1, 1); + + SpinBox_Zcentre = new QDoubleSpinBox(gBSphere); + SpinBox_Zcentre->setObjectName(QString::fromUtf8("SpinBox_Zcentre")); + SpinBox_Zcentre->setDecimals(5); + SpinBox_Zcentre->setMinimum(-999999999.000000000000000); + SpinBox_Zcentre->setMaximum(999999999.000000000000000); + SpinBox_Zcentre->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Zcentre, 2, 1, 1, 1); + + TLRayon = new QLabel(gBSphere); + TLRayon->setObjectName(QString::fromUtf8("TLRayon")); + sizePolicy.setHeightForWidth(TLRayon->sizePolicy().hasHeightForWidth()); + TLRayon->setSizePolicy(sizePolicy); + TLRayon->setWordWrap(false); + + gridLayout2->addWidget(TLRayon, 1, 2, 1, 1); + + TLZcentre = new QLabel(gBSphere); + TLZcentre->setObjectName(QString::fromUtf8("TLZcentre")); + sizePolicy.setHeightForWidth(TLZcentre->sizePolicy().hasHeightForWidth()); + TLZcentre->setSizePolicy(sizePolicy); + TLZcentre->setWordWrap(false); + + gridLayout2->addWidget(TLZcentre, 2, 0, 1, 1); + + TLYcentre = new QLabel(gBSphere); + TLYcentre->setObjectName(QString::fromUtf8("TLYcentre")); + sizePolicy.setHeightForWidth(TLYcentre->sizePolicy().hasHeightForWidth()); + TLYcentre->setSizePolicy(sizePolicy); + TLYcentre->setWordWrap(false); + + gridLayout2->addWidget(TLYcentre, 1, 0, 1, 1); + + SpinBox_Ycentre = new QDoubleSpinBox(gBSphere); + SpinBox_Ycentre->setObjectName(QString::fromUtf8("SpinBox_Ycentre")); + SpinBox_Ycentre->setDecimals(5); + SpinBox_Ycentre->setMinimum(-999999999.000000000000000); + SpinBox_Ycentre->setMaximum(999999999.000000000000000); + SpinBox_Ycentre->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Ycentre, 1, 1, 1, 1); + + SpinBox_Xcentre = new QDoubleSpinBox(gBSphere); + SpinBox_Xcentre->setObjectName(QString::fromUtf8("SpinBox_Xcentre")); + SpinBox_Xcentre->setDecimals(5); + SpinBox_Xcentre->setMinimum(-999999999.000000000000000); + SpinBox_Xcentre->setMaximum(999999999.000000000000000); + SpinBox_Xcentre->setValue(0.000000000000000); + + gridLayout2->addWidget(SpinBox_Xcentre, 0, 1, 1, 1); + + TLXcentre = new QLabel(gBSphere); + TLXcentre->setObjectName(QString::fromUtf8("TLXcentre")); + sizePolicy.setHeightForWidth(TLXcentre->sizePolicy().hasHeightForWidth()); + TLXcentre->setSizePolicy(sizePolicy); + TLXcentre->setWordWrap(false); + + gridLayout2->addWidget(TLXcentre, 0, 0, 1, 1); + + + gridLayout_5->addWidget(gBSphere, 3, 0, 1, 2); + + gBCone = new QGroupBox(CreateBoundaryAn); + gBCone->setObjectName(QString::fromUtf8("gBCone")); + sizePolicy.setHeightForWidth(gBCone->sizePolicy().hasHeightForWidth()); + gBCone->setSizePolicy(sizePolicy); + gridLayout_3 = new QGridLayout(gBCone); + gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3")); + groupBox = new QGroupBox(gBCone); + groupBox->setObjectName(QString::fromUtf8("groupBox")); + gridLayout_2 = new QGridLayout(groupBox); + gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); + RB_Def_radius = new QRadioButton(groupBox); + RB_Def_radius->setObjectName(QString::fromUtf8("RB_Def_radius")); + QIcon icon4; + icon4.addFile(QString::fromUtf8("../../resources/conedxyz.png"), QSize(), QIcon::Normal, QIcon::Off); + RB_Def_radius->setIcon(icon4); + RB_Def_radius->setChecked(true); + + gridLayout_2->addWidget(RB_Def_radius, 0, 0, 1, 1); + + RB_Def_angle = new QRadioButton(groupBox); + RB_Def_angle->setObjectName(QString::fromUtf8("RB_Def_angle")); + QIcon icon5; + icon5.addFile(QString::fromUtf8("../../resources/conepointvector.png"), QSize(), QIcon::Normal, QIcon::Off); + RB_Def_angle->setIcon(icon5); + + gridLayout_2->addWidget(RB_Def_angle, 0, 1, 1, 1); + + + gridLayout_3->addWidget(groupBox, 0, 0, 1, 2); + + TLCone_X1 = new QLabel(gBCone); + TLCone_X1->setObjectName(QString::fromUtf8("TLCone_X1")); + sizePolicy.setHeightForWidth(TLCone_X1->sizePolicy().hasHeightForWidth()); + TLCone_X1->setSizePolicy(sizePolicy); + TLCone_X1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_X1, 1, 0, 1, 1); + + SpinBox_Cone_X1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_X1->setObjectName(QString::fromUtf8("SpinBox_Cone_X1")); + SpinBox_Cone_X1->setDecimals(5); + SpinBox_Cone_X1->setMinimum(-999999999.000000000000000); + SpinBox_Cone_X1->setMaximum(999999999.000000000000000); + SpinBox_Cone_X1->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_X1, 1, 1, 1, 1); + + TLCone_X2 = new QLabel(gBCone); + TLCone_X2->setObjectName(QString::fromUtf8("TLCone_X2")); + sizePolicy.setHeightForWidth(TLCone_X2->sizePolicy().hasHeightForWidth()); + TLCone_X2->setSizePolicy(sizePolicy); + TLCone_X2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_X2, 1, 2, 1, 1); + + SpinBox_Cone_X2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_X2->setObjectName(QString::fromUtf8("SpinBox_Cone_X2")); + SpinBox_Cone_X2->setDecimals(5); + SpinBox_Cone_X2->setMinimum(-999999999.000000000000000); + SpinBox_Cone_X2->setMaximum(999999999.000000000000000); + SpinBox_Cone_X2->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_X2, 1, 3, 1, 1); + + TLCone_Y1 = new QLabel(gBCone); + TLCone_Y1->setObjectName(QString::fromUtf8("TLCone_Y1")); + sizePolicy.setHeightForWidth(TLCone_Y1->sizePolicy().hasHeightForWidth()); + TLCone_Y1->setSizePolicy(sizePolicy); + TLCone_Y1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Y1, 2, 0, 1, 1); + + SpinBox_Cone_Y1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Y1->setObjectName(QString::fromUtf8("SpinBox_Cone_Y1")); + SpinBox_Cone_Y1->setDecimals(5); + SpinBox_Cone_Y1->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Y1->setMaximum(999999999.000000000000000); + SpinBox_Cone_Y1->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Y1, 2, 1, 1, 1); + + TLCone_Y2 = new QLabel(gBCone); + TLCone_Y2->setObjectName(QString::fromUtf8("TLCone_Y2")); + sizePolicy.setHeightForWidth(TLCone_Y2->sizePolicy().hasHeightForWidth()); + TLCone_Y2->setSizePolicy(sizePolicy); + TLCone_Y2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Y2, 2, 2, 1, 1); + + SpinBox_Cone_Y2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Y2->setObjectName(QString::fromUtf8("SpinBox_Cone_Y2")); + SpinBox_Cone_Y2->setDecimals(5); + SpinBox_Cone_Y2->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Y2->setMaximum(999999999.000000000000000); + SpinBox_Cone_Y2->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Y2, 2, 3, 1, 1); + + TLCone_Z1 = new QLabel(gBCone); + TLCone_Z1->setObjectName(QString::fromUtf8("TLCone_Z1")); + sizePolicy.setHeightForWidth(TLCone_Z1->sizePolicy().hasHeightForWidth()); + TLCone_Z1->setSizePolicy(sizePolicy); + TLCone_Z1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Z1, 3, 0, 1, 1); + + SpinBox_Cone_Z1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Z1->setObjectName(QString::fromUtf8("SpinBox_Cone_Z1")); + SpinBox_Cone_Z1->setDecimals(5); + SpinBox_Cone_Z1->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Z1->setMaximum(999999999.000000000000000); + SpinBox_Cone_Z1->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Z1, 3, 1, 1, 1); + + TLCone_Z2 = new QLabel(gBCone); + TLCone_Z2->setObjectName(QString::fromUtf8("TLCone_Z2")); + sizePolicy.setHeightForWidth(TLCone_Z2->sizePolicy().hasHeightForWidth()); + TLCone_Z2->setSizePolicy(sizePolicy); + TLCone_Z2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_Z2, 3, 2, 1, 1); + + SpinBox_Cone_Z2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_Z2->setObjectName(QString::fromUtf8("SpinBox_Cone_Z2")); + SpinBox_Cone_Z2->setDecimals(5); + SpinBox_Cone_Z2->setMinimum(-999999999.000000000000000); + SpinBox_Cone_Z2->setMaximum(999999999.000000000000000); + SpinBox_Cone_Z2->setValue(0.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_Z2, 3, 3, 1, 1); + + TLCone_V1 = new QLabel(gBCone); + TLCone_V1->setObjectName(QString::fromUtf8("TLCone_V1")); + sizePolicy.setHeightForWidth(TLCone_V1->sizePolicy().hasHeightForWidth()); + TLCone_V1->setSizePolicy(sizePolicy); + TLCone_V1->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_V1, 4, 0, 1, 1); + + SpinBox_Cone_V1 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_V1->setObjectName(QString::fromUtf8("SpinBox_Cone_V1")); + SpinBox_Cone_V1->setDecimals(5); + SpinBox_Cone_V1->setMaximum(1000000000.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_V1, 4, 1, 1, 1); + + TLCone_V2 = new QLabel(gBCone); + TLCone_V2->setObjectName(QString::fromUtf8("TLCone_V2")); + sizePolicy.setHeightForWidth(TLCone_V2->sizePolicy().hasHeightForWidth()); + TLCone_V2->setSizePolicy(sizePolicy); + TLCone_V2->setWordWrap(false); + + gridLayout_3->addWidget(TLCone_V2, 4, 2, 1, 1); + + SpinBox_Cone_V2 = new QDoubleSpinBox(gBCone); + SpinBox_Cone_V2->setObjectName(QString::fromUtf8("SpinBox_Cone_V2")); + SpinBox_Cone_V2->setDecimals(5); + SpinBox_Cone_V2->setMaximum(1000000000.000000000000000); + + gridLayout_3->addWidget(SpinBox_Cone_V2, 4, 3, 1, 1); + + + gridLayout_5->addWidget(gBCone, 4, 0, 1, 2); + + gBTore = new QGroupBox(CreateBoundaryAn); + gBTore->setObjectName(QString::fromUtf8("gBTore")); + sizePolicy.setHeightForWidth(gBTore->sizePolicy().hasHeightForWidth()); + gBTore->setSizePolicy(sizePolicy); + gridLayout_4 = new QGridLayout(gBTore); + gridLayout_4->setObjectName(QString::fromUtf8("gridLayout_4")); + TLToreXcent = new QLabel(gBTore); + TLToreXcent->setObjectName(QString::fromUtf8("TLToreXcent")); + sizePolicy.setHeightForWidth(TLToreXcent->sizePolicy().hasHeightForWidth()); + TLToreXcent->setSizePolicy(sizePolicy); + TLToreXcent->setWordWrap(false); + + gridLayout_4->addWidget(TLToreXcent, 0, 0, 1, 1); + + SpinBoxToreXcent = new QDoubleSpinBox(gBTore); + SpinBoxToreXcent->setObjectName(QString::fromUtf8("SpinBoxToreXcent")); + SpinBoxToreXcent->setDecimals(5); + SpinBoxToreXcent->setMinimum(-999999999.000000000000000); + SpinBoxToreXcent->setMaximum(999999999.000000000000000); + SpinBoxToreXcent->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreXcent, 0, 1, 1, 1); + + TLToreXaxe = new QLabel(gBTore); + TLToreXaxe->setObjectName(QString::fromUtf8("TLToreXaxe")); + sizePolicy.setHeightForWidth(TLToreXaxe->sizePolicy().hasHeightForWidth()); + TLToreXaxe->setSizePolicy(sizePolicy); + TLToreXaxe->setWordWrap(false); + + gridLayout_4->addWidget(TLToreXaxe, 0, 2, 1, 1); + + SpinBoxToreXaxe = new QDoubleSpinBox(gBTore); + SpinBoxToreXaxe->setObjectName(QString::fromUtf8("SpinBoxToreXaxe")); + SpinBoxToreXaxe->setDecimals(5); + SpinBoxToreXaxe->setMinimum(-999999999.000000000000000); + SpinBoxToreXaxe->setMaximum(999999999.000000000000000); + SpinBoxToreXaxe->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreXaxe, 0, 3, 1, 1); + + TLToreYcent = new QLabel(gBTore); + TLToreYcent->setObjectName(QString::fromUtf8("TLToreYcent")); + sizePolicy.setHeightForWidth(TLToreYcent->sizePolicy().hasHeightForWidth()); + TLToreYcent->setSizePolicy(sizePolicy); + TLToreYcent->setWordWrap(false); + + gridLayout_4->addWidget(TLToreYcent, 1, 0, 1, 1); + + SpinBoxToreYcent = new QDoubleSpinBox(gBTore); + SpinBoxToreYcent->setObjectName(QString::fromUtf8("SpinBoxToreYcent")); + SpinBoxToreYcent->setDecimals(5); + SpinBoxToreYcent->setMinimum(-999999999.000000000000000); + SpinBoxToreYcent->setMaximum(999999999.000000000000000); + SpinBoxToreYcent->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreYcent, 1, 1, 1, 1); + + TLToreYaxe = new QLabel(gBTore); + TLToreYaxe->setObjectName(QString::fromUtf8("TLToreYaxe")); + sizePolicy.setHeightForWidth(TLToreYaxe->sizePolicy().hasHeightForWidth()); + TLToreYaxe->setSizePolicy(sizePolicy); + TLToreYaxe->setWordWrap(false); + + gridLayout_4->addWidget(TLToreYaxe, 1, 2, 1, 1); + + SpinBoxToreYaxe = new QDoubleSpinBox(gBTore); + SpinBoxToreYaxe->setObjectName(QString::fromUtf8("SpinBoxToreYaxe")); + SpinBoxToreYaxe->setDecimals(5); + SpinBoxToreYaxe->setMinimum(-999999999.000000000000000); + SpinBoxToreYaxe->setMaximum(999999999.000000000000000); + SpinBoxToreYaxe->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreYaxe, 1, 3, 1, 1); + + TLToreZcent = new QLabel(gBTore); + TLToreZcent->setObjectName(QString::fromUtf8("TLToreZcent")); + sizePolicy.setHeightForWidth(TLToreZcent->sizePolicy().hasHeightForWidth()); + TLToreZcent->setSizePolicy(sizePolicy); + TLToreZcent->setWordWrap(false); + + gridLayout_4->addWidget(TLToreZcent, 2, 0, 1, 1); + + SpinBoxToreZcent = new QDoubleSpinBox(gBTore); + SpinBoxToreZcent->setObjectName(QString::fromUtf8("SpinBoxToreZcent")); + SpinBoxToreZcent->setDecimals(5); + SpinBoxToreZcent->setMinimum(-999999999.000000000000000); + SpinBoxToreZcent->setMaximum(999999999.000000000000000); + SpinBoxToreZcent->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreZcent, 2, 1, 1, 1); + + TLToreZaxe = new QLabel(gBTore); + TLToreZaxe->setObjectName(QString::fromUtf8("TLToreZaxe")); + sizePolicy.setHeightForWidth(TLToreZaxe->sizePolicy().hasHeightForWidth()); + TLToreZaxe->setSizePolicy(sizePolicy); + TLToreZaxe->setWordWrap(false); + + gridLayout_4->addWidget(TLToreZaxe, 2, 2, 1, 1); + + SpinBoxToreZaxe = new QDoubleSpinBox(gBTore); + SpinBoxToreZaxe->setObjectName(QString::fromUtf8("SpinBoxToreZaxe")); + SpinBoxToreZaxe->setDecimals(5); + SpinBoxToreZaxe->setMinimum(-999999999.000000000000000); + SpinBoxToreZaxe->setMaximum(999999999.000000000000000); + SpinBoxToreZaxe->setValue(0.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreZaxe, 2, 3, 1, 1); + + TLToreRayRev = new QLabel(gBTore); + TLToreRayRev->setObjectName(QString::fromUtf8("TLToreRayRev")); + sizePolicy.setHeightForWidth(TLToreRayRev->sizePolicy().hasHeightForWidth()); + TLToreRayRev->setSizePolicy(sizePolicy); + TLToreRayRev->setWordWrap(false); + + gridLayout_4->addWidget(TLToreRayRev, 3, 0, 1, 1); + + SpinBoxToreRRev = new QDoubleSpinBox(gBTore); + SpinBoxToreRRev->setObjectName(QString::fromUtf8("SpinBoxToreRRev")); + SpinBoxToreRRev->setDecimals(5); + SpinBoxToreRRev->setMaximum(1000000000.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreRRev, 3, 1, 1, 1); + + TLToreRayPri = new QLabel(gBTore); + TLToreRayPri->setObjectName(QString::fromUtf8("TLToreRayPri")); + sizePolicy.setHeightForWidth(TLToreRayPri->sizePolicy().hasHeightForWidth()); + TLToreRayPri->setSizePolicy(sizePolicy); + TLToreRayPri->setWordWrap(false); + + gridLayout_4->addWidget(TLToreRayPri, 3, 2, 1, 1); + + SpinBoxToreRPri = new QDoubleSpinBox(gBTore); + SpinBoxToreRPri->setObjectName(QString::fromUtf8("SpinBoxToreRPri")); + SpinBoxToreRPri->setDecimals(5); + SpinBoxToreRPri->setMaximum(1000000000.000000000000000); + + gridLayout_4->addWidget(SpinBoxToreRPri, 3, 3, 1, 1); + + + gridLayout_5->addWidget(gBTore, 5, 0, 1, 2); + + GBButtons = new QGroupBox(CreateBoundaryAn); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + sizePolicy.setHeightForWidth(GBButtons->sizePolicy().hasHeightForWidth()); + GBButtons->setSizePolicy(sizePolicy); + gridLayout3 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout3->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout3->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout3->setObjectName(QString::fromUtf8("gridLayout3")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout3->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout3->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout3->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout3->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout_5->addWidget(GBButtons, 6, 0, 1, 2); + + + retranslateUi(CreateBoundaryAn); + + QMetaObject::connectSlotsByName(CreateBoundaryAn); + } // setupUi + + void retranslateUi(QDialog *CreateBoundaryAn) + { + CreateBoundaryAn->setWindowTitle(QApplication::translate("CreateBoundaryAn", "Create an analytical boundary", nullptr)); + Name->setText(QApplication::translate("CreateBoundaryAn", "Name", nullptr)); + TypeBoundary->setTitle(QApplication::translate("CreateBoundaryAn", "Type of boundary", nullptr)); + RBCylindre->setText(QApplication::translate("CreateBoundaryAn", "Cylinder", nullptr)); + RBSphere->setText(QApplication::translate("CreateBoundaryAn", "Sphere", nullptr)); + RBCone->setText(QApplication::translate("CreateBoundaryAn", "Cone", nullptr)); + RBTore->setText(QApplication::translate("CreateBoundaryAn", "Torus", nullptr)); + gBCylindre->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + TLXcent->setText(QApplication::translate("CreateBoundaryAn", "X centre", nullptr)); + TLradius->setText(QApplication::translate("CreateBoundaryAn", "Radius", nullptr)); + TLZcent->setText(QApplication::translate("CreateBoundaryAn", "Z centre", nullptr)); + TLYcent->setText(QApplication::translate("CreateBoundaryAn", "Y centre", nullptr)); + TLXaxis->setText(QApplication::translate("CreateBoundaryAn", "X axis", nullptr)); + TLYaxis->setText(QApplication::translate("CreateBoundaryAn", "Y axis", nullptr)); + TLZaxis->setText(QApplication::translate("CreateBoundaryAn", "Z axis", nullptr)); + gBSphere->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + TLRayon->setText(QApplication::translate("CreateBoundaryAn", "Radius", nullptr)); + TLZcentre->setText(QApplication::translate("CreateBoundaryAn", "Z centre", nullptr)); + TLYcentre->setText(QApplication::translate("CreateBoundaryAn", "Y centre", nullptr)); + TLXcentre->setText(QApplication::translate("CreateBoundaryAn", "X centre", nullptr)); + gBCone->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + groupBox->setTitle(QApplication::translate("CreateBoundaryAn", "Definition", nullptr)); + RB_Def_radius->setText(QApplication::translate("CreateBoundaryAn", "Radius", nullptr)); + RB_Def_angle->setText(QApplication::translate("CreateBoundaryAn", "Angle", nullptr)); + TLCone_X1->setText(QApplication::translate("CreateBoundaryAn", "X 1", nullptr)); + TLCone_X2->setText(QApplication::translate("CreateBoundaryAn", "X 2", nullptr)); + TLCone_Y1->setText(QApplication::translate("CreateBoundaryAn", "Y 1", nullptr)); + TLCone_Y2->setText(QApplication::translate("CreateBoundaryAn", "Y 2", nullptr)); + TLCone_Z1->setText(QApplication::translate("CreateBoundaryAn", "Z 1", nullptr)); + TLCone_Z2->setText(QApplication::translate("CreateBoundaryAn", "Z 2", nullptr)); + TLCone_V1->setText(QApplication::translate("CreateBoundaryAn", "V 1", nullptr)); + TLCone_V2->setText(QApplication::translate("CreateBoundaryAn", "V 2", nullptr)); + gBTore->setTitle(QApplication::translate("CreateBoundaryAn", "Coordinates", nullptr)); + TLToreXcent->setText(QApplication::translate("CreateBoundaryAn", "X centre", nullptr)); + TLToreXaxe->setText(QApplication::translate("CreateBoundaryAn", "X axis", nullptr)); + TLToreYcent->setText(QApplication::translate("CreateBoundaryAn", "Y centre", nullptr)); + TLToreYaxe->setText(QApplication::translate("CreateBoundaryAn", "Y axis", nullptr)); + TLToreZcent->setText(QApplication::translate("CreateBoundaryAn", "Z centre", nullptr)); + TLToreZaxe->setText(QApplication::translate("CreateBoundaryAn", "Z axis", nullptr)); + TLToreRayRev->setText(QApplication::translate("CreateBoundaryAn", "R revolution", nullptr)); + TLToreRayPri->setText(QApplication::translate("CreateBoundaryAn", "Primary R", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateBoundaryAn", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateBoundaryAn", "Cancel", nullptr)); + buttonApply->setText(QApplication::translate("CreateBoundaryAn", "Apply", nullptr)); + buttonOk->setText(QApplication::translate("CreateBoundaryAn", "OK", nullptr)); + } // retranslateUi +}; + +class SMESH_Ui_CreateBoundaryCAO +{ +public: + QGridLayout *gridLayout; + QGroupBox *GBButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + QCheckBox *CBGroupe; + QLineEdit *LEFileName; + QPushButton *PushFichier; + QLabel *XAO; + QLineEdit *LEName; + QLabel *Name; + + void setupUi(QDialog *CreateBoundaryCAO) + { + if (CreateBoundaryCAO->objectName().isEmpty()) + CreateBoundaryCAO->setObjectName(QString::fromUtf8("CreateBoundaryCAO")); + CreateBoundaryCAO->resize(566, 195); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(CreateBoundaryCAO->sizePolicy().hasHeightForWidth()); + CreateBoundaryCAO->setSizePolicy(sizePolicy); + CreateBoundaryCAO->setAutoFillBackground(true); + CreateBoundaryCAO->setSizeGripEnabled(true); + gridLayout = new QGridLayout(CreateBoundaryCAO); +#ifndef Q_OS_MAC + gridLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + GBButtons = new QGroupBox(CreateBoundaryCAO); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + gridLayout1 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout1->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout->addWidget(GBButtons, 3, 0, 1, 3); + + CBGroupe = new QCheckBox(CreateBoundaryCAO); + CBGroupe->setObjectName(QString::fromUtf8("CBGroupe")); + + gridLayout->addWidget(CBGroupe, 2, 0, 1, 3); + + LEFileName = new QLineEdit(CreateBoundaryCAO); + LEFileName->setObjectName(QString::fromUtf8("LEFileName")); + LEFileName->setMinimumSize(QSize(370, 21)); + + gridLayout->addWidget(LEFileName, 1, 2, 1, 1); + + PushFichier = new QPushButton(CreateBoundaryCAO); + PushFichier->setObjectName(QString::fromUtf8("PushFichier")); + + gridLayout->addWidget(PushFichier, 1, 1, 1, 1); + + XAO = new QLabel(CreateBoundaryCAO); + XAO->setObjectName(QString::fromUtf8("XAO")); + + gridLayout->addWidget(XAO, 1, 0, 1, 1); + + LEName = new QLineEdit(CreateBoundaryCAO); + LEName->setObjectName(QString::fromUtf8("LEName")); + LEName->setMinimumSize(QSize(382, 21)); + LEName->setMaxLength(32); + + gridLayout->addWidget(LEName, 0, 1, 1, 2); + + Name = new QLabel(CreateBoundaryCAO); + Name->setObjectName(QString::fromUtf8("Name")); + + gridLayout->addWidget(Name, 0, 0, 1, 1); + + + retranslateUi(CreateBoundaryCAO); + + QMetaObject::connectSlotsByName(CreateBoundaryCAO); + } // setupUi + + void retranslateUi(QDialog *CreateBoundaryCAO) + { + CreateBoundaryCAO->setWindowTitle(QApplication::translate("CreateBoundaryCAO", "Get CAO", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateBoundaryCAO", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateBoundaryCAO", "Cancel", nullptr)); + buttonApply->setText(QApplication::translate("CreateBoundaryCAO", "Apply", nullptr)); + buttonOk->setText(QApplication::translate("CreateBoundaryCAO", "OK", nullptr)); + CBGroupe->setText(QApplication::translate("CreateBoundaryCAO", "Filtering with groups", nullptr)); + PushFichier->setText(QString()); + XAO->setText(QApplication::translate("CreateBoundaryCAO", "XAO", nullptr)); + Name->setText(QApplication::translate("CreateBoundaryCAO", "Name", nullptr)); + } // retranslateUi +}; + +class SMESH_Ui_CreateBoundaryDi +{ +public: + QGridLayout *gridLayout; + QGroupBox *GBButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + QCheckBox *CBGroupe; + QLineEdit *LEFileName; + QPushButton *PushFichier; + QLabel *Mesh; + QLineEdit *LEName; + QLabel *Name; + + void setupUi(QDialog *CreateBoundaryDi) + { + if (CreateBoundaryDi->objectName().isEmpty()) + CreateBoundaryDi->setObjectName(QString::fromUtf8("CreateBoundaryDi")); + CreateBoundaryDi->resize(566, 169); + QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(CreateBoundaryDi->sizePolicy().hasHeightForWidth()); + CreateBoundaryDi->setSizePolicy(sizePolicy); + CreateBoundaryDi->setAutoFillBackground(true); + CreateBoundaryDi->setSizeGripEnabled(true); + gridLayout = new QGridLayout(CreateBoundaryDi); +#ifndef Q_OS_MAC + gridLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + GBButtons = new QGroupBox(CreateBoundaryDi); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + gridLayout1 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout1->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout->addWidget(GBButtons, 3, 0, 1, 3); + + CBGroupe = new QCheckBox(CreateBoundaryDi); + CBGroupe->setObjectName(QString::fromUtf8("CBGroupe")); + + gridLayout->addWidget(CBGroupe, 2, 0, 1, 3); + + LEFileName = new QLineEdit(CreateBoundaryDi); + LEFileName->setObjectName(QString::fromUtf8("LEFileName")); + LEFileName->setMinimumSize(QSize(370, 21)); + + gridLayout->addWidget(LEFileName, 1, 2, 1, 1); + + PushFichier = new QPushButton(CreateBoundaryDi); + PushFichier->setObjectName(QString::fromUtf8("PushFichier")); + + gridLayout->addWidget(PushFichier, 1, 1, 1, 1); + + Mesh = new QLabel(CreateBoundaryDi); + Mesh->setObjectName(QString::fromUtf8("Mesh")); + + gridLayout->addWidget(Mesh, 1, 0, 1, 1); + + LEName = new QLineEdit(CreateBoundaryDi); + LEName->setObjectName(QString::fromUtf8("LEName")); + LEName->setMinimumSize(QSize(382, 21)); + LEName->setMaxLength(32); + + gridLayout->addWidget(LEName, 0, 1, 1, 2); + + Name = new QLabel(CreateBoundaryDi); + Name->setObjectName(QString::fromUtf8("Name")); + + gridLayout->addWidget(Name, 0, 0, 1, 1); + + + retranslateUi(CreateBoundaryDi); + + QMetaObject::connectSlotsByName(CreateBoundaryDi); + } // setupUi + + void retranslateUi(QDialog *CreateBoundaryDi) + { + CreateBoundaryDi->setWindowTitle(QApplication::translate("CreateBoundaryDi", "Create a discrete boundary", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateBoundaryDi", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateBoundaryDi", "Cancel", nullptr)); + buttonApply->setText(QApplication::translate("CreateBoundaryDi", "Apply", nullptr)); + buttonOk->setText(QApplication::translate("CreateBoundaryDi", "OK", nullptr)); + CBGroupe->setText(QApplication::translate("CreateBoundaryDi", "Filtering with groups", nullptr)); + PushFichier->setText(QString()); + Mesh->setText(QApplication::translate("CreateBoundaryDi", "Mesh", nullptr)); + Name->setText(QApplication::translate("CreateBoundaryDi", "Name", nullptr)); + } // retranslateUi +}; + +class SMESHGUI_EXPORT SMESH_CreateBoundaryAn : public QDialog, public SMESH_Ui_CreateBoundaryAn +{ + Q_OBJECT + +public: + SMESH_CreateBoundaryAn (SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName); + virtual ~SMESH_CreateBoundaryAn(); + +protected : + SMESH_CreateBoundaryAn (SMESHGUI_HomardAdaptDlg* parent, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName); + + SMESHGUI_HomardAdaptDlg * _parent; + + QString _Name; + + int _Type; + double _BoundaryAnXcentre, _BoundaryAnYcentre, _BoundaryAnZcentre, _BoundaryAnRayon; + double _BoundaryAnXaxis, _BoundaryAnYaxis, _BoundaryAnZaxis; + double _Xcentre, _Ycentre, _Zcentre, _Rayon ; + double _Xmin, _Xmax, _Xincr, _Ymin, _Ymax, _Yincr, _Zmin, _Zmax, _Zincr, _DMax ; + double _BoundaryAnXcone1, _BoundaryAnYcone1, _BoundaryAnZcone1, _BoundaryAnRayon1; + double _BoundaryAnXcone2, _BoundaryAnYcone2, _BoundaryAnZcone2, _BoundaryAnRayon2; + double _BoundaryAnXaxisCone, _BoundaryAnYaxisCone, _BoundaryAnZaxisCone; + double _BoundaryAnXorigCone, _BoundaryAnYorigCone, _BoundaryAnZorigCone; + double _BoundaryAngle; + double _BoundaryAnToreXcentre, _BoundaryAnToreYcentre, _BoundaryAnToreZcentre; + double _BoundaryAnToreXaxe, _BoundaryAnToreYaxe, _BoundaryAnToreZaxe; + double _BoundaryAnToreRRev, _BoundaryAnToreRPri; + + bool Chgt; + + SMESHHOMARD::HOMARD_Boundary_var aBoundaryAn; + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + virtual void InitConnect(); + virtual void InitValBoundaryAn(); + virtual void InitMinMax(); + virtual void SetNewName(); + virtual bool CreateOrUpdateBoundaryAn(); + virtual void convertRayonAngle(int option); + +public slots: + virtual void SetCylinder(); + virtual void SetSphere(); + virtual void SetCone(); + virtual void SetConeR(); + virtual void SetConeA(); + virtual void SetTore(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); +}; + +class SMESHGUI_EXPORT SMESH_EditBoundaryAn : public SMESH_CreateBoundaryAn +{ + Q_OBJECT +public: + SMESH_EditBoundaryAn( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString Name); + virtual ~SMESH_EditBoundaryAn(); + +protected : + bool CreateOrUpdateBoundaryAn(); + void InitValEdit(); + void InitValBoundaryAnLimit(); + void SetCylinder(); + void SetSphere(); + void SetConeR(); + void SetConeA(); + void SetTore(); + void InitValBoundaryAnCylindre(); + void InitValBoundaryAnSphere(); + void InitValBoundaryAnConeR(); + void InitValBoundaryAnConeA(); + void InitValBoundaryAnTore(); +}; + +class SMESHGUI_EXPORT SMESH_CreateBoundaryCAO : public QDialog, public SMESH_Ui_CreateBoundaryCAO +{ + Q_OBJECT + +public: + SMESH_CreateBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString BoundaryName ); + ~SMESH_CreateBoundaryCAO(); + virtual void setGroups (QStringList listGroup); + +protected : + + SMESHGUI_HomardAdaptDlg *_parent; + + QString _aName; + + SMESHHOMARD::HOMARD_Boundary_var aBoundary; + SMESHHOMARD::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(); +}; + +class SMESHGUI_EXPORT SMESH_EditBoundaryCAO : public SMESH_CreateBoundaryCAO +{ + Q_OBJECT +public: + SMESH_EditBoundaryCAO( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString Name ); + virtual ~SMESH_EditBoundaryCAO(); + +protected : + virtual void InitValEdit(); + virtual bool PushOnApply(); + virtual void SetFiltrage(); +}; + +class SMESHGUI_EXPORT SMESH_CreateBoundaryDi : public QDialog, public SMESH_Ui_CreateBoundaryDi +{ + Q_OBJECT + +public: + SMESH_CreateBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString BoundaryName ); + ~SMESH_CreateBoundaryDi(); + virtual void setGroups (QStringList listGroup); + +protected : + + SMESHGUI_HomardAdaptDlg *_parent; + + QString _aName; + + SMESHHOMARD::HOMARD_Boundary_var aBoundary; + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + QStringList _listeGroupesBoundary; + + virtual void AssocieLesGroupes(); + virtual void InitConnect(); + virtual void SetNewName(); + +public slots: + + virtual void SetMeshFile(); + virtual void SetFiltrage(); + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); +}; + +class SMESHGUI_EXPORT SMESH_EditBoundaryDi : public SMESH_CreateBoundaryDi +{ + Q_OBJECT +public: + SMESH_EditBoundaryDi( SMESHGUI_HomardAdaptDlg* parent, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString caseName, QString Name ); + virtual ~SMESH_EditBoundaryDi(); + +protected : + virtual void InitValEdit(); + virtual bool PushOnApply(); + virtual void SetFiltrage(); +}; + +#endif // MON_CREATEBOUNDARY_H diff --git a/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx b/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx new file mode 100644 index 000000000..9e632d9c3 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardListGroup.cxx @@ -0,0 +1,326 @@ +// Copyright (C) 2011-2021 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 "SMESHGUI_HomardListGroup.h" + +#include "SMESHGUI_HomardBoundaryDlg.h" +#include "SMESHGUI_HomardUtils.h" +#include "SMESHGUI_Utils.h" + +#include "SalomeApp_Tools.h" + +#include +#include +#include +#include +#include + +#include + +#include + +using namespace std; + +// ------------------------------------------------------------------------------------ +SMESH_CreateListGroupCAO::SMESH_CreateListGroupCAO(SMESH_CreateBoundaryCAO* parentBound, + bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, + QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + MESSAGE("Debut de SMESH_CreateListGroupCAO"); + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + InitGroupes(); +} +// ------------------------------------------------------------------------------------ +SMESH_CreateListGroupCAO::SMESH_CreateListGroupCAO(SMESH_CreateBoundaryCAO* parentBound, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, + QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + InitConnect(); +} + +// ------------------------------------------------------------------------ +SMESH_CreateListGroupCAO::~SMESH_CreateListGroupCAO() +// ------------------------------------------------------------------------ +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::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 SMESH_CreateListGroupCAO::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 ( _parentBound ) { _parentBound->setGroups(ListeGroup);}; + return true; +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) this->close(); + if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); }; +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#filtering-by-the-groups")); +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroupCAO::InitGroupes() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SMESH_CreateListGroupCAO::InitGroupes "); + for ( int row=0; row< TWGroupe->rowCount(); row++) + TWGroupe->removeRow(row); + TWGroupe->setRowCount(0); + if (_aCaseName == QString("")) { return; }; + SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); + SMESHHOMARD::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 SMESH_CreateListGroupCAO::InitGroupes "); +} + + +// ------------------------------------------------------------------------ +SMESH_CreateListGroup::SMESH_CreateListGroup(SMESH_CreateBoundaryDi* parentBound, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + MESSAGE("Debut de SMESH_CreateListGroup"); + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + setModal(modal); + InitConnect(); + InitGroupes(); +} + +// ------------------------------------------------------------------------ +SMESH_CreateListGroup::SMESH_CreateListGroup(SMESH_CreateBoundaryDi* parentBound, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, QStringList listeGroupesHypo) + : QDialog(0), SMESH_Ui_CreateListGroup(), + _aCaseName (aCaseName), + _listeGroupesHypo (listeGroupesHypo), + _parentBound(parentBound) +{ + myHomardGen = SMESHHOMARD::HOMARD_Gen::_duplicate(myHomardGen0); + setupUi(this); + InitConnect(); +} + +// ------------------------------------------------------------------------ +SMESH_CreateListGroup::~SMESH_CreateListGroup() +{ + // no need to delete child widgets, Qt does it all for us +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::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 SMESH_CreateListGroup::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 ( _parentBound ) { _parentBound->setGroups(ListeGroup);}; + return true; +} + + +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::PushOnOK() +// ------------------------------------------------------------------------ +{ + if (PushOnApply()) + { + this->close(); + if ( _parentBound ) { _parentBound->raise(); _parentBound->activateWindow(); }; + } +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::PushOnHelp() +// ------------------------------------------------------------------------ +{ + SMESH::ShowHelpFile(QString("homard_create_boundary.html#filtering-by-the-groups")); +} +// ------------------------------------------------------------------------ +void SMESH_CreateListGroup::InitGroupes() +// ------------------------------------------------------------------------ +{ + MESSAGE("Debut de SMESH_CreateListGroup::InitGroupes "); + for ( int row=0; row< TWGroupe->rowCount(); row++) + TWGroupe->removeRow(row); + TWGroupe->setRowCount(0); + if (_aCaseName == QString("")) { return; }; + SMESHHOMARD::HOMARD_Cas_var monCas = myHomardGen->GetCase(); + SMESHHOMARD::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 SMESH_CreateListGroup::InitGroupes "); +} + +//--------------------------------------------------------------------- +SMESH_EditListGroupCAO::SMESH_EditListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, + bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, + QStringList listeGroupesHypo): +//--------------------------------------------------------------------- +SMESH_CreateListGroupCAO(parentBound,myHomardGen0,aCaseName,listeGroupesHypo) +{ + MESSAGE("Debut de SMESH_EditListGroupCAO"); + setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE")); + setModal(true); + InitGroupes(); +} + +//------------------------------------ +SMESH_EditListGroupCAO:: ~SMESH_EditListGroupCAO() +//------------------------------------ +{ +} +// ------------------------------------- +void SMESH_EditListGroupCAO:: 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(); +} + +//--------------------------------------------------------------------- +SMESH_EditListGroup::SMESH_EditListGroup( SMESH_CreateBoundaryDi* parentBound, + bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen0, + QString aCaseName, + QStringList listeGroupesHypo): +//--------------------------------------------------------------------- +SMESH_CreateListGroup(parentBound,myHomardGen0,aCaseName,listeGroupesHypo) +{ + MESSAGE("Debut de SMESH_EditListGroup"); + setWindowTitle(QObject::tr("HOM_GROU_EDIT_WINDOW_TITLE")); + setModal(true); + InitGroupes(); +} + +//------------------------------------ +SMESH_EditListGroup::~SMESH_EditListGroup() +//------------------------------------ +{ +} +// ------------------------------------- +void SMESH_EditListGroup::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(); +} diff --git a/src/SMESHGUI/SMESHGUI_HomardListGroup.h b/src/SMESHGUI/SMESHGUI_HomardListGroup.h new file mode 100644 index 000000000..67e46b94d --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardListGroup.h @@ -0,0 +1,254 @@ +// Copyright (C) 2011-2021 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 "SMESH_SMESHGUI.hxx" + +#include +#include + +//#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(SMESH_Homard) + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class SMESH_CreateBoundaryCAO; +class SMESH_CreateBoundaryDi; + + +QT_BEGIN_NAMESPACE + +class SMESH_Ui_CreateListGroup +{ +public: + QGridLayout *gridLayout; + QGroupBox *GBButtons; + QGridLayout *gridLayout1; + QPushButton *buttonHelp; + QPushButton *buttonCancel; + QPushButton *buttonApply; + QPushButton *buttonOk; + QGroupBox *GBOptions; + QGridLayout *gridLayout2; + QTableWidget *TWGroupe; + + void setupUi(QDialog *CreateListGroup) + { + if (CreateListGroup->objectName().isEmpty()) + CreateListGroup->setObjectName(QString::fromUtf8("CreateListGroup")); + CreateListGroup->resize(717, 600); + QSizePolicy sizePolicy(static_cast(0), static_cast(0)); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(CreateListGroup->sizePolicy().hasHeightForWidth()); + CreateListGroup->setSizePolicy(sizePolicy); + CreateListGroup->setAutoFillBackground(true); + CreateListGroup->setSizeGripEnabled(true); + gridLayout = new QGridLayout(CreateListGroup); +#ifndef Q_OS_MAC + gridLayout->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout->setObjectName(QString::fromUtf8("gridLayout")); + GBButtons = new QGroupBox(CreateListGroup); + GBButtons->setObjectName(QString::fromUtf8("GBButtons")); + gridLayout1 = new QGridLayout(GBButtons); +#ifndef Q_OS_MAC + gridLayout1->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout1->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout1->setObjectName(QString::fromUtf8("gridLayout1")); + buttonHelp = new QPushButton(GBButtons); + buttonHelp->setObjectName(QString::fromUtf8("buttonHelp")); + + gridLayout1->addWidget(buttonHelp, 0, 3, 1, 1); + + buttonCancel = new QPushButton(GBButtons); + buttonCancel->setObjectName(QString::fromUtf8("buttonCancel")); + + gridLayout1->addWidget(buttonCancel, 0, 2, 1, 1); + + buttonApply = new QPushButton(GBButtons); + buttonApply->setObjectName(QString::fromUtf8("buttonApply")); + + gridLayout1->addWidget(buttonApply, 0, 1, 1, 1); + + buttonOk = new QPushButton(GBButtons); + buttonOk->setObjectName(QString::fromUtf8("buttonOk")); + + gridLayout1->addWidget(buttonOk, 0, 0, 1, 1); + + + gridLayout->addWidget(GBButtons, 1, 0, 1, 1); + + GBOptions = new QGroupBox(CreateListGroup); + GBOptions->setObjectName(QString::fromUtf8("GBOptions")); + gridLayout2 = new QGridLayout(GBOptions); +#ifndef Q_OS_MAC + gridLayout2->setSpacing(6); +#endif +#ifndef Q_OS_MAC + gridLayout2->setContentsMargins(9, 9, 9, 9); +#endif + gridLayout2->setObjectName(QString::fromUtf8("gridLayout2")); + TWGroupe = new QTableWidget(GBOptions); + if (TWGroupe->columnCount() < 2) + TWGroupe->setColumnCount(2); + QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem(); + TWGroupe->setHorizontalHeaderItem(0, __qtablewidgetitem); + QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem(); + TWGroupe->setHorizontalHeaderItem(1, __qtablewidgetitem1); + TWGroupe->setObjectName(QString::fromUtf8("TWGroupe")); + TWGroupe->setShowGrid(true); + TWGroupe->setRowCount(0); + TWGroupe->setColumnCount(2); + + gridLayout2->addWidget(TWGroupe, 0, 0, 1, 1); + + + gridLayout->addWidget(GBOptions, 0, 0, 1, 1); + + + retranslateUi(CreateListGroup); + + QMetaObject::connectSlotsByName(CreateListGroup); + } // setupUi + + void retranslateUi(QDialog *CreateListGroup) + { + CreateListGroup->setWindowTitle(QApplication::translate("CreateListGroup", "Selection of groups", nullptr)); + GBButtons->setTitle(QString()); + buttonHelp->setText(QApplication::translate("CreateListGroup", "Help", nullptr)); + buttonCancel->setText(QApplication::translate("CreateListGroup", "Cancel", nullptr)); + buttonApply->setText(QApplication::translate("CreateListGroup", "Apply", nullptr)); + buttonOk->setText(QApplication::translate("CreateListGroup", "OK", nullptr)); + GBOptions->setTitle(QApplication::translate("CreateListGroup", "Selected groups", nullptr)); + QTableWidgetItem *___qtablewidgetitem = TWGroupe->horizontalHeaderItem(0); + ___qtablewidgetitem->setText(QApplication::translate("CreateListGroup", "Selection", nullptr)); + QTableWidgetItem *___qtablewidgetitem1 = TWGroupe->horizontalHeaderItem(1); + ___qtablewidgetitem1->setText(QApplication::translate("CreateListGroup", "Group", nullptr)); + } // retranslateUi + +}; + +namespace Ui { + class CreateListGroup: public SMESH_Ui_CreateListGroup {}; +} // namespace Ui + +QT_END_NAMESPACE + +class SMESHGUI_EXPORT SMESH_CreateListGroupCAO : public QDialog, public SMESH_Ui_CreateListGroup +{ + Q_OBJECT + +public: + SMESH_CreateListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, bool modal, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + SMESH_CreateListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_CreateListGroupCAO(); + +protected : + + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + SMESH_CreateBoundaryCAO * _parentBound; + QString _aCaseName; + QStringList _listeGroupesHypo; + + virtual void InitConnect(); + virtual void InitGroupes(); + +public slots: + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +class SMESHGUI_EXPORT SMESH_CreateListGroup : public QDialog, public SMESH_Ui_CreateListGroup +{ + Q_OBJECT + +public: + SMESH_CreateListGroup( SMESH_CreateBoundaryDi* parentBound, bool modal, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + SMESH_CreateListGroup( SMESH_CreateBoundaryDi* parentBound, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_CreateListGroup(); + +protected : + + SMESHHOMARD::HOMARD_Gen_var myHomardGen; + + SMESH_CreateBoundaryDi * _parentBound; + QString _aCaseName; + QStringList _listeGroupesHypo; + + virtual void InitConnect(); + virtual void InitGroupes(); + +public slots: + virtual void PushOnOK(); + virtual bool PushOnApply(); + virtual void PushOnHelp(); + +}; + +class SMESHGUI_EXPORT SMESH_EditListGroupCAO : public SMESH_CreateListGroupCAO +{ + Q_OBJECT + +public: + SMESH_EditListGroupCAO( SMESH_CreateBoundaryCAO* parentBound, bool modal, SMESHHOMARD::HOMARD_Gen_var myHomardGen, QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_EditListGroupCAO(); + +protected : + + virtual void InitGroupes(); + +}; + +class SMESHGUI_EXPORT SMESH_EditListGroup : public SMESH_CreateListGroup +{ + Q_OBJECT + +public: + SMESH_EditListGroup( SMESH_CreateBoundaryDi* parentBound, bool modal, + SMESHHOMARD::HOMARD_Gen_var myHomardGen, + QString aCaseName, QStringList listeGroupesHypo); + virtual ~SMESH_EditListGroup(); + +protected : + + virtual void InitGroupes(); + +}; + +#endif // MON_CREATELISTGROUPCAO_H diff --git a/src/SMESHGUI/SMESHGUI_HomardUtils.cxx b/src/SMESHGUI/SMESHGUI_HomardUtils.cxx new file mode 100644 index 000000000..30361c9ce --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardUtils.cxx @@ -0,0 +1,659 @@ +// Copyright (C) 2011-2021 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 "SMESHGUI_HomardUtils.h" + +#include + +#include "OB_Browser.h" + +#include "SUIT_Desktop.h" +#include "SUIT_Application.h" +#include "SUIT_Session.h" + +#include "LightApp_SelectionMgr.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Module.h" +#include "SalomeApp_Study.h" + +#include "SALOME_ListIO.hxx" + +#include "SALOMEconfig.h" +#include + +#include +#include +#include +#include +#include +#include + +#include +#ifndef WIN32 +#include +#include +#endif + +#include "SalomeApp_Tools.h" + +#include + +SALOME_ListIO SMESH_HOMARD_UTILS::mySelected; + +//================================================================ +// Function : GetActiveStudy +// Returne un pointeur sur l'etude active +//================================================================ +SUIT_Study* SMESH_HOMARD_UTILS::GetActiveStudy() +{ + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if (app) + return app->activeStudy(); + else + return NULL; +} + +//================================================================ +// Function : getStudy +// Returne un pointeur sur l'etude active +//================================================================ +_PTR(Study) SMESH_HOMARD_UTILS::getStudy() +{ + static _PTR(Study) _study; + if(!_study) + _study = SalomeApp_Application::getStudy(); + return _study; +} + +//================================================================ +// Function : updateObjBrowser +// Purpose : met a jour l arbre d 'etude pour Homard +//================================================================ +void SMESH_HOMARD_UTILS::updateObjBrowser() +{ + SalomeApp_Application* app = dynamic_cast(SUIT_Session::session()->activeApplication()); + if (app) { + // Le nom identifiant doit etre la valeur du parametre + // name de la section HOMARD du fichier SalomeApp.xml + CAM_Module* module = app->module("Homard" ); + SalomeApp_Module* appMod = dynamic_cast( module ); + if ( appMod ) { + app->updateObjectBrowser(); + appMod->updateObjBrowser( true ); + } + else + MESSAGE( "--- SMESHHOMARD::updateObjBrowser: appMod = NULL"); + } +} + +//================================================================ +// Function : selectedIO +// Return the list of selected SALOME_InteractiveObject's +//================================================================ +const SALOME_ListIO& SMESH_HOMARD_UTILS::selectedIO() +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > ( SUIT_Session::session()->activeApplication() ); + LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr(); + if( aSelectionMgr ) + { + aSelectionMgr->selectedObjects( mySelected ); + for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next()) + SCRUTE(it.Value()->getEntry()); + }; + return mySelected; +} + +//================================================================ +// Function : IObjectCount +// Return the number of selected objects +//================================================================ +int SMESH_HOMARD_UTILS::IObjectCount() +{ + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + LightApp_SelectionMgr* aSelectionMgr = app->selectionMgr(); + if( aSelectionMgr ) + { + aSelectionMgr->selectedObjects( mySelected ); + SCRUTE(mySelected.Extent()); + return mySelected.Extent(); + } + return 0; +} + +//================================================================ +// Function : firstIObject +// Purpose : Return the first selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) SMESH_HOMARD_UTILS::firstIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.First() : Handle(SALOME_InteractiveObject)(); +} + +//================================================================ +// Function : lastIObject +// Return the last selected object in the selected object list +//================================================================ +Handle(SALOME_InteractiveObject) SMESH_HOMARD_UTILS::lastIObject() +{ + const SALOME_ListIO& aList = selectedIO(); + return aList.Extent() > 0 ? aList.Last() : Handle(SALOME_InteractiveObject)(); +} + +//================================================================ +// Retourne vrai si l'objet est du type voulu +// . Dans le cas d'un cas, d'une hypothese, d'une zone, on se contente +// d'une comparaison simple entre le type stocke et TypeObject. +// . Pour l'iteration, le type stocke en attribut est sous la forme +// "IterationHomard" + le nom de l'iteration precedente. +// Il faut donc regarder si la chaine commence par TypeObject. +// . Idem pour le fichier de messages : "Mess " + numero d'iteration +// +// On filtre ce genre de situation avec option : +// -1 : comparaison totale +// 0 : comparaison sur le debut de la chaine +//================================================================ +bool SMESH_HOMARD_UTILS::isObject(_PTR(SObject) MonObj, QString TypeObject, int option) +{ +// MESSAGE("isObject, TypeObject = "<Value().c_str()); +// MESSAGE("Type = "< 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_2") ); + return QString(""); + } +// + Handle(SALOME_InteractiveObject) aIO = SMESH_HOMARD_UTILS::firstIObject(); + if ( aIO->hasEntry() ) + { +// MESSAGE("aIO->getEntry() = " << aIO->getEntry()); + _PTR(Study) aStudy = SMESH_HOMARD_UTILS::getStudy(); + _PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if (aSO->FindAttribute(anAttr, "AttributeComment") ) + { + if ( commentaire != "" ) + { + _PTR(AttributeComment) attributComment = anAttr; + QString aComment= QString(attributComment->Value().data()); +// MESSAGE("... aComment = " << aComment.toStdString().c_str()); + int iaux = aComment.lastIndexOf(commentaire); +// MESSAGE("... iaux = " << iaux); + if ( iaux !=0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_3").arg(commentaire) ); + return QString(""); + } + } + if (aSO->FindAttribute(anAttr, "AttributeName") ) + { + _PTR(AttributeName) attributName = anAttr; + QString aName= QString(attributName->Value().data()); + return aName; + } + } + } +// + return QString(""); +} + +// ======================================================================= +QString SMESH_HOMARD_QT_COMMUN::SelectionCasEtude() +// ======================================================================= +{ + QString aName = QString(""); + int nbSel = SMESH_HOMARD_UTILS::IObjectCount() ; + if ( nbSel == 0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_1") ); + return QString(""); + } + if ( nbSel > 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_OBJECT_2") ); + return QString(""); + } + Handle(SALOME_InteractiveObject) aIO = SMESH_HOMARD_UTILS::firstIObject(); + if ( aIO->hasEntry() ) + { + _PTR(Study) aStudy = SMESH_HOMARD_UTILS::getStudy(); + _PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) ); + _PTR(SObject) aSObjCas = aSO->GetFather(); + _PTR(GenericAttribute) anAttr; + if (aSObjCas->FindAttribute(anAttr, "AttributeName") ) + { + _PTR(AttributeName) attributName = anAttr; + aName= QString(attributName->Value().data()); + } + return aName; + } + return QString(""); +} + +// ======================================================================= +QString SMESH_HOMARD_QT_COMMUN::PushNomFichier(bool avertir, QString TypeFichier) +// ======================================================================= +// Gestion les boutons qui permettent de +// 1) retourne le nom d'un fichier par une fenetre de dialogue si aucun +// objet est selectionne dans l arbre d etude +// 2) retourne le nom du fichier asocie a l objet +// selectionne dans l arbre d etude +{ +// MESSAGE("PushNomFichier avec avertir "<hasEntry() ) + { + _PTR(Study) aStudy = SMESH_HOMARD_UTILS::getStudy(); + _PTR(SObject) aSO ( aStudy->FindObjectID( aIO->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + _PTR(AttributeFileType) aFileType; + _PTR(AttributeExternalFileDef) aFileName; + if (aSO) { + if (aSO->FindAttribute(anAttr, "AttributeFileType") ) { + aFileType=anAttr; + QString fileType=QString(aFileType->Value().data()); + if ( fileType==QString("FICHIERMED")) { + if (aSO->FindAttribute(anAttr,"AttributeExternalFileDef")) { + aFileName=anAttr; + aFile= QString(aFileName->Value().data()); } + } + } + } + } + + if ( aFile==QString::null ) + { + if ( avertir ) { + QMessageBox::warning( 0, QObject::tr("HOM_WARNING"), + QObject::tr("HOM_SELECT_STUDY") ); + } + aFile = QFileDialog::getOpenFileName(0, QObject::tr("HOM_SELECT_FILE_0"), QString(""), filtre ); + } + } + // B.3. Bizarre + else + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_SELECT_FILE_2") ); + } + + return aFile; +} +// ======================================================================= +med_idt SMESH_HOMARD_QT_COMMUN::OuvrirFichier(QString aFile) +// ======================================================================= +// renvoie le medId associe au fichier Med apres ouverture +{ + med_idt medIdt = MEDfileOpen(aFile.toStdString().c_str(),MED_ACC_RDONLY); + if (medIdt <0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_1") ); + } + return medIdt; +} + +// ====================================================== +QString SMESH_HOMARD_QT_COMMUN::LireNomMaillage(QString aFile) +// ======================================================== +{ + QString nomMaillage = "" ; + int erreur = 0 ; + med_idt medIdt ; + while ( erreur == 0 ) + { + // Ouverture du fichier + medIdt = SMESH_HOMARD_QT_COMMUN::OuvrirFichier(aFile); + if ( medIdt < 0 ) + { + erreur = 1 ; + break ; + } + med_int numberOfMeshes = MEDnMesh(medIdt) ; + if (numberOfMeshes == 0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_2") ); + erreur = 2 ; + break ; + } + if (numberOfMeshes > 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_3") ); + erreur = 3 ; + break ; + } + + nomMaillage = SMESH_HOMARD_QT_COMMUN::LireNomMaillage2(medIdt,1); + break ; + } + // Fermeture du fichier + if ( medIdt > 0 ) MEDfileClose(medIdt); + + return nomMaillage; +} +// ======================================================================= +QString SMESH_HOMARD_QT_COMMUN::LireNomMaillage2(med_idt medIdt ,int meshId) +// ======================================================================= +{ + QString NomMaillage=QString::null; + char meshname[MED_NAME_SIZE+1]; + med_int spacedim,meshdim; + med_mesh_type meshtype; + char descriptionription[MED_COMMENT_SIZE+1]; + char dtunit[MED_SNAME_SIZE+1]; + med_sorting_type sortingtype; + med_int nstep; + med_axis_type axistype; + int naxis = MEDmeshnAxis(medIdt,1); + char *axisname=new char[naxis*MED_SNAME_SIZE+1]; + char *axisunit=new char[naxis*MED_SNAME_SIZE+1]; + med_err aRet = MEDmeshInfo(medIdt, + meshId, + meshname, + &spacedim, + &meshdim, + &meshtype, + descriptionription, + dtunit, + &sortingtype, + &nstep, + &axistype, + axisname, + axisunit); + + if ( aRet < 0 ) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), \ + QObject::tr("HOM_MED_FILE_4") ); } + else { NomMaillage=QString(meshname); } + + delete[] axisname ; + delete[] axisunit ; + + return NomMaillage; +} + + +// ======================================================================= +std::list SMESH_HOMARD_QT_COMMUN::GetListeChamps(QString aFile) +// ======================================================================= +{ +// Il faut voir si plusieurs maillages + + MESSAGE("GetListeChamps"); + std::list ListeChamp ; + + med_err erreur = 0 ; + med_idt medIdt ; + + while ( erreur == 0 ) + { + // Ouverture du fichier + SCRUTE(aFile.toStdString()); + medIdt = SMESH_HOMARD_QT_COMMUN::OuvrirFichier(aFile); + if ( medIdt < 0 ) + { + erreur = 1 ; + break ; + } + // Lecture du nombre de champs + med_int ncha = MEDnField(medIdt) ; + if (ncha < 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_5") ); + erreur = 2 ; + break ; + } + // Lecture des caracteristiques des champs + for (int i=0; i< ncha; i++) + { +// Lecture du nombre de composantes + med_int ncomp = MEDfieldnComponent(medIdt,i+1); +// Lecture du type du champ, des noms des composantes et du nom de l'unite + char nomcha [MED_NAME_SIZE+1]; + char meshname[MED_NAME_SIZE+1]; + char * comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char * unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char dtunit[MED_SNAME_SIZE+1]; + med_bool local; + med_field_type typcha; + med_int nbofcstp; + erreur = MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) ; + free(comp); + free(unit); + if ( erreur < 0 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_6") ); + break ; + } + ListeChamp.push_back(QString(nomcha)); + } + break ; + } + // Fermeture du fichier + if ( medIdt > 0 ) MEDfileClose(medIdt); + + return ListeChamp; +} + +// ====================================================================================== +std::list SMESH_HOMARD_QT_COMMUN::GetListeComposants(QString aFile, QString aChamp) +// ====================================================================================== +{ + MESSAGE ( "GetListeComposants pour le fichier " << aFile.toStdString().c_str()); + MESSAGE ( "GetListeComposants pour le champ " << aChamp.toStdString().c_str()); + + std::list ListeComposants; + + med_err erreur = 0 ; + med_idt medIdt ; + + while ( erreur == 0 ) + { + // Ouverture du fichier + SCRUTE(aFile.toStdString()); + medIdt = SMESH_HOMARD_QT_COMMUN::OuvrirFichier(aFile); + if ( medIdt < 0 ) + { + erreur = 1 ; + break ; + } + // Lecture du nombre de champs + med_int ncha = MEDnField(medIdt) ; + if (ncha < 1 ) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_5") ); + erreur = 2 ; + break ; + } + // Lecture des caracteristiques des champs + for (int i=0; i< ncha; i++) + { +// Lecture du nombre de composantes + med_int ncomp = MEDfieldnComponent(medIdt,i+1); +// Lecture du type du champ, des noms des composantes et du nom de l'unite + char nomcha [MED_NAME_SIZE+1]; + char meshname[MED_NAME_SIZE+1]; + char * comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char * unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1); + char dtunit[MED_SNAME_SIZE+1]; + med_bool local; + med_field_type typcha; + med_int nbofcstp; + erreur = MEDfieldInfo(medIdt,i+1,nomcha,meshname,&local,&typcha,comp,unit,dtunit,&nbofcstp) ; + free(unit); + if ( erreur < 0 ) + { + free(comp); + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_MED_FILE_6") ); + break ; + } + // Lecture des composantes si c'est le bon champ + if ( QString(nomcha) == aChamp ) + { + for (int j = 0; j 0 ) MEDfileClose(medIdt); + + return ListeComposants; +} diff --git a/src/SMESHGUI/SMESHGUI_HomardUtils.h b/src/SMESHGUI/SMESHGUI_HomardUtils.h new file mode 100644 index 000000000..14b13343c --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_HomardUtils.h @@ -0,0 +1,112 @@ +// Copyright (C) 2011-2021 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 SMESH_HOMARD_H_UTILS +#define SMESH_HOMARD_H_UTILS + +#include "SMESH_SMESHGUI.hxx" + +#include + +#include +//#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(SMESH_Homard) + +#include +#include +#include +#include +#include +//#include +#include + +#include + +#include +#include +#include + +class QString; +class QStringList; +class QComboBox; + +class SUIT_ViewWindow; +class SUIT_Desktop; +class SUIT_Study; +class SUIT_ResourceMgr; + +class CAM_Module; + +class SALOMEDSClient_Study; +class SALOMEDSClient_SObject; + +class SalomeApp_Study; +class SalomeApp_Module; +class LightApp_SelectionMgr; + +namespace SMESH_HOMARD_UTILS { + + SMESHGUI_EXPORT SUIT_Study* GetActiveStudy(); + SMESHGUI_EXPORT _PTR(Study) getStudy(); + + SMESHGUI_EXPORT void updateObjBrowser(); + + // Function returns a list of SALOME_InteractiveObject's from + // selection manager in GUI + SMESHGUI_EXPORT const SALOME_ListIO& selectedIO(); + + // Function returns the number of selected objects + SMESHGUI_EXPORT int IObjectCount(); + + // Function returns the first selected object in the list + // of selected objects + SMESHGUI_EXPORT Handle(SALOME_InteractiveObject) firstIObject() ; + + // Function returns the last selected object in the list + // of selected objects + SMESHGUI_EXPORT Handle(SALOME_InteractiveObject) lastIObject() ; + + SMESHGUI_EXPORT bool isBoundaryCAO(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isBoundaryAn(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isBoundaryDi(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isCase(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isHypo(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isIter(_PTR(SObject) MonObj); + SMESHGUI_EXPORT bool isFileType(_PTR(SObject) MonObj, QString TypeFile); + SMESHGUI_EXPORT bool isObject(_PTR(SObject) MonObj, QString TypeObject, int option ); + + extern SALOME_ListIO mySelected; +} + +namespace SMESH_HOMARD_QT_COMMUN +{ + SMESHGUI_EXPORT QString PushNomFichier(bool avertir, QString TypeFichier=""); + SMESHGUI_EXPORT QString LireNomMaillage(QString aFile); + SMESHGUI_EXPORT QString LireNomMaillage2(med_idt Medidt,int MeshId); + + SMESHGUI_EXPORT med_idt OuvrirFichier(QString aFile); + + SMESHGUI_EXPORT std::list GetListeChamps(QString aFile); + SMESHGUI_EXPORT std::list GetListeComposants(QString aFile, QString aChamp); + + SMESHGUI_EXPORT QString SelectionArbreEtude(QString commentaire, int grave ); + SMESHGUI_EXPORT QString SelectionCasEtude(); +}; + +#endif // ifndef SMESH_HOMARD_H_UTILS diff --git a/src/SMESHGUI/SMESHGUI_Homard_msg_en.ts b/src/SMESHGUI/SMESHGUI_Homard_msg_en.ts new file mode 100644 index 000000000..e1ebe2ec9 --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Homard_msg_en.ts @@ -0,0 +1,255 @@ + + + + + @default + + ADAPT_WITH_HOMARD + Adaptation with HOMARD + + + HOM_WARNING + Warning + + + HOM_ERROR + Error + + + HOM_INACTIVE_BUTTON + Inactive button + + + HOM_SELECT_OBJECT_1 + Select an object. + + + HOM_SELECT_OBJECT_2 + Select only one object. + + + HOM_SELECT_OBJECT_3 + Select an object with type %1. + + + HOM_SELECT_OBJECT_4 + The name of the object is already selected. Modify it or cancel. + + + HOM_SELECT_FILE_0 + File selection + + + HOM_SELECT_FILE_1 + Select a file. + + + HOM_SELECT_FILE_2 + Select only one file. + + + HOM_SELECT_FILE_3 + This file cannot be opened. + + + HOM_SCRIPT_FILE + A script file must be given. + + + HOM_MED_FILE_1 + This MED file cannot be read. + + + HOM_MED_FILE_2 + No mesh in this MED file. + + + HOM_MED_FILE_3 + More than one mesh in this MED file. + + + HOM_MED_FILE_4 + The mesh in this MED file cannot be read. + + + HOM_SELECT_STUDY + Select a study object with associated MED file \n or select a MED file. + + + HOM_CASE_NAME + The case must be named. + + + HOM_CASE_DIRECTORY_1 + A directory for the case must be selected. + + + HOM_CASE_DIRECTORY_2 + This directory is already used by the case + + + HOM_CASE_DIRECTORY_3 + A valid directory for the case must be selected. + + + HOM_CASE_DIRECTORY_4 + A directory for the computation must be selected. + + + HOM_START_DIRECTORY_1 + A starting directory for the pursuit must be selected. + + + HOM_START_DIRECTORY_3 + A valid directory for the pursuit must be selected. + + + HOM_CASE_MESH + The file of the initial mesh must be selected. + + + HOM_CASE_GROUP + The group "%1" cannot be given for more than 1 boundary. + + + HOM_CASE_EDIT_WINDOW_TITLE + Edition of a case + + + HOM_CASE_EDIT_STATE_0 + Initial mesh. + + + HOM_CASE_EDIT_STATE + Pursuit of an iteration. + + + HOM_CASE_PURSUE_WINDOW_TITLE + Case: pursuit of a stored iteration + + + HOM_ITER_NAME + The iteration must be named. + + + HOM_ITER_STARTING_POINT + The previous iteration must be given. + + + HOM_ITER_MESH + Give a name for the final mesh. + + + HOM_ITER_HYPO + A hypothesis must be selected. + + + HOM_ITER_STARTING_POINT_0 + Mesh + + + HOM_ITER_STARTING_POINT_1 + First iteration of the case. + + + HOM_ITER_STARTING_POINT_2 + First iteration of the case for the pursuit. + + + HOM_ITER_EDIT_WINDOW_TITLE + Edition of an iteration + + + HOM_HYPO_NAME + The hypothesis must be named. + + + HOM_HYPO_NORM_L2 + L2 norm + + + HOM_HYPO_NORM_INF + Infinite norm + + + HOM_HYPO_NORM_ABS + Absolute + + + HOM_HYPO_NORM_REL + Relative + + + HOM_HYPO_COMP + At least, one component must be selected. + + + HOM_HYPO_EDIT_WINDOW_TITLE + Edition of a hypothesis + + + HOM_BOUN_NAME + The boundary must be named. + + + HOM_BOUN_MESH + The file for the mesh of the boundary must be selected. + + + HOM_BOUN_CAO + The file for the CAO must be selected. + + + HOM_BOUN_CASE + The meshfile of the case is unknown. + + + HOM_AXE + The axis must be a non 0 vector. + + + HOM_BOUN_C_EDIT_WINDOW_TITLE + Edition of a CAO based boundary + + + HOM_BOUN_A_EDIT_WINDOW_TITLE + Edition of an analytical boundary + + + HOM_BOUN_D_EDIT_WINDOW_TITLE + Edition of a discrete boundary + + + HOM_GROU_EDIT_WINDOW_TITLE + Selected groups + + + HOM_MESH_INFO_0 + Mesh analysis + + + HOM_MESH_INFO_1 + Select at least one option. + + + HOM_MESH_INFO_2 + Analysis in the object browser, file + + + PREF_TAB_GENERAL + General + + + PREF_PUBLICATION + Publication + + + PREF_PUBLICATION_MAILLAGE_IN + IN meshes + + + PREF_PUBLICATION_MAILLAGE_OUT + OUT meshes + + + diff --git a/src/SMESHGUI/SMESHGUI_Homard_msg_fr.ts b/src/SMESHGUI/SMESHGUI_Homard_msg_fr.ts new file mode 100644 index 000000000..77cd8ed7c --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Homard_msg_fr.ts @@ -0,0 +1,871 @@ + + + + + @default + + HOM_WARNING + Avertissement + + + HOM_ERROR + Erreur + + + HOM_INACTIVE_BUTTON + Bouton inactif + + + OK + Appliquer et fermer + + + Apply + Appliquer + + + Cancel + Annuler + + + Help + Aide + + + New + Nouveau + + + Edit + Editer + + + Quit + Quitter + + + Name + Nom + + + Directory + Répertoire + + + Mesh + Maillage + + + Selection + Sélection + + + None + Aucun + + + All + Tout + + + HOM_SELECT_OBJECT_1 + Sélectionner un objet. + + + HOM_SELECT_OBJECT_2 + Sélectionner un seul objet. + + + HOM_SELECT_OBJECT_3 + Sélectionner un objet de type %1. + + + HOM_SELECT_OBJECT_4 + Le nom est déjà choisi. Modifiez le ou annulez la saisie. + + + HOM_SELECT_FILE_0 + Choix de fichier + + + HOM_SELECT_FILE_1 + Sélectionner un fichier. + + + HOM_SELECT_FILE_2 + Sélectionner un seul fichier. + + + HOM_SELECT_FILE_3 + Impossible d'ouvrir ce fichier. + + + HOM_SCRIPT_FILE + Il faut donner un fichier pour le script python. + + + HOM_MED_FILE_1 + Ce fichier MED est illisible. + + + HOM_MED_FILE_2 + Ce fichier MED ne contient aucun maillage. + + + HOM_MED_FILE_3 + Ce fichier MED contient plus d'un maillage. + + + HOM_MED_FILE_4 + Impossible de lire le maillage de ce fichier MED. + + + HOM_SELECT_STUDY + Sélectionner une étude avec un fichier MED associé\n ou sélectionner un fichier MED. + + + HOM_CASE_DIRECTORY_3 + Un répertoire valide doit être choisi. + + + HOM_CASE_DIRECTORY_4 + Il faut choisir un répertoire de travail pour le calcul. + + + HOM_START_DIRECTORY_1 + Il faut choisir un répertoire contenant l'itération à poursuivre. + + + HOM_START_DIRECTORY_3 + Un répertoire valide contenant l'itération à poursuivre doit être choisi. + + + HOM_CASE_MESH + Il faut choisir le maillage initial. + + + HOM_CASE_GROUP + Le groupe "%1" ne peut pas être attribué à plus d'une frontière. + + + HOM_CASE_EDIT_WINDOW_TITLE + Edition d'un cas + + + HOM_CASE_EDIT_STATE_0 + Maillage initial. + + + HOM_CASE_EDIT_STATE + Poursuite d'une itération. + + + HOM_CASE_PURSUE_WINDOW_TITLE + Cas de poursuite d'une itération + + + The configuration file cannot be found. + Le fichier de configuration de HOMARD est introuvable. + + + The configuration file cannot be read. + Le fichier de configuration de HOMARD est illisible. + + + The HOMARD mesh file cannot be found. + Le fichier de maillage de HOMARD est introuvable. + + + HOM_ITER_NAME + Il faut donner un nom à l'itération. + + + HOM_ITER_STARTING_POINT + Il faut désigner l'itération précédente. + + + HOM_ITER_MESH + Donner le nom du maillage final. + + + HOM_ITER_HYPO + Choisir une hypothèse. + + + HOM_ITER_STARTING_POINT_0 + Maillage + + + HOM_ITER_STARTING_POINT_1 + Itération initiale du cas. + + + HOM_ITER_STARTING_POINT_2 + Itération initiale du cas pour la poursuite. + + + HOM_ITER_EDIT_WINDOW_TITLE + Edition d'une itération + + + Boundary type + Type de frontière + + + No boundary + Pas de frontière + + + Non CAO + Autre que CAO + + + Discrete boundary + Frontière discrète + + + Analytical boundary + Frontière analytique + + + Conformity type + Type de conformité + + + Conformal + Conforme + + + Non conformal + Non conforme + + + Non conformal option + Option de non conformité + + + Conformity + + Conformité + + + + Free + Libre + + + 1 hanging node per mesh + 1 noeud pendant par maille + + + 1 node per edge + 1 noeud pendant par arête + + + Advanced options + Options avancées + + + Authorized pyramids + Pyramides autorisées + + + Minimal diameter + Diamètre minimal + + + Initialization of adaptation + Initialisation de l'adaptation + + + Maximal level + Niveau maximal + + + Output of the level of refinement + Sortie du niveau de raffinement + + + Output of the qualities + Sortie des qualités + + + Output of the diameters + Sortie des diamètres + + + Output of the parents + Sortie des parents + + + Output of the neighbours + Sortie des voisins + + + Create an iteration + Création d'une itération + + + Iteration Name + Nom de l'itération + + + Previous iteration + Itération précédente + + + Invalid boundary + Frontière non valable + + + Invalid case + Cas non valable + + + Invalid case context + Cas contextuel non valable + + + Invalid hypothesis + Hypothèse non valable + + + Invalid iteration + Itération non valable + + + This boundary has already been defined. + Cette frontière est déjà définie. + + + This case has already been defined. + Ce cas est déjà défini. + + + This hypothesis has already been defined. + Cette hypothèse est déjà définie. + + + This iteration has already been defined. + Cette itération est déjà définie. + + + The parent iteration is not defined. + L'itération parent n'est pas définie. + + + Unable to create the iteration. + Impossible de créer l'itération. + + + The directory for the computation cannot be created. + Impossible de créer le répertoire pour le calcul de l'itération. + + + This iteration is the first of the case and cannot be computed. + Cette itération définit le point de départ du cas. Elle ne peut pas être calculée. + + + This iteration does not have any associated hypothesis. + Cette itération n'est associée à aucune hypothèse. + + + The mesh file does not exist. + Le fichier du maillage n'existe pas. + + + The mesh file cannot be deleted. + Impossible de supprimer le fichier du maillage. + + + Mesh n + Maillage n + + + Mesh n+1 + Maillage n+1 + + + Rank + Numéro d'ordre + + + Hypothesis + Hypothèse + + + Create a hypothesis + Création d'une hypothèse + + + HOM_HYPO_NAME + Il faut donner un nom à l'hypothèse. + + + HOM_HYPO_NORM_L2 + Norme L2 + + + HOM_HYPO_NORM_INF + Norme infinie + + + HOM_HYPO_NORM_ABS + Absolu + + + HOM_HYPO_NORM_REL + Relatif + + + HOM_HYPO_COMP + Il faut choisir au moins une composante. + + + HOM_HYPO_EDIT_WINDOW_TITLE + Edition d'une hypothèse + + + Type of adaptation + Type d'adaptation + + + Uniform + Uniforme + + + Uniform adaptation + Adaptation uniforme + + + Coarsening + Déraffinement + + + Refinement + Raffinement + + + Nothing + Rien + + + Jump between elements + Saut entre éléments + + + Component + Composante + + + Refinement threshold + Seuil de raffinement + + + Coarsening threshold + Seuil de déraffinement + + + Percentage of meshes + Pourcentage de mailles + + + Mean + n*(std deviation) + Moyenne + n*(ecart-type) + + + No refinement + Sans raffinement + + + Mean - n*(std deviation) + Moyenne - n*(ecart-type) + + + No coarsening + Sans déraffinement + + + Chosen + Choisi + + + Box + Boîte + + + Sphere + Sphère + + + Cylinder + Cylindre + + + Disk + Disque + + + Disk with hole + Disque avec trou + + + Pipe + Tuyau + + + Coordinates + Coordonnées + + + Get CAO + Acquisition de la CAO + + + Create an analytical boundary + Création d'une frontière analytique + + + Create a discrete boundary + Création d'une frontière discrète + + + Type of boundary + Type de la frontière + + + Torus + Tore + + + Radius + Rayon + + + Radius 1 + Rayon 1 + + + Radius 2 + Rayon 2 + + + External radius + Rayon externe + + + Internal radius + Rayon interne + + + Height + Hauteur + + + X axis + X axe + + + Y axis + Y axe + + + Z axis + Z axe + + + R revolution + R révolution + + + Primary R + R primaire + + + HOM_BOUN_NAME + Il faut donner un nom à la frontière. + + + HOM_BOUN_MESH + Il faut choisir le fichier qui contient le maillage de la frontière discrète. + + + HOM_BOUN_CAO + Il faut choisir le fichier qui contient la CAO. + + + HOM_BOUN_CASE + Le fichier du maillage du cas est inconnu. + + + HOM_AXE + L'axe doit être un vecteur non nul. + + + HOM_BOUN_C_EDIT_WINDOW_TITLE + Edition d'une frontière basée sur une CAO + + + HOM_BOUN_A_EDIT_WINDOW_TITLE + Edition d'une frontière analytique + + + HOM_BOUN_D_EDIT_WINDOW_TITLE + Edition d'une frontière discrète + + + HOM_GROU_EDIT_WINDOW_TITLE + Groupes choisis + + + The height must be positive. + La hauteur doit être positive. + + + The radius must be positive. + Un rayon doit être positif. + + + The axis must be a non 0 vector. + L'axe doit être un vecteur non nul. + + + The angle must be included higher than 0 degree and lower than 90 degrees. + L'angle doit être compris entre 0 et 90 degrés. + + + The radius must be different. + Les rayons doivent être différents. + + + The centers must be different. + Les centres doivent être différents. + + + The external radius must be higher than the internal radius. + Le rayon externe doit être supérieur au rayon interne. + + + The X coordinates are not coherent. + Les coordonnées en X ne sont pas cohérentes. + + + The Y coordinates are not coherent. + Les coordonnées en Y ne sont pas cohérentes. + + + The Z coordinates are not coherent. + Les coordonnées en Z ne sont pas cohérentes. + + + The first coordinates are not coherent. + Les premières coordonnées ne sont pas cohérentes. + + + The second coordinates are not coherent. + Les secondes coordonnées ne sont pas cohérentes. + + + The orientation must be 1, 2 or 3. + L'orientation vaut 1, 2 ou 3. + + + HOM_MESH_INFO_0 + Analyse de maillage + + + HOM_MESH_INFO_1 + Choisir au moins une option. + + + HOM_MESH_INFO_2 + Bilan de l'analyse dans l'arbre d'études, fichier + + + Filtering with groups + Filtrage par les groupes + + + Selection of groups + Choix des groupes + + + Selected groups + Groupes choisis + + + Group + Groupe + + + Information on a mesh + Analyse d'un maillage + + + Group size + Taille des domaines + + + Quality + Qualité + + + Connection + Connexité + + + Diametre + Diamètre + + + Entanglement + Interpénétration + + + No change is allowed in a boundary. Ask for evolution. + Impossible de changer une donnée dans une frontière. Demander une évolution. + + + This boundary is used in a case and cannot be deleted. + Cette frontière est utilisée dans un cas ; elle ne peut pas être détruite. + + + This hypothesis is used and cannot be deleted. + Cette hypothèse est utilisée dans une itération ; elle ne peut pas être détruite. + + + This iteration cannot be deleted. + Cette itération ne peut pas être détruite. + + + The directory for the calculation cannot be cleared. + Menage du repertoire de calcul impossible + + + Starting point + Point de départ + + + From an iteration + A partir d'une itération + + + From a case + A partir d'un cas + + + Iteration into the case + Choix d'une itération dans le cas + + + Last iteration + A partir de la dernière itération + + + Iteration number + A partir d'une itération numérotée + + + The directory of the case does not exist. + Le répertoire du cas n'existe pas. + + + The directory for the case cannot be modified because some iterations are already defined. + Impossible de changer le répertoire du cas car des itérations ont déjà été définies. + + + The directory for the case cannot be reached. + Impossible d'atteindre ce répertoire pour le cas. + + + The starting point for the case cannot be copied into the working directory. + Impossible de copier le point de départ du cas dans le répertoire de travail. + + + The starting point for the case cannot be moved into the new directory. + Impossible de déplacer le point de départ du cas dans le nouveau répertoire. + + + The directory of the case for the pursuit does not exist. + Le répertoire du cas de reprise n'existe pas. + + + The directory of the iteration does not exist. + Le répertoire de l'itération de reprise n'existe pas. + + + The number of iteration must be positive. + Le numéro de l'itération doit etre positif. + + + Number of iteration + Numéro de l'itération + + + Case + Cas + + + Mesh file + Maillage initial + + + Constant + Constant + + + Variable + Variable + + + Type of schema + Type de schema + + + Maximum of ... + Maximum de ... + + + Iterations + Itérations + + + Nodes + Noeuds + + + Elements + Eléments + + + Test of convergence + Test de convergence + + + Edit a file + Affichage d'un fichier + + + Print + Imprimer + + + Invalid study context + Etude contextuelle non valable + + + PREF_TAB_GENERAL + Général + + + PREF_PUBLICATION + Publication + + + PREF_PUBLICATION_MAILLAGE_IN + Les maillages d'entrée + + + PREF_PUBLICATION_MAILLAGE_OUT + Les maillages de sortie + + + diff --git a/src/SMESHGUI/SMESHGUI_Homard_msg_ja.ts b/src/SMESHGUI/SMESHGUI_Homard_msg_ja.ts new file mode 100644 index 000000000..94cd0943c --- /dev/null +++ b/src/SMESHGUI/SMESHGUI_Homard_msg_ja.ts @@ -0,0 +1,868 @@ + + + + + @default + + HOM_WARNING + 警告 + + + HOM_ERROR + エラー + + + HOM_INACTIVE_BUTTON + アクティブでないボタン + + + OK + Ok + + + Apply + 適用 + + + Cancel + キャンセル + + + Help + ヘルプ + + + New + 新規 + + + Edit + 編集 + + + Quit + 終了 + + + Name + 名前 + + + Directory + ディレクトリ + + + Mesh + メッシュ + + + Selection + 選択 + + + None + なし + + + All + 全て + + + HOM_SELECT_OBJECT_1 + オブジェクトを選択します。 + + + HOM_SELECT_OBJECT_2 + 1 つのオブジェクトを選択します。 + + + HOM_SELECT_OBJECT_3 + 型 %1 のオブジェクトを選択します。 + + + HOM_SELECT_OBJECT_4 + The name of the object is already selected. Modify it or cancel. + + + HOM_SELECT_FILE_0 + ファイル選択 + + + HOM_SELECT_FILE_1 + ファイルを選択します。 + + + HOM_SELECT_FILE_2 + 1 つのファイルを選択します。 + + + HOM_SELECT_FILE_3 + このファイルを開くことができません。 + + + HOM_SCRIPT_FILE + 我々 は python スクリプトにファイルを与える必要があります。 + + + HOM_MED_FILE_1 + この医学ファイルは読み取り不可能です。 + + + HOM_MED_FILE_2 + この医学のファイルには、メッシュが含まれていません。 + + + HOM_MED_FILE_3 + この医学のファイルにはよりも 1 つのメッシュが含まれています。 + + + HOM_MED_FILE_4 + 音楽配信マック & ファイルのメッシュを読み取れませんでした。 + + + HOM_MED_FILE_5 + この医学のファイルには、フィールドが含まれていません。 + + + HOM_MED_FILE_6 + 医学ファイル (秒) (秒) フィールドを読み取ることができません。 + + + HOM_SELECT_STUDY + 研究医 associe + のファイルを選択または医学ファイルを選択します。 + + + Create a case + ケースの作成 + + + HOM_CASE_NAME + 場合に名前を付ける必要があります。 + + + HOM_CASE_DIRECTORY_1 + 1 つの場合を動作するようにディレクトリを選択する必要があります。 + + + HOM_CASE_DIRECTORY_2 + このディレクトリは、既に使用中です。 + + + HOM_CASE_DIRECTORY_3 + 有効なディレクトリを選択する必要があります。 + + + HOM_CASE_DIRECTORY_4 + 計算のための作業ディレクトリを選択する必要があります。 + + + HOM_START_DIRECTORY_1 + 追跡のため開始点を選択する必要があります。 + + + HOM_START_DIRECTORY_3 + 追跡のため有効な方向を選択する必要があります。 + + + HOM_CASE_MESH + 1 つは、初期のメッシュを選択する必要があります。 + + + HOM_CASE_GROUP + グループ"%1"は、以上の境界線に割り当てることはできません。 + + + HOM_CASE_EDIT_WINDOW_TITLE + 場合の編集 + + + HOM_CASE_EDIT_STATE_0 + 初期メッシュ。 + + + HOM_CASE_EDIT_STATE + イテレーションの継続。 + + + HOM_CASE_PURSUE_WINDOW_TITLE + イテレーションの追跡 + + + The configuration file cannot be found. + コンフィギュレーションファイルが見つかりません。 + + + The configuration file cannot be read. + コンフィギュレーションファイルが読み込めません。 + + + The HOMARD mesh file cannot be found. + HOMARDメッシュファイルが見つかりません。 + + + HOM_ITER_NAME + 名前を反復処理する必要があります。 + + + HOM_ITER_STARTING_POINT + これは、前のイテレーションを指定する必要があります。 + + + HOM_ITER_MESH + 最終的なメッシュの名前。 + + + HOM_ITER_HYPO + 仮説を選択します。 + + + HOM_ITER_STARTING_POINT_0 + メッシュ + + + HOM_ITER_STARTING_POINT_1 + ケースの最初のイテレーションです。 + + + HOM_ITER_STARTING_POINT_2 + 検察側の事件の最初のイテレーションです。 + + + HOM_ITER_EDIT_WINDOW_TITLE + イテレーションの編集 + + + Discrete boundary + 離散境界 + + + Analytical boundary + 解析的境界 + + + Conformity type + 適合タイプ + + + Conformal + 等角 + + + Non conformal + 非共形 + + + Non conformal option + 非共形オプション + + + Conformity + + 適合性 + + + + Free + Free + + + 1 hanging node per mesh + メッシュあたりの1接続節点 + + + 1 node per edge + エッジ辺りの1節点 + + + Advanced options + 詳細オプション + + + Authorized pyramids + 認定済みピラミッド + + + Minimal diameter + 最小径 + + + Initialization of adaptation + 適応の初期化 + + + Maximal level + 最大レベル + + + Output of the level of refinement + リファインレベルの出力 + + + Output of the qualities + 品質の出力 + + + Output of the diameters + 直径の出力 + + + Output of the parents + 親直径の出力 + + + Output of the neighbours + 隣の直径の出力 + + + Create an iteration + イテレーションの作成 + + + Iteration Name + イテレーションの名前 + + + Previous iteration + 以前のイテレーション + + + Invalid boundary + 無効な境界 + + + Invalid case + 無効なケース + + + Invalid case context + ケースの内容が無効です + + + Invalid hypothesis + 無効なhypothesis + + + Invalid iteration + 無効なイテレーション + + + This boundary has already been defined. + この境界は既に定義されています。 + + + This case has already been defined. + このケースは既に定義されています。 + + + This hypothesis has already been defined. + このhypothesisは既に定義されています。 + + + This iteration has already been defined. + このイテレーションは既に定義されています。 + + + The parent iteration is not defined. + 親イテレーションは、定義されていません。 + + + Unable to create the iteration. + イテレーションを作成することができません。 + + + The directory for the computation cannot be created. + 計算のためのディレクトリを作成できません。 + + + This iteration is the first of the case and cannot be computed. + このイタレーションはケースの最初であり、計算できません。 + + + This iteration does not have any associated hypothesis. + このイタレーションは関連した hypothesis がありません。 + + + The mesh file does not exist. + メッシュ ファイルは存在しません。 + + + The mesh file cannot be deleted. + メッシュ ファイルを削除できません。 + + + Mesh n + メッシュ n + + + Mesh n+1 + メッシュ n + 1 + + + Rank + ランク + + + Hypothesis + Hypothesis + + + Create a hypothesis + hypothesis の作成 + + + HOM_HYPO_NAME + 仮説に名前を付ける必要があります。 + + + HOM_HYPO_NORM_L2 + 標準の L2 + + + HOM_HYPO_NORM_INF + 無限の標準 + + + HOM_HYPO_NORM_ABS + 絶対値 + + + HOM_HYPO_NORM_REL + 関係 + + + HOM_HYPO_COMP + 1 つ以上のコンポーネントを選択する必要があります。 + + + HOM_HYPO_EDIT_WINDOW_TITLE + 仮説の編集 + + + Type of adaptation + 適合のタイプ + + + Uniform + 均一 + + + Uniform adaptation + 均一な適応 + + + Refinement + リファインメント + + + Nothing + なし + + + Jump between elements + 要素間ジャンプ + + + Component + コンポーネント + + + Refinement threshold + リファインメント閾値 + + + Coarsening threshold + 粗大化閾値 + + + Percentage of meshes + メッシュの割合 + + + Mean + n*(std deviation) + 平均 + n * (標準偏差) + + + No refinement + リファインメントなし + + + Mean - n*(std deviation) + 平均 - n * (標準偏差) + + + No coarsening + 粗大化なし + + + Chosen + 選択済み + + + Box + Box + + + Sphere + 球 + + + Cylinder + 円筒 + + + Disk + 円盤 + + + Disk with hole + 穴付き円盤 + + + Pipe + パイプ + + + Coordinates + 座標 + + + Create an analytical boundary + 分析境界の作成 + + + Create a discrete boundary + 離散境界の作成 + + + Type of boundary + 境界のタイプ + + + Torus + 環状体 + + + Radius + 半径 + + + Radius 1 + 半径1 + + + Radius 2 + 半径2 + + + External radius + 外半径 + + + Internal radius + 内半径 + + + Height + 高さ + + + X axis + X 軸 + + + Y axis + Y 軸 + + + Z axis + Z 軸 + + + R revolution + R 回転 + + + Primary R + 主 R + + + HOM_BOUN_NAME + 名前の国境に与えする必要があります。 + + + HOM_BOUN_MESH + 1 つの枠を含むメッシュを選択する必要があります。 + + + HOM_BOUN_CASE + 場合ファイルのメッシュが知られています。 + + + HOM_AXE + 軸は、ゼロ以外のベクトルでなければなりません。 + + + HOM_BOUN_A_EDIT_WINDOW_TITLE + 分析のフロンティアの編集 + + + HOM_BOUN_D_EDIT_WINDOW_TITLE + 離散境界の編集 + + + HOM_GROU_EDIT_WINDOW_TITLE + 選択したグループ + + + The height must be positive. + 高さは正でなければなりません。 + + + The radius must be positive. + 半径は正でなければなりません。 + + + The axis must be a non 0 vector. + 軸は非 0 のベクトルでなければなりません。 + + + The angle must be included higher than 0 degree and lower than 90 degrees. + 角度は0 °よりも大きく 90 °未満である必要があります。 + + + The radius must be different. + 半径が異なる必要があります。 + + + The centers must be different. + 中心が異なる必要があります。 + + + The external radius must be higher than the internal radius. + 外部の半径は内部の半径より大きい必要があります。 + + + The X coordinates are not coherent. + X座標は論理上問題があります。 + + + The Y coordinates are not coherent. + Y座標は論理上問題があります。 + + + The Z coordinates are not coherent. + Z座標は論理上問題があります。 + + + The first coordinates are not coherent. + 最初の座標に論理上問題があります。 + + + The second coordinates are not coherent. + 2番目の座標に論理上問題があります。 + + + The orientation must be 1, 2 or 3. + 方向は1、2、3のどれかにする必要があります。 + + + HOM_MESH_INFO_0 + メッシュの解析 + + + HOM_MESH_INFO_1 + 少なくとも 1 つのオプションを選択します。 + + + HOM_MESH_INFO_2 + バランス シート分析結果をスタディ ツリーで、ファイル + + + Filtering with groups + グループでフィルタリング + + + Selection of groups + グループの選択 + + + Selected groups + 選択されたグループ + + + Group + グループ : + + + Information on a mesh + メッシュに関する情報 + + + Group size + グループのサイズ + + + Quality + 品質 + + + Connection + 接続 + + + Diametre + 直径 + + + Entanglement + 縺れ合い + + + No change is allowed in a boundary. Ask for evolution. + 境界内に許可された変更はありません。旋回について尋ねます。 + + + This boundary is used in a case and cannot be deleted. + この境界はケースで使用されており、削除できません。 + + + This hypothesis is used and cannot be deleted. + このhypothesisは使用されており、削除できません。 + + + This iteration cannot be deleted. + このイテレーションは削除できません。 + + + The directory for the calculation cannot be cleared. + 計算用ディレクトリは削除できません。 + + + Starting point + 始点 + + + From an iteration + イテレーションから + + + From a case + ケースから + + + Iteration into the case + ケースへのイテレーション + + + Last iteration + 最後のイテレーション + + + Iteration number + イテレーション数 + + + The directory of the case does not exist. + ケースのディレクトリは存在しません。 + + + The directory for the case cannot be modified because some iterations are already defined. + いくつかのイテレーションが既に定義されているため、ケースのディレクトリを変更できません。 + + + The directory for the case cannot be reached. + ケースのディレクトリに到達できません。 + + + The starting point for the case cannot be copied into the working directory. + ケースの開始点は作業ディレクトリにコピーできません。 + + + The starting point for the case cannot be moved into the new directory. + ケースの開始点は新しいディレクトリに移動できません。 + + + The directory of the case for the pursuit does not exist. + 追跡用ケースのディレクトリは存在しません。 + + + The directory of the iteration does not exist. + イテレーションのディレクトリが存在しません。 + + + The number of iteration must be positive. + イテレーション数は正である必要があります。 + + + Number of iteration + イテレーション数 + + + Case + ケース + + + Mesh file + メッシュファイル + + + Constant + 定数 + + + Variable + 変数 + + + Type of schema + スキーマタイプ + + + Maximum of ... + 最大の... + + + Iterations + イテレーション + + + Nodes + 節点 + + + Elements + 要素 + + + Test of convergence + 収束テスト + + + Edit a file + ファイルの編集 + + + Print + 印刷 + + + Invalid study context + 無効なスタディの内容 + + + PREF_TAB_GENERAL + 一般的な + + + PREF_PUBLICATION + 発行 + + + PREF_PUBLICATION_MAILLAGE_IN + メッシュ入力 + + + PREF_PUBLICATION_MAILLAGE_OUT + メッシュ出力 + + + diff --git a/src/SMESHGUI/SMESHGUI_Operations.h b/src/SMESHGUI/SMESHGUI_Operations.h index e24bcd558..b91a92787 100644 --- a/src/SMESHGUI/SMESHGUI_Operations.h +++ b/src/SMESHGUI/SMESHGUI_Operations.h @@ -184,6 +184,7 @@ namespace SMESHOp { OpSplitBiQuadratic = 4515, // MENU MODIFICATION - SPLIT BI-QUADRATIC TO LINEAR // Adaptation ---------------------//-------------------------------- OpMGAdapt = 8020, // MENU ADAPTATION - MG-ADAPT + OpHomardAdapt = 8021, // MENU ADAPTATION - HOMARD-ADAPT // Measurements -------------------//-------------------------------- OpPropertiesLength = 5000, // MENU MEASUREMENTS - BASIC PROPERTIES - LENGTH OpPropertiesArea = 5001, // MENU MEASUREMENTS - BASIC PROPERTIES - AREA diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 74697d463..676c0aad8 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -87,6 +87,10 @@ ICON_MG_ADAPT adapt_mg_adapt.png + + ICON_HOMARD_ADAPT + adapt_homard.png + ICON_CONV_TO_QUAD mesh_conv_to_quad.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 67ca49fe5..827d8ab82 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -340,6 +340,10 @@ MEN_MG_ADAPT Remesh with MG_Adapt + + MEN_HOMARD_ADAPT + Uniform refinement + Args Arguments @@ -3025,6 +3029,10 @@ Check algorithm documentation for supported geometry ADAPT_PREF_NONE None + + ADAPT_WITH_HOMARD + Adaptation with HOMARD + ADAPT_PREF_MG_ADAPT Adaptation with MG-Adapt @@ -3216,6 +3224,10 @@ Use Display Entity menu command to show them. SMESH_Z Z + + SMESH_Z_SCALARBAR + Z: + STATE_ALGO_MISSING %3 %2D algorithm is missing @@ -3312,6 +3324,10 @@ Use Display Entity menu command to show them. STB_MG_ADAPT Remesh with MG_Adapt + + STB_HOMARD_ADAPT + Uniform refinement + STB_CONV_TO_QUAD Convert to/from quadratic @@ -4008,6 +4024,10 @@ Use Display Entity menu command to show them. TOP_MG_ADAPT Remesh with MG_Adapt + + TOP_HOMARD_ADAPT + Uniform refinement + TOP_CONV_TO_QUAD Convert to/from quadratic diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 5ff731606..8a06db471 100644 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -340,6 +340,10 @@ MEN_MG_ADAPT Remaillage avec MG_Adapt + + MEN_HOMARD_ADAPT + Raffinement uniforme + Args Arguments @@ -1610,6 +1614,10 @@ Merci de les corriger, puis essayez de nouveau SMESH_AVAILABLE Disponible + + SMESH_NOT_AVAILABLE + Indisponible + SMESH_AVAILABLE_ALGORITHMS Algorithmes disponibles @@ -1750,7 +1758,7 @@ Merci de les corriger, puis essayez de nouveau SMESH_CONTINUE_MESH_VISUALIZATION - La système semble manquer de mémoire pour visualiser le maillage, + Le système semble manquer de mémoire pour visualiser le maillage, ce qui peut faire planter l'application. Voulez-vous continuer la visualisation ? @@ -2816,6 +2824,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée SMESH_RENUMBERING + Renumérotation + + + SMESH_RENUMBER Renuméroter @@ -2836,7 +2848,7 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée SMESH_RM_HYP_WRN - "%1" n'est pas attribué, mais: + "%1" n'est pas attribué, mais : @@ -3011,6 +3023,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée ADAPT_PREF_NONE Sans + + ADAPT_WITH_HOMARD + Adaptation avec HOMARD + ADAPT_PREF_MG_ADAPT Adaptation avec MG-Adapt @@ -3203,6 +3219,10 @@ Utilisez le menu "Visualiser une entité" pour les afficher. SMESH_Z Z + + SMESH_Z_SCALARBAR + Z : + STATE_ALGO_MISSING Il manque l'algorithme %3 %2D @@ -3299,6 +3319,10 @@ Utilisez le menu "Visualiser une entité" pour les afficher. STB_MG_ADAPT Remaillage avec MG_Adapt + + STB_HOMARD_ADAPT + Raffinement uniforme + STB_CONV_TO_QUAD Convertir vers/depuis quadratique @@ -3521,7 +3545,7 @@ Utilisez le menu "Visualiser une entité" pour les afficher. STB_DEFLECTION_2D - Deflection 2D + Déflection 2D STB_MAP @@ -3995,6 +4019,10 @@ Utilisez le menu "Visualiser une entité" pour les afficher. TOP_MG_ADAPT Remaillage avec MG_Adapt + + TOP_HOMARD_ADAPT + Raffinement uniforme + TOP_CONV_TO_QUAD Convertir vers/de quadratique diff --git a/src/SMESH_I/CMakeLists.txt b/src/SMESH_I/CMakeLists.txt index e04e4a604..0ce820e3a 100644 --- a/src/SMESH_I/CMakeLists.txt +++ b/src/SMESH_I/CMakeLists.txt @@ -115,6 +115,7 @@ SET(SMESHEngine_HEADERS SMESH.hxx SMESH_Component_Generator.hxx MG_ADAPT_i.hxx + SMESH_Homard_i.hxx ) # --- sources --- @@ -144,6 +145,7 @@ SET(SMESHEngine_SOURCES SMESH_PreMeshInfo.cxx SMESH_Component_Generator.cxx MG_ADAPT_i.cxx + SMESH_Homard_i.cxx ) # --- rules --- diff --git a/src/SMESH_I/MG_ADAPT_i.cxx b/src/SMESH_I/MG_ADAPT_i.cxx index 02415c69e..7950f58dd 100644 --- a/src/SMESH_I/MG_ADAPT_i.cxx +++ b/src/SMESH_I/MG_ADAPT_i.cxx @@ -19,6 +19,8 @@ #include "MG_ADAPT_i.hxx" +#include CORBA_SERVER_HEADER(SMESH_Homard) + #include "MG_ADAPT.hxx" #include "SMESH_File.hxx" #include "SMESH_Gen_i.hxx" @@ -114,7 +116,8 @@ SMESH::MG_ADAPT_ptr SMESH_Gen_i::CreateAdaptationHypothesis() return SMESH::MG_ADAPT_ptr(); #endif } -SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) +//SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) +SALOME::GenericObj_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) { #ifndef DISABLE_MG_ADAPT if (!strcmp(adaptationType, "MG_Adapt")) @@ -124,6 +127,9 @@ SMESH::MG_ADAPT_OBJECT_ptr SMESH_Gen_i::Adaptation( const char* adaptationType) return anObj._retn(); } #endif + if (!strcmp(adaptationType, "Uniform")) { + return CreateHOMARD_ADAPT(); + } return SMESH::MG_ADAPT_OBJECT_ptr(); } //============================================================================= diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 07b3d3399..f69c70eef 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1013,6 +1013,11 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand ) { Handle(_pyMesh) mesh = new _pyMesh( theCommand ); AddObject( mesh ); + // set mesh name + _pyID id = mesh->GetID(), comma("'"); + if ( myObjectNames.IsBound( id )) + theCommand->SetArg( theCommand->GetNbArgs() + 1, + comma + myObjectNames( id ) + comma); return; } if ( method == "CreateMeshesFromUNV" || diff --git a/src/SMESH_I/SMESH_Gen_i.hxx b/src/SMESH_I/SMESH_Gen_i.hxx index 9caaa543c..fd17647fa 100644 --- a/src/SMESH_I/SMESH_Gen_i.hxx +++ b/src/SMESH_I/SMESH_Gen_i.hxx @@ -477,8 +477,10 @@ public: int CountInPyDump(const TCollection_AsciiString& text); SMESH::MG_ADAPT_ptr CreateMG_ADAPT(); + SMESHHOMARD::HOMARD_Gen_ptr CreateHOMARD_ADAPT(); SMESH::MG_ADAPT_ptr CreateAdaptationHypothesis(); - SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType); + //SMESH::MG_ADAPT_OBJECT_ptr Adaptation( const char* adaptationType); + SALOME::GenericObj_ptr Adaptation( const char* adaptationType); // ***************************************** // Internal methods diff --git a/src/SMESH_I/SMESH_Homard_i.cxx b/src/SMESH_I/SMESH_Homard_i.cxx new file mode 100644 index 000000000..55699404a --- /dev/null +++ b/src/SMESH_I/SMESH_Homard_i.cxx @@ -0,0 +1,2838 @@ +// Copyright (C) 2011-2021 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 "SMESH_Homard_i.hxx" +#include "SMESH_Homard.hxx" + +#include "SMESH_Gen_i.hxx" +#include "SMESH_PythonDump.hxx" + +#include "SMESH_File.hxx" + +#include "utilities.h" +#include "Basics_Utils.hxx" +#include "Basics_DirUtils.hxx" +#include "Utils_SINGLETON.hxx" +#include "Utils_CorbaException.hxx" +#include "SALOMEDS_Tool.hxx" +#include "SALOME_LifeCycleCORBA.hxx" +#include "SALOMEconfig.h" + +// Have to be included before std headers +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef WIN32 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +// C'est le ASSERT de SALOMELocalTrace/utilities.h dans KERNEL +#ifndef VERIFICATION +#define VERIFICATION(condition) \ + if (!(condition)){INTERRUPTION("CONDITION "<<#condition<<" NOT VERIFIED")} +#endif /* VERIFICATION */ + +// La gestion des repertoires +#ifndef CHDIR + #ifdef WIN32 + #define CHDIR _chdir + #else + #define CHDIR chdir + #endif +#endif + +using namespace std; + +SMESHHOMARD::HOMARD_Gen_ptr SMESH_Gen_i::CreateHOMARD_ADAPT() +{ + if (getenv("HOMARD_ROOT_DIR") == NULL) { + THROW_SALOME_CORBA_EXCEPTION("HOMARD_ROOT_DIR is not defined", SALOME::INTERNAL_ERROR); + } + else { + std::string homard_exec = getenv("HOMARD_ROOT_DIR"); + homard_exec += "/bin/salome/homard"; + if (!SMESH_File(homard_exec).exists()) + THROW_SALOME_CORBA_EXCEPTION("HOMARD module is not built", SALOME::INTERNAL_ERROR); + } + SMESHHOMARD_I::HOMARD_Gen_i* aHomardGen = new SMESHHOMARD_I::HOMARD_Gen_i(); + SMESHHOMARD::HOMARD_Gen_var anObj = aHomardGen->_this(); + return anObj._retn(); +} + +namespace SMESHHOMARD_I +{ + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Boundary_i::HOMARD_Boundary_i() + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) +{ + MESSAGE("Default constructor, not for use"); + ASSERT(0); +} +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Boundary_i::HOMARD_Boundary_i(SMESHHOMARD::HOMARD_Gen_var engine) + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) +{ + MESSAGE("HOMARD_Boundary_i"); + _gen_i = engine; + myHomardBoundary = new SMESHHOMARDImpl::HOMARD_Boundary(); + ASSERT(myHomardBoundary); +} +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +HOMARD_Boundary_i::~HOMARD_Boundary_i() +{ +} +//============================================================================= +//============================================================================= +// Generalites +//============================================================================= +//============================================================================= +void HOMARD_Boundary_i::SetName(const char* Name) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetName(Name); +} +//============================================================================= +char* HOMARD_Boundary_i::GetName() +{ + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetName().c_str()); +} +//============================================================================= +char* HOMARD_Boundary_i::GetDumpPython() +{ + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetDumpPython().c_str()); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Boundary_i::SetType(CORBA::Long Type) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetType(Type); +} +//============================================================================= +CORBA::Long HOMARD_Boundary_i::GetType() +{ + ASSERT(myHomardBoundary); + return CORBA::Long(myHomardBoundary->GetType()); +} +//============================================================================= +void HOMARD_Boundary_i::SetMeshName(const char* MeshName) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetMeshName(MeshName); +} +//============================================================================= +char* HOMARD_Boundary_i::GetMeshName() +{ + ASSERT(myHomardBoundary); + return CORBA::string_dup(myHomardBoundary->GetMeshName().c_str()); +} +//============================================================================= +void HOMARD_Boundary_i::SetDataFile(const char* DataFile) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetDataFile(DataFile); +} +//============================================================================= +char* HOMARD_Boundary_i::GetDataFile() +{ + ASSERT(myHomardBoundary); + 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) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetCylinder(X0, X1, X2, X3, X4, X5, X6); +} +//============================================================================= +void HOMARD_Boundary_i::SetSphere(double Xcentre, double Ycentre, double ZCentre, double rayon) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetSphere(Xcentre, Ycentre, ZCentre, rayon); +} +//============================================================================= +void HOMARD_Boundary_i::SetConeR(double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetConeR(Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2); +} +//============================================================================= +void HOMARD_Boundary_i::SetConeA(double Xaxe, double Yaxe, double Zaxe, double Angle, double Xcentre, double Ycentre, double Zcentre) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetConeA(Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre); +} +//============================================================================= +void HOMARD_Boundary_i::SetTorus(double X0, double X1, double X2, double X3, double X4, double X5, double X6, double X7) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetTorus(X0, X1, X2, X3, X4, X5, X6, X7); +} +//============================================================================= +SMESHHOMARD::double_array* HOMARD_Boundary_i::GetCoords() +{ + ASSERT(myHomardBoundary); + SMESHHOMARD::double_array_var aResult = new SMESHHOMARD::double_array(); + std::vector mesCoor = myHomardBoundary->GetCoords(); + aResult->length(mesCoor .size()); + std::vector::const_iterator it; + int i = 0; + for (it = mesCoor.begin(); it != mesCoor.end(); it++) + aResult[i++] = (*it); + return aResult._retn(); +} +//============================================================================= +void HOMARD_Boundary_i::SetLimit(double Xincr, double Yincr, double Zincr) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->SetLimit(Xincr, Yincr, Zincr); +} +//============================================================================= +SMESHHOMARD::double_array* HOMARD_Boundary_i::GetLimit() +{ + ASSERT(myHomardBoundary); + SMESHHOMARD::double_array_var aResult = new SMESHHOMARD::double_array(); + std::vector mesCoor = myHomardBoundary->GetLimit(); + aResult->length(mesCoor .size()); + std::vector::const_iterator it; + int i = 0; + for (it = mesCoor.begin(); it != mesCoor.end(); it++) + aResult[i++] = (*it); + return aResult._retn(); +} +//============================================================================= +void HOMARD_Boundary_i::AddGroup(const char* Group) +{ + ASSERT(myHomardBoundary); + myHomardBoundary->AddGroup(Group); +} +//============================================================================= +void HOMARD_Boundary_i::SetGroups(const SMESHHOMARD::ListGroupType& ListGroup) +{ + ASSERT(myHomardBoundary); + std::list ListString; + for (unsigned int i = 0; i < ListGroup.length(); i++) { + ListString.push_back(std::string(ListGroup[i])); + } + myHomardBoundary->SetGroups(ListString); +} +//============================================================================= +SMESHHOMARD::ListGroupType* HOMARD_Boundary_i::GetGroups() +{ + ASSERT(myHomardBoundary); + const std::list& ListString = myHomardBoundary->GetGroups(); + SMESHHOMARD::ListGroupType_var aResult = new SMESHHOMARD::ListGroupType; + aResult->length(ListString.size()); + std::list::const_iterator it; + int i = 0; + for (it = ListString.begin(); it != ListString.end(); it++) + { + aResult[i++] = CORBA::string_dup((*it).c_str()); + } + return aResult._retn(); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Cas_i::HOMARD_Cas_i() + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) +{ + MESSAGE("Default constructor, not for use"); + ASSERT(0); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Cas_i::HOMARD_Cas_i(SMESHHOMARD::HOMARD_Gen_var engine) + : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()) +{ + MESSAGE("HOMARD_Cas_i"); + _gen_i = engine; + myHomardCas = new SMESHHOMARDImpl::HOMARD_Cas(); + ASSERT(myHomardCas); +} + +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +HOMARD_Cas_i::~HOMARD_Cas_i() +{ +} +//============================================================================= +char* HOMARD_Cas_i::GetDumpPython() +{ + ASSERT(myHomardCas); + return CORBA::string_dup(myHomardCas->GetDumpPython().c_str()); +} +//============================================================================= +//============================================================================= +// Caracteristiques +//============================================================================= +//============================================================================= +void HOMARD_Cas_i::SetDirName(const char* NomDir) +{ + ASSERT(myHomardCas); + int codret; + // A. recuperation du nom; on ne fait rien si c'est le meme + char* oldrep = GetDirName(); + if (strcmp(oldrep,NomDir) == 0) return; + MESSAGE ("SetDirName : passage de oldrep = "<< oldrep << " a NomDir = "<SetDirName(NomDir); + if (codret != 0) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text; + if (codret == 1) + text = "The directory for the case cannot be modified because some iterations are already defined."; + else + text = "The directory for the case cannot be reached."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + + // D. En cas de reprise, deplacement du point de depart + HOMARD_Gen_i* aGenImpl = SMESH::DownCast(_gen_i); + HOMARD_Iteration_i* Iter0 = aGenImpl->GetIteration(0); + int state = Iter0->GetNumber(); + if (state != 0) { // GetState() + MESSAGE ("etat : " << state); + // D.1. Nom local du repertoire de l'iteration de depart dans le repertoire actuel du cas + char* DirNameIter = Iter0->GetDirNameLoc(); + MESSAGE ("SetDirName : nom actuel pour le repertoire de l iteration, DirNameIter = "<< DirNameIter); + // D.2. Recherche d'un nom local pour l'iteration de depart dans le futur repertoire du cas + char* nomDirIter = aGenImpl->CreateDirNameIter(NomDir, 0); + MESSAGE ("SetDirName : nom futur pour le repertoire de l iteration, nomDirIter = "<< nomDirIter); + // D.3. Creation du futur repertoire local pour l'iteration de depart + std::string nomDirIterTotal; + nomDirIterTotal = std::string(NomDir) + "/" + std::string(nomDirIter); +#ifndef WIN32 + if (mkdir(nomDirIterTotal.c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(nomDirIterTotal.c_str()) != 0) +#endif + { + MESSAGE ("nomDirIterTotal : " << nomDirIterTotal); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The directory for the starting iteration cannot be created."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + // D.4. Deplacement du contenu du repertoire + std::string oldnomDirIterTotal; + oldnomDirIterTotal = std::string(oldrep) + "/" + std::string(DirNameIter); + std::string commande = "mv " + std::string(oldnomDirIterTotal) + "/*" + " " + std::string(nomDirIterTotal); + codret = system(commande.c_str()); + if (codret != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The starting point for the case cannot be moved into the new directory."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + commande = "rm -rf " + std::string(oldnomDirIterTotal); + codret = system(commande.c_str()); + if (codret != 0) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The starting point for the case cannot be deleted."; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + // D.5. Memorisation du nom du repertoire de l'iteration + Iter0->SetDirNameLoc(nomDirIter); + } +} +//============================================================================= +char* HOMARD_Cas_i::GetDirName() +{ + ASSERT(myHomardCas); + return CORBA::string_dup(myHomardCas->GetDirName().c_str()); +} +//============================================================================= +void HOMARD_Cas_i::SetBoundingBox(const SMESHHOMARD::extrema& LesExtrema) +{ + ASSERT(myHomardCas); + std::vector VExtrema; + ASSERT(LesExtrema.length() == 10); + VExtrema.resize(LesExtrema.length()); + for (int i = 0; i < (int)LesExtrema.length(); i++) { + VExtrema[i] = LesExtrema[i]; + } + myHomardCas->SetBoundingBox(VExtrema); +} +//============================================================================= +SMESHHOMARD::extrema* HOMARD_Cas_i::GetBoundingBox() +{ + ASSERT(myHomardCas); + SMESHHOMARD::extrema_var aResult = new SMESHHOMARD::extrema(); + std::vector LesExtremes = myHomardCas->GetBoundingBox(); + ASSERT(LesExtremes.size() == 10); + aResult->length(10); + for (unsigned int i = 0; i < LesExtremes.size(); i++) { + aResult[i] = LesExtremes[i]; + } + return aResult._retn(); +} + +//============================================================================= +void HOMARD_Cas_i::AddGroup(const char* Group) +{ + ASSERT(myHomardCas); + myHomardCas->AddGroup(Group); +} +//============================================================================= +void HOMARD_Cas_i::SetGroups(const SMESHHOMARD::ListGroupType& ListGroup) +{ + ASSERT(myHomardCas); + std::list ListString; + for (unsigned int i = 0; i < ListGroup.length(); i++) + { + ListString.push_back(std::string(ListGroup[i])); + } + myHomardCas->SetGroups(ListString); +} +//============================================================================= +SMESHHOMARD::ListGroupType* HOMARD_Cas_i::GetGroups() +{ + ASSERT(myHomardCas); + const std::list& ListString = myHomardCas->GetGroups(); + SMESHHOMARD::ListGroupType_var aResult = new SMESHHOMARD::ListGroupType(); + aResult->length(ListString.size()); + std::list::const_iterator it; + int i = 0; + for (it = ListString.begin(); it != ListString.end(); it++) { + aResult[i++] = CORBA::string_dup((*it).c_str()); + } + 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 ("HOMARD_Cas_i::AddBoundaryGroup : BoundaryName = "<< BoundaryName << ", Group = " << Group); + ASSERT(myHomardCas); + // A. Préalables + // A.1. Caractéristiques de la frontière à ajouter + SMESHHOMARD::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& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); + std::list::const_iterator it; + // B. Controles + const char * boun; + int erreur = 0; + while (erreur == 0) + { + // 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); + SMESHHOMARD::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) + { + SMESHHOMARD::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 + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) { + MESSAGE (".. Frontiere : "<< *it); + // On saute le nom du groupe + it++; + } + // 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; + } + // 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::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); + } +} +//============================================================================= +SMESHHOMARD::ListBoundaryGroupType* HOMARD_Cas_i::GetBoundaryGroup() +{ + MESSAGE ("GetBoundaryGroup"); + ASSERT(myHomardCas); + const std::list& ListBoundaryGroup = myHomardCas->GetBoundaryGroup(); + SMESHHOMARD::ListBoundaryGroupType_var aResult = new SMESHHOMARD::ListBoundaryGroupType(); + aResult->length(ListBoundaryGroup.size()); + std::list::const_iterator it; + int i = 0; + for (it = ListBoundaryGroup.begin(); it != ListBoundaryGroup.end(); it++) + { + aResult[i++] = CORBA::string_dup((*it).c_str()); + } + return aResult._retn(); +} +//============================================================================= +void HOMARD_Cas_i::SupprBoundaryGroup() +{ + MESSAGE ("SupprBoundaryGroup"); + ASSERT(myHomardCas); + myHomardCas->SupprBoundaryGroup(); +} + +void HOMARD_Cas_i::AddIteration(const char* NomIteration) +{ + ASSERT(myHomardCas); + myHomardCas->AddIteration(NomIteration); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Iteration_i::HOMARD_Iteration_i() +{ + MESSAGE("Default constructor, not for use"); + ASSERT(0); +} +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Iteration_i::HOMARD_Iteration_i(SMESHHOMARD::HOMARD_Gen_var engine) +{ + MESSAGE("constructor"); + _gen_i = engine; + myHomardIteration = new SMESHHOMARDImpl::HOMARD_Iteration(); + ASSERT(myHomardIteration); +} +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +HOMARD_Iteration_i::~HOMARD_Iteration_i() +{ +} +//============================================================================= +void HOMARD_Iteration_i::SetName(const char* Name) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetName(Name); +} +//============================================================================= +char* HOMARD_Iteration_i::GetName() +{ + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetName().c_str()); +} +//============================================================================= +void HOMARD_Iteration_i::SetDirNameLoc(const char* NomDir) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetDirNameLoc(NomDir); +} +//============================================================================= +char* HOMARD_Iteration_i::GetDirNameLoc() +{ + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetDirNameLoc().c_str()); +} +//============================================================================= +char* HOMARD_Iteration_i::GetDirName() +{ + ASSERT(myHomardIteration); + SMESHHOMARD::HOMARD_Cas_ptr caseiter = _gen_i->GetCase(); + std::string dirnamecase = caseiter->GetDirName(); + std::string dirname = dirnamecase + "/" + GetDirNameLoc(); + return CORBA::string_dup(dirname.c_str()); +} +//============================================================================= +void HOMARD_Iteration_i::SetNumber(CORBA::Long NumIter) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetNumber(NumIter); +} +//============================================================================= +CORBA::Long HOMARD_Iteration_i::GetNumber() +{ + ASSERT(myHomardIteration); + return myHomardIteration->GetNumber(); +} +//============================================================================= +void HOMARD_Iteration_i::SetState(CORBA::Long Etat) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetState(Etat); +} +//============================================================================= +CORBA::Long HOMARD_Iteration_i::GetState() +{ + ASSERT(myHomardIteration); + return myHomardIteration->GetState(); +} +//============================================================================= +void HOMARD_Iteration_i::SetMeshName(const char* NomMesh) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetMeshName(NomMesh); +} +//============================================================================= +char* HOMARD_Iteration_i::GetMeshName() +{ + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetMeshName().c_str()); +} +//============================================================================= +void HOMARD_Iteration_i::SetMeshFile(const char* MeshFile) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetMeshFile(MeshFile); +} +//============================================================================= +char* HOMARD_Iteration_i::GetMeshFile() +{ + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetMeshFile().c_str()); +} +//============================================================================= +void HOMARD_Iteration_i::SetLogFile(const char* LogFile) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetLogFile(LogFile); +} +//============================================================================= +char* HOMARD_Iteration_i::GetLogFile() +{ + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetLogFile().c_str()); +} +//============================================================================= +void HOMARD_Iteration_i::SetFileInfo(const char* FileInfo) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetFileInfo(FileInfo); +} +//============================================================================= +char* HOMARD_Iteration_i::GetFileInfo() +{ + ASSERT(myHomardIteration); + return CORBA::string_dup(myHomardIteration->GetFileInfo().c_str()); +} +//============================================================================= +void HOMARD_Iteration_i::SetInfoCompute(CORBA::Long MessInfo) +{ + ASSERT(myHomardIteration); + myHomardIteration->SetInfoCompute(MessInfo); +} +//============================================================================= +CORBA::Long HOMARD_Iteration_i::GetInfoCompute() +{ + ASSERT(myHomardIteration); + return myHomardIteration->GetInfoCompute(); +} + +//============================================================================= +/*! + * standard constructor + */ +//============================================================================= +HOMARD_Gen_i::HOMARD_Gen_i() : SALOME::GenericObj_i(SMESH_Gen_i::GetPOA()), + myIteration0(NULL), + myIteration1(NULL), + _ConfType(0), + _KeepMedOUT(true), + _PublishMeshOUT(false), + _KeepWorkingFiles(false), + _LogInFile(false), + _RemoveLogOnSuccess(false), + _VerboseLevel(0), + _MeshNameOUT(""), + _MeshFileOUT(""), + _LogFile(""), + _CaseOnMedFile(true), + _SmeshMesh(SMESH::SMESH_Mesh::_nil()), + _TmpMeshFile("") +{ + MESSAGE("constructor de HOMARD_Gen_i"); + myHomard = new SMESHHOMARDImpl::HOMARD_Gen; +} + +//============================================================================= +/*! + * standard destructor + */ +//============================================================================= +HOMARD_Gen_i::~HOMARD_Gen_i() +{ + MESSAGE ("HOMARD_Gen_i::~HOMARD_Gen_i()"); +} + +//============================================================================= +//============================================================================= +// Destruction des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteBoundary(const char* BoundaryName) +{ + MESSAGE ("DeleteBoundary : BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid boundary"; + throw SALOME::SALOME_Exception(es); + } + + // Boundaries should be deleted only after all cases deletion!!! + + // comme on a un _var comme pointeur CORBA, on ne se preoccupe pas du delete + _mesBoundarys.erase(BoundaryName); + + return 0; +} + +//============================================================================= +CORBA::Long HOMARD_Gen_i::DeleteIteration(int numIter) +{ + MESSAGE ("DeleteIteration : numIter = " << numIter); + + if (numIter == 0) { + if (myIteration0 != NULL) { + delete myIteration0; + myIteration0 = NULL; + } + } + else { + if (myIteration1 != NULL) { + // Invalide Iteration + if (myIteration1->GetState() > 0) { + myIteration1->SetState(1); + if (!_KeepWorkingFiles) { + std::string nomDir = myIteration1->GetDirName(); + std::string commande = "rm -rf " + nomDir; + if (numIter > 0 && !_KeepMedOUT) { + // Remove associated mesh file + std::string nomFichier = myIteration1->GetMeshFile(); + commande = commande + ";rm -rf " + nomFichier; + } + MESSAGE ("commande = " << commande); + if ((system(commande.c_str())) != 0) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The directory for the calculation cannot be cleared."; + throw SALOME::SALOME_Exception(es); + } + } + } + + delete myIteration1; + myIteration1 = NULL; + } + } + + return 0; +} + +//============================================================================= +//============================================================================= +// Invalidation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::InvalideBoundary(const char* BoundaryName) +{ + MESSAGE("InvalideBoundary : BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; + if (CORBA::is_nil(myBoundary)) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid boundary"; + throw SALOME::SALOME_Exception(es); + } + else { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "No change is allowed in a boundary. Ask for evolution."; + throw SALOME::SALOME_Exception(es); + } +} + +//============================================================================= +//============================================================================= +// Association de lien entre des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +void HOMARD_Gen_i::AssociateCaseIter(int numIter, const char* labelIter) +{ + MESSAGE("AssociateCaseIter : " << numIter << ", " << labelIter); + + if (CORBA::is_nil(myCase)) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case"; + throw SALOME::SALOME_Exception(es); + } + + if (numIter == 0) { + if (myIteration0 == NULL) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + } + + HOMARD_Cas_i* aCaseImpl = SMESH::DownCast(myCase); + aCaseImpl->AddIteration(myIteration0->GetName()); + } + else { + if (myIteration1 == NULL) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid iteration"; + throw SALOME::SALOME_Exception(es); + } + + HOMARD_Cas_i* aCaseImpl = SMESH::DownCast(myCase); + aCaseImpl->AddIteration(myIteration1->GetName()); + } +} + +//============================================================================= +//============================================================================= +// Recuperation des listes +//============================================================================= +//============================================================================= +SMESHHOMARD::listeBoundarys* HOMARD_Gen_i::GetAllBoundarysName() +{ + MESSAGE("GetAllBoundarysName"); + + SMESHHOMARD::listeBoundarys_var ret = new SMESHHOMARD::listeBoundarys; + ret->length(_mesBoundarys.size()); + std::map::const_iterator it; + int i = 0; + for (it = _mesBoundarys.begin(); + it != _mesBoundarys.end(); it++) { + ret[i++] = CORBA::string_dup((*it).first.c_str()); + } + + return ret._retn(); +} + +//============================================================================= +//============================================================================= +// Recuperation des structures identifiees par leurs noms +//============================================================================= +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::GetBoundary(const char* nomBoundary) +{ + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[nomBoundary]; + ASSERT(!CORBA::is_nil(myBoundary)); + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::GetCase() +{ + ASSERT(!CORBA::is_nil(myCase)); + return SMESHHOMARD::HOMARD_Cas::_duplicate(myCase); +} +//============================================================================= +HOMARD_Iteration_i* HOMARD_Gen_i::GetIteration(int numIter) +{ + if (numIter == 0) { + ASSERT(myIteration0); + return myIteration0; + } + + ASSERT(myIteration1); + return myIteration1; +} + +//============================================================================= +//============================================================================= +// Nouvelles structures +//============================================================================= +//============================================================================= +SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::newCase() +{ + SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); + HOMARD_Cas_i* aServant = new HOMARD_Cas_i(engine); + SMESHHOMARD::HOMARD_Cas_var aCase = SMESHHOMARD::HOMARD_Cas::_narrow(aServant->_this()); + return aCase._retn(); +} +//============================================================================= +HOMARD_Iteration_i* HOMARD_Gen_i::newIteration() +{ + SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); + HOMARD_Iteration_i* aServant = new HOMARD_Iteration_i(engine); + return aServant; +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::newBoundary() +{ + SMESHHOMARD::HOMARD_Gen_var engine = POA_SMESHHOMARD::HOMARD_Gen::_this(); + HOMARD_Boundary_i* aServant = new HOMARD_Boundary_i(engine); + SMESHHOMARD::HOMARD_Boundary_var aBoundary = + SMESHHOMARD::HOMARD_Boundary::_narrow(aServant->_this()); + return aBoundary._retn(); +} + +//============================================================================= +// Creation of a case +// MeshName : name of the mesh +// smeshMesh : correspondent mesh +// theWorkingDir : path to working directory +//============================================================================= +SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCaseOnMesh (const char* MeshName, + SMESH::SMESH_Mesh_ptr smeshMesh, + const char* theWorkingDir) +{ + INFOS("CreateCaseOnMesh"); + + // A. Controles + // A.1. Controle du nom : + if (!myCase->_is_nil()) { + DeleteCase(); + } + + // A.2. Controle du objet maillage + if (CORBA::is_nil(smeshMesh)) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh object is null."; + throw SALOME::SALOME_Exception(es); + } + MESSAGE("CreateCaseOnMesh : smeshMesh is not nil"); + + // A.3. Write mesh object in a temporary file in the working directory + std::string aTmpMeshFile = theWorkingDir; + aTmpMeshFile = theWorkingDir; + aTmpMeshFile += std::string("/") + std::string(MeshName) + "_saved_from_SMESH"; + _TmpMeshFile = aTmpMeshFile + ".med"; + SMESH_File aFile (_TmpMeshFile, false); + for (int ii = 1; aFile.exists(); ii++) { + _TmpMeshFile = aTmpMeshFile + std::string("_") + std::to_string(ii) + ".med"; + aFile = SMESH_File(_TmpMeshFile, false); + } + const char* MeshFile = _TmpMeshFile.c_str(); + bool toOverwrite = true; + bool toFindOutDim = true; + + // Prevent dump of ExportMED + { + SMESH::TPythonDump pDump; // do not delete this line of code + smeshMesh->ExportMED(MeshFile, false, -1, toOverwrite, toFindOutDim); + } + + // A.4. Controle du fichier du maillage + med_idt medIdt = MEDfileOpen(MeshFile, MED_ACC_RDONLY); + bool existeMeshFile = medIdt >= 0; + if (existeMeshFile) MEDfileClose(medIdt); + MESSAGE("CreateCaseOnMesh : existeMeshFile = " << existeMeshFile); + if (!existeMeshFile) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file does not exist."; + throw SALOME::SALOME_Exception(es); + } + + // B. Creation de l'objet cas + myCase = newCase(); + _CaseOnMedFile = false; + _SmeshMesh = SMESH::SMESH_Mesh::_duplicate(smeshMesh); + + // C. Caracteristiques du maillage + if (existeMeshFile) { + // Les valeurs extremes des coordonnées + //MESSAGE ("CreateCaseOnMesh : Les valeurs extremes des coordonnées"); + std::vector LesExtremes = GetBoundingBoxInMedFile(MeshFile); + SMESHHOMARD::extrema_var aSeq = new SMESHHOMARD::extrema(); + if (LesExtremes.size() != 10) { return 0; } + aSeq->length(10); + for (unsigned int i = 0; i < LesExtremes.size(); i++) + aSeq[i] = LesExtremes[i]; + myCase->SetBoundingBox(aSeq); + // Les groupes + //MESSAGE ("CreateCaseOnMesh : Les groupes"); + std::set LesGroupes = GetListeGroupesInMedFile(MeshFile); + SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::ListGroupType; + aSeqGroupe->length(LesGroupes.size()); + std::set::const_iterator it; + int i = 0; + for (it = LesGroupes.begin(); it != LesGroupes.end(); it++) + aSeqGroupe[i++] = (*it).c_str(); + myCase->SetGroups(aSeqGroupe); + } + + // D. L'iteration initiale du cas + MESSAGE ("CreateCaseOnMesh : iteration initiale du cas"); + // D.1. Recherche d'un nom : par defaut, on prend le nom du maillage correspondant. + // Si ce nom d'iteration existe deja, on incremente avec 0, 1, 2, etc. + MESSAGE("CreateCaseOnMesh : ==> NomIteration = " << MeshName); + + // D.2. Creation de l'iteration 0 + myIteration0 = newIteration(); + myIteration0->SetName(MeshName); + AssociateCaseIter(0, "IterationHomard"); + + // D.4. Maillage correspondant + if (existeMeshFile) { + myIteration0->SetMeshFile(MeshFile); + } + myIteration0->SetMeshName(MeshName); + myIteration0->SetNumber(0); + myIteration0->SetState(0); + + // Only after full initialization of Iteration0 + myCase->SetDirName(theWorkingDir); + + return SMESHHOMARD::HOMARD_Cas::_duplicate(myCase); +} + +//============================================================================= +// Creation of a case +// MeshName : name of the mesh +// MeshFile : med file +// theWorkingDir : path to working directory +//============================================================================= +SMESHHOMARD::HOMARD_Cas_ptr HOMARD_Gen_i::CreateCase(const char* MeshName, + const char* MeshFile, + const char* theWorkingDir) +{ + INFOS("CreateCase : MeshName = " << MeshName << ", MeshFile = " << MeshFile); + + // A. Controles + // A.1. Controle du nom : + if (!myCase->_is_nil()) { + DeleteCase(); + } + + // A.3. Controle du fichier du maillage + med_idt medIdt = MEDfileOpen(MeshFile, MED_ACC_RDONLY); + bool existeMeshFile = medIdt >= 0; + if (existeMeshFile) MEDfileClose(medIdt); + MESSAGE("CreateCase : existeMeshFile = " << existeMeshFile); + if (!existeMeshFile) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file does not exist."; + throw SALOME::SALOME_Exception(es); + } + + // B. Creation de l'objet cas + myCase = newCase(); + _CaseOnMedFile = true; + + // C. Caracteristiques du maillage + if (existeMeshFile) { + // Les valeurs extremes des coordonnées + //MESSAGE ("CreateCase : Les valeurs extremes des coordonnées"); + std::vector LesExtremes = GetBoundingBoxInMedFile(MeshFile); + SMESHHOMARD::extrema_var aSeq = new SMESHHOMARD::extrema(); + if (LesExtremes.size() != 10) { return 0; } + aSeq->length(10); + for (unsigned int i = 0; i < LesExtremes.size(); i++) + aSeq[i] = LesExtremes[i]; + myCase->SetBoundingBox(aSeq); + // Les groupes + //MESSAGE ("CreateCase : Les groupes"); + std::set LesGroupes = GetListeGroupesInMedFile(MeshFile); + SMESHHOMARD::ListGroupType_var aSeqGroupe = new SMESHHOMARD::ListGroupType; + aSeqGroupe->length(LesGroupes.size()); + std::set::const_iterator it; + int i = 0; + for (it = LesGroupes.begin(); it != LesGroupes.end(); it++) + aSeqGroupe[i++] = (*it).c_str(); + myCase->SetGroups(aSeqGroupe); + } + + // D. L'iteration initiale du cas + MESSAGE ("CreateCase : iteration initiale du cas"); + // D.1. Recherche d'un nom : par defaut, on prend le nom du maillage correspondant. + // Si ce nom d'iteration existe deja, on incremente avec 0, 1, 2, etc. + MESSAGE("CreateCas : ==> NomIteration = " << MeshName); + + // D.2. Creation de l'iteration + myIteration0 = newIteration(); + myIteration0->SetName(MeshName); + AssociateCaseIter(0, "IterationHomard"); + + // D.4. Maillage correspondant + if (existeMeshFile) { + myIteration0->SetMeshFile(MeshFile); + } + myIteration0->SetMeshName(MeshName); + myIteration0->SetNumber(0); + myIteration0->SetState(0); + + // Only after full initialization of Iteration0 + myCase->SetDirName(theWorkingDir); + + return SMESHHOMARD::HOMARD_Cas::_duplicate(myCase); +} + +//============================================================================= +// Create Iteration1 +//============================================================================= +HOMARD_Iteration_i* HOMARD_Gen_i::CreateIteration() +{ + if (myIteration0 == NULL) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The parent iteration is not defined."; + throw SALOME::SALOME_Exception(es); + } + + if (CORBA::is_nil(myCase)) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid case context"; + throw SALOME::SALOME_Exception(es); + } + const char* nomDirCase = myCase->GetDirName(); + + if (myIteration1 != NULL) { + DeleteIteration(1); + } + + myIteration1 = newIteration(); + if (myIteration1 == NULL) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Unable to create the iteration 1"; + throw SALOME::SALOME_Exception(es); + } + + // Nom de l'iteration et du maillage + myIteration1->SetName("Iter_1"); + myIteration1->SetMeshName("Iter_1"); + myIteration1->SetState(1); + myIteration1->SetNumber(1); + + int nbitercase = 1; + char* nomDirIter = CreateDirNameIter(nomDirCase, nbitercase); + myIteration1->SetDirNameLoc(nomDirIter); + + // Le nom du fichier du maillage MED est indice par le nombre d'iterations du cas. + // Si on a une chaine unique depuis le depart, ce nombre est le meme que le + // numero d'iteration dans la sucession : maill.01.med, maill.02.med, etc... C'est la + // situation la plus frequente. + // Si on a plusieurs branches, donc des iterations du meme niveau d'adaptation, utiliser + // le nombre d'iterations du cas permet d'eviter les collisions. + int jaux; + if (nbitercase < 100) { jaux = 2; } + else if (nbitercase < 1000) { jaux = 3; } + else if (nbitercase < 10000) { jaux = 4; } + else if (nbitercase < 100000) { jaux = 5; } + else { jaux = 9; } + std::ostringstream iaux; + iaux << std::setw(jaux) << std::setfill('0') << nbitercase; + std::stringstream MeshFile; + MeshFile << nomDirCase << "/maill." << iaux.str() << ".med"; + myIteration1->SetMeshFile(MeshFile.str().c_str()); + + // Association avec le cas + std::string nomIterParent = myIteration0->GetName(); + std::string label = "IterationHomard_" + nomIterParent; + AssociateCaseIter(1, label.c_str()); + + return myIteration1; +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundary(const char* BoundaryName, + CORBA::Long BoundaryType) +{ + MESSAGE ("CreateBoundary : BoundaryName = " << BoundaryName << + ", BoundaryType = " << BoundaryType); + + // Controle du nom : + if ((_mesBoundarys).find(BoundaryName) != (_mesBoundarys).end()) { + MESSAGE ("CreateBoundary : la frontiere " << BoundaryName << " existe deja"); + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This boundary has already been defined"; + throw SALOME::SALOME_Exception(es); + } + + SMESHHOMARD::HOMARD_Boundary_var myBoundary = newBoundary(); + myBoundary->SetName(BoundaryName); + myBoundary->SetType(BoundaryType); + + _mesBoundarys[BoundaryName] = myBoundary; + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCAO(const char* BoundaryName, const char* CAOFile) +{ + MESSAGE ("CreateBoundaryCAO : BoundaryName = " << BoundaryName << ", CAOFile = " << CAOFile); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, -1); + myBoundary->SetDataFile(CAOFile); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryDi(const char* BoundaryName, const char* MeshName, const char* MeshFile) +{ + MESSAGE ("CreateBoundaryDi : BoundaryName = " << BoundaryName << ", MeshName = " << MeshName << ", MeshFile = " << MeshFile); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 0); + myBoundary->SetDataFile(MeshFile); + myBoundary->SetMeshName(MeshName); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryCylinder(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double Rayon) +{ + MESSAGE ("CreateBoundaryCylinder : BoundaryName = " << BoundaryName); +// + SALOME::ExceptionStruct es; + int error = 0; + if (Rayon <= 0.0) + { es.text = "The radius must be positive."; + error = 1; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe); + if (daux < 0.0000001) + { es.text = "The axis must be a non 0 vector."; + error = 2; } + if (error != 0) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 1); + myBoundary->SetCylinder(Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, Rayon); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundarySphere(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon) +{ + MESSAGE ("CreateBoundarySphere : BoundaryName = " << BoundaryName); +// + SALOME::ExceptionStruct es; + int error = 0; + if (Rayon <= 0.0) + { es.text = "The radius must be positive."; + error = 1; } + if (error != 0) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 2); + myBoundary->SetSphere(Xcentre, Ycentre, Zcentre, Rayon); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeA(const char* BoundaryName, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, CORBA::Double Angle, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre) +{ + MESSAGE ("CreateBoundaryConeA : BoundaryName = " << BoundaryName); +// + SALOME::ExceptionStruct es; + int error = 0; + if (Angle <= 0.0 || Angle >= 90.0) + { es.text = "The angle must be included higher than 0 degree and lower than 90 degrees."; + error = 1; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe); + if (daux < 0.0000001) + { es.text = "The axis must be a non 0 vector."; + error = 2; } + if (error != 0) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 3); + myBoundary->SetConeA(Xaxe, Yaxe, Zaxe, Angle, Xcentre, Ycentre, Zcentre); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryConeR(const char* BoundaryName, + CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, CORBA::Double Rayon1, + CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, CORBA::Double Rayon2) +{ + MESSAGE ("CreateBoundaryConeR : BoundaryName = " << BoundaryName); +// + SALOME::ExceptionStruct es; + int error = 0; + if (Rayon1 < 0.0 || Rayon2 < 0.0) + { es.text = "The radius must be positive."; + error = 1; } + double daux = fabs(Rayon2-Rayon1); + if (daux < 0.0000001) + { es.text = "The radius must be different."; + error = 2; } + daux = fabs(Xcentre2-Xcentre1) + fabs(Ycentre2-Ycentre1) + fabs(Zcentre2-Zcentre1); + if (daux < 0.0000001) + { es.text = "The centers must be different."; + error = 3; } + if (error != 0) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 4); + myBoundary->SetConeR(Xcentre1, Ycentre1, Zcentre1, Rayon1, Xcentre2, Ycentre2, Zcentre2, Rayon2); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} +//============================================================================= +SMESHHOMARD::HOMARD_Boundary_ptr HOMARD_Gen_i::CreateBoundaryTorus(const char* BoundaryName, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxe, CORBA::Double Yaxe, CORBA::Double Zaxe, + CORBA::Double RayonRev, CORBA::Double RayonPri) +{ + MESSAGE ("CreateBoundaryTorus : BoundaryName = " << BoundaryName); +// + SALOME::ExceptionStruct es; + int error = 0; + if ((RayonRev <= 0.0) || (RayonPri <= 0.0)) + { es.text = "The radius must be positive."; + error = 1; } + double daux = fabs(Xaxe) + fabs(Yaxe) + fabs(Zaxe); + if (daux < 0.0000001) + { es.text = "The axis must be a non 0 vector."; + error = 2; } + if (error != 0) + { + es.type = SALOME::BAD_PARAM; + throw SALOME::SALOME_Exception(es); + return 0; + }; +// + SMESHHOMARD::HOMARD_Boundary_var myBoundary = CreateBoundary(BoundaryName, 5); + myBoundary->SetTorus(Xcentre, Ycentre, Zcentre, Xaxe, Yaxe, Zaxe, RayonRev, RayonPri); + + return SMESHHOMARD::HOMARD_Boundary::_duplicate(myBoundary); +} + +//============================================================================= +//============================================================================= +CORBA::Long HOMARD_Gen_i::Compute() +{ + INFOS ("Compute"); + // A. Prealable + int codret = 0; + + // A.0. Create Iteration 1 + CreateIteration(); + myIteration1->SetInfoCompute(_VerboseLevel); + myIteration1->SetMeshName(_MeshNameOUT.c_str()); + myIteration1->SetMeshFile(_MeshFileOUT.c_str()); + if (_LogInFile) myIteration1->SetLogFile(_LogFile.c_str()); + + // A.1. L'objet iteration + ASSERT(myIteration1); + + // A.2. Controle de la possibilite d'agir + // A.2.1. Etat de l'iteration + int etat = myIteration1->GetState(); + MESSAGE ("etat = " << etat); + // A.2.2. On ne calcule pas l'iteration initiale, ni une iteration deja calculee + if (etat == 2) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "This iteration is already computed."; + throw SALOME::SALOME_Exception(es); + } + + // A.3. Numero de l'iteration + // siterp1 : numero de l'iteration a traiter + // Si adaptation : + // siter: numero de l'iteration parent, ou 0 si deja au debut mais cela ne servira pas ! + // Ou si information : + // siter = siterp1 + int NumeIter = myIteration1->GetNumber(); + std::string siterp1; + std::stringstream saux1; + saux1 << NumeIter; + siterp1 = saux1.str(); + if (NumeIter < 10) { siterp1 = "0" + siterp1; } + + std::string siter; + std::stringstream saux0; + int iaux = max(0, NumeIter-1); + saux0 << iaux; + siter = saux0.str(); + if (NumeIter < 11) { siter = "0" + siter; } + + // A.4. Le cas + ASSERT(!CORBA::is_nil(myCase)); + + // B. Les répertoires + // B.1. Le répertoire courant + std::string nomDirWork = getenv("PWD"); + // B.2. Le sous-répertoire de l'iteration a traiter + char* DirCompute = ComputeDirManagement(); + MESSAGE(". DirCompute = " << DirCompute); + + // C. Le fichier des messages + // C.1. Le deroulement de l'execution de HOMARD + std::string LogFile = myIteration1->GetLogFile(); + if (LogFile.empty()) { + LogFile = DirCompute; + LogFile += "/Liste." + siter + ".vers." + siterp1 + ".log"; + myIteration1->SetLogFile(LogFile.c_str()); + } + MESSAGE (". LogFile = " << LogFile); + // C.2. Le bilan de l'analyse du maillage + std::string FileInfo = DirCompute; + FileInfo += "/apad." + siterp1 + ".bilan"; + myIteration1->SetFileInfo(FileInfo.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 + SMESHHOMARDImpl::HomardDriver* myDriver = new SMESHHOMARDImpl::HomardDriver(siter, siterp1); + myDriver->TexteInit(DirCompute, LogFile, "English"); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration1->GetMeshName(); + MESSAGE (". NomMesh = " << NomMesh); + const char* MeshFile = myIteration1->GetMeshFile(); + MESSAGE (". MeshFile = " << MeshFile); + + // E.3. Les données du traitement HOMARD + iaux = 1; + myDriver->TexteMaillageHOMARD(DirCompute, siterp1, iaux); + myDriver->TexteMaillage(NomMesh, MeshFile, 1); + codret = ComputeAdap(myDriver); + + // E.4. Ajout des informations liees a l'eventuel suivi de frontiere + int BoundaryOption = DriverTexteBoundary(myDriver); + + // E.5. Ecriture du texte dans le fichier + MESSAGE (". Ecriture du texte dans le fichier de configuration; codret = "<CreeFichier(); } + + // G. Execution + // + int codretexec = 1789; + if (codret == 0) { + codretexec = myDriver->ExecuteHomard(); + // + MESSAGE ("Erreur en executant HOMARD : " << codretexec); + // En mode adaptation, on ajuste l'etat de l'iteration + if (codretexec == 0) { myIteration1->SetState(2); } + else { myIteration1->SetState(1); } + } + + // H. Gestion des resultats + if (codret == 0) { + std::string Commentaire; + // H.1. Le fichier des messages, dans tous les cas + Commentaire = "log"; + Commentaire += " " + siterp1; + + // H.2. Si tout s'est bien passe : + if (codretexec == 0) { + // H.2.1. Le fichier de bilan + Commentaire = "Summary"; + Commentaire += " " + siterp1; + // H.2.2. Le fichier de maillage obtenu + std::stringstream saux0; + Commentaire = "Mesh"; + Commentaire += " " + siterp1; + if (_PublishMeshOUT) PublishResultInSmesh(MeshFile); + } + // H.3 Message d'erreur + if (codretexec != 0) { + std::string text = ""; + // Message d'erreur en cas de probleme en adaptation + 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 + std::string ligne; // variable contenant chaque ligne lue + while (std::getline(fichier, ligne)) { + //INFOS(ligne); + if (stopvu) { text += ligne+ "\n"; } + else { + int position = ligne.find("===== HOMARD ===== STOP ====="); + if (position > 0) { stopvu = true; } + } + } + } + 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); + } + } + + // I. Menage et retour dans le répertoire du cas + if (codret == 0) { + delete myDriver; + MESSAGE (". On retourne dans nomDirWork = " << nomDirWork); + CHDIR(nomDirWork.c_str()); + } + + // J. Suivi de la frontière CAO + if (codret == 0) { + if ((BoundaryOption % 5 == 0) && (codretexec == 0)) { + MESSAGE ("Suivi de frontière CAO"); + codret = ComputeCAO(); + } + } + + if (codretexec == 0) { + // Python Dump + PythonDump(); + + // Delete log file, if required + if (myIteration1 != NULL) { + MESSAGE("myIteration1->GetLogFile() = " << myIteration1->GetLogFile()); + if (_LogInFile && _RemoveLogOnSuccess) { + // Remove log file on success + SMESH_File(myIteration1->GetLogFile(), false).remove(); + } + } + + // Clean all data + DeleteCase(); + } + + return codretexec; +} + +void HOMARD_Gen_i::DeleteCase() +{ + MESSAGE ("DeleteCase"); + if (myCase->_is_nil()) return; + + // Delete all boundaries + _mesBoundarys.clear(); + + // Delete iterations + DeleteIteration(1); + DeleteIteration(0); + + // Delete case + myCase = SMESHHOMARD::HOMARD_Cas::_nil(); + + // Delete tmp mesh file + if (!_CaseOnMedFile && !_TmpMeshFile.empty()) { + SMESH_File aFile (_TmpMeshFile, false); + if (aFile.exists()) aFile.remove(); + _TmpMeshFile = ""; + } + _SmeshMesh = SMESH::SMESH_Mesh::_nil(); +} + +//============================================================================= +// Calcul d'une iteration : partie spécifique à l'adaptation +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeAdap(SMESHHOMARDImpl::HomardDriver* myDriver) +{ + MESSAGE ("ComputeAdap"); + + // A. Prealable + // A.1. Bases + int codret = 0; + // Numero de l'iteration + int NumeIter = 1; + std::stringstream saux0; + saux0 << NumeIter-1; + std::string siter = saux0.str(); + if (NumeIter < 11) { siter = "0" + siter; } + + // B. L'iteration parent + ASSERT(myIteration0); + + // C. Le sous-répertoire de l'iteration precedente + char* DirComputePa = ComputeDirPaManagement(); + MESSAGE(". DirComputePa = " << DirComputePa); + + // D. Les données de l'adaptation HOMARD + // D.1. Le type de conformite + MESSAGE (". ConfType = " << _ConfType); + + // D.3. Le maillage de depart + const char* NomMeshParent = myIteration0->GetMeshName(); + MESSAGE (". NomMeshParent = " << NomMeshParent); + const char* MeshFileParent = myIteration0->GetMeshFile(); + MESSAGE (". MeshFileParent = " << MeshFileParent); + + // D.4. Le maillage associe a l'iteration + const char* MeshFile = myIteration1->GetMeshFile(); + MESSAGE (". MeshFile = " << MeshFile); + FILE *file = fopen(MeshFile,"r"); + if (file != NULL) { + fclose(file); + // CleanOption = 0 : report an error if output mesh file exists + // CleanOption = 1 : destruction du répertoire d'execution + int CleanOption = 1; + if (CleanOption == 0) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "MeshFile : " + std::string(MeshFile) + " already exists "; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + else { + std::string commande = "rm -f " + std::string(MeshFile); + codret = system(commande.c_str()); + if (codret != 0) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "The mesh file cannot be deleted."; + throw SALOME::SALOME_Exception(es); + } + } + } + + // E. Texte du fichier de configuration + // E.1. Incontournables du texte + myDriver->TexteAdap(); + int iaux = 0; + myDriver->TexteMaillageHOMARD(DirComputePa, siter, iaux); + myDriver->TexteMaillage(NomMeshParent, MeshFileParent, 0); + myDriver->TexteConfRaffDera(_ConfType); + + // E.6. Ajout des options avancees + //myDriver->TexteAdvanced(NivMax, DiamMin, AdapInit, ExtraOutput); + myDriver->TexteAdvanced(-1, -1.0, 0, 1); + + // E.7. Ajout des informations sur le deroulement de l'execution + int MessInfo = myIteration1->GetInfoCompute(); + MESSAGE (". MessInfo = " << MessInfo); + myDriver->TexteInfoCompute(MessInfo); + + return codret; +} +//============================================================================= +// Calcul d'une iteration : partie spécifique au suivi de frontière CAO +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAO() +{ + MESSAGE ("ComputeCAO"); + + // A. Prealable + // A.1. Bases + int codret = 0; + // A.2. Le sous-répertoire de l'iteration en cours de traitement + char* DirCompute = myIteration1->GetDirName(); + // A.3. Le maillage résultat de l'iteration en cours de traitement + char* MeshFile = myIteration1->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); + std::basic_string::size_type 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 + SMESHHOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + std::string BoundaryName = std::string((*ListBoundaryGroupType)[0]); + MESSAGE (". BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; + const std::string theXaoFileName = myBoundary->GetDataFile(); + MESSAGE (". theXaoFileName = " << theXaoFileName); + + // C. Lancement des projections + MESSAGE (". Lancement des projections"); + + assert(Py_IsInitialized()); + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + PyRun_SimpleString("from FrontTrack import FrontTrack"); + // FrontTrack().track( fic_med_brut, fic_med_new, l_fr, xao_file ) + std::string pyCommand ("FrontTrack().track( \""); + pyCommand += theInputMedFile + "\", \"" + theOutputMedFile + "\", ["; + for (int i = 0; i < icpt; i++) { + if (i > 0) pyCommand += ", "; + pyCommand += "\""; + pyCommand += theInputNodeFiles[i]; + pyCommand += "\""; + } + pyCommand += "], \"" + theXaoFileName + "\", False )"; + MESSAGE (". Lancement des projections: pyCommand = " << pyCommand); + PyRun_SimpleString(pyCommand.c_str()); + PyGILState_Release(gstate); + + // 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(); + + return codret; +} +//============================================================================= +//============================================================================= +// Transfert des coordonnées en suivi de frontière CAO +//============================================================================= +CORBA::Long HOMARD_Gen_i::ComputeCAObis() +{ + MESSAGE ("ComputeCAObis"); + + // A. Prealable + int codret = 0; + + // A.1. Controle de la possibilite d'agir + // A.1.1. Etat de l'iteration + int etat = myIteration1->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 = myIteration1->GetNumber(); + std::string siterp1; + std::stringstream saux1; + saux1 << NumeIter; + siterp1 = saux1.str(); + if (NumeIter < 10) { siterp1 = "0" + siterp1; } + MESSAGE ("siterp1 = "<GetDirName(); + MESSAGE(". DirCompute = " << DirCompute); + + // C. Le fichier des messages + std::string LogFile = DirCompute; + LogFile += "/Liste." + siterp1 + ".maj_coords.log"; + MESSAGE (". LogFile = " << LogFile); + myIteration1->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 + SMESHHOMARDImpl::HomardDriver* myDriver = new SMESHHOMARDImpl::HomardDriver("", siterp1); + myDriver->TexteInit(DirCompute, LogFile, "English"); + + // E.2. Le maillage associe a l'iteration + const char* NomMesh = myIteration1->GetMeshName(); + MESSAGE (". NomMesh = " << NomMesh); + const char* MeshFile = myIteration1->GetMeshFile(); + MESSAGE (". MeshFile = " << MeshFile); + + // E.3. Les données du traitement HOMARD + myDriver->TexteMajCoords(NumeIter); + int 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 = "<CreeFichier(); + + // F. Execution + // + int codretexec = 1789; + if (codret == 0) { + codretexec = myDriver->ExecuteHomard(); + MESSAGE ("Erreur en executant HOMARD : " << codretexec); + } + + // G. Gestion des resultats + if (codret == 0) { + // G.1. Le fichier des messages, dans tous les cas + std::string Commentaire = "logmaj_coords"; + // 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 = "<d_name); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(nomrep, &ffd); + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); +#endif + if (file_name == DirNameA.str()) { existe = true; } + } +#ifndef WIN32 + closedir(dp); +#else + FindClose(hFind); +#endif + if (!existe) + { + DirName = DirNameA.str(); + a_chercher = false; + break; + } + } + num += 1; + } + + MESSAGE ("==> DirName = " << DirName); + MESSAGE (". On retourne dans nomDirActuel = " << nomDirActuel); + CHDIR(nomDirActuel.c_str()); + return CORBA::string_dup(DirName.c_str()); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul +//============================================================================= +char* HOMARD_Gen_i::ComputeDirManagement() +{ + MESSAGE ("ComputeDirManagement : répertoires pour le calcul"); + + //Si le sous-répertoire existe : + // CleanOption = 0 : on sort en erreur si le répertoire n'est pas vide + // CleanOption = 1 : on fait le menage du répertoire + // CleanOption = -1 : on ne fait rien + int CleanOption = 0; + + // B.2. Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE (". nomDirCase = " << nomDirCase); + + // 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 = myIteration1->GetDirNameLoc(); + + // 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-répertoire n'existe pas, on le cree + if (CHDIR(DirCompute.str().c_str()) != 0) + { +#ifndef WIN32 + if (mkdir(DirCompute.str().c_str(), S_IRWXU|S_IRGRP|S_IXGRP) != 0) +#else + if (_mkdir(DirCompute.str().c_str()) != 0) +#endif + { + // GERALD -- QMESSAGE BOX + std::cerr << "Pb Creation du répertoire DirCompute = " << DirCompute.str() << std::endl; + VERIFICATION("Pb a la creation du répertoire" == 0); + } + } + else + { + // Le répertoire existe + // On demande de faire le menage de son contenu : + if (CleanOption == 1) { + 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 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 : + else { + if (CleanOption == 0) { +#ifndef WIN32 + DIR *dp; + struct dirent *dirp; + dp = opendir(DirCompute.str().c_str()); + bool result = true; + while ((dirp = readdir(dp)) != NULL && result) + { + std::string file_name(dirp->d_name); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + closedir(dp); +#else + HANDLE hFind = INVALID_HANDLE_VALUE; + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(DirCompute.str().c_str(), &ffd); + bool result = true; + if (INVALID_HANDLE_VALUE != hFind) { + while (FindNextFile(hFind, &ffd) != 0) { + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; //skip directories + std::string file_name(ffd.cFileName); + result = file_name.empty() || file_name == "." || file_name == ".."; //if any file - break and return false + } + } + FindClose(hFind); +#endif + if (result == false) + { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "Directory : " + DirCompute.str() + " is not empty"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + VERIFICATION("Directory is not empty" == 0); + } + } + } + } + + return CORBA::string_dup(DirCompute.str().c_str()); +} +//============================================================================= +// Calcul d'une iteration : gestion du répertoire de calcul de l'iteration parent +//============================================================================= +char* HOMARD_Gen_i::ComputeDirPaManagement() +{ + MESSAGE ("ComputeDirPaManagement : répertoires pour le calcul"); + // Le répertoire du cas + const char* nomDirCase = myCase->GetDirName(); + MESSAGE (". nomDirCase = " << nomDirCase); + + // Le sous-répertoire de l'iteration precedente + + const char* nomDirItPa = myIteration0->GetDirNameLoc(); + std::stringstream DirComputePa; + DirComputePa << nomDirCase << "/" << nomDirItPa; + MESSAGE(". nomDirItPa = " << nomDirItPa); + MESSAGE(". DirComputePa = " << DirComputePa.str()); + + return CORBA::string_dup(DirComputePa.str().c_str()); +} + +//============================================================================= +// Calcul d'une iteration : ecriture des frontieres dans le fichier de configuration +// On ecrit dans l'ordre : +// 1. la definition des frontieres +// 2. les liens avec les groupes +// 3. un entier resumant le type de comportement pour les frontieres +//============================================================================= +int HOMARD_Gen_i::DriverTexteBoundary(SMESHHOMARDImpl::HomardDriver* myDriver) +{ + MESSAGE ("... DriverTexteBoundary"); + // 1. Recuperation des frontieres + std::list ListeBoundaryTraitees; + SMESHHOMARD::ListBoundaryGroupType* ListBoundaryGroupType = myCase->GetBoundaryGroup(); + int numberOfitems = ListBoundaryGroupType->length(); + MESSAGE ("... number of string for Boundary+Group = " << numberOfitems); + int BoundaryOption = 1; + // 2. Parcours des frontieres pour ecrire leur description + int NumBoundaryAnalytical = 0; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ("... BoundaryName = " << BoundaryName); + // 2.1. La frontiere a-t-elle deja ete ecrite ? + // Cela arrive quand elle est liee a plusieurs groupes. Il ne faut l'ecrire que la premiere fois + int A_faire = 1; + std::list::const_iterator it = ListeBoundaryTraitees.begin(); + while (it != ListeBoundaryTraitees.end()) + { + MESSAGE ("..... BoundaryNameTraitee = " << *it); + if (BoundaryName == *it) { A_faire = 0; } + it++; + } + // 2.2. Ecriture de la frontiere + if (A_faire == 1) + { + // 2.2.1. Caracteristiques de la frontiere + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ("... BoundaryType = " << BoundaryType); + // 2.2.2. Ecriture selon le type + // 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->GetDataFile(); + MESSAGE (". MeshFile = " << MeshFile); + myDriver->TexteBoundaryDi(MeshName, MeshFile); + if (BoundaryOption % 2 != 0) { BoundaryOption = BoundaryOption*2; } + } + // 2.2.2.3. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++; + SMESHHOMARD::double_array* coor = myBoundary->GetCoords(); + if (BoundaryType == 1) // Cas d un cylindre + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if (BoundaryOption % 3 != 0) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 2) // Cas d une sphere + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], 0., 0., 0., 0.); + if (BoundaryOption % 3 != 0) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 3) // Cas d un cone defini par un axe et un angle + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], 0.); + if (BoundaryOption % 3 != 0) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 4) // Cas d un cone defini par les 2 rayons + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if (BoundaryOption % 3 != 0) { BoundaryOption = BoundaryOption*3; } + } + else if (BoundaryType == 5) // Cas d un tore + { + myDriver->TexteBoundaryAn(BoundaryName, NumBoundaryAnalytical, BoundaryType, (*coor)[0], (*coor)[1], (*coor)[2], (*coor)[3], (*coor)[4], (*coor)[5], (*coor)[6], (*coor)[7]); + if (BoundaryOption % 3 != 0) { BoundaryOption = BoundaryOption*3; } + } + } + // 2.2.3. Memorisation du traitement + ListeBoundaryTraitees.push_back(BoundaryName); + } + } + // 3. Parcours des frontieres pour ecrire les liens avec les groupes + NumBoundaryAnalytical = 0; + for (int NumBoundary = 0; NumBoundary< numberOfitems; NumBoundary=NumBoundary+2) + { + std::string BoundaryName = std::string((*ListBoundaryGroupType)[NumBoundary]); + MESSAGE ("... BoundaryName = " << BoundaryName); + SMESHHOMARD::HOMARD_Boundary_var myBoundary = _mesBoundarys[BoundaryName]; + ASSERT(!CORBA::is_nil(myBoundary)); + int BoundaryType = myBoundary->GetType(); + MESSAGE ("... BoundaryType = " << BoundaryType); + // 3.1. Recuperation du nom du groupe + std::string GroupName = std::string((*ListBoundaryGroupType)[NumBoundary+1]); + MESSAGE ("... GroupName = " << GroupName); + // 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.4. Cas d une frontiere analytique + else + { + NumBoundaryAnalytical++; + myDriver->TexteBoundaryAnGr (BoundaryName, NumBoundaryAnalytical, GroupName); + } + } + // 4. Ecriture de l'option finale + myDriver->TexteBoundaryOption(BoundaryOption); +// + return BoundaryOption; +} +//=========================================================================== +//=========================================================================== + +//=========================================================================== +// Publication +//=========================================================================== +void HOMARD_Gen_i::PublishResultInSmesh(const char* NomFich) +{ + // Prevent dump of CreateMeshesFromMED + SMESH::TPythonDump pDump; // do not delete this line of code + + MESSAGE("PublishResultInSmesh " << NomFich); + if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant())) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + } + + // Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindComponent("SMESH"); + // + // TODO? + // Temporary suppressed depublication of mesh with the same name of file + /* + if (!CORBA::is_nil(aSmeshSO)) { + // On verifie que le fichier n est pas deja publie + SALOMEDS::ChildIterator_var aIter = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr, "AttributeExternalFileDef")) { + SALOMEDS::AttributeExternalFileDef_var anAttr = + SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value = anAttr->Value(); + if (strcmp((const char*)value, NomFich) == 0) { + MESSAGE ("PublishResultInSmesh : le fichier " << NomFich << " est deja publie."); + // Pour un fichier importe, on ne republie pas + // Option = 0 : fichier issu d'une importation + // Option = 1 : fichier issu d'une execution HOMARD + if (Option == 0) { return; } + // Pour un fichier calcule, on commence par faire la depublication + else { + MESSAGE("PublishResultInSmesh : depublication"); + if (aSO->FindAttribute(aGAttr, "AttributeName")) { + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2 = anAttr2->Value(); + std::string MeshName = string(value2); + MESSAGE("PublishResultInSmesh : depublication de " << MeshName); + DeleteResultInSmesh(NomFich, MeshName); + } + } + } + } + } + } + */ + + // On enregistre le fichier + MESSAGE("Enregistrement du fichier"); + // + //SMESH::SMESH_Gen_var aSmeshEngine = this->retrieveSMESHInst(); + SMESH_Gen_i* aSmeshEngine = SMESH_Gen_i::GetSMESHGen(); + // + //ASSERT(!CORBA::is_nil(aSmeshEngine)); + aSmeshEngine->UpdateStudy(); + SMESH::DriverMED_ReadStatus theStatus; + + // On met a jour les attributs AttributeExternalFileDef et AttributePixMap + SMESH::mesh_array* mesMaillages = aSmeshEngine->CreateMeshesFromMED(NomFich, theStatus); + if (CORBA::is_nil(aSmeshSO)) { + aSmeshSO = SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindComponent("SMESH"); + if (CORBA::is_nil(aSmeshSO)) return; + } + + for (int i = 0; i < (int)mesMaillages->length(); i++) { + MESSAGE(". Mise a jour des attributs du maillage"); + SMESH::SMESH_Mesh_var monMaillage = (*mesMaillages)[i]; + SALOMEDS::SObject_var aSO = SALOMEDS::SObject::_narrow + (SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindObjectIOR + (SMESH_Gen_i::GetORB()->object_to_string(monMaillage))); + SALOMEDS::StudyBuilder_var aStudyBuilder = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewBuilder(); + SALOMEDS::GenericAttribute_var aGAttr = + aStudyBuilder->FindOrCreateAttribute(aSO, "AttributeExternalFileDef"); + SALOMEDS::AttributeExternalFileDef_var anAttr = + SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + anAttr->SetValue(NomFich); + SALOMEDS::GenericAttribute_var aPixMap = + aStudyBuilder->FindOrCreateAttribute(aSO, "AttributePixMap"); + SALOMEDS::AttributePixMap_var anAttr2 = SALOMEDS::AttributePixMap::_narrow(aPixMap); + anAttr2->SetPixMap("mesh_tree_mesh.png"); + } +} + +//============================================================================= +void HOMARD_Gen_i::DeleteResultInSmesh(std::string NomFich, std::string MeshName) +{ + MESSAGE ("DeleteResultInSmesh pour le maillage " << MeshName << " dans le fichier " << NomFich); + if (CORBA::is_nil(SMESH_Gen_i::GetSMESHGen()->getStudyServant())) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + es.text = "Invalid study context"; + throw SALOME::SALOME_Exception(es); + } + + // Le module SMESH est-il actif ? + SALOMEDS::SObject_var aSmeshSO = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->FindComponent("SMESH"); + // + if (CORBA::is_nil(aSmeshSO)) return; + // On verifie que le fichier est deja publie + SALOMEDS::StudyBuilder_var myBuilder = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewBuilder(); + SALOMEDS::ChildIterator_var aIter = + SMESH_Gen_i::GetSMESHGen()->getStudyServant()->NewChildIterator(aSmeshSO); + for (; aIter->More(); aIter->Next()) { + SALOMEDS::SObject_var aSO = aIter->Value(); + SALOMEDS::GenericAttribute_var aGAttr; + if (aSO->FindAttribute(aGAttr, "AttributeExternalFileDef")) { + SALOMEDS::AttributeExternalFileDef_var anAttr = + SALOMEDS::AttributeExternalFileDef::_narrow(aGAttr); + CORBA::String_var value = anAttr->Value(); + if (strcmp((const char*)value, NomFich.c_str()) == 0) { + if (aSO->FindAttribute(aGAttr, "AttributeName")) { + SALOMEDS::AttributeName_var anAttr2 = SALOMEDS::AttributeName::_narrow(aGAttr); + CORBA::String_var value2 = anAttr2->Value(); + if (strcmp((const char*)value2, MeshName.c_str()) == 0) { + myBuilder->RemoveObjectWithChildren(aSO); + } + } + } + } + } +} + +void HOMARD_Gen_i::PythonDump() +{ + MESSAGE ("Begin PythonDump"); + SMESH::TPythonDump pd; + + // SMESH_Homard + pd << "import SMESHHOMARD\n"; + //pd << "smeshhomard = " << SMESH_Gen_i::GetSMESHGen() << ".CreateHOMARD_ADAPT()\n"; + pd << "smeshhomard = " << SMESH_Gen_i::GetSMESHGen() << ".Adaptation(\"Uniform\")\n"; + + // Boundaries + if (_mesBoundarys.size() > 0) MESSAGE(". Creation of the boundaries"); + std::map::const_iterator it_boundary; + for (it_boundary = _mesBoundarys.begin(); + it_boundary != _mesBoundarys.end(); ++it_boundary) { + SMESHHOMARD::HOMARD_Boundary_var maBoundary = (*it_boundary).second; + //MESSAGE ("PythonDump of boundary " << (*it_boundary).first << + // " : " << maBoundary->GetDumpPython()); + pd << maBoundary->GetDumpPython(); + } + + // Case + ASSERT(!myCase->_is_nil()); + MESSAGE (". Creation of the case"); + + if (_CaseOnMedFile) { + pd << "smeshhomard.CreateCase(\"" << myIteration0->GetMeshName(); + pd << "\", \"" << myIteration0->GetMeshFile(); + pd << "\", \"" << myCase->GetDirName() << "\")\n"; + } + else { + pd << "smeshhomard.CreateCaseOnMesh(\"" << myIteration0->GetMeshName(); + pd << "\", " << _SmeshMesh; + pd << ".GetMesh(), \"" << myCase->GetDirName() << "\")\n"; + } + + pd << myCase->GetDumpPython(); + + // Preferences + pd << "smeshhomard.SetConfType(" << _ConfType << ")\n"; + pd << "smeshhomard.SetKeepMedOUT(" << (_KeepMedOUT ? "True" : "False") << ")\n"; + pd << "smeshhomard.SetPublishMeshOUT(" << (_PublishMeshOUT ? "True" : "False") << ")\n"; + pd << "smeshhomard.SetMeshNameOUT(\"" << _MeshNameOUT << "\")\n"; + pd << "smeshhomard.SetMeshFileOUT(\"" << _MeshFileOUT << "\")\n"; + + pd << "smeshhomard.SetKeepWorkingFiles(" << (_KeepWorkingFiles ? "True" : "False") << ")\n"; + pd << "smeshhomard.SetLogInFile(" << (_LogInFile ? "True" : "False") << ")\n"; + if (_LogInFile) pd << "smeshhomard.SetLogFile(\"" << _LogFile << "\")\n"; + pd << "smeshhomard.SetRemoveLogOnSuccess(" << (_RemoveLogOnSuccess ? "True" : "False") << ")\n"; + pd << "smeshhomard.SetVerboseLevel(" << _VerboseLevel << ")\n"; + + // Compute + pd << "smeshhomard.Compute()\n"; + MESSAGE ("End PythonDump"); +} + +void HOMARD_Gen_i::AddBoundary(const char* BoundaryName) +{ + MESSAGE("HOMARD_Gen_i::AddBoundary : BoundaryName = " << BoundaryName); + if (myCase->_is_nil()) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The input mesh must be defined before boundary addition"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + myCase->AddBoundary(BoundaryName); +} + +void HOMARD_Gen_i::AddBoundaryGroup(const char* BoundaryName, const char* Group) +{ + MESSAGE("HOMARD_Gen_i::AddBoundaryGroup : BoundaryName = " << + BoundaryName << ", Group = " << Group); + if (myCase->_is_nil()) { + SALOME::ExceptionStruct es; + es.type = SALOME::BAD_PARAM; + std::string text = "The input mesh must be defined before boundary group addition"; + es.text = CORBA::string_dup(text.c_str()); + throw SALOME::SALOME_Exception(es); + } + myCase->AddBoundaryGroup(BoundaryName, Group); +} + +//=============================================================================== +// Preferences +//=============================================================================== +void HOMARD_Gen_i::SetConfType(CORBA::Long theConfType) +{ + _ConfType = theConfType; +} +void HOMARD_Gen_i::SetKeepMedOUT(bool theKeepMedOUT) +{ + _KeepMedOUT = theKeepMedOUT; +} +void HOMARD_Gen_i::SetPublishMeshOUT(bool thePublishMeshOUT) +{ + _PublishMeshOUT = thePublishMeshOUT; +} +void HOMARD_Gen_i::SetKeepWorkingFiles(bool theKeepWorkingFiles) +{ + _KeepWorkingFiles = theKeepWorkingFiles; +} +void HOMARD_Gen_i::SetLogInFile(bool theLogInFile) +{ + _LogInFile = theLogInFile; +} +void HOMARD_Gen_i::SetRemoveLogOnSuccess(bool theRemoveLogOnSuccess) +{ + _RemoveLogOnSuccess = theRemoveLogOnSuccess; +} +void HOMARD_Gen_i::SetVerboseLevel(CORBA::Long theVerboseLevel) +{ + _VerboseLevel = theVerboseLevel; +} +void HOMARD_Gen_i::SetMeshNameOUT(const char* theMeshNameOUT) +{ + _MeshNameOUT = theMeshNameOUT; +} +void HOMARD_Gen_i::SetMeshFileOUT(const char* theMeshFileOUT) +{ + _MeshFileOUT = theMeshFileOUT; +} +void HOMARD_Gen_i::SetLogFile(const char* theLogFile) +{ + _LogFile = theLogFile; +} + +// ======================================================================= +std::set GetListeGroupesInMedFile(const char * aFile) +{ + std::set ListeGroupes; + med_err erreur = 0; + med_idt medIdt; + while (erreur == 0) { + // Ouverture du fichier + medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); + if (medIdt < 0) { + erreur = 1; + break; + } + // Caracteristiques du maillage + char meshname[MED_NAME_SIZE+1]; + med_int spacedim,meshdim; + med_mesh_type meshtype; + char descriptionription[MED_COMMENT_SIZE+1]; + char dtunit[MED_SNAME_SIZE+1]; + med_sorting_type sortingtype; + med_int nstep; + med_axis_type axistype; + int naxis = MEDmeshnAxis(medIdt,1); + char *axisname=new char[naxis*MED_SNAME_SIZE+1]; + char *axisunit=new char[naxis*MED_SNAME_SIZE+1]; + erreur = MEDmeshInfo(medIdt, + 1, + meshname, + &spacedim, + &meshdim, + &meshtype, + descriptionription, + dtunit, + &sortingtype, + &nstep, + &axistype, + axisname, + axisunit); + delete[] axisname; + delete[] axisunit; + if (erreur < 0) { break; } + // Nombre de familles + med_int nfam; + nfam = MEDnFamily(medIdt,meshname); + if (nfam < 0) { + erreur = 2; + break; + } + // Lecture des caracteristiques des familles + for (int i=0;i 0) { + char familyname[MED_NAME_SIZE+1]; + med_int numfam; + char* gro = (char*) malloc(MED_LNAME_SIZE*ngro+1); + erreur = MEDfamilyInfo(medIdt, + meshname, + i+1, + familyname, + &numfam, + gro); + if (erreur < 0) { + free(gro); + break; + } + // Lecture des groupes pour une famille de mailles + if (numfam < 0) { + for (int j=0;j 0) MEDfileClose(medIdt); + + return ListeGroupes; +} + +// ======================================================================= +// Le vecteur en retour contiendra les informations suivantes : +// en position 0 et 1 Xmin, Xmax et en position 2 Dx si < 0 2D +// en position 3 et 4 Ymin, Ymax et en position 5 Dy si < 0 2D +// en position 6 et 7 Zmin, Zmax et en position 8 Dz si < 0 2D +// 9 distance max dans le maillage +// ======================================================================= +std::vector GetBoundingBoxInMedFile(const char * aFile) +{ + std::vector LesExtremes; + med_err erreur = 0; + med_idt medIdt; + while (erreur == 0) { + // Ouverture du fichier + medIdt = MEDfileOpen(aFile,MED_ACC_RDONLY); + if (medIdt < 0) { + erreur = 1; + break; + } + //Nombre de maillage : on ne peut en lire qu'un seul + med_int numberOfMeshes = MEDnMesh(medIdt); + if (numberOfMeshes != 1) { + erreur = 2; + break; + } + // Caracteristiques du maillage + char meshname[MED_NAME_SIZE+1]; + med_int spacedim,meshdim; + med_mesh_type meshtype; + char descriptionription[MED_COMMENT_SIZE+1]; + char dtunit[MED_SNAME_SIZE+1]; + med_sorting_type sortingtype; + med_int nstep; + med_axis_type axistype; + int naxis = MEDmeshnAxis(medIdt,1); + char *axisname=new char[naxis*MED_SNAME_SIZE+1]; + char *axisunit=new char[naxis*MED_SNAME_SIZE+1]; + erreur = MEDmeshInfo(medIdt, + 1, + meshname, + &spacedim, + &meshdim, + &meshtype, + descriptionription, + dtunit, + &sortingtype, + &nstep, + &axistype, + axisname, + axisunit); + delete[] axisname; + delete[] axisunit; + if (erreur < 0) { break; } + + // Nombre de noeuds + med_bool chgt,trsf; + med_int nnoe = MEDmeshnEntity(medIdt, + meshname, + MED_NO_DT, + MED_NO_IT, + MED_NODE, + MED_NO_GEOTYPE, + MED_COORDINATE, + MED_NO_CMODE, + &chgt, + &trsf); + if (nnoe < 0) { + erreur = 4; + break; + } + + // Les coordonnees + med_float* coo = (med_float*) malloc(sizeof(med_float)*nnoe*spacedim); + + erreur = MEDmeshNodeCoordinateRd(medIdt, + meshname, + MED_NO_DT, + MED_NO_IT, + MED_NO_INTERLACE, + coo); + if (erreur < 0) { + free(coo); + break; + } + + // Calcul des extremes + med_float xmin,xmax,ymin,ymax,zmin,zmax; + + xmin = coo[0]; + xmax = coo[0]; + for (int i = 1; i < nnoe; i++) { + xmin = std::min(xmin, coo[i]); + xmax = std::max(xmax, coo[i]); + } + // + if (spacedim > 1) { + ymin = coo[nnoe]; + ymax = coo[nnoe]; + for (int i = nnoe + 1; i < 2*nnoe; i++) { + ymin = std::min(ymin,coo[i]); + ymax = std::max(ymax,coo[i]); + } + } + else { + ymin = 0; + ymax = 0; + zmin = 0; + zmax = 0; + } + // + if (spacedim > 2) { + zmin = coo[2*nnoe]; + zmax = coo[2*nnoe]; + for (int i = 2*nnoe + 1; i < 3*nnoe; i++) { + zmin = std::min(zmin,coo[i]); + zmax = std::max(zmax,coo[i]); + } + } + else { + zmin = 0; + zmax = 0; + } + + MESSAGE("_______________________________________"); + MESSAGE("xmin : " << xmin << " xmax : " << xmax); + MESSAGE("ymin : " << ymin << " ymax : " << ymax); + MESSAGE("zmin : " << zmin << " zmax : " << zmax); + MESSAGE("_______________________________________"); + double epsilon = 1.e-6; + LesExtremes.push_back(xmin); + LesExtremes.push_back(xmax); + LesExtremes.push_back(0); + LesExtremes.push_back(ymin); + LesExtremes.push_back(ymax); + LesExtremes.push_back(0); + LesExtremes.push_back(zmin); + LesExtremes.push_back(zmax); + LesExtremes.push_back(0); + + double max1 = std::max (LesExtremes[1] - LesExtremes[0], LesExtremes[4] - LesExtremes[3]); + double max2 = std::max (max1 , LesExtremes[7] - LesExtremes[6]); + LesExtremes.push_back(max2); + + // LesExtremes[0] = Xmini du maillage + // LesExtremes[1] = Xmaxi du maillage + // LesExtremes[2] = increment de progression en X + // LesExtremes[3,4,5] : idem pour Y + // LesExtremes[6,7,8] : idem pour Z + // LesExtremes[9] = ecart maximal entre coordonnees + // On fait un traitement pour dans le cas d'une coordonnee constante + // inhiber ce cas en mettant un increment negatif + // + double diff = LesExtremes[1] - LesExtremes[0]; + if (fabs(diff) > epsilon*max2) { LesExtremes[2] = diff/100.; } + else { LesExtremes[2] = -1.; } + + diff = LesExtremes[4] - LesExtremes[3]; + if (fabs(diff) > epsilon*max2) { LesExtremes[5]=diff/100.; } + else { LesExtremes[5] = -1.; } + + diff = LesExtremes[7] - LesExtremes[6]; + if (fabs(diff) > epsilon*max2) { LesExtremes[8]=diff/100.; } + else { LesExtremes[8] = -1.; } + + MESSAGE ("_______________________________________"); + MESSAGE ("xmin : " << LesExtremes[0] << " xmax : " << LesExtremes[1] << " xincr : " << LesExtremes[2]); + MESSAGE ("ymin : " << LesExtremes[3] << " ymax : " << LesExtremes[4] << " yincr : " << LesExtremes[5]); + MESSAGE ("zmin : " << LesExtremes[6] << " zmax : " << LesExtremes[7] << " zincr : " << LesExtremes[8]); + MESSAGE ("dmax : " << LesExtremes[9]); + MESSAGE ("_______________________________________"); + + free(coo); + break; + } + // Fermeture du fichier + if (medIdt > 0) MEDfileClose(medIdt); + + return LesExtremes; +} + +}; // namespace SMESHHOMARD_I diff --git a/src/SMESH_I/SMESH_Homard_i.hxx b/src/SMESH_I/SMESH_Homard_i.hxx new file mode 100644 index 000000000..0fbf2dc31 --- /dev/null +++ b/src/SMESH_I/SMESH_Homard_i.hxx @@ -0,0 +1,310 @@ +// Copyright (C) 2011-2021 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 _SMESH_HOMARD_I_HXX_ +#define _SMESH_HOMARD_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_Homard) +#include CORBA_CLIENT_HEADER(SALOMEDS) +#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) +#include CORBA_CLIENT_HEADER(SMESH_Gen) +#include CORBA_CLIENT_HEADER(SMESH_Mesh) + +#include "SMESH.hxx" +#include "SMESH_Homard.hxx" +//#include "FrontTrack.hxx" +#include "SALOME_Component_i.hxx" +#include "SALOME_NamingService.hxx" +#include "Utils_CorbaException.hxx" + +#include +#include +#include +#include + +namespace SMESHHOMARD_I +{ + +class SMESH_I_EXPORT HOMARD_Boundary_i : public virtual SALOME::GenericObj_i, + public virtual POA_SMESHHOMARD::HOMARD_Boundary +{ +public: + HOMARD_Boundary_i(SMESHHOMARD::HOMARD_Gen_var gen_i); + HOMARD_Boundary_i(); + + virtual ~HOMARD_Boundary_i(); + + // Generalites + void SetName(const char* Name); + char* GetName(); + + char* GetDumpPython(); + + // Caracteristiques + void SetType(CORBA::Long Type); + CORBA::Long GetType(); + + void SetMeshName(const char* MeshName); + char* GetMeshName(); + + void SetDataFile(const char* DataFile); + char* GetDataFile(); + + void SetCylinder(double Xcentre, double Ycentre, double ZCentre, + double Xaxe, double Yaxe, double Zaxe, + double rayon); + void SetSphere(double Xcentre, double Ycentre, double ZCentre, + double rayon); + void SetConeR(double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1, + double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2); + void SetConeA(double Xaxe, double Yaxe, double Zaxe, double Angle, + double Xcentre, double Ycentre, double ZCentre); + void SetTorus(double Xcentre, double Ycentre, double ZCentre, + double Xaxe, double Yaxe, double Zaxe, + double rayonRev, double rayonPri); + + SMESHHOMARD::double_array* GetCoords(); + + void SetLimit(double Xincr, double Yincr, double Zincr); + SMESHHOMARD::double_array* GetLimit(); + + void AddGroup(const char* Group); + void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup); + SMESHHOMARD::ListGroupType* GetGroups(); + +private: + SMESHHOMARDImpl::HOMARD_Boundary* myHomardBoundary; + SMESHHOMARD::HOMARD_Gen_var _gen_i; +}; + +class SMESH_I_EXPORT HOMARD_Cas_i : public virtual SALOME::GenericObj_i, + public virtual POA_SMESHHOMARD::HOMARD_Cas +{ +public: + HOMARD_Cas_i(SMESHHOMARD::HOMARD_Gen_var gen_i); + HOMARD_Cas_i(); + + virtual ~HOMARD_Cas_i(); + + char* GetDumpPython(); + + // Caracteristiques + void SetDirName(const char* NomDir); + char* GetDirName(); + + void SetBoundingBox(const SMESHHOMARD::extrema& LesExtremes); + SMESHHOMARD::extrema* GetBoundingBox(); + + void AddGroup(const char* Group); + void SetGroups(const SMESHHOMARD::ListGroupType& ListGroup); + SMESHHOMARD::ListGroupType* GetGroups(); + + void AddBoundary(const char* Boundary); + void AddBoundaryGroup(const char* Boundary, const char* Group); + SMESHHOMARD::ListBoundaryGroupType* GetBoundaryGroup(); + void SupprBoundaryGroup(); + + void AddIteration(const char* NomIteration); + +private: + SMESHHOMARDImpl::HOMARD_Cas* myHomardCas; + SMESHHOMARD::HOMARD_Gen_var _gen_i; +}; + +class SMESH_I_EXPORT HOMARD_Iteration_i +{ +public: + HOMARD_Iteration_i(SMESHHOMARD::HOMARD_Gen_var gen_i); + HOMARD_Iteration_i(); + + virtual ~HOMARD_Iteration_i(); + + // Generalites + void SetName(const char* Name); + char* GetName(); + + // Caracteristiques + void SetDirNameLoc(const char* NomDir); + char* GetDirNameLoc(); + + char* GetDirName(); + + void SetNumber(CORBA::Long NumIter); + CORBA::Long GetNumber(); + + void SetState(CORBA::Long etat); + CORBA::Long GetState(); + + void SetMeshName(const char* NomMesh); + char* GetMeshName(); + + void SetMeshFile(const char* MeshFile); + char* GetMeshFile(); + + void SetLogFile(const char* LogFile); + char* GetLogFile(); + + void SetFileInfo(const char* FileInfo); + char* GetFileInfo(); + + // Liens avec les autres structures + void SetCaseName(const char* NomCas); + char* GetCaseName(); + + // Drivers + void SetInfoCompute(CORBA::Long MessInfo); + CORBA::Long GetInfoCompute(); + +private: + SMESHHOMARDImpl::HOMARD_Iteration* myHomardIteration; + SMESHHOMARD::HOMARD_Gen_var _gen_i; +}; + +class SMESH_I_EXPORT HOMARD_Gen_i : public virtual SALOME::GenericObj_i, + public virtual POA_SMESHHOMARD::HOMARD_Gen +{ +public: + HOMARD_Gen_i(); + virtual ~HOMARD_Gen_i(); + + // Les creations + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundary (const char* nomBoundary, + CORBA::Long typeBoundary); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryCAO (const char* nomBoundary, + const char* DataFile); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryDi (const char* nomBoundary, + const char* MeshName, const char* DataFile); + SMESHHOMARD::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::Double Rayon); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundarySphere + (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Rayon); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryConeR + (const char* nomBoundary, + CORBA::Double Xcentre1, CORBA::Double Ycentre1, CORBA::Double Zcentre1, + CORBA::Double Rayon1, + CORBA::Double Xcentre2, CORBA::Double Ycentre2, CORBA::Double Zcentre2, + CORBA::Double Rayon2); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryConeA + (const char* nomBoundary, + CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, + CORBA::Double Angle, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre); + SMESHHOMARD::HOMARD_Boundary_ptr CreateBoundaryTorus + (const char* nomBoundary, + CORBA::Double Xcentre, CORBA::Double Ycentre, CORBA::Double Zcentre, + CORBA::Double Xaxis, CORBA::Double Yaxis, CORBA::Double Zaxis, + CORBA::Double RayonRev, CORBA::Double RayonPri); + + SMESHHOMARD::HOMARD_Cas_ptr CreateCaseOnMesh (const char* MeshName, + SMESH::SMESH_Mesh_ptr smeshMesh, + const char* theWorkingDir); + SMESHHOMARD::HOMARD_Cas_ptr CreateCase (const char* MeshName, + const char* FileName, + const char* theWorkingDir); + + HOMARD_Iteration_i* CreateIteration(); + + // Les informations + SMESHHOMARD::HOMARD_Boundary_ptr GetBoundary (const char* nomBoundary); + SMESHHOMARD::HOMARD_Cas_ptr GetCase (); + HOMARD_Iteration_i* GetIteration (CORBA::Long numIter); + + SMESHHOMARD::listeBoundarys* GetAllBoundarysName(); + + void InvalideBoundary(const char* nomBoundary); + + CORBA::Long DeleteBoundary(const char* nomBoundary); + void DeleteCase(); + CORBA::Long DeleteIteration(int numIter); + + void AddBoundary(const char* Boundary); + void AddBoundaryGroup(const char* Boundary, const char* Group); + + void AssociateCaseIter(int numIter, const char* labelIter); + char* CreateDirNameIter(const char* nomrep, CORBA::Long num); + + CORBA::Long Compute(); + CORBA::Long ComputeAdap(SMESHHOMARDImpl::HomardDriver* myDriver); + CORBA::Long ComputeCAO(); + CORBA::Long ComputeCAObis(); + char* ComputeDirManagement(); + char* ComputeDirPaManagement(); + int DriverTexteBoundary(SMESHHOMARDImpl::HomardDriver* myDriver); + + void PublishResultInSmesh(const char* NomFich); + void DeleteResultInSmesh(std::string NomFich, std::string MeshName); + + void PythonDump(); + + // Preferences + void SetConfType (CORBA::Long theConfType); + void SetKeepMedOUT (bool theKeepMedOUT); + void SetPublishMeshOUT (bool thePublishMeshOUT); + void SetMeshNameOUT (const char* theMeshNameOUT); + void SetMeshFileOUT (const char* theMeshFileOUT); + + void SetVerboseLevel (CORBA::Long theVerboseLevel); + void SetKeepWorkingFiles(bool theKeepWorkingFiles); + void SetLogInFile(bool theLogInFile); + void SetLogFile (const char* theLogFile); + void SetRemoveLogOnSuccess(bool theRemoveLogOnSuccess); + +private: + SMESHHOMARD::HOMARD_Boundary_ptr newBoundary(); + SMESHHOMARD::HOMARD_Cas_ptr newCase(); + HOMARD_Iteration_i* newIteration(); + +private: + SMESHHOMARDImpl::HOMARD_Gen* myHomard; + HOMARD_Iteration_i* myIteration0; + HOMARD_Iteration_i* myIteration1; + SMESHHOMARD::HOMARD_Cas_var myCase; + std::map _mesBoundarys; + + // Preferences + int _ConfType; // Le type de conformite ou non conformite + bool _KeepMedOUT; + bool _PublishMeshOUT; + bool _KeepWorkingFiles; + bool _LogInFile; + bool _RemoveLogOnSuccess; + int _VerboseLevel; + std::string _MeshNameOUT; + std::string _MeshFileOUT; + std::string _LogFile; + + // Input data type + bool _CaseOnMedFile; + SMESH::SMESH_Mesh_var _SmeshMesh; + std::string _TmpMeshFile; +}; + +SMESH_I_EXPORT std::vector GetBoundingBoxInMedFile(const char * aFile); +SMESH_I_EXPORT std::set GetListeGroupesInMedFile(const char * aFile); + +}; // namespace SMESHHOMARD_I + +#endif