Salome HOME
topo2vol: use CEA repository
[tools/sat_salome.git] / products / patches / smesh_spns-19079_topo2volmesh.patch
1 diff -Naur SMESH_ref/src/Tools/CMakeLists.txt SMESH_new/src/Tools/CMakeLists.txt
2 --- SMESH_ref/src/Tools/CMakeLists.txt  2022-01-14 16:13:39.350133329 +0100
3 +++ SMESH_new/src/Tools/CMakeLists.txt  2022-01-14 16:35:41.543110352 +0100
4 @@ -26,6 +26,7 @@
5  IF(SALOME_BUILD_GUI)
6    ADD_SUBDIRECTORY(MGCleanerPlug)
7    ADD_SUBDIRECTORY(YamsPlug)
8 +  ADD_SUBDIRECTORY(Topo2VolMeshPlug)
9  #  ADD_SUBDIRECTORY(ZCracksPlug)
10  ENDIF(SALOME_BUILD_GUI)
11  
12 diff -Naur SMESH_ref/src/Tools/smesh_plugins.py SMESH_new/src/Tools/smesh_plugins.py
13 --- SMESH_ref/src/Tools/smesh_plugins.py        2022-01-14 16:13:39.506135336 +0100
14 +++ SMESH_new/src/Tools/smesh_plugins.py        2022-01-14 16:35:41.543110352 +0100
15 @@ -91,3 +91,14 @@
16    #print 'probleme zcracks'
17    salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable: {}'.format(e))
18    pass
19 +
20 +# Topological to volumic mesh plugin
21 +try:
22 +  from Topo2VolMeshPlugin import Topo2VolMeshLct
23 +  salome_pluginsmanager.AddFunction('Run Topological Volumic mesher',
24 +                                    'run topological volumic meshing',
25 +                                    Topo2VolMeshLct)
26 +except Exception as e:
27 +  #print 'probleme zcracks'
28 +  salome_pluginsmanager.logger.info('ERROR: topo2volmesh plug-in is unavailable: {}'.format(e))
29 +  pass
30 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/CMakeLists.txt SMESH_new/src/Tools/Topo2VolMeshPlug/CMakeLists.txt
31 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
32 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/CMakeLists.txt 2022-01-14 16:35:41.543110352 +0100
33 @@ -0,0 +1,56 @@
34 +# Copyright (C) 2013-2021  EDF R&D
35 +#
36 +# This library is free software; you can redistribute it and/or
37 +# modify it under the terms of the GNU Lesser General Public
38 +# License as published by the Free Software Foundation; either
39 +# version 2.1 of the License, or (at your option) any later version.
40 +#
41 +# This library is distributed in the hope that it will be useful,
42 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
43 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
44 +# Lesser General Public License for more details.
45 +#
46 +# You should have received a copy of the GNU Lesser General Public
47 +# License along with this library; if not, write to the Free Software
48 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
49 +#
50 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
51 +#
52 +
53 +IF(SALOME_BUILD_GUI)
54 +  INCLUDE(UsePyQt)
55 +ENDIF(SALOME_BUILD_GUI)
56 +
57 +# --- scripts ---
58 +
59 +# scripts / static
60 +SET(_plugin_SCRIPTS
61 +  Topo2VolMeshPluginDialog.py
62 +  Topo2VolMeshPlugin.py
63 +  Topo2VolMeshPlugin_plugin.py
64 +  Topo2VolMeshMonitor.py
65 +  README
66 +)
67 +
68 +IF(SALOME_BUILD_GUI)
69 +  # uic files / to be processed by pyuic
70 +  SET(_pyuic_FILES
71 +    Topo2VolMeshPluginDialog.ui
72 +    Topo2VolMeshMonitor.ui
73 +  )
74 +  # scripts / pyuic wrappings
75 +  PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_FILES} TARGET_NAME _target_name_pyuic)
76 +ENDIF(SALOME_BUILD_GUI)
77 +
78 +# --- rules ---
79 +
80 +SALOME_INSTALL_SCRIPTS("${_plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS})
81 +MESSAGE(VERBOSE "iNSTALLATION FOLDER ${SALOME_SMESH_INSTALL_PLUGINS}")
82 +IF(SALOME_BUILD_GUI)
83 +  SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS} TARGET_NAME _target_name_pyuic_py)
84 +  # add dependency of compiled py files on uic files in order
85 +  # to avoid races problems when compiling in parallel
86 +  ADD_DEPENDENCIES(${_target_name_pyuic_py} ${_target_name_pyuic})
87 +  # Install the CMake configuration files:
88 +  INSTALL(FILES "${PROJECT_SOURCE_DIR}/README" DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
89 +ENDIF(SALOME_BUILD_GUI)
90 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/README SMESH_new/src/Tools/Topo2VolMeshPlug/README
91 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/README 1970-01-01 01:00:00.000000000 +0100
92 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/README 2022-01-14 16:35:41.543110352 +0100
93 @@ -0,0 +1,109 @@
94 +******************************
95 +About SALOME HexaBlock plug-in
96 +******************************
97 +
98 +SALOME HexaBlock plug-in implements meshing of the CAD models created with
99 +the SALOME HexaBlock module.
100 +
101 +SALOME HexaBlock plug-in is integrated into SALOME platform via the SALOME Mesh
102 +module.
103 +
104 +For more information please visit the SALOME platform web site:
105 +
106 +  <http://www.salome-platform.org/>
107 +
108 +=======
109 +License
110 +=======
111 +
112 +SALOME platform is distributed under the GNU Lesser General Public License.
113 +See COPYING file for more details.
114 +
115 +Also, additional information can be found at SALOME platform web site:
116 +
117 +  <http://www.salome-platform.org/downloads/license/>
118 +
119 +============
120 +Installation
121 +============
122 +
123 +--------------
124 +Pre-requisites
125 +--------------
126 +
127 +SALOME platform relies on a set of third-party softwares; some of them are needed
128 +at build time only, while other ones are needed in runtime also.
129 +
130 +For more information about the pre-requisites please visit SALOME platform web
131 +site:
132 +
133 +* Check Release Notes and Software Requirements of the latest SALOME release at
134 +
135 +  <http://www.salome-platform.org/downloads/current-version/>
136 +
137 +* Pre-requisites page at SALOME web site:
138 +
139 +  <http://www.salome-platform.org/downloads/license/>
140 +
141 +Note: SALOME HexaBlock plug-in needs SALOME KERNEL, SALOME GUI, SALOME Geometry,
142 +SALOME Mesh and SALOME HexaBlock as pre-requisites.
143 +
144 +------------------
145 +Basic Installation
146 +------------------
147 +
148 +The build procedure of the SALOME platform is implemented with CMake.
149 +In order to build the plug-in you have to do the following actions:
150 +
151 +1. Set up environment for pre-requisites (see "Pre-requisites" section above).
152 +
153 +2. Create a build directory:
154 +
155 +   % mkdir HEXABLOCKPLUGIN_BUILD
156 +
157 +3. Configure the build procedure:
158 +
159 +   % cd HEXABLOCKPLUGIN_BUILD
160 +   % cmake -DCMAKE_BUILD_TYPE=<mode> -DCMAKE_INSTALL_PREFIX=<installation_directory> <path_to_src_dir>
161 +
162 +   where
163 +   - <mode> is either Release or Debug (default: Release);
164 +   - <installation_directory> is a destination folder to install SALOME HexaBlock
165 +     plug-in (default: /usr);
166 +   - <path_to_src_dir> is a path to the SALOME HexaBlock plug-in sources directory.
167 +
168 +   Note: by default (if CMAKE_INSTALL_PREFIX option is not given), SALOME HexaBlock
169 +   plug-in will be configured for installation to the /usr directory that requires
170 +   root permissions to complete the installation.
171 +
172 +4. Build and install:
173 +
174 +   % make
175 +   % make install
176 +
177 +   This will install SALOME HexaBlock plug-in to the <installation_directory>
178 +   specified to cmake command on the previous step.
179 +
180 +-------------------
181 +Custom installation
182 +-------------------
183 +
184 +SALOME HexaBlock plug-in supports a set of advanced configuration options;
185 +for more details learn CMakeLists.txt file in the root source directory.
186 +
187 +You can also use other options of cmake command to customize your installation.
188 +Learn more about available options by typing
189 +
190 +   % cmake --help
191 +
192 +=============
193 +Documentation
194 +=============
195 +
196 +The directory doc contains additional documentation file of SALOME HexaBlock plug-in.
197 +
198 +===============
199 +Troubleshooting
200 +===============
201 +
202 +Please, send a mail to webmaster.salome@opencascade.com.
203 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py
204 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py 1970-01-01 01:00:00.000000000 +0100
205 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.py 2022-01-14 16:35:41.543110352 +0100
206 @@ -0,0 +1,97 @@
207 +# -*- coding: utf-8 -*-
208 +# Copyright (C) 2013-2020  EDF R&D
209 +#
210 +# This library is free software; you can redistribute it and/or
211 +# modify it under the terms of the GNU Lesser General Public
212 +# License as published by the Free Software Foundation; either
213 +# version 2.1 of the License, or (at your option) any later version.
214 +#
215 +# This library is distributed in the hope that it will be useful,
216 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
217 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
218 +# Lesser General Public License for more details.
219 +#
220 +# You should have received a copy of the GNU Lesser General Public
221 +# License along with this library; if not, write to the Free Software
222 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
223 +#
224 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
225 +#
226 +
227 +import os
228 +import sys
229 +import string
230 +import types
231 +import tempfile
232 +import traceback
233 +import pprint as PP #pretty print
234 +
235 +from qtsalome import *
236 +
237 +# Import des panels
238 +
239 +from Topo2VolMeshMonitor_ui import Ui_qdLogger
240 +
241 +verbose = True
242 +
243 +class Topo2VolMeshMonitor(Ui_qdLogger, QDialog):
244 +  def __init__(self, parent, txt):
245 +    QDialog.__init__(self,parent)
246 +    self.setupUi(self)
247 +    self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) )
248 +    self.qpbOK.clicked.connect( self.OnQpbOKClicked )
249 +    # Button OK is disabled until computation is finished
250 +    self.qpbOK.setEnabled(False)
251 +    self.qpbSave.clicked.connect( self.OnQpbSaveClicked )
252 +    self.qpbSave.setToolTip("Save trace in log file")
253 +    self.qpbOK.setToolTip("Close view")
254 +    self.myExecutable=QProcess(self)
255 +    self.myExecutable.readyReadStandardOutput.connect( self.readFromStdOut )
256 +    self.myExecutable.readyReadStandardError.connect( self.readFromStdErr )
257 +    self.myExecutable.finished.connect( self.computationFinished )
258 +    self.myExecutable.errorOccurred.connect( self.computationOnError )
259 +    if os.path.exists(self.parent().outputMesh):
260 +       os.remove(self.parent().outputMesh)
261 +    self.myExecutable.start(txt)
262 +    self.myExecutable.closeWriteChannel()
263 +    self.show()
264 +
265 +  def OnQpbOKClicked(self):
266 +    self.close()
267 +
268 +  def OnQpbSaveClicked(self):
269 +    outputDirectory=os.path.expanduser("~")
270 +    fn, mask = QFileDialog.getSaveFileName(None,"Save File",outputDirectory)
271 +    if not fn:
272 +      return
273 +    ulfile = os.path.abspath(str(fn))
274 +    try:
275 +      f = open(fn, 'wb')
276 +      f.write(self.qtbLogWindow.toPlainText().encode("utf-8"))
277 +      f.close()
278 +    except IOError as why:
279 +      QMessageBox.critical(self, 'Save File',
280 +                                 'The file <b>%s</b> could not be saved.<br>Reason: %s'%(str(fn), str(why)))
281 +
282 +  def readFromStdErr(self):
283 +    a=self.myExecutable.readAllStandardError()
284 +    aa=a.data().decode(errors='ignore')
285 +    self.qtbLogWindow.append(aa)
286 +
287 +  def readFromStdOut(self) :
288 +    a=self.myExecutable.readAllStandardOutput()
289 +    aa=a.data().decode(errors='ignore')
290 +    self.qtbLogWindow.append(aa)
291 +
292 +  def computationFinished(self):
293 +    self.qpbOK.setEnabled(True)
294 +    if self.myExecutable.exitCode() == 0:
295 +      self.parent().saveOutputMesh()
296 +    else:
297 +      QMessageBox.critical(self, 'Computation failed',
298 +                                 'The computation has failed.<br>Please, check the log message.')
299 +
300 +  def computationOnError(self):
301 +    self.qpbOK.setEnabled(True)
302 +    QMessageBox.critical(self, 'Computation failed',
303 +                               'The computation has failed.<br>Please, check the log message.')
304 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui
305 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui 1970-01-01 01:00:00.000000000 +0100
306 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshMonitor.ui 2022-01-14 16:35:41.543110352 +0100
307 @@ -0,0 +1,38 @@
308 +<?xml version="1.0" encoding="UTF-8"?>
309 +<ui version="4.0">
310 + <class>qdLogger</class>
311 + <widget class="QDialog" name="qdLogger">
312 +  <property name="geometry">
313 +   <rect>
314 +    <x>0</x>
315 +    <y>0</y>
316 +    <width>469</width>
317 +    <height>489</height>
318 +   </rect>
319 +  </property>
320 +  <property name="windowTitle">
321 +   <string>Run Topo2VolMesh</string>
322 +  </property>
323 +  <layout class="QGridLayout" name="gridLayout">
324 +   <item row="1" column="1">
325 +    <widget class="QPushButton" name="qpbSave">
326 +     <property name="text">
327 +      <string>Save log</string>
328 +     </property>
329 +    </widget>
330 +   </item>
331 +   <item row="0" column="0" colspan="2">
332 +    <widget class="QTextBrowser" name="qtbLogWindow"/>
333 +   </item>
334 +   <item row="1" column="0">
335 +    <widget class="QPushButton" name="qpbOK">
336 +     <property name="text">
337 +      <string>Ok</string>
338 +     </property>
339 +    </widget>
340 +   </item>
341 +  </layout>
342 + </widget>
343 + <resources/>
344 + <connections/>
345 +</ui>
346 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py
347 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py    1970-01-01 01:00:00.000000000 +0100
348 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.py    2022-01-14 16:36:18.691585755 +0100
349 @@ -0,0 +1,162 @@
350 +# -*- coding: utf-8 -*-
351 +# Copyright (C) 2013-2020  EDF R&D
352 +#
353 +# This library is free software; you can redistribute it and/or
354 +# modify it under the terms of the GNU Lesser General Public
355 +# License as published by the Free Software Foundation; either
356 +# version 2.1 of the License, or (at your option) any later version.
357 +#
358 +# This library is distributed in the hope that it will be useful,
359 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
360 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
361 +# Lesser General Public License for more details.
362 +#
363 +# You should have received a copy of the GNU Lesser General Public
364 +# License along with this library; if not, write to the Free Software
365 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
366 +#
367 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
368 +#
369 +
370 +
371 +import os, subprocess
372 +import random
373 +import getpass
374 +import time
375 +import pathlib
376 +
377 +# set seed
378 +from datetime import datetime
379 +random.seed(datetime.now())
380 +
381 +import platform
382 +import tempfile
383 +from Topo2VolMeshPluginDialog_ui import Ui_Topo2VolMeshMainFrame
384 +from Topo2VolMeshMonitor import Topo2VolMeshMonitor
385 +from qtsalome import *
386 +
387 +verbose = True
388 +
389 +class Topo2VolMeshPluginDialog(Ui_Topo2VolMeshMainFrame,QWidget):
390 +  """
391 +  """
392 +  def __init__(self):
393 +    QWidget.__init__(self)
394 +    self.setupUi(self)
395 +    self.qpbHelp.clicked.connect(self.OnQpbHelpClicked)
396 +    self.qpbCompute.clicked.connect(self.OnQpbComputeClicked)
397 +    self.qpbMeshFile.clicked.connect(self.OnQpbMeshFileClicked)
398 +    self.qpbMeshFile.setToolTip("hypothesis from Salome Object Browser")
399 +    self.qpbClose.clicked.connect(self.OnQpbCloseClicked)
400 +    self.qcbDistributed.stateChanged[int].connect(self.OnqcbDistributedClicked)
401 +    self.qlbXParts.setVisible(False)
402 +    self.qlbYParts.setVisible(False)
403 +    self.qlbZParts.setVisible(False)
404 +    self.qsbXParts.setVisible(False)
405 +    self.qsbYParts.setVisible(False)
406 +    self.qsbZParts.setVisible(False)
407 +    self.SALOME_TMP_DIR = None
408 +    try:
409 +      self.qleTmpDir.setText(os.path.join('/tmp',getpass.getuser(),'top-ii-vol'))
410 +    except:
411 +      self.qleTmpDir.setText('/tmp')
412 +    self.resize(800, 500)
413 +    self.outputMesh = ''
414 +
415 +  def OnQpbHelpClicked(self):
416 +    import SalomePyQt
417 +    sgPyQt = SalomePyQt.SalomePyQt()
418 +    try:
419 +      mydir=os.environ["SMESH_ROOT_DIR"]
420 +    except Exception:
421 +      QMessageBox.warning(self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
422 +      return
423 +
424 +    myDoc=mydir + "/share/doc/salome/gui/SMESH/Topo2VolMeshPlugin/index.html"
425 +    sgPyQt.helpContext(myDoc,"")
426 +
427 +  def OnQpbMeshFileClicked(self):
428 +    fd = QFileDialog(self, "select an existing Mesh file", self.qleMeshFile.text(), "Mesh-Files (*.xyz);;All Files (*)")
429 +    if fd.exec_():
430 +      infile = fd.selectedFiles()[0]
431 +      self.qleMeshFile.setText(infile)
432 +
433 +  def OnQpbComputeClicked(self):
434 +    if self.qleMeshFile.text() == '':
435 +      QMessageBox.critical(self, "Mesh", "select an input mesh")
436 +      return
437 +    inputMesh = self.qleMeshFile.text()
438 +    # retrieve x,y,z and depth parameters
439 +    xPoints = self.qsbXPoints.value()
440 +    yPoints = self.qsbYPoints.value()
441 +    zPoints = self.qsbZPoints.value()
442 +    depth   = self.qsbDepth.value()
443 +    nProcs  = self.qsbNBprocs.value()
444 +    if not self.qcbDistributed.isChecked():
445 +      if nProcs == 1:
446 +        shellCmd = "topIIvol_Mesher"
447 +      else:
448 +        shellCmd = "mpirun -np {} topIIvol_ParMesher".format(nProcs)
449 +      shellCmd+= " --xpoints " + str(xPoints)
450 +      shellCmd+= " --ypoints " + str(yPoints)
451 +      shellCmd+= " --zpoints " + str(zPoints)
452 +      shellCmd+= " --depth   " + str(depth)
453 +      shellCmd+= " --in " + inputMesh
454 +    else:
455 +      xParts = self.qsbXParts.value()
456 +      yParts = self.qsbYParts.value()
457 +      zParts = self.qsbZParts.value()
458 +      shellCmd = "mpirun -np {} topIIvol_DistMesher".format(nProcs)
459 +      shellCmd+= " --xpoints " + str(xPoints)
460 +      shellCmd+= " --ypoints " + str(yPoints)
461 +      shellCmd+= " --zpoints " + str(zPoints)
462 +      shellCmd+= " --depth   " + str(depth)
463 +      shellCmd+= " --partition_x " + str(xParts)
464 +      shellCmd+= " --partition_y " + str(xParts)
465 +      shellCmd+= " --partition_z " + str(xParts)
466 +      shellCmd+= " --in " + inputMesh
467 +    if platform.system()=="Windows" :
468 +      self.SALOME_TMP_DIR = os.getenv("SALOME_TMP_DIR")
469 +    else:
470 +      self.SALOME_TMP_DIR = os.path.join(self.qleTmpDir.text(), time.strftime("%Y-%m-%d-%H-%M-%S"))
471 +      pathlib.Path(self.SALOME_TMP_DIR).mkdir(parents=True, exist_ok=True)
472 +    self.outputMesh= os.path.join(self.SALOME_TMP_DIR, inputMesh.split('/').pop().replace('.xyz','.mesh'))
473 +    shellCmd+= " --out " + self.outputMesh
474 +    print("INFO: ", shellCmd)
475 +    myMonitorView=Topo2VolMeshMonitor(self, shellCmd)
476 +
477 +  def OnqcbDistributedClicked(self):
478 +    state = self.qcbDistributed.isChecked()
479 +    self.qlbXParts.setVisible(state)
480 +    self.qlbYParts.setVisible(state)
481 +    self.qlbZParts.setVisible(state)
482 +    self.qsbXParts.setVisible(state)
483 +    self.qsbYParts.setVisible(state)
484 +    self.qsbZParts.setVisible(state)
485 +
486 +  def OnQpbCloseClicked(self):
487 +    self.close()
488 +
489 +  def saveOutputMesh(self):
490 +    import salome
491 +    import  SMESH, SALOMEDS
492 +    from salome.smesh import smeshBuilder
493 +    smesh = smeshBuilder.New()
494 +    self.outputMesh.split('/')
495 +    for mesh in pathlib.Path(self.SALOME_TMP_DIR).glob('*.mesh'):
496 +      (outputMesh, status) = smesh.CreateMeshesFromGMF(os.path.join(self.SALOME_TMP_DIR, mesh))
497 +    if salome.sg.hasDesktop():
498 +        salome.sg.updateObjBrowser()
499 +    return True
500 +
501 +__instance = None
502 +
503 +def getInstance():
504 +  """
505 +  This function returns a singleton instance of the plugin dialog.
506 +  It is mandatory in order to call show without a parent ...
507 +  """
508 +  global __instance
509 +  if __instance is None:
510 +    __instance = Topo2VolMeshPluginDialog()
511 +  return __instance
512 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui
513 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui    1970-01-01 01:00:00.000000000 +0100
514 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPluginDialog.ui    2022-01-14 16:35:41.543110352 +0100
515 @@ -0,0 +1,448 @@
516 +<?xml version="1.0" encoding="UTF-8"?>
517 +<ui version="4.0">
518 + <class>Topo2VolMeshMainFrame</class>
519 + <widget class="QWidget" name="Topo2VolMeshMainFrame">
520 +  <property name="geometry">
521 +   <rect>
522 +    <x>0</x>
523 +    <y>0</y>
524 +    <width>780</width>
525 +    <height>411</height>
526 +   </rect>
527 +  </property>
528 +  <property name="windowTitle">
529 +   <string>Tetra Mesh from cloud of xyz points mesh generator</string>
530 +  </property>
531 +  <widget class="QGroupBox" name="groupBox">
532 +   <property name="geometry">
533 +    <rect>
534 +     <x>10</x>
535 +     <y>10</y>
536 +     <width>761</width>
537 +     <height>101</height>
538 +    </rect>
539 +   </property>
540 +   <property name="font">
541 +    <font>
542 +     <pointsize>10</pointsize>
543 +    </font>
544 +   </property>
545 +   <property name="title">
546 +    <string>Input Mesh</string>
547 +   </property>
548 +   <widget class="QPushButton" name="qpbMeshFile">
549 +    <property name="geometry">
550 +     <rect>
551 +      <x>10</x>
552 +      <y>50</y>
553 +      <width>151</width>
554 +      <height>31</height>
555 +     </rect>
556 +    </property>
557 +    <property name="font">
558 +     <font>
559 +      <pointsize>10</pointsize>
560 +     </font>
561 +    </property>
562 +    <property name="text">
563 +     <string>DEM input file</string>
564 +    </property>
565 +    <property name="iconSize">
566 +     <size>
567 +      <width>18</width>
568 +      <height>18</height>
569 +     </size>
570 +    </property>
571 +   </widget>
572 +   <widget class="QLineEdit" name="qleMeshFile">
573 +    <property name="geometry">
574 +     <rect>
575 +      <x>170</x>
576 +      <y>50</y>
577 +      <width>531</width>
578 +      <height>31</height>
579 +     </rect>
580 +    </property>
581 +    <property name="font">
582 +     <font>
583 +      <pointsize>10</pointsize>
584 +     </font>
585 +    </property>
586 +   </widget>
587 +  </widget>
588 +  <widget class="QGroupBox" name="gbOptions">
589 +   <property name="geometry">
590 +    <rect>
591 +     <x>10</x>
592 +     <y>120</y>
593 +     <width>761</width>
594 +     <height>231</height>
595 +    </rect>
596 +   </property>
597 +   <property name="title">
598 +    <string>Options</string>
599 +   </property>
600 +   <widget class="QSpinBox" name="qsbXPoints">
601 +    <property name="geometry">
602 +     <rect>
603 +      <x>10</x>
604 +      <y>30</y>
605 +      <width>62</width>
606 +      <height>22</height>
607 +     </rect>
608 +    </property>
609 +    <property name="minimum">
610 +     <number>0</number>
611 +    </property>
612 +    <property name="maximum">
613 +     <number>999999999</number>
614 +    </property>
615 +    <property name="value">
616 +     <number>10</number>
617 +    </property>
618 +   </widget>
619 +   <widget class="QLabel" name="qlXpoints">
620 +    <property name="geometry">
621 +     <rect>
622 +      <x>80</x>
623 +      <y>30</y>
624 +      <width>201</width>
625 +      <height>20</height>
626 +     </rect>
627 +    </property>
628 +    <property name="text">
629 +     <string>Number of points in X direction</string>
630 +    </property>
631 +   </widget>
632 +   <widget class="QSpinBox" name="qsbYPoints">
633 +    <property name="geometry">
634 +     <rect>
635 +      <x>10</x>
636 +      <y>70</y>
637 +      <width>62</width>
638 +      <height>22</height>
639 +     </rect>
640 +    </property>
641 +    <property name="minimum">
642 +     <number>0</number>
643 +    </property>
644 +    <property name="maximum">
645 +     <number>999999999</number>
646 +    </property>
647 +    <property name="value">
648 +     <number>10</number>
649 +    </property>
650 +   </widget>
651 +   <widget class="QSpinBox" name="qsbZPoints">
652 +    <property name="geometry">
653 +     <rect>
654 +      <x>10</x>
655 +      <y>110</y>
656 +      <width>62</width>
657 +      <height>22</height>
658 +     </rect>
659 +    </property>
660 +    <property name="minimum">
661 +     <number>0</number>
662 +    </property>
663 +    <property name="maximum">
664 +     <number>999999999</number>
665 +    </property>
666 +    <property name="value">
667 +     <number>10</number>
668 +    </property>
669 +   </widget>
670 +   <widget class="QLabel" name="qlYpoints">
671 +    <property name="geometry">
672 +     <rect>
673 +      <x>80</x>
674 +      <y>70</y>
675 +      <width>211</width>
676 +      <height>20</height>
677 +     </rect>
678 +    </property>
679 +    <property name="text">
680 +     <string>Number of points in Y direction</string>
681 +    </property>
682 +   </widget>
683 +   <widget class="QLabel" name="qlZpoints">
684 +    <property name="geometry">
685 +     <rect>
686 +      <x>80</x>
687 +      <y>110</y>
688 +      <width>211</width>
689 +      <height>20</height>
690 +     </rect>
691 +    </property>
692 +    <property name="text">
693 +     <string>Number of points in Z direction</string>
694 +    </property>
695 +   </widget>
696 +   <widget class="QSpinBox" name="qsbDepth">
697 +    <property name="geometry">
698 +     <rect>
699 +      <x>10</x>
700 +      <y>150</y>
701 +      <width>62</width>
702 +      <height>22</height>
703 +     </rect>
704 +    </property>
705 +    <property name="minimum">
706 +     <number>-999999999</number>
707 +    </property>
708 +    <property name="maximum">
709 +     <number>999999999</number>
710 +    </property>
711 +    <property name="value">
712 +     <number>0</number>
713 +    </property>
714 +   </widget>
715 +   <widget class="QLabel" name="qlDepth">
716 +    <property name="geometry">
717 +     <rect>
718 +      <x>80</x>
719 +      <y>150</y>
720 +      <width>201</width>
721 +      <height>20</height>
722 +     </rect>
723 +    </property>
724 +    <property name="text">
725 +     <string>Depth in Z direction</string>
726 +    </property>
727 +   </widget>
728 +   <widget class="QCheckBox" name="qcbDistributed">
729 +    <property name="geometry">
730 +     <rect>
731 +      <x>630</x>
732 +      <y>30</y>
733 +      <width>91</width>
734 +      <height>21</height>
735 +     </rect>
736 +    </property>
737 +    <property name="text">
738 +     <string/>
739 +    </property>
740 +   </widget>
741 +   <widget class="QLabel" name="qlbNbProcs">
742 +    <property name="geometry">
743 +     <rect>
744 +      <x>370</x>
745 +      <y>30</y>
746 +      <width>151</width>
747 +      <height>16</height>
748 +     </rect>
749 +    </property>
750 +    <property name="text">
751 +     <string>Number of processors</string>
752 +    </property>
753 +   </widget>
754 +   <widget class="QLabel" name="qlDistributed">
755 +    <property name="geometry">
756 +     <rect>
757 +      <x>660</x>
758 +      <y>30</y>
759 +      <width>101</width>
760 +      <height>16</height>
761 +     </rect>
762 +    </property>
763 +    <property name="text">
764 +     <string>Distributed</string>
765 +    </property>
766 +   </widget>
767 +   <widget class="QLabel" name="qlbXParts">
768 +    <property name="geometry">
769 +     <rect>
770 +      <x>370</x>
771 +      <y>70</y>
772 +      <width>261</width>
773 +      <height>16</height>
774 +     </rect>
775 +    </property>
776 +    <property name="text">
777 +     <string>Number of partitions in X direction</string>
778 +    </property>
779 +   </widget>
780 +   <widget class="QLabel" name="qlbYParts">
781 +    <property name="geometry">
782 +     <rect>
783 +      <x>370</x>
784 +      <y>110</y>
785 +      <width>251</width>
786 +      <height>16</height>
787 +     </rect>
788 +    </property>
789 +    <property name="text">
790 +     <string>Number of partitions in Y direction</string>
791 +    </property>
792 +   </widget>
793 +   <widget class="QLabel" name="qlbZParts">
794 +    <property name="geometry">
795 +     <rect>
796 +      <x>370</x>
797 +      <y>150</y>
798 +      <width>251</width>
799 +      <height>16</height>
800 +     </rect>
801 +    </property>
802 +    <property name="text">
803 +     <string>Number of partitions in Z direction</string>
804 +    </property>
805 +   </widget>
806 +   <widget class="QSpinBox" name="qsbNBprocs">
807 +    <property name="geometry">
808 +     <rect>
809 +      <x>300</x>
810 +      <y>30</y>
811 +      <width>62</width>
812 +      <height>22</height>
813 +     </rect>
814 +    </property>
815 +    <property name="minimum">
816 +     <number>0</number>
817 +    </property>
818 +    <property name="maximum">
819 +     <number>999999999</number>
820 +    </property>
821 +    <property name="value">
822 +     <number>1</number>
823 +    </property>
824 +   </widget>
825 +   <widget class="QSpinBox" name="qsbXParts">
826 +    <property name="geometry">
827 +     <rect>
828 +      <x>300</x>
829 +      <y>70</y>
830 +      <width>62</width>
831 +      <height>22</height>
832 +     </rect>
833 +    </property>
834 +    <property name="minimum">
835 +     <number>0</number>
836 +    </property>
837 +    <property name="maximum">
838 +     <number>999999999</number>
839 +    </property>
840 +    <property name="value">
841 +     <number>1</number>
842 +    </property>
843 +   </widget>
844 +   <widget class="QSpinBox" name="qsbYParts">
845 +    <property name="geometry">
846 +     <rect>
847 +      <x>300</x>
848 +      <y>110</y>
849 +      <width>62</width>
850 +      <height>22</height>
851 +     </rect>
852 +    </property>
853 +    <property name="minimum">
854 +     <number>0</number>
855 +    </property>
856 +    <property name="maximum">
857 +     <number>999999999</number>
858 +    </property>
859 +    <property name="value">
860 +     <number>1</number>
861 +    </property>
862 +   </widget>
863 +   <widget class="QSpinBox" name="qsbZParts">
864 +    <property name="geometry">
865 +     <rect>
866 +      <x>300</x>
867 +      <y>150</y>
868 +      <width>62</width>
869 +      <height>22</height>
870 +     </rect>
871 +    </property>
872 +    <property name="minimum">
873 +     <number>0</number>
874 +    </property>
875 +    <property name="maximum">
876 +     <number>999999999</number>
877 +    </property>
878 +    <property name="value">
879 +     <number>1</number>
880 +    </property>
881 +   </widget>
882 +   <widget class="QLineEdit" name="qleTmpDir">
883 +    <property name="geometry">
884 +     <rect>
885 +      <x>10</x>
886 +      <y>200</y>
887 +      <width>611</width>
888 +      <height>23</height>
889 +     </rect>
890 +    </property>
891 +    <property name="text">
892 +     <string/>
893 +    </property>
894 +   </widget>
895 +   <widget class="QLabel" name="qlTmpDir">
896 +    <property name="geometry">
897 +     <rect>
898 +      <x>10</x>
899 +      <y>180</y>
900 +      <width>391</width>
901 +      <height>16</height>
902 +     </rect>
903 +    </property>
904 +    <property name="text">
905 +     <string>Workspace</string>
906 +    </property>
907 +   </widget>
908 +  </widget>
909 +  <widget class="QWidget" name="layoutWidget">
910 +   <property name="geometry">
911 +    <rect>
912 +     <x>10</x>
913 +     <y>370</y>
914 +     <width>761</width>
915 +     <height>27</height>
916 +    </rect>
917 +   </property>
918 +   <layout class="QHBoxLayout" name="horizontalLayout">
919 +    <item>
920 +     <widget class="QPushButton" name="qpbCompute">
921 +      <property name="text">
922 +       <string>Compute</string>
923 +      </property>
924 +     </widget>
925 +    </item>
926 +    <item>
927 +     <widget class="QPushButton" name="qpbClose">
928 +      <property name="text">
929 +       <string>Close</string>
930 +      </property>
931 +     </widget>
932 +    </item>
933 +    <item>
934 +     <spacer name="horizontalSpacer">
935 +      <property name="orientation">
936 +       <enum>Qt::Horizontal</enum>
937 +      </property>
938 +      <property name="sizeHint" stdset="0">
939 +       <size>
940 +        <width>40</width>
941 +        <height>20</height>
942 +       </size>
943 +      </property>
944 +     </spacer>
945 +    </item>
946 +    <item>
947 +     <widget class="QPushButton" name="qpbHelp">
948 +      <property name="font">
949 +       <font>
950 +        <pointsize>10</pointsize>
951 +       </font>
952 +      </property>
953 +      <property name="text">
954 +       <string>Help</string>
955 +      </property>
956 +     </widget>
957 +    </item>
958 +   </layout>
959 +  </widget>
960 + </widget>
961 + <resources/>
962 + <connections/>
963 +</ui>
964 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py
965 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py   1970-01-01 01:00:00.000000000 +0100
966 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin_plugin.py   2022-01-14 16:36:28.963717213 +0100
967 @@ -0,0 +1,36 @@
968 +# -*- coding: utf-8 -*-
969 +# Copyright (C) 2013-2020  EDF R&D
970 +#
971 +# This library is free software; you can redistribute it and/or
972 +# modify it under the terms of the GNU Lesser General Public
973 +# License as published by the Free Software Foundation; either
974 +# version 2.1 of the License, or (at your option) any later version.
975 +#
976 +# This library is distributed in the hope that it will be useful,
977 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
978 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
979 +# Lesser General Public License for more details.
980 +#
981 +# You should have received a copy of the GNU Lesser General Public
982 +# License along with this library; if not, write to the Free Software
983 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
984 +#
985 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
986 +#
987 +
988 +# if you already have plugins defined in a salome_plugins.py file, add this file at the end.
989 +# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
990 +
991 +def Topo2VolMeshLct(context):
992 +  # get context study, salomeGui
993 +  study = context.study
994 +  sg = context.sg
995 +
996 +  import os
997 +  import subprocess
998 +  import tempfile
999 +  from qtsalome import QFileDialog, QMessageBox
1000 +
1001 +  import Topo2VolMeshPluginDialog
1002 +  window = Topo2VolMeshPluginDialog.getDialog()
1003 +  window.show()
1004 diff -Naur SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py
1005 --- SMESH_ref/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py  1970-01-01 01:00:00.000000000 +0100
1006 +++ SMESH_new/src/Tools/Topo2VolMeshPlug/Topo2VolMeshPlugin.py  2022-01-14 16:35:41.543110352 +0100
1007 @@ -0,0 +1,36 @@
1008 +# -*- coding: utf-8 -*-
1009 +# Copyright (C) 2013-2020  EDF R&D
1010 +#
1011 +# This library is free software; you can redistribute it and/or
1012 +# modify it under the terms of the GNU Lesser General Public
1013 +# License as published by the Free Software Foundation; either
1014 +# version 2.1 of the License, or (at your option) any later version.
1015 +#
1016 +# This library is distributed in the hope that it will be useful,
1017 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1018 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1019 +# Lesser General Public License for more details.
1020 +#
1021 +# You should have received a copy of the GNU Lesser General Public
1022 +# License along with this library; if not, write to the Free Software
1023 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
1024 +#
1025 +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
1026 +#
1027 +
1028 +# if you already have plugins defined in a salome_plugins.py file, add this file at the end.
1029 +# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
1030 +
1031 +def Topo2VolMeshLct(context):
1032 +  # get context study, salomeGui
1033 +  study = context.study
1034 +  sg = context.sg
1035 +
1036 +  import os
1037 +  import subprocess
1038 +  import tempfile
1039 +  from qtsalome import QFileDialog, QMessageBox
1040 +
1041 +  import Topo2VolMeshPluginDialog
1042 +  window = Topo2VolMeshPluginDialog.getInstance()
1043 +  window.show()