From: jfa Date: Wed, 29 Dec 2021 13:30:31 +0000 (+0300) Subject: New examples X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=090d533f339d886d08177706ed5e4a03aea99511;p=modules%2Fsmesh.git New examples --- diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index d327b91a8..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 test_homard_adapt.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_uniform_refinement.py b/doc/salome/examples/test_uniform_refinement.py new file mode 100644 index 000000000..92451c949 --- /dev/null +++ b/doc/salome/examples/test_uniform_refinement.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 + +import salome +salome.salome_init() + +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +import SMESHHOMARD + +smesh = smeshBuilder.New() + +import os, inspect, tempfile, shutil + +data_dir = 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.AddBoundaryGroup(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.AddBoundaryGroup("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 33086566a..325ef2bd6 100644 --- a/doc/salome/examples/tests.set +++ b/doc/salome/examples/tests.set @@ -47,6 +47,7 @@ SET(BAD_TESTS test_smeshplugins.py MGAdaptTests_without_session.py test_homard_adapt.py + test_uniform_refinement.py blocFissure_01_without_session.py blocFissure_02_without_session.py blocFissure_03_without_session.py 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/input/tui_adaptation.rst b/doc/salome/gui/SMESH/input/tui_adaptation.rst index b478d9911..2e90aad82 100644 --- a/doc/salome/gui/SMESH/input/tui_adaptation.rst +++ b/doc/salome/gui/SMESH/input/tui_adaptation.rst @@ -9,6 +9,11 @@ Adaptation 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 diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index a2b347f0d..827d8ab82 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -342,7 +342,7 @@ MEN_HOMARD_ADAPT - Remesh with HOMARD + Uniform refinement Args @@ -3224,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 @@ -3322,7 +3326,7 @@ Use Display Entity menu command to show them. STB_HOMARD_ADAPT - Remesh with HOMARD + Uniform refinement STB_CONV_TO_QUAD @@ -4022,7 +4026,7 @@ Use Display Entity menu command to show them. TOP_HOMARD_ADAPT - Remesh with HOMARD + Uniform refinement TOP_CONV_TO_QUAD diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 839175130..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 : @@ -3207,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 @@ -3303,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 @@ -3525,7 +3545,7 @@ Utilisez le menu "Visualiser une entité" pour les afficher. STB_DEFLECTION_2D - Deflection 2D + Déflection 2D STB_MAP @@ -3999,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