From b131becc0872f2050b117ce5bfc0fda84e34faa6 Mon Sep 17 00:00:00 2001 From: Yoann Audouin Date: Mon, 10 Oct 2022 09:34:15 +0200 Subject: [PATCH] Adding user documentation --- .../examples/create_dual_mesh.py | 14 ++--- doc/examples/tests.set | 1 + doc/gui/CMakeLists.txt | 2 +- doc/gui/images/create_dual_mesh_dlg.png | Bin 0 -> 11000 bytes doc/gui/input/about_meshes.rst | 21 ++++--- doc/gui/input/create_dual_mesh.rst | 42 ++++++++++++++ doc/gui/input/tui_creating_meshes.rst | 16 +++++- src/SMESHGUI/SMESHGUI_CreateDualMeshOp.cxx | 3 +- src/SMESH_I/SMESH_Gen_i.cxx | 1 + src/SMESH_SWIG/smesh_tools.py | 52 ++++++++++++++++-- test/SMESH_create_dual_mesh_adapt.py | 2 + test/tests.set | 1 - 12 files changed, 128 insertions(+), 27 deletions(-) rename test/SMESH_create_dual_mesh.py => doc/examples/create_dual_mesh.py (90%) create mode 100644 doc/gui/images/create_dual_mesh_dlg.png create mode 100644 doc/gui/input/create_dual_mesh.rst diff --git a/test/SMESH_create_dual_mesh.py b/doc/examples/create_dual_mesh.py similarity index 90% rename from test/SMESH_create_dual_mesh.py rename to doc/examples/create_dual_mesh.py index 08621f30e..08dfea822 100644 --- a/test/SMESH_create_dual_mesh.py +++ b/doc/examples/create_dual_mesh.py @@ -1,8 +1,5 @@ -#!/usr/bin/env python +# Creating dual Mesh -### -### This file is generated automatically by SALOME v9.9.0 with dump python functionality -### import sys import salome @@ -22,6 +19,7 @@ import math import SALOMEDS +# Creating a sphere geompy = geomBuilder.New() O = geompy.MakeVertex(0, 0, 0) @@ -36,20 +34,20 @@ geompy.addToStudy( OY, 'OY' ) geompy.addToStudy( OZ, 'OZ' ) geompy.addToStudy( Sphere_1, 'Sphere_1' ) -### -### SMESH component -### - import SMESH, SALOMEDS from salome.smesh import smeshBuilder smesh = smeshBuilder.New() +# Meshing sphere in Tetrahedron NETGEN_3D_Parameters_1 = smesh.CreateHypothesisByAverageLength( 'NETGEN_Parameters', 'NETGENEngine', 34.641, 0 ) Mesh_1 = smesh.Mesh(Sphere_1,'Mesh_1') status = Mesh_1.AddHypothesis( Sphere_1, NETGEN_3D_Parameters_1 ) NETGEN_1D_2D_3D = Mesh_1.Tetrahedron(algo=smeshBuilder.NETGEN_1D2D3D) isDone = Mesh_1.Compute() + + +# Creating Dual mesh dual_Mesh_1 = smesh.CreateDualMesh( Mesh_1, 'dual_Mesh_1', True) diff --git a/doc/examples/tests.set b/doc/examples/tests.set index cb22edab5..df39d9dd9 100644 --- a/doc/examples/tests.set +++ b/doc/examples/tests.set @@ -128,6 +128,7 @@ SET(BAD_TESTS transforming_meshes_ex06.py viewing_meshes_ex01.py radial_prism_3d_algo.py + create_dual_mesh.py ) IF(NOT WIN32) LIST(APPEND BAD_TESTS diff --git a/doc/gui/CMakeLists.txt b/doc/gui/CMakeLists.txt index c85b76e94..26660b650 100644 --- a/doc/gui/CMakeLists.txt +++ b/doc/gui/CMakeLists.txt @@ -57,7 +57,7 @@ SET(_cmd_smeshBuilder_gen_options ${smesh_merge_file} -o tmp2/smeshBuilder.py sm SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd_smeshBuilder_gen env_script "${PYTHON_EXECUTABLE}" "${_cmd_smeshBuilder_gen_options}" CONTEXT "SMESH_DOC" ADDITIONAL_VARIABLES ${ADD_VAR}) ADD_CUSTOM_TARGET(pre_usr_docs - # 1. Make temporary directories for python modules + # 1. Make temporary directories for python modules COMMAND ${CMAKE_COMMAND} -E make_directory tmp1 COMMAND ${CMAKE_COMMAND} -E make_directory tmp2 diff --git a/doc/gui/images/create_dual_mesh_dlg.png b/doc/gui/images/create_dual_mesh_dlg.png new file mode 100644 index 0000000000000000000000000000000000000000..b28beaaf83f28c62ed22b23baccd167ed71579a3 GIT binary patch literal 11000 zcmaKS1zc2JyYC1nBT|Bdq=blolnO{oOG}Q@p`fI6qtY$XEg&G>-5_0p(h`Dncf)=3 zJKuZao_qICQD)Dqz4uz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$vVNQD(dW9XqvrU|6`P5psqR4}gjDusDx1b)!_lTIU$34j@a4WB9k%@DMA z--d>`rb%3|QCCByzNV`!*;I)nLo?FxaFZrMp8LTANPMU)^IUJ_XCz*5yw5~J zj*u2`J>G={yJC6;6ri!OqCywMq`EsQkpII0VM>^S;3%LGI2UM^0i|3x(?|+Tv-MIi z2ego}2rh5Kbc_%}P@?9{xhXCSz2h|=3iIvX9n0Dgkmi+@{dFLsqUbTQt-mZGML)a4 zfvGv^-YuK)9lkM8P#*Un<&z>K0I}WNL_S)YaPzIp6U71l8_y+WKL^+D;Hw-j9d|HXW$lGRGZ2K6aBK=vno|ap!AQ@Aq&| z>GnVh&c(&0QEm=SWj2A&e&G9eHl4cohzM2i(6H=1c{aATjt&kZqoXZweEmATbqIN3 zr(uzT;L&d)g`8zVB}tbbbCAJ7$>NJZ5<_J=bmAqIvmBh6k1=RgT2ur`+cvrKsoxm7 zS-=bsMKtPu>B274q(sWdbb;uEScejgGX|y%`j#N#fs!H_G06*QJu5T;Y|N~!i!(Ft zM&2q}0XGZk3bqU2GBoI*x6z`%SD)n3H3um+5iv3N04p8}m=Qz6AETok3p)|gx4lFf zwXd`Vk^eEk!2AY}#(H~k$6aiM>b6fq`tNhj3px@}Qp%IHaw59lgEaLbzPS^idoad&4>&9v*Gx zq(C?j#xBgy@27ZeIc9JH%1)RZSs4yS5m3+}B;1&E+iymmp1OD{K6&ETx($8Xyu_a?K%7V$&}BDgVtMb|MpLkX9oy&sbiEfRam30>A4W=eSLh0fR0E8628&# f|Ng?q=W{&bUIDTexkp{_F2oaYd9geZ-S__ov-E?$ literal 0 HcmV?d00001 diff --git a/doc/gui/input/about_meshes.rst b/doc/gui/input/about_meshes.rst index 270fbe5e1..73af1714e 100644 --- a/doc/gui/input/about_meshes.rst +++ b/doc/gui/input/about_meshes.rst @@ -1,8 +1,8 @@ -.. _about_meshes_page: +.. _about_meshes_page: ************ About meshes -************ +************ **MESH** represents a discrete approximation of a subset of the three-dimensional space by `elementary geometrical elements`_. @@ -10,7 +10,7 @@ A SALOME study can contain multiple meshes, but they do not implicitly compose o Mesh module provides several ways to create the mesh: -* The main way is to :ref:`construct the mesh ` on the basis of the geometrical shape produced in the Geometry module. This way implies selection of +* The main way is to :ref:`construct the mesh ` on the basis of the geometrical shape produced in the Geometry module. This way implies selection of * a geometrical object (*main shape*) and * *meshing parameters* (:ref:`meshing algorithms ` and characteristics (e.g. element size) of a required mesh encapsulated in :ref:`hypothesis ` objects). @@ -20,19 +20,21 @@ Mesh module provides several ways to create the mesh: .. note:: Algorithms and hypotheses used at mesh level are referred to as *global* ones and those used at sub-mesh level are referred to as *local* ones. - + * Bottom-up way, using :ref:`mesh modification ` operations, especially :ref:`extrusion ` and :ref:`revolution `. To create an empty mesh not based on geometry, use the same dialog as to :ref:`construct the mesh on geometry ` but specify neither the geometry nor meshing algorithms. - + * The mesh can be :ref:`imported ` from (and exported to) the file in MED, UNV, STL, CGNS, DAT and GMF formats. - + * The 3D mesh can be generated from the 2D mesh not based on geometry, which was either :ref:`imported ` or created in other way. To setup the meshing parameters of a mesh not based on geometry, just invoke :ref:`Edit mesh / sub-mesh ` command on your 2D mesh. - + * Several meshes can be :ref:`combined ` into a new mesh. - + * The whole mesh or its part (sub-mesh or group) can be :ref:`copied ` into a new mesh. - + * A new mesh can be created from a transformed, e.g. :ref:`translated `, part of the mesh. +* A new mesh can be created from the gernation of the :ref:`dual ` of a Tetrahedron Mesh. + Meshes can be edited using the MESH functions destined for :ref:`modification ` of meshes. @@ -82,4 +84,5 @@ Quadratic mesh can be obtained in three ways: importing_exporting_meshes.rst building_compounds.rst copy_mesh.rst + create_dual_mesh.rst connectivity.rst diff --git a/doc/gui/input/create_dual_mesh.rst b/doc/gui/input/create_dual_mesh.rst new file mode 100644 index 000000000..2a540a1c6 --- /dev/null +++ b/doc/gui/input/create_dual_mesh.rst @@ -0,0 +1,42 @@ +.. _create_dual_mesh_page: + +**************** +Create Dual Mesh +**************** + +We can create the dual of a Tetrahedron Mesh which will be a polyhedron mesh. +The Mesh is created using MEDCoupling computeDualMesh function. + +*To create a dual mesh:* + +.. |img| image:: ../images/create_dual_mesh_icon.png + +From the contextual menu in the Object Browser of from the **Mesh** menu select +**Create Dual Mesh** or click *"Create Dual Mesh"* button |img| in the toolbar. + +The following dialog box will appear: + +.. image:: ../images/create_dual_mesh_dlg.png + :align: center + +In the dialog: + +* specify the mesh for which to create the dual mesh: + * **Select whole mesh** from the study tree. If a mesh was selected before calling function it will be preselected. + * If the mesh is not made of only Tetrahedrons a error message will be displayed and you won't be allowed to go through. +* specify the **New Mesh Name**; +* activate **Project boundary elements on shape** for the boundary points of the + dual mesh to be projected on their associated shape. + +* Click **Apply** or **Apply and Close** button to confirm the operation. + +---------------------------- +Limitations of the dual mesh +---------------------------- + +Only 2d groups will be transferred to the dual mesh. + +If you have convex shape the projection might not improve the mesh. + + +**See Also** a sample script of :ref:`tui_create_dual_mesh`. diff --git a/doc/gui/input/tui_creating_meshes.rst b/doc/gui/input/tui_creating_meshes.rst index 9d3cb5077..253fbf260 100644 --- a/doc/gui/input/tui_creating_meshes.rst +++ b/doc/gui/input/tui_creating_meshes.rst @@ -70,7 +70,7 @@ Export of a Mesh :download:`Download this script <../../examples/creating_meshes_ex05.py>` -.. _how_to_mesh_a_cylinder_with_hexahedrons: +.. _how_to_mesh_a_cylinder_with_hexahedrons: How to mesh a cylinder with hexahedrons? ======================================== @@ -84,10 +84,10 @@ demonstrates the resulting mesh. :download:`Download this script <../../examples/creating_meshes_ex06.py>` .. image:: ../images/mesh_cylinder_hexa.png - :align: center + :align: center -.. _tui_building_compound: +.. _tui_building_compound: Building a compound of meshes ============================= @@ -107,3 +107,13 @@ Mesh Copying :download:`Download this script <../../examples/creating_meshes_ex08.py>` +.. _tui_create_dual_mesh: + +Creating Dual Mesh +================== + +.. literalinclude:: ../../examples/create_dual_mesh.py + :language: python + +:download:`Download this script <../../examples/create_dual_mesh.py>` + diff --git a/src/SMESHGUI/SMESHGUI_CreateDualMeshOp.cxx b/src/SMESHGUI/SMESHGUI_CreateDualMeshOp.cxx index 4ee81382a..c0fed0340 100644 --- a/src/SMESHGUI/SMESHGUI_CreateDualMeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_CreateDualMeshOp.cxx @@ -150,9 +150,10 @@ void SMESHGUI_CreateDualMeshOp::selectionDone() { SMESH::SMESH_subMesh_var subMesh = SMESH::SObjectToInterface( pObj ); - // TODO: Check that mesh is only tetra + // Check that mesh is only tetra if (!checkMesh(idSource)){ myDlg->ShowWarning( true ); + myDlg->setButtonEnabled(false, QtxDialog::OK|QtxDialog::Apply); } } std::string mesh_name = "dual_" + pObj->GetName(); diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 0fd53cbc7..f6abcbdce 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -2885,6 +2885,7 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateDualMesh(SMESH::SMESH_IDSource_ptr mesh SMESH_Mesh& newMesh2 = newMesh_i->GetImpl(); + MESSAGE("Loading file: " << dual_mesh_file.string() << " with mesh " << mesh_name); newMesh2.MEDToMesh(dual_mesh_file.c_str(), meshName); MESSAGE("Imported created MED") diff --git a/src/SMESH_SWIG/smesh_tools.py b/src/SMESH_SWIG/smesh_tools.py index 1a6995eed..3d95f730c 100644 --- a/src/SMESH_SWIG/smesh_tools.py +++ b/src/SMESH_SWIG/smesh_tools.py @@ -4,6 +4,7 @@ import sys import salome import medcoupling as mc from math import pi +import numpy as np #salome.salome_init() @@ -17,6 +18,10 @@ from salome.smesh import smeshBuilder smesh = smeshBuilder.New() +from salome.kernel.logger import Logger +logger = Logger("salome.smesh.smesh_tools") +logger.setLevel("DEBUG") + def smesh_create_dual_mesh(mesh_ior, output_file, adapt_to_shape=True, mesh_name="MESH"): """ Create a dual of the mesh in input_file into output_file @@ -31,15 +36,51 @@ def smesh_create_dual_mesh(mesh_ior, output_file, adapt_to_shape=True, mesh_name shape = mesh.GetShapeToMesh() + # Creating output file + myfile = mc.MEDFileUMesh() + myfile.setName(mesh_name) + + # We got a meshProxy so we need to convert pointer to MEDCoupling int_ptr = mesh.ExportMEDCoupling(True, True) dab = mc.FromPyIntPtrToDataArrayByte(int_ptr) - tetras = mc.MEDFileMesh.New(dab)[0] + mc_mesh_file = mc.MEDFileMesh.New(dab) + tetras = mc_mesh_file[0] # End of SMESH -> MEDCoupling part for dualmesh tetras = mc.MEDCoupling1SGTUMesh(tetras) polyh = tetras.computeDualMesh() - dual_volume_raw = polyh.getMeasureField(True).accumulate()[0] + + ## Adding skin + transfering groups on faces from tetras mesh + mesh2d = polyh.buildUnstructured().computeSkin() + mesh2d.setName(mesh_name) + myfile.setMeshAtLevel(-1, mesh2d) + + + for grp_name in mc_mesh_file.getGroupsOnSpecifiedLev(-1): + logger.debug("Transferring group: "+ grp_name) + grp_tria = mc_mesh_file.getGroup(-1, grp_name) + # Retrieve the nodes in group + grp_nodes = grp_tria.computeFetchedNodeIds() + # Find all the cells lying on one of the nodes + id_grp_poly = mesh2d.getCellIdsLyingOnNodes(grp_nodes, False) + + grp_poly = mesh2d[id_grp_poly] + + # We use the interpolation to remove the element that are not really in + # the group (the ones that are next to a nodes nut not in the group + # will have the sum of their column in the enterpolation matrix equal + # to zero) + rem = mc.MEDCouplingRemapper() + + rem.prepare(grp_poly, grp_tria, "P0P0") + m = rem.getCrudeCSRMatrix() + _, id_to_keep = np.where(m.sum(dtype=np.int64, axis=0) >= 1e-07) + + id_grp_poly = id_grp_poly[id_to_keep.tolist()] + id_grp_poly.setName(grp_name) + + myfile.addGroup(-1, id_grp_poly) # Getting list of new points added on the skin skin = tetras.buildUnstructured().computeSkin() @@ -50,6 +91,7 @@ def smesh_create_dual_mesh(mesh_ior, output_file, adapt_to_shape=True, mesh_name ptsAddedMesh = mc.MEDCouplingUMesh.Build0DMeshFromCoords( skin_polyh.getCoords()[ptsAdded] ) if adapt_to_shape: + logger.debug("Adapting to shape") ptsAddedCoo = ptsAddedMesh.getCoords() ptsAddedCooModified = ptsAddedCoo[:] @@ -58,7 +100,6 @@ def smesh_create_dual_mesh(mesh_ior, output_file, adapt_to_shape=True, mesh_name id2face = {} for face in faces: id2face[face.GetSubShapeIndices()[0]] = face - print(id2face) ## Projecting each points added by the dual mesh on the surface it is # associated with @@ -74,4 +115,7 @@ def smesh_create_dual_mesh(mesh_ior, output_file, adapt_to_shape=True, mesh_name polyh.getCoords()[ptsAdded] = ptsAddedCooModified polyh.setName(mesh_name) - polyh.write(output_file) + myfile.setMeshAtLevel(0, polyh) + + logger.debug("Writting dual mesh in :"+output_file) + myfile.write(output_file, 2) diff --git a/test/SMESH_create_dual_mesh_adapt.py b/test/SMESH_create_dual_mesh_adapt.py index c95e6a62e..9f79618da 100644 --- a/test/SMESH_create_dual_mesh_adapt.py +++ b/test/SMESH_create_dual_mesh_adapt.py @@ -80,6 +80,8 @@ isDone = Mesh_1.Compute() dual_Mesh_1 = smesh.CreateDualMesh(Mesh_1, 'dual_Mesh_1', True) dual_Mesh_raw_1 = smesh.CreateDualMesh(Mesh_1, 'dual_Mesh_1', False) +[ top_2, middle_2, bottom_2 ] = dual_Mesh_1.GetGroups() + #Comparing volumes dual_volume = dual_Mesh_1.GetVolume() dual_raw_volume = dual_Mesh_raw_1.GetVolume() diff --git a/test/tests.set b/test/tests.set index 977f4a667..fddb00249 100644 --- a/test/tests.set +++ b/test/tests.set @@ -62,7 +62,6 @@ SET(BAD_TESTS SMESH_test1.py SMESH_test2.py SMESH_test4.py - SMESH_create_dual_mesh.py SMESH_create_dual_mesh_adapt.py ) IF(NOT WIN32) -- 2.30.2