ENDIF( ENV{HDF5_ROOT_DIR} )
ENDIF( NOT HDF5_ROOT_DIR )
-
#Paraview library paths
set (PV_LIB_DIR /usr/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/dist-packages/paraview/:/usr/lib64/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtk/:${MATPLOTLIB_ROOT_DIR}/lib/:${PARAVIEW_LIBRARIES_DIR})
set (PV_PYTHON_DIR /usr/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/dist-packages/paraview/:/usr/lib64/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtk/:/usr/lib64/paraview/site-packages/:/usr/lib64/paraview/site-packages/paraview/:/usr/lib64/paraview/site-packages/vtk/:/usr/lib64/paraview/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/:/usr/lib64/paraview/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/paraview/:/usr/lib64/paraview/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtkmodules:/usr/lib/paraview/site-packages/paraview:/usr/lib/paraview/site-packages/paraview/vtk:${PARAVIEW_ROOT_DIR}/lib/:${PARAVIEW_ROOT_DIR}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/:${PARAVIEW_ROOT_DIR}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtkmodules/:${MATPLOTLIB_ROOT_DIR}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages:${PYQT5_ROOT_DIR}:${PYQT5_ROOT_DIR}/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages)
# Graphic interface-----------------------------------------------------------------------------------------#
#
-if (COREFLOWS_WITH_GUI) #
- set (CoreFlows_GUI_DIR ${CoreFlows_SOURCE_DIR}/gui) #
- add_subdirectory(${CoreFlows_GUI_DIR})
-
+if (COREFLOWS_WITH_GUI) #
+ set (CoreFlows_GUI_DIR ${CoreFlows_SOURCE_DIR}/gui) #
+ add_subdirectory(${CoreFlows_GUI_DIR})
endif () #
#
# ------------- --------------------------------------------------------------------------------------------#
# Graphic interface---------------------------------------------------------------------------------------------#
#
-if (COREFLOWS_WITH_GUI)
+if (COREFLOWS_WITH_GUI)
+
+ SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+ IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+ INCLUDE(SalomeMacros NO_POLICY_SCOPE)
+ ELSE()
+ MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
+ ENDIF()
#
# Find KERNEL
# ==============
SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
IF( EXISTS ${KERNEL_ROOT_DIR} )
- LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
- LIST(APPEND CMAKE_PREFIX_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
- INCLUDE(SalomeMacros)
FIND_PACKAGE(SalomeKERNEL REQUIRED)
ELSE( EXISTS ${KERNEL_ROOT_DIR} )
MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR!")
# ==============
SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
IF(EXISTS ${GUI_ROOT_DIR})
- LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
- LIST(APPEND CMAKE_PREFIX_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
FIND_PACKAGE(SalomeGUI)
ELSE(EXISTS ${GUI_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR!")
# =============
# Mandatory products
- IF( $ENV{PARAVIEW_VERSION} STRLESS "5")
- FIND_PACKAGE(SalomePython REQUIRED)
- ELSE()
- FIND_PACKAGE(SalomePythonInterp REQUIRED)
- FIND_PACKAGE(SalomePythonLibs REQUIRED)
- ENDIF()
+# FIND_PACKAGE(SalomePythonInterp REQUIRED)
+# FIND_PACKAGE(SalomePythonLibs REQUIRED)
SET(_all_SCRIPTS
main_tests.py
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+cmake_minimum_required (VERSION 3.1)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
INCLUDE(CMakeDependentOption)
# Versioning
OPTION(SALOME_BUILD_DOC "Generate SALOME CoreFlows documentation" ON)
OPTION(SALOME_BUILD_TESTS "Generate SALOME CoreFlows tests" ON)
+# Common CMake macros
+# ===================
+SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
+IF(EXISTS ${CONFIGURATION_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
+ INCLUDE(SalomeMacros NO_POLICY_SCOPE)
+ELSE()
+ MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
+ENDIF()
# Find KERNEL
# ==============
SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
IF( EXISTS ${KERNEL_ROOT_DIR} )
- LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
- INCLUDE(SalomeMacros)
FIND_PACKAGE(SalomeKERNEL REQUIRED)
ELSE( EXISTS ${KERNEL_ROOT_DIR} )
MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR!")
# ==============
SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
IF(EXISTS ${GUI_ROOT_DIR})
- LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
FIND_PACKAGE(SalomeGUI)
ELSE(EXISTS ${GUI_ROOT_DIR})
MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR!")
ENDIF()
MESSAGE(STATUS "SalomeKERNEL_VERSION is ${SalomeKERNEL_VERSION}")
-# Qt4
-FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
+# Qt5
+FIND_PACKAGE(SalomeQt5 REQUIRED COMPONENTS QtCore QtGui)
IF(SALOME_BUILD_DOC)
# FIND_PACKAGE(SalomeDoxygen)
# Author : A. Bruneton
#
-from PyQt4.QtCore import Qt
-from PyQt4.QtGui import QMainWindow,QMenu, QDockWidget
+from PyQt5.QtCore import Qt
+from PyQt5.QtWidgets import QMainWindow,QMenu, QDockWidget
from MainCFWidget import MainCFWidget
class CFDesktop(QMainWindow):
# Author : A. Bruneton
#
import sys, os
-from PyQt4.QtGui import QApplication
-from PyQt4.QtCore import SIGNAL, SLOT
+from PyQt5.QtWidgets import QApplication
+#from PyQt5.QtCore import SIGNAL, SLOT
from CFDesktop import CFDesktop
import SalomePyQt_MockUp
-from PyQt4.QtCore import QTimer, QTranslator, Qt
+from PyQt5.QtCore import QTimer, QTranslator, Qt
desktop = None
#
- app.connect(app,SIGNAL("lastWindowClosed()"),app,SLOT("quit()"))
+# app.connect(app,SIGNAL("lastWindowClosed()"),app,SLOT("quit()"))
+ app.lastWindowClosed.connect(quit)
app.exec_()
if __name__ == "__main__" :
# Author : A. Bruneton
#
-from PyQt4.QtGui import QApplication, QTabWidget
-from PyQt4.QtGui import QAction, QMenu, QIcon, QPixmap, QDesktopWidget, QFileDialog
-from PyQt4.QtCore import SIGNAL, SLOT, QObject, pyqtSlot, pyqtSignal
+from PyQt5.QtWidgets import QApplication, QTabWidget
+from PyQt5.QtWidgets import QAction, QMenu, QDesktopWidget, QFileDialog
+from PyQt5.QtGui import QIcon, QPixmap
+#from PyQt5.QtCore import SIGNAL, SLOT, QObject, pyqtSlot, pyqtSignal
+from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal
RESOURCE_DIR = "@SGPYQT_RES_DIR@"
if self._mainWindow:
self._menuBar = self._mainWindow.menuBar()
self._mainWindow.setCentralWidget(self._tabWidget)
- self.connect(self._tabWidget, SIGNAL("currentChanged(int)"), self, SLOT("onTabChanged(int)"))
+# self.connect(self._tabWidget, SIGNAL("currentChanged(int)"), self, SLOT("onTabChanged(int)"))
+ self._tabWidget.currentChanged.connect(self.onTabChanged)
self._blockSignal = False
def getDesktop(self):
if self._blockSignal:
return
invDict = dict([(v, k) for k,v in self._viewIDs.items()])
- if invDict.has_key(index):
+ if index in invDict:
+# if invDict.has_key(index):
self._blockSignal = True
self.currentTabChanged.emit(invDict[index])
self._blockSignal = False
-from PyQt4 import QtGui, QtCore
-from PyQt4.uic import loadUi
+# -*- coding: utf-8 -*-
+from PyQt5 import QtWidgets, QtCore
+from PyQt5.uic import loadUi
from utils import completeResPath
import CoreFlows as cf
import cdmath as cm
-class MainCFWidget(QtGui.QTabWidget):
+class MainCFWidget(QtWidgets.QTabWidget):
def __init__(self):
- QtGui.QTabWidget.__init__(self)
+ QtWidgets.QTabWidget.__init__(self)
loadUi(completeResPath("MainCFWidget.ui"), self)
self._python_dump = []
def scanWidgets(self):
- print self.tabModel
+ print(self.tabModel)
dictCF={}
for k in self.__dict__:
att = self.__dict__[k]
- if isinstance(att, QtGui.QWidget):
+ if isinstance(att, QtWidgets.QWidget):
name = str(att.objectName())
if name != "":
# print(name)
if name.endswith("RadioButton"):
- assert(isinstance(att, QtGui.QRadioButton))
+ assert(isinstance(att, QtWidgets.QRadioButton))
if att.isChecked() :
# parse name
name=name[:len(name)-len("_RadioButton")]#On retire le suffixe _Radiobutton
elif name=="MeshCreation" :
dictCF["MeshCreation"]=True
elif name.endswith("spinBox") :
- assert(isinstance(att, QtGui.QSpinBox))
+ assert(isinstance(att, QtWidgets.QSpinBox))
val = att.value()
# parse name
name=name[:len(name)-len("_spinBox")]#On retire le suffixe _SpinBox
elif name=="NO_FreqSave" :
dictCF["FreqSave"]=val
elif name.endswith("doubleSpinBox"):
- assert(isinstance(att, QtGui.QDoubleSpinBox))
+ assert(isinstance(att, QtWidgets.QDoubleSpinBox))
val = att.value()
# parse name
name=name[:len(name)-len("_doubleSpinBox")]#On retire le suffixe _doubleSpinBox
name=name[3:len(name)-len("_BC")]#On retire le préfixe SP_ ou DM_ au début et le suffixe _BC à la fin
dictCF[name]=val
elif name.endswith('comboBox'):
- assert(isinstance(att, QtGui.QComboBox))
+ assert(isinstance(att, QtWidgets.QComboBox))
val = att.currentText()
# parse name
name=name[:len(name)-len("_comboBox")]#On retire le suffixe _comboBox
elif name=="NO_Preconditioner" :
dictCF["Preconditioner"]=val
elif name.endswith('lineEdit'):
- assert(isinstance(att, QtGui.QLineEdit))
+ assert(isinstance(att, QtWidgets.QLineEdit))
val = str(att.text())
# parse name
name=name[:len(name)-len("_lineEdit")]#On retire le suffixe _comboBox
return dictCF
def onLaunchSimu(self):
- print "Reading widgets"
+ print("Reading widgets")
dictCF = self.scanWidgets()
- print "Setting Model and VV_Constant"
+ print("Setting Model and VV_Constant")
######## Setting Model and VV_Constant #########################
if dictCF["ModelName"]=="SinglePhase" :
- exec "myProblem = cf.%s(cf.%s,cf.%s,%s)" % (dictCF["ModelName"],dictCF["fluidType"],dictCF["pressureEstimate"],dictCF["spaceDim"])
+ exec("myProblem = cf.%s(cf.%s,cf.%s,%s)" % (dictCF["ModelName"],dictCF["fluidType"],dictCF["pressureEstimate"],dictCF["spaceDim"]))
nVar = myProblem.getNumberOfVariables()
VV_Constant =[0]*nVar
VV_Constant[0] = dictCF["InitialPressure"]
VV_Constant[3] = dictCF["InitialVelocity_3d"]
VV_Constant[nVar-1] = dictCF["InitialTemperature"]
elif dictCF["ModelName"]=="DriftModel" :
- exec "myProblem = cf.%s(cf.%s,%s)" % (dictCF["ModelName"],dictCF["pressureEstimate"],dictCF["spaceDim"])
+ exec("myProblem = cf.%s(cf.%s,%s)" % (dictCF["ModelName"],dictCF["pressureEstimate"],dictCF["spaceDim"]))
nVar = myProblem.getNumberOfVariables()
VV_Constant =[0]*nVar
VV_Constant[0] = dictCF["InitialConcentration"]
VV_Constant[4] = dictCF["InitialVelocity_3d"]
VV_Constant[nVar-1] = dictCF["InitialTemperature"]
else :
- raise NameError('Model not yet handled', dictCF["ModelName"])
+ raise NameError('Model not yet handled', dictCF["ModelName"])
- print "Setting initial data"
+ print("Setting initial data")
############ setting initial data ################################
if dictCF["spaceDim"] ==1 :
- print "spaceDim= ", dictCF["spaceDim"]
- print "VV_Constant= ", VV_Constant
- print "Xinf= ", dictCF["Xinf"]
- print "Xsup= ", dictCF["Xsup"]
- print "Nx= ", dictCF["Nx"]
+ print("spaceDim= ", dictCF["spaceDim"])
+ print("VV_Constant= ", VV_Constant)
+ print("Xinf= ", dictCF["Xinf"])
+ print("Xsup= ", dictCF["Xsup"])
+ print("Nx= ", dictCF["Nx"])
myProblem.setInitialFieldConstant( dictCF["spaceDim"], VV_Constant, dictCF["Xinf"], dictCF["Xsup"], dictCF["Nx"],"Left","Right");
- print "Initial field set"
+ print("Initial field set")
elif dictCF["spaceDim"] ==2 :
myProblem.setInitialFieldConstant( dictCF["spaceDim"], VV_Constant, dictCF["Xinf"], dictCF["Xsup"], dictCF["Nx"],"Left","Right", dictCF["Yinf"], dictCF["Ysup"], dictCF["Ny"],"Bottom","Top");
elif dictCF["spaceDim"] ==3 :
# for k, v in dictCF.items():
# line = "cf.set%s(%s)" % (k, v)
-# #exec line
+# #exec(line)
# self._python_dump.append(line)
######## 1D for the moment ######################
myProblem.setGravity(gravite)
########## Numerical options ###############
- exec "myProblem.setNumericalScheme(cf.%s, cf.%s)" % (dictCF["Scheme"],dictCF["Method"])
+ exec("myProblem.setNumericalScheme(cf.%s, cf.%s)" % (dictCF["Scheme"],dictCF["Method"]))
myProblem.setWellBalancedCorrection(True);
myProblem.setCFL(dictCF["CFL"]);