Salome HOME
spns #19079: Top-ii-vol integration in SMESH
authorNabil Ghodbane <nabil.ghodbane@cea.fr>
Sat, 12 Feb 2022 13:20:21 +0000 (14:20 +0100)
committervsr <vsr@opencascade.com>
Tue, 15 Feb 2022 08:51:48 +0000 (11:51 +0300)
16 files changed:
doc/salome/gui/SMESH/input/tools.rst
src/Tools/CMakeLists.txt
src/Tools/TopIIVolMeshPlug/CMakeLists.txt [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/README [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/TopIIVolMeshMonitor.py [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/TopIIVolMeshMonitor.ui [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/TopIIVolMeshPlugin.py [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/TopIIVolMeshPluginDialog.py [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/TopIIVolMeshPluginDialog.ui [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/TopIIVolMeshPlugin_plugin.py [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/doc/CMakeLists.txt [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/doc/TopIIVolMesh.rst [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/doc/conf.py.in [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/doc/images/callTopIIVolMesh.png [new file with mode: 0644]
src/Tools/TopIIVolMeshPlug/doc/index.rst [new file with mode: 0644]
src/Tools/smesh_plugins.py

index f9b53c046637d2a1e88365b707e2347703d23cda..0812a8e925b8d9f55c6ef175081bbda95fbded58 100644 (file)
@@ -9,6 +9,7 @@ The following plugins are accessible via **Mesh > SMESH plugins** menu:
 * `SpherePadder plugin <padder/padder_userguide_page.html>`_
 * `MGSurfOpt plugin <yams/index.html>`_
 * `MGCleaner plugin <MGCleaner/index.html>`_
+* `topIIVolMesh plugin <TopIIVolMesh/index.html>`_
 * `Z-cracks plugin <zcracks/index.html>`_
 * `MacMesh plugin <MacMesh/index.html>`_
 * `blocFissure plugin <blocFissure/index.html>`_
index 2c8c207816fc8e3fc8513fdcf1b33464382231a6..ca7f5a1ffae59236fefc58eeb09db639e1138e7b 100644 (file)
@@ -26,6 +26,7 @@ ADD_SUBDIRECTORY(MacMesh)
 IF(SALOME_BUILD_GUI)
   ADD_SUBDIRECTORY(MGCleanerPlug)
   ADD_SUBDIRECTORY(YamsPlug)
+  ADD_SUBDIRECTORY(TopIIVolMeshPlug)
 #  ADD_SUBDIRECTORY(ZCracksPlug)
 ENDIF(SALOME_BUILD_GUI)
 
diff --git a/src/Tools/TopIIVolMeshPlug/CMakeLists.txt b/src/Tools/TopIIVolMeshPlug/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7edc1b5
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright (C) 2013-2021  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(SALOME_BUILD_DOC)
+  ADD_SUBDIRECTORY(doc)
+ENDIF(SALOME_BUILD_DOC)
+
+IF(SALOME_BUILD_GUI)
+  INCLUDE(UsePyQt)
+ENDIF(SALOME_BUILD_GUI)
+
+# --- scripts ---
+
+# scripts / static
+SET(_plugin_SCRIPTS
+  TopIIVolMeshPluginDialog.py
+  TopIIVolMeshPlugin.py
+  TopIIVolMeshPlugin_plugin.py
+  TopIIVolMeshMonitor.py
+  README
+)
+
+IF(SALOME_BUILD_GUI)
+  # uic files / to be processed by pyuic
+  SET(_pyuic_FILES
+    TopIIVolMeshPluginDialog.ui
+    TopIIVolMeshMonitor.ui
+  )
+  # scripts / pyuic wrappings
+  PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_FILES} TARGET_NAME _target_name_pyuic)
+ENDIF(SALOME_BUILD_GUI)
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${_plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS})
+MESSAGE(VERBOSE "iNSTALLATION FOLDER ${SALOME_SMESH_INSTALL_PLUGINS}")
+IF(SALOME_BUILD_GUI)
+  SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS} TARGET_NAME _target_name_pyuic_py)
+  # add dependency of compiled py files on uic files in order
+  # to avoid races problems when compiling in parallel
+  ADD_DEPENDENCIES(${_target_name_pyuic_py} ${_target_name_pyuic})
+  # 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/TopIIVolMeshPlug/README b/src/Tools/TopIIVolMeshPlug/README
new file mode 100644 (file)
index 0000000..fbcad99
--- /dev/null
@@ -0,0 +1,37 @@
+******************************
+About SALOME TopIIVolMesh plug-in
+******************************
+
+SALOME TopIIVolMesh plug-in implements an interface to the topIIvol meshing tool.
+
+SALOME TopIIVolMesh plug-in is integrated into SALOME platform via the SALOME Mesh
+module.
+
+For more information please visit the SALOME platform web site:
+
+  <http://www.salome-platform.org/>
+
+=======
+License
+=======
+
+SALOME platform is distributed under the GNU Lesser General Public License.
+See COPYING file for more details.
+
+Also, additional information can be found at SALOME platform web site:
+
+  <http://www.salome-platform.org/downloads/license/>
+
+============
+Installation
+============
+
+=============
+Documentation
+=============
+
+===============
+Troubleshooting
+===============
+
+Please, send a mail to webmaster.salome@opencascade.com.
diff --git a/src/Tools/TopIIVolMeshPlug/TopIIVolMeshMonitor.py b/src/Tools/TopIIVolMeshPlug/TopIIVolMeshMonitor.py
new file mode 100644 (file)
index 0000000..119aba9
--- /dev/null
@@ -0,0 +1,97 @@
+# -*- 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
+#
+
+import os
+import sys
+import string
+import types
+import tempfile
+import traceback
+import pprint as PP #pretty print
+
+from qtsalome import *
+
+# Import des panels
+
+from TopIIVolMeshMonitor_ui import Ui_qdLogger
+
+verbose = True
+
+class TopIIVolMeshMonitor(Ui_qdLogger, QDialog):
+  def __init__(self, parent, txt):
+    QDialog.__init__(self,parent)
+    self.setupUi(self)
+    self.resize( QSize(1000,600).expandedTo(self.minimumSizeHint()) )
+    self.qpbOK.clicked.connect( self.OnQpbOKClicked )
+    # Button OK is disabled until computation is finished
+    self.qpbOK.setEnabled(False)
+    self.qpbSave.clicked.connect( self.OnQpbSaveClicked )
+    self.qpbSave.setToolTip("Save trace in log file")
+    self.qpbOK.setToolTip("Close view")
+    self.myExecutable=QProcess(self)
+    self.myExecutable.readyReadStandardOutput.connect( self.readFromStdOut )
+    self.myExecutable.readyReadStandardError.connect( self.readFromStdErr )
+    self.myExecutable.finished.connect( self.computationFinished )
+    self.myExecutable.errorOccurred.connect( self.computationOnError )
+    if os.path.exists(self.parent().outputMesh):
+       os.remove(self.parent().outputMesh)
+    self.myExecutable.start(txt)
+    self.myExecutable.closeWriteChannel()
+    self.show()
+
+  def OnQpbOKClicked(self):
+    self.close()
+
+  def OnQpbSaveClicked(self):
+    outputDirectory=os.path.expanduser("~")
+    fn, mask = QFileDialog.getSaveFileName(None,"Save File",outputDirectory)
+    if not fn:
+      return
+    ulfile = os.path.abspath(str(fn))
+    try:
+      f = open(fn, 'wb')
+      f.write(self.qtbLogWindow.toPlainText().encode("utf-8"))
+      f.close()
+    except IOError as why:
+      QMessageBox.critical(self, 'Save File',
+                                 'The file <b>%s</b> could not be saved.<br>Reason: %s'%(str(fn), str(why)))
+
+  def readFromStdErr(self):
+    a=self.myExecutable.readAllStandardError()
+    aa=a.data().decode(errors='ignore')
+    self.qtbLogWindow.append(aa)
+
+  def readFromStdOut(self) :
+    a=self.myExecutable.readAllStandardOutput()
+    aa=a.data().decode(errors='ignore')
+    self.qtbLogWindow.append(aa)
+
+  def computationFinished(self):
+    self.qpbOK.setEnabled(True)
+    if self.myExecutable.exitCode() == 0:
+      self.parent().saveOutputMesh()
+    else:
+      QMessageBox.critical(self, 'Computation failed',
+                                 'The computation has failed.<br>Please, check the log message.')
+
+  def computationOnError(self):
+    self.qpbOK.setEnabled(True)
+    QMessageBox.critical(self, 'Computation failed',
+                               'The computation has failed.<br>Please, check the log message.')
diff --git a/src/Tools/TopIIVolMeshPlug/TopIIVolMeshMonitor.ui b/src/Tools/TopIIVolMeshPlug/TopIIVolMeshMonitor.ui
new file mode 100644 (file)
index 0000000..5bded34
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>qdLogger</class>
+ <widget class="QDialog" name="qdLogger">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>469</width>
+    <height>489</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Run TopIIVolMesh</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="1" column="1">
+    <widget class="QPushButton" name="qpbSave">
+     <property name="text">
+      <string>Save log</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" colspan="2">
+    <widget class="QTextBrowser" name="qtbLogWindow"/>
+   </item>
+   <item row="1" column="0">
+    <widget class="QPushButton" name="qpbOK">
+     <property name="text">
+      <string>Ok</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPlugin.py b/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPlugin.py
new file mode 100644 (file)
index 0000000..e53b616
--- /dev/null
@@ -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 TopIIVolMeshLct(context):
+  # get context study, salomeGui
+  study = context.study
+  sg = context.sg
+
+  import os
+  import subprocess
+  import tempfile
+  from qtsalome import QFileDialog, QMessageBox
+
+  import TopIIVolMeshPluginDialog
+  window = TopIIVolMeshPluginDialog.getInstance()
+  window.show()
diff --git a/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPluginDialog.py b/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPluginDialog.py
new file mode 100644 (file)
index 0000000..bc1f20d
--- /dev/null
@@ -0,0 +1,164 @@
+# -*- 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
+#
+
+
+import os, subprocess
+import random
+import getpass
+import time
+import pathlib
+
+# set seed
+from datetime import datetime
+random.seed(datetime.now())
+
+import platform
+import tempfile
+from TopIIVolMeshPluginDialog_ui import Ui_TopIIVolMeshMainFrame
+from TopIIVolMeshMonitor import TopIIVolMeshMonitor
+from qtsalome import *
+
+verbose = True
+
+class TopIIVolMeshPluginDialog(Ui_TopIIVolMeshMainFrame,QWidget):
+  """
+  """
+  def __init__(self):
+    QWidget.__init__(self)
+    self.setupUi(self)
+    self.qpbHelp.clicked.connect(self.OnQpbHelpClicked)
+    self.qpbCompute.clicked.connect(self.OnQpbComputeClicked)
+    self.qpbMeshFile.clicked.connect(self.OnQpbMeshFileClicked)
+    self.qpbMeshFile.setToolTip("Select input DEM file")
+    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 = ''
+
+  def OnQpbHelpClicked(self):
+    import SalomePyQt
+    sgPyQt = SalomePyQt.SalomePyQt()
+    try:
+      mydir=os.environ["SMESH_ROOT_DIR"]
+    except Exception:
+      QMessageBox.warning(self, "Help", "Help unavailable $SMESH_ROOT_DIR not found")
+      return
+
+    myDoc=mydir + "/share/doc/salome/gui/SMESH/TopIIVolMesh/index.html"
+    sgPyQt.helpContext(myDoc,"")
+
+  def OnQpbMeshFileClicked(self):
+    fd = QFileDialog(self, "select an existing Mesh file", self.qleMeshFile.text(), "Mesh-Files (*.xyz);;All Files (*)")
+    if fd.exec_():
+      infile = fd.selectedFiles()[0]
+      self.qleMeshFile.setText(infile)
+
+  def OnQpbComputeClicked(self):
+    if self.qleMeshFile.text() == '':
+      QMessageBox.critical(self, "Mesh", "select an input mesh")
+      return
+    inputMesh = self.qleMeshFile.text()
+    # retrieve x,y,z and depth parameters
+    xPoints = self.qsbXPoints.value()
+    yPoints = self.qsbYPoints.value()
+    zPoints = self.qsbZPoints.value()
+    depth   = self.qsbDepth.value()
+    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(yParts)
+      shellCmd+= " --partition_z " + str(zParts)
+      shellCmd+= " --in " + inputMesh
+    if platform.system()=="Windows" :
+      self.SALOME_TMP_DIR = os.getenv("SALOME_TMP_DIR")
+    else:
+      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=TopIIVolMeshMonitor(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 self.qcbDisplayMesh.isChecked():
+      return True
+    import salome
+    import  SMESH, SALOMEDS
+    from salome.smesh import smeshBuilder
+    smesh = smeshBuilder.New()
+    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
+
+__instance = None
+
+def getInstance():
+  """
+  This function returns a singleton instance of the plugin dialog.
+  It is mandatory in order to call show without a parent ...
+  """
+  global __instance
+  if __instance is None:
+    __instance = TopIIVolMeshPluginDialog()
+  return __instance
diff --git a/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPluginDialog.ui b/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPluginDialog.ui
new file mode 100644 (file)
index 0000000..c148582
--- /dev/null
@@ -0,0 +1,474 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TopIIVolMeshMainFrame</class>
+ <widget class="QWidget" name="TopIIVolMeshMainFrame">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>780</width>
+    <height>411</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Tetra Mesh from cloud of xyz points mesh generator</string>
+  </property>
+  <widget class="QGroupBox" name="groupBox">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>10</y>
+     <width>761</width>
+     <height>101</height>
+    </rect>
+   </property>
+   <property name="font">
+    <font>
+     <pointsize>10</pointsize>
+    </font>
+   </property>
+   <property name="title">
+    <string>Input Mesh</string>
+   </property>
+   <widget class="QPushButton" name="qpbMeshFile">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>50</y>
+      <width>151</width>
+      <height>31</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <pointsize>10</pointsize>
+     </font>
+    </property>
+    <property name="text">
+     <string>DEM input file</string>
+    </property>
+    <property name="iconSize">
+     <size>
+      <width>18</width>
+      <height>18</height>
+     </size>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="qleMeshFile">
+    <property name="geometry">
+     <rect>
+      <x>170</x>
+      <y>50</y>
+      <width>531</width>
+      <height>31</height>
+     </rect>
+    </property>
+    <property name="font">
+     <font>
+      <pointsize>10</pointsize>
+     </font>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QGroupBox" name="gbOptions">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>120</y>
+     <width>761</width>
+     <height>231</height>
+    </rect>
+   </property>
+   <property name="title">
+    <string>Options</string>
+   </property>
+   <widget class="QSpinBox" name="qsbXPoints">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>30</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>0</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>10</number>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlXpoints">
+    <property name="geometry">
+     <rect>
+      <x>80</x>
+      <y>30</y>
+      <width>201</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Number of points in X direction</string>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="qsbYPoints">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>70</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>0</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>10</number>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="qsbZPoints">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>110</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>0</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>10</number>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlYpoints">
+    <property name="geometry">
+     <rect>
+      <x>80</x>
+      <y>70</y>
+      <width>211</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Number of points in Y direction</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlZpoints">
+    <property name="geometry">
+     <rect>
+      <x>80</x>
+      <y>110</y>
+      <width>211</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Number of points in Z direction</string>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="qsbDepth">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>150</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>-999999999</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>0</number>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlDepth">
+    <property name="geometry">
+     <rect>
+      <x>80</x>
+      <y>150</y>
+      <width>201</width>
+      <height>20</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Depth in Z direction</string>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="qcbDistributed">
+    <property name="geometry">
+     <rect>
+      <x>630</x>
+      <y>30</y>
+      <width>91</width>
+      <height>21</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlbNbProcs">
+    <property name="geometry">
+     <rect>
+      <x>370</x>
+      <y>30</y>
+      <width>151</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Number of processors</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlDistributed">
+    <property name="geometry">
+     <rect>
+      <x>660</x>
+      <y>30</y>
+      <width>101</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Distributed</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlbXParts">
+    <property name="geometry">
+     <rect>
+      <x>370</x>
+      <y>70</y>
+      <width>261</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Number of partitions in X direction</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlbYParts">
+    <property name="geometry">
+     <rect>
+      <x>370</x>
+      <y>110</y>
+      <width>251</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Number of partitions in Y direction</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlbZParts">
+    <property name="geometry">
+     <rect>
+      <x>370</x>
+      <y>150</y>
+      <width>251</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Number of partitions in Z direction</string>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="qsbNBprocs">
+    <property name="geometry">
+     <rect>
+      <x>300</x>
+      <y>30</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>0</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>1</number>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="qsbXParts">
+    <property name="geometry">
+     <rect>
+      <x>300</x>
+      <y>70</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>0</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>1</number>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="qsbYParts">
+    <property name="geometry">
+     <rect>
+      <x>300</x>
+      <y>110</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>0</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>1</number>
+    </property>
+   </widget>
+   <widget class="QSpinBox" name="qsbZParts">
+    <property name="geometry">
+     <rect>
+      <x>300</x>
+      <y>150</y>
+      <width>62</width>
+      <height>22</height>
+     </rect>
+    </property>
+    <property name="minimum">
+     <number>0</number>
+    </property>
+    <property name="maximum">
+     <number>999999999</number>
+    </property>
+    <property name="value">
+     <number>1</number>
+    </property>
+   </widget>
+   <widget class="QLineEdit" name="qleTmpDir">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>200</y>
+      <width>611</width>
+      <height>23</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlTmpDir">
+    <property name="geometry">
+     <rect>
+      <x>10</x>
+      <y>180</y>
+      <width>391</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Workspace</string>
+    </property>
+   </widget>
+   <widget class="QCheckBox" name="qcbDisplayMesh">
+    <property name="geometry">
+     <rect>
+      <x>630</x>
+      <y>70</y>
+      <width>91</width>
+      <height>21</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+   </widget>
+   <widget class="QLabel" name="qlDisplayMesh">
+    <property name="geometry">
+     <rect>
+      <x>660</x>
+      <y>70</y>
+      <width>101</width>
+      <height>16</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Display mesh</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QWidget" name="layoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>370</y>
+     <width>761</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <widget class="QPushButton" name="qpbCompute">
+      <property name="text">
+       <string>Compute</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="qpbClose">
+      <property name="text">
+       <string>Close</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <spacer name="horizontalSpacer">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>40</width>
+        <height>20</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <widget class="QPushButton" name="qpbHelp">
+      <property name="font">
+       <font>
+        <pointsize>10</pointsize>
+       </font>
+      </property>
+      <property name="text">
+       <string>Help</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPlugin_plugin.py b/src/Tools/TopIIVolMeshPlug/TopIIVolMeshPlugin_plugin.py
new file mode 100644 (file)
index 0000000..2468401
--- /dev/null
@@ -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 TopIIVolMeshLct(context):
+  # get context study, salomeGui
+  study = context.study
+  sg = context.sg
+
+  import os
+  import subprocess
+  import tempfile
+  from qtsalome import QFileDialog, QMessageBox
+
+  import TopIIVolMeshPluginDialog
+  window = TopIIVolMeshPluginDialog.getDialog()
+  window.show()
diff --git a/src/Tools/TopIIVolMeshPlug/doc/CMakeLists.txt b/src/Tools/TopIIVolMeshPlug/doc/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b764912
--- /dev/null
@@ -0,0 +1,30 @@
+# Copyright (C) 2012-2021  CEA
+#
+# 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
+#
+
+SALOME_CONFIGURE_FILE(conf.py.in conf.py)
+
+SET(_cmd_options -c ${CMAKE_CURRENT_BINARY_DIR} -b html -d doctrees ${CMAKE_CURRENT_SOURCE_DIR} docutils)
+SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_cmd_options}" CONTEXT TopIIVolMeshPlug_DOC)
+ADD_CUSTOM_TARGET(html_docs_TopIIVolMeshPlug COMMAND ${_cmd})
+
+INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target html_docs_TopIIVolMeshPlug)")
+INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docutils/ DESTINATION ${SALOME_INSTALL_DOC}/gui/SMESH/TopIIVolMesh)
+
+SET(make_clean_files docutils doctrees)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}")
diff --git a/src/Tools/TopIIVolMeshPlug/doc/TopIIVolMesh.rst b/src/Tools/TopIIVolMeshPlug/doc/TopIIVolMesh.rst
new file mode 100644 (file)
index 0000000..48e3f87
--- /dev/null
@@ -0,0 +1,63 @@
+Introduction
+============
+
+**topIIvol** meshing tool provides sequential/parallel tools for creating volumetric tetrahedral meshes from a given topology (point-cloud `*.xyz`). 
+
+Running topIIvol Plug-in
+========================
+
+**topIIVolMesh** plug-in can be invoked via SMESH Plugin item in Mesh menu bar 
+
+.. image:: images/callTopIIVolMesh.png
+   :align: center
+
+
+**topIIVolMesh** Options
+========================
+
+
+Sequential mode
+---------------
+If the number of processors is set to 1, **topIIvol_Mesher** sequential tool is called for creating volumetric tetrahedral meshes from a given topology. The volumetric mesh can be displayed in SALOME by ticking the "Display mesh" check-box.
+
+The list of input parameters are:
+
+- DEM input file: input point cloud file;
+- Number of X points present in the input point cloud;
+- Number of Y points present in the input point cloud;
+- Number of Z points intended in the z direction;
+- Depth of the mesh needed;
+- temporary directory for calculation.
+
+Parallel mode
+---------------
+If the number of processors is greater than one, **topIIvol_ParMesher** parallel computing tool is called for creating volumetric tetrahedral meshes from a given topology. The volumetric mesh can be displayed in SALOME by ticking the "Display mesh" check-box.
+
+The list of input parameters are:
+
+- DEM input file: input point cloud file;
+- Number of X points present in the input point cloud;
+- Number of Y points present in the input point cloud;
+- Number of Z points intended in the z direction;
+- Depth of the mesh needed;
+- Number of MPI ranks
+- temporary directory for calculation.
+
+
+Distributed mode
+-----------------
+If the check-box **Distributed** is ticked,  **topIIvol_DistMesher** computing tool is called for creating embarassingly parallel distributed meshes from a given topology.
+
+The list of input parameters are:
+
+- DEM input file: input point cloud file;
+- Number of X points present in the input point cloud;
+- Number of Y points present in the input point cloud;
+- Number of Z points intended in the z direction;
+- Number of partitions in X direction;
+- Number of partitions in Y direction;
+- Number of partitions in Z direction;
+- Depth of the mesh needed;
+- Number of MPI ranks
+- temporary directory for calculation.
+
diff --git a/src/Tools/TopIIVolMeshPlug/doc/conf.py.in b/src/Tools/TopIIVolMeshPlug/doc/conf.py.in
new file mode 100644 (file)
index 0000000..56b7819
--- /dev/null
@@ -0,0 +1,187 @@
+# -*- coding: utf-8 -*-
+#
+# TopIIVolMesh PlugIn documentation build configuration file
+#
+
+import sys, os
+import sphinx
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('some/directory'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc']
+try:
+  import sphinx_rtd_theme
+  extensions += ['sphinx_rtd_theme']
+  use_rtd_theme = True
+except:
+  use_rtd_theme = False
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['.templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General substitutions.
+project = 'topIIvol Plug-in'
+copyright = '2007-2021 CEA'
+
+# The default replacements for |version| and |release|, also used in various
+# other places throughout the built documents.
+#
+# The short X.Y version.
+version = '@SALOMESMESH_VERSION@'
+# The full version, including alpha/beta/rc tags.
+release = '@SALOMESMESH_VERSION@'
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directories, that shouldn't be searched
+# for source files.
+#exclude_dirs = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The theme to use for HTML and HTML Help pages.  Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+if use_rtd_theme:
+  html_theme = 'sphinx_rtd_theme'
+else:
+  html_theme = 'default' if sphinx.version_info[:2] < (1,3) else 'classic'
+
+themes_options = {}
+themes_options['classic'] = {
+  'body_max_width':'none',
+  'body_min_width':0,
+}
+html_theme_options = themes_options.get(html_theme, {})
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (within the static path) to place at the top of
+# the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+#html_static_path = ['.static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'TopIIVolMeshPlug-in doc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+  ('index', 'TopIIVolMeshPlugIn.tex', 'TopIIVolMesh PlugIn Documentation',
+   'CEA', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
diff --git a/src/Tools/TopIIVolMeshPlug/doc/images/callTopIIVolMesh.png b/src/Tools/TopIIVolMeshPlug/doc/images/callTopIIVolMesh.png
new file mode 100644 (file)
index 0000000..72a9d5d
Binary files /dev/null and b/src/Tools/TopIIVolMeshPlug/doc/images/callTopIIVolMesh.png differ
diff --git a/src/Tools/TopIIVolMeshPlug/doc/index.rst b/src/Tools/TopIIVolMeshPlug/doc/index.rst
new file mode 100644 (file)
index 0000000..3cd2379
--- /dev/null
@@ -0,0 +1,22 @@
+.. TopIIVolMesh documentation master file, created by sphinx-quickstart.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+topIIvol plugin documentation
+=====================================
+
+This documentation covers the usage of **top-ii-vol** as plug-in in SALOME that can be used within the SALOME
+Mesh module.
+
+TopIIVolMesh plug-in uses CEA **top-ii-Vol** meshing tool,which provides sequential/parallel tools for creating volumetric tetrahedral meshes from a given topology.
+This plug-in offers only the most common functionalities of the tool.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   TopIIVolMesh.rst
+
+
+
index 7c726820ad47b7570b1576c234c8314b39644657..66aa07bd9392eea2135d5f6e3373ac0924e4798b 100644 (file)
@@ -91,3 +91,14 @@ except Exception as e:
   #print 'probleme zcracks'
   salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable: {}'.format(e))
   pass
+
+# Topological to volumic mesh plugin
+try:
+  from TopIIVolMeshPlugin import TopIIVolMeshLct
+  salome_pluginsmanager.AddFunction('Run Topological Volumic mesher',
+                                    'run topological volumic mesher',
+                                    TopIIVolMeshLct)
+except Exception as e:
+  #print 'probleme zcracks'
+  salome_pluginsmanager.logger.info('ERROR: TopIIVolMesh plug-in is unavailable: {}'.format(e))
+  pass