X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=products%2Fpatches%2Fsmesh_spns-19079_topo2volmesh.patch;h=513a1883dba9ddd04111dd4df618c29614abc552;hb=4ba4aa15535111058a36cebddd3614094a9c187d;hp=9e355346c65de1003587e14c573d7c2f222e646c;hpb=0df090158caad9222b860e3bf769fedf71ce1606;p=tools%2Fsat_salome.git diff --git a/products/patches/smesh_spns-19079_topo2volmesh.patch b/products/patches/smesh_spns-19079_topo2volmesh.patch index 9e35534..513a188 100644 --- a/products/patches/smesh_spns-19079_topo2volmesh.patch +++ b/products/patches/smesh_spns-19079_topo2volmesh.patch @@ -1,8 +1,7 @@ -diff --git a/src/Tools/CMakeLists.txt b/src/Tools/CMakeLists.txt -index 2c8c207..e91875d 100644 ---- a/src/Tools/CMakeLists.txt -+++ b/src/Tools/CMakeLists.txt -@@ -26,6 +26,7 @@ ADD_SUBDIRECTORY(MacMesh) +diff -Naur SMESH_ref/src/Tools/CMakeLists.txt SMESH_new/src/Tools/CMakeLists.txt +--- SMESH_ref/src/Tools/CMakeLists.txt 2022-01-14 16:13:39.350133329 +0100 ++++ SMESH_new/src/Tools/CMakeLists.txt 2022-01-14 16:35:41.543110352 +0100 +@@ -26,6 +26,7 @@ IF(SALOME_BUILD_GUI) ADD_SUBDIRECTORY(MGCleanerPlug) ADD_SUBDIRECTORY(YamsPlug) @@ -10,11 +9,27 @@ index 2c8c207..e91875d 100644 # ADD_SUBDIRECTORY(ZCracksPlug) ENDIF(SALOME_BUILD_GUI) -diff --git a/src/Tools/Topo2VolMeshPlug/CMakeLists.txt b/src/Tools/Topo2VolMeshPlug/CMakeLists.txt -new file mode 100755 -index 0000000..c9ab7ca ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/CMakeLists.txt +diff -Naur SMESH_ref/src/Tools/smesh_plugins.py SMESH_new/src/Tools/smesh_plugins.py +--- SMESH_ref/src/Tools/smesh_plugins.py 2022-01-14 16:13:39.506135336 +0100 ++++ SMESH_new/src/Tools/smesh_plugins.py 2022-01-14 16:35:41.543110352 +0100 +@@ -91,3 +91,14 @@ + #print 'probleme zcracks' + salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable: {}'.format(e)) + pass ++ ++# Topological to volumic mesh plugin ++try: ++ from Topo2VolMeshPlugin import Topo2VolMeshLct ++ salome_pluginsmanager.AddFunction('Run Topological Volumic mesher', ++ 'run topological volumic meshing', ++ Topo2VolMeshLct) ++except Exception as e: ++ #print 'probleme zcracks' ++ salome_pluginsmanager.logger.info('ERROR: topo2volmesh plug-in is unavailable: {}'.format(e)) ++ pass +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/CMakeLists.txt SMESH_new/src/Tools/Topo2VolMeshPlug/CMakeLists.txt +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/CMakeLists.txt 2022-01-14 16:35:41.543110352 +0100 @@ -0,0 +1,56 @@ +# Copyright (C) 2013-2021 EDF R&D +# @@ -44,8 +59,8 @@ index 0000000..c9ab7ca +# scripts / static +SET(_plugin_SCRIPTS + Topo2VolMeshPluginDialog.py -+ Topo2VolMeshPlugin.py -+ Topo2VolMeshPlugin_plugin.py ++ Topo2VolMeshPlugin.py ++ Topo2VolMeshPlugin_plugin.py + Topo2VolMeshMonitor.py + README +) @@ -72,11 +87,9 @@ index 0000000..c9ab7ca + # Install the CMake configuration files: + INSTALL(FILES "${PROJECT_SOURCE_DIR}/README" DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}") +ENDIF(SALOME_BUILD_GUI) -diff --git a/src/Tools/Topo2VolMeshPlug/README b/src/Tools/Topo2VolMeshPlug/README -new file mode 100755 -index 0000000..073fdf3 ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/README +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/README SMESH_new/src/Tools/Topo2VolMeshPlug/README +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/README 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/README 2022-01-14 16:35:41.543110352 +0100 @@ -0,0 +1,109 @@ +****************************** +About SALOME HexaBlock plug-in @@ -125,7 +138,7 @@ index 0000000..073fdf3 + + + -+Note: SALOME HexaBlock plug-in needs SALOME KERNEL, SALOME GUI, SALOME Geometry, ++Note: SALOME HexaBlock plug-in needs SALOME KERNEL, SALOME GUI, SALOME Geometry, +SALOME Mesh and SALOME HexaBlock as pre-requisites. + +------------------ @@ -133,7 +146,7 @@ index 0000000..073fdf3 +------------------ + +The build procedure of the SALOME platform is implemented with CMake. -+In order to build the plug-in you have to do the following actions: ++In order to build the plug-in you have to do the following actions: + +1. Set up environment for pre-requisites (see "Pre-requisites" section above). + @@ -149,7 +162,7 @@ index 0000000..073fdf3 + where + - is either Release or Debug (default: Release); + - is a destination folder to install SALOME HexaBlock -+ plug-in (default: /usr); ++ plug-in (default: /usr); + - is a path to the SALOME HexaBlock plug-in sources directory. + + Note: by default (if CMAKE_INSTALL_PREFIX option is not given), SALOME HexaBlock @@ -187,11 +200,9 @@ index 0000000..073fdf3 +=============== + +Please, send a mail to webmaster.salome@opencascade.com. -diff --git a/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py -new file mode 100755 -index 0000000..455738b ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py 2022-01-14 16:35:41.543110352 +0100 @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2013-2020 EDF R&D @@ -246,7 +257,7 @@ index 0000000..455738b + self.myExecutable.finished.connect( self.computationFinished ) + self.myExecutable.errorOccurred.connect( self.computationOnError ) + if os.path.exists(self.parent().outputMesh): -+ os.remove(self.parent().outputMesh) ++ os.remove(self.parent().outputMesh) + self.myExecutable.start(txt) + self.myExecutable.closeWriteChannel() + self.show() @@ -290,11 +301,9 @@ index 0000000..455738b + self.qpbOK.setEnabled(True) + QMessageBox.critical(self, 'Computation failed', + 'The computation has failed.
Please, check the log message.') -diff --git a/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui -new file mode 100755 -index 0000000..ea6d196 ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui 2022-01-14 16:35:41.543110352 +0100 @@ -0,0 +1,38 @@ + + @@ -334,54 +343,10 @@ index 0000000..ea6d196 + + + -diff --git a/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py -new file mode 100755 -index 0000000..136cd63 ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py -@@ -0,0 +1,36 @@ -+# -*- coding: utf-8 -*- -+# Copyright (C) 2013-2020 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 -+# -+ -+# if you already have plugins defined in a salome_plugins.py file, add this file at the end. -+# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py -+ -+def Topo2VolMeshLct(context): -+ # get context study, salomeGui -+ study = context.study -+ sg = context.sg -+ -+ import os -+ import subprocess -+ import tempfile -+ from qtsalome import QFileDialog, QMessageBox -+ -+ import Topo2VolMeshPluginDialog -+ window = Topo2VolMeshPluginDialog.getInstance() -+ window.show() -diff --git a/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py -new file mode 100755 -index 0000000..ac4a32c ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py -@@ -0,0 +1,129 @@ +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py 2022-01-14 16:36:18.691585755 +0100 +@@ -0,0 +1,162 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2013-2020 EDF R&D +# @@ -405,6 +370,9 @@ index 0000000..ac4a32c + +import os, subprocess +import random ++import getpass ++import time ++import pathlib + +# set seed +from datetime import datetime @@ -425,10 +393,22 @@ index 0000000..ac4a32c + QWidget.__init__(self) + self.setupUi(self) + self.qpbHelp.clicked.connect(self.OnQpbHelpClicked) -+ self.qpbCompute.clicked.connect(self.OnQpbComputeClicked) ++ self.qpbCompute.clicked.connect(self.OnQpbComputeClicked) + self.qpbMeshFile.clicked.connect(self.OnQpbMeshFileClicked) + self.qpbMeshFile.setToolTip("hypothesis from Salome Object Browser") + self.qpbClose.clicked.connect(self.OnQpbCloseClicked) ++ self.qcbDistributed.stateChanged[int].connect(self.OnqcbDistributedClicked) ++ self.qlbXParts.setVisible(False) ++ self.qlbYParts.setVisible(False) ++ self.qlbZParts.setVisible(False) ++ self.qsbXParts.setVisible(False) ++ self.qsbYParts.setVisible(False) ++ self.qsbZParts.setVisible(False) ++ self.SALOME_TMP_DIR = None ++ try: ++ self.qleTmpDir.setText(os.path.join('/tmp',getpass.getuser(),'top-ii-vol')) ++ except: ++ self.qleTmpDir.setText('/tmp') + self.resize(800, 500) + self.outputMesh = '' + @@ -450,7 +430,7 @@ index 0000000..ac4a32c + infile = fd.selectedFiles()[0] + self.qleMeshFile.setText(infile) + -+ def OnQpbComputeClicked(self): ++ def OnQpbComputeClicked(self): + if self.qleMeshFile.text() == '': + QMessageBox.critical(self, "Mesh", "select an input mesh") + return @@ -460,41 +440,60 @@ index 0000000..ac4a32c + yPoints = self.qsbYPoints.value() + zPoints = self.qsbZPoints.value() + depth = self.qsbDepth.value() -+ -+ shellCmd = "Top2Vol-Mesher.exe" -+ shellCmd+= " --xpoints " + str(xPoints) -+ shellCmd+= " --ypoints " + str(yPoints) -+ shellCmd+= " --zpoints " + str(zPoints) -+ shellCmd+= " --zdepth " + str(depth) -+ shellCmd+= " --in " + inputMesh -+ ++ nProcs = self.qsbNBprocs.value() ++ if not self.qcbDistributed.isChecked(): ++ if nProcs == 1: ++ shellCmd = "topIIvol_Mesher" ++ else: ++ shellCmd = "mpirun -np {} topIIvol_ParMesher".format(nProcs) ++ shellCmd+= " --xpoints " + str(xPoints) ++ shellCmd+= " --ypoints " + str(yPoints) ++ shellCmd+= " --zpoints " + str(zPoints) ++ shellCmd+= " --depth " + str(depth) ++ shellCmd+= " --in " + inputMesh ++ else: ++ xParts = self.qsbXParts.value() ++ yParts = self.qsbYParts.value() ++ zParts = self.qsbZParts.value() ++ shellCmd = "mpirun -np {} topIIvol_DistMesher".format(nProcs) ++ shellCmd+= " --xpoints " + str(xPoints) ++ shellCmd+= " --ypoints " + str(yPoints) ++ shellCmd+= " --zpoints " + str(zPoints) ++ shellCmd+= " --depth " + str(depth) ++ shellCmd+= " --partition_x " + str(xParts) ++ shellCmd+= " --partition_y " + str(xParts) ++ shellCmd+= " --partition_z " + str(xParts) ++ shellCmd+= " --in " + inputMesh + if platform.system()=="Windows" : -+ SALOME_TMP_DIR = os.getenv("SALOME_TMP_DIR") ++ self.SALOME_TMP_DIR = os.getenv("SALOME_TMP_DIR") + else: -+ SALOME_TMP_DIR = '/tmp' -+ n=random.random() -+ self.outputMesh= os.path.join(SALOME_TMP_DIR,'top2Vol_' + str(n) + '.mesh') ++ self.SALOME_TMP_DIR = os.path.join(self.qleTmpDir.text(), time.strftime("%Y-%m-%d-%H-%M-%S")) ++ pathlib.Path(self.SALOME_TMP_DIR).mkdir(parents=True, exist_ok=True) ++ self.outputMesh= os.path.join(self.SALOME_TMP_DIR, inputMesh.split('/').pop().replace('.xyz','.mesh')) + shellCmd+= " --out " + self.outputMesh ++ print("INFO: ", shellCmd) + myMonitorView=Topo2VolMeshMonitor(self, shellCmd) + ++ def OnqcbDistributedClicked(self): ++ state = self.qcbDistributed.isChecked() ++ self.qlbXParts.setVisible(state) ++ self.qlbYParts.setVisible(state) ++ self.qlbZParts.setVisible(state) ++ self.qsbXParts.setVisible(state) ++ self.qsbYParts.setVisible(state) ++ self.qsbZParts.setVisible(state) ++ + def OnQpbCloseClicked(self): + self.close() + + def saveOutputMesh(self): -+ if not os.path.isfile(self.outputMesh): -+ QMessageBox.warning(self, "Compute", "Result file " + self.outputMesh + " not found") -+ return False -+ + import salome + import SMESH, SALOMEDS + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New() -+ meshName=str(self.qleMeshFile.text()) -+ meshName=os.path.basename(os.path.splitext(meshName)[0])#.replace('-','_').replace(' ','') -+ meshName= 'Top2Vol_' + meshName -+ -+ (outputMesh, status) = smesh.CreateMeshesFromGMF(self.outputMesh) -+ smesh.SetName(outputMesh.GetMesh(), meshName) ++ self.outputMesh.split('/') ++ for mesh in pathlib.Path(self.SALOME_TMP_DIR).glob('*.mesh'): ++ (outputMesh, status) = smesh.CreateMeshesFromGMF(os.path.join(self.SALOME_TMP_DIR, mesh)) + if salome.sg.hasDesktop(): + salome.sg.updateObjBrowser() + return True @@ -510,13 +509,10 @@ index 0000000..ac4a32c + if __instance is None: + __instance = Topo2VolMeshPluginDialog() + return __instance -+ -diff --git a/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui -new file mode 100755 -index 0000000..9a9ea35 ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui -@@ -0,0 +1,268 @@ +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui 2022-01-14 16:35:41.543110352 +0100 +@@ -0,0 +1,448 @@ + + + Topo2VolMeshMainFrame @@ -525,12 +521,12 @@ index 0000000..9a9ea35 + + 0 + 0 -+ 779 -+ 389 ++ 780 ++ 411 + + + -+ Tetra Mesh from cloud of x y points mesh generator ++ Tetra Mesh from cloud of xyz points mesh generator + + + @@ -538,7 +534,7 @@ index 0000000..9a9ea35 + 10 + 10 + 761 -+ 120 ++ 101 + + + @@ -554,7 +550,7 @@ index 0000000..9a9ea35 + + 10 + 50 -+ 190 ++ 151 + 31 + + @@ -564,7 +560,7 @@ index 0000000..9a9ea35 + + + -+ Mesh File XY format ++ DEM input file + + + @@ -576,9 +572,9 @@ index 0000000..9a9ea35 + + + -+ 220 ++ 170 + 50 -+ 481 ++ 531 + 31 + + @@ -593,9 +589,9 @@ index 0000000..9a9ea35 + + + 10 -+ 150 ++ 120 + 761 -+ 201 ++ 231 + + + @@ -604,7 +600,7 @@ index 0000000..9a9ea35 + + + -+ 40 ++ 10 + 30 + 62 + 22 @@ -623,9 +619,9 @@ index 0000000..9a9ea35 + + + -+ 120 ++ 80 + 30 -+ 551 ++ 201 + 20 + + @@ -636,7 +632,7 @@ index 0000000..9a9ea35 + + + -+ 40 ++ 10 + 70 + 62 + 22 @@ -655,7 +651,7 @@ index 0000000..9a9ea35 + + + -+ 40 ++ 10 + 110 + 62 + 22 @@ -674,9 +670,9 @@ index 0000000..9a9ea35 + + + -+ 120 ++ 80 + 70 -+ 551 ++ 211 + 20 + + @@ -687,9 +683,9 @@ index 0000000..9a9ea35 + + + -+ 120 ++ 80 + 110 -+ 551 ++ 211 + 20 + + @@ -700,7 +696,7 @@ index 0000000..9a9ea35 + + + -+ 40 ++ 10 + 150 + 62 + 22 @@ -719,9 +715,9 @@ index 0000000..9a9ea35 + + + -+ 120 ++ 80 + 150 -+ 551 ++ 201 + 20 + + @@ -729,14 +725,194 @@ index 0000000..9a9ea35 + Depth in Z direction + + ++ ++ ++ ++ 630 ++ 30 ++ 91 ++ 21 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 370 ++ 30 ++ 151 ++ 16 ++ ++ ++ ++ Number of processors ++ ++ ++ ++ ++ ++ 660 ++ 30 ++ 101 ++ 16 ++ ++ ++ ++ Distributed ++ ++ ++ ++ ++ ++ 370 ++ 70 ++ 261 ++ 16 ++ ++ ++ ++ Number of partitions in X direction ++ ++ ++ ++ ++ ++ 370 ++ 110 ++ 251 ++ 16 ++ ++ ++ ++ Number of partitions in Y direction ++ ++ ++ ++ ++ ++ 370 ++ 150 ++ 251 ++ 16 ++ ++ ++ ++ Number of partitions in Z direction ++ ++ ++ ++ ++ ++ 300 ++ 30 ++ 62 ++ 22 ++ ++ ++ ++ 0 ++ ++ ++ 999999999 ++ ++ ++ 1 ++ ++ ++ ++ ++ ++ 300 ++ 70 ++ 62 ++ 22 ++ ++ ++ ++ 0 ++ ++ ++ 999999999 ++ ++ ++ 1 ++ ++ ++ ++ ++ ++ 300 ++ 110 ++ 62 ++ 22 ++ ++ ++ ++ 0 ++ ++ ++ 999999999 ++ ++ ++ 1 ++ ++ ++ ++ ++ ++ 300 ++ 150 ++ 62 ++ 22 ++ ++ ++ ++ 0 ++ ++ ++ 999999999 ++ ++ ++ 1 ++ ++ ++ ++ ++ ++ 10 ++ 200 ++ 611 ++ 23 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 10 ++ 180 ++ 391 ++ 16 ++ ++ ++ ++ Workspace ++ ++ + + + + + 10 -+ 360 ++ 370 + 761 -+ 26 ++ 27 + + + @@ -785,12 +961,10 @@ index 0000000..9a9ea35 + + + -diff --git a/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py -new file mode 100755 -index 0000000..a17b00c ---- /dev/null -+++ b/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py -@@ -0,0 +1,37 @@ +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py 2022-01-14 16:36:28.963717213 +0100 +@@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2013-2020 EDF R&D +# @@ -818,32 +992,52 @@ index 0000000..a17b00c + # get context study, salomeGui + study = context.study + sg = context.sg -+ ++ + import os + import subprocess + import tempfile + from qtsalome import QFileDialog, QMessageBox -+ ++ + import Topo2VolMeshPluginDialog + window = Topo2VolMeshPluginDialog.getDialog() + window.show() +diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py +--- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py 1970-01-01 01:00:00.000000000 +0100 ++++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py 2022-01-14 16:35:41.543110352 +0100 +@@ -0,0 +1,36 @@ ++# -*- coding: utf-8 -*- ++# Copyright (C) 2013-2020 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 ++# + -diff --git a/src/Tools/smesh_plugins.py b/src/Tools/smesh_plugins.py -index 7c72682..134965c 100644 ---- a/src/Tools/smesh_plugins.py -+++ b/src/Tools/smesh_plugins.py -@@ -91,3 +91,14 @@ except Exception as e: - #print 'probleme zcracks' - salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable: {}'.format(e)) - pass ++# if you already have plugins defined in a salome_plugins.py file, add this file at the end. ++# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py + -+# Topological to volumic mesh plugin -+try: -+ from Topo2VolMeshPlugin import Topo2VolMeshLct -+ salome_pluginsmanager.AddFunction('Run Topological Volumic mesher', -+ 'run topological volumic meshing', -+ Topo2VolMeshLct) -+except Exception as e: -+ #print 'probleme zcracks' -+ salome_pluginsmanager.logger.info('ERROR: topo2volmesh plug-in is unavailable: {}'.format(e)) -+ pass ++def Topo2VolMeshLct(context): ++ # get context study, salomeGui ++ study = context.study ++ sg = context.sg ++ ++ import os ++ import subprocess ++ import tempfile ++ from qtsalome import QFileDialog, QMessageBox ++ ++ import Topo2VolMeshPluginDialog ++ window = Topo2VolMeshPluginDialog.getInstance() ++ window.show()