New examples

This commit is contained in:
jfa 2021-12-29 16:30:31 +03:00
parent 1c08dab8eb
commit 090d533f33
10 changed files with 793 additions and 7 deletions

View File

@ -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}

View File

@ -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()

View File

@ -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

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -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

View File

@ -342,7 +342,7 @@
</message>
<message>
<source>MEN_HOMARD_ADAPT</source>
<translation>Remesh with HOMARD</translation>
<translation>Uniform refinement</translation>
</message>
<message>
<source>Args</source>
@ -3224,6 +3224,10 @@ Use Display Entity menu command to show them.
<source>SMESH_Z</source>
<translation>Z</translation>
</message>
<message>
<source>SMESH_Z_SCALARBAR</source>
<translation>Z:</translation>
</message>
<message>
<source>STATE_ALGO_MISSING</source>
<translation>%3 %2D algorithm is missing</translation>
@ -3322,7 +3326,7 @@ Use Display Entity menu command to show them.
</message>
<message>
<source>STB_HOMARD_ADAPT</source>
<translation>Remesh with HOMARD</translation>
<translation>Uniform refinement</translation>
</message>
<message>
<source>STB_CONV_TO_QUAD</source>
@ -4022,7 +4026,7 @@ Use Display Entity menu command to show them.
</message>
<message>
<source>TOP_HOMARD_ADAPT</source>
<translation>Remesh with HOMARD</translation>
<translation>Uniform refinement</translation>
</message>
<message>
<source>TOP_CONV_TO_QUAD</source>

View File

@ -340,6 +340,10 @@
<source>MEN_MG_ADAPT</source>
<translation>Remaillage avec MG_Adapt</translation>
</message>
<message>
<source>MEN_HOMARD_ADAPT</source>
<translation>Raffinement uniforme</translation>
</message>
<message>
<source>Args</source>
<translation>Arguments</translation>
@ -1610,6 +1614,10 @@ Merci de les corriger, puis essayez de nouveau</translation>
<source>SMESH_AVAILABLE</source>
<translation>Disponible</translation>
</message>
<message>
<source>SMESH_NOT_AVAILABLE</source>
<translation>Indisponible</translation>
</message>
<message>
<source>SMESH_AVAILABLE_ALGORITHMS</source>
<translation>Algorithmes disponibles</translation>
@ -1750,7 +1758,7 @@ Merci de les corriger, puis essayez de nouveau</translation>
</message>
<message>
<source>SMESH_CONTINUE_MESH_VISUALIZATION</source>
<translation>La système semble manquer de mémoire pour visualiser le maillage,
<translation>Le système semble manquer de mémoire pour visualiser le maillage,
ce qui peut faire planter l'application. Voulez-vous continuer la visualisation ?</translation>
</message>
<message>
@ -2816,6 +2824,10 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée
</message>
<message>
<source>SMESH_RENUMBERING</source>
<translation>Renumérotation</translation>
</message>
<message>
<source>SMESH_RENUMBER</source>
<translation>Renuméroter</translation>
</message>
<message>
@ -2836,7 +2848,7 @@ Référez-vous à la documentation sur l'algorithme et la géométrie supportée
</message>
<message>
<source>SMESH_RM_HYP_WRN</source>
<translation>&quot;%1&quot; n'est pas attribué, mais:
<translation>&quot;%1&quot; n'est pas attribué, mais :
</translation>
</message>
<message>
@ -3207,6 +3219,10 @@ Utilisez le menu &quot;Visualiser une entité&quot; pour les afficher.
<source>SMESH_Z</source>
<translation>Z</translation>
</message>
<message>
<source>SMESH_Z_SCALARBAR</source>
<translation>Z :</translation>
</message>
<message>
<source>STATE_ALGO_MISSING</source>
<translation>Il manque l'algorithme %3 %2D</translation>
@ -3303,6 +3319,10 @@ Utilisez le menu &quot;Visualiser une entité&quot; pour les afficher.
<source>STB_MG_ADAPT</source>
<translation>Remaillage avec MG_Adapt</translation>
</message>
<message>
<source>STB_HOMARD_ADAPT</source>
<translation>Raffinement uniforme</translation>
</message>
<message>
<source>STB_CONV_TO_QUAD</source>
<translation>Convertir vers/depuis quadratique</translation>
@ -3525,7 +3545,7 @@ Utilisez le menu &quot;Visualiser une entité&quot; pour les afficher.
</message>
<message>
<source>STB_DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
<translation>Déflection 2D</translation>
</message>
<message>
<source>STB_MAP</source>
@ -3999,6 +4019,10 @@ Utilisez le menu &quot;Visualiser une entité&quot; pour les afficher.
<source>TOP_MG_ADAPT</source>
<translation>Remaillage avec MG_Adapt</translation>
</message>
<message>
<source>TOP_HOMARD_ADAPT</source>
<translation>Raffinement uniforme</translation>
</message>
<message>
<source>TOP_CONV_TO_QUAD</source>
<translation>Convertir vers/de quadratique</translation>