From dc769d251635334cd49e913cb9aa8b44c12b701d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Renaud=20N=C3=A9d=C3=A9lec?= Date: Tue, 6 May 2014 18:00:28 +0200 Subject: [PATCH] [Verima] Missing giles --- src/Tools/Verima/Base/tableGroupeRatios.py | 38 ++++ src/Tools/Verima/Base/tableGroupeTailles.py | 39 ++++ .../templatesHtml/groupeRatio.html | 179 ++++++++++++++++++ .../templatesHtml/groupeTaille.html | 178 +++++++++++++++++ .../templatesHtml/maillageEntete.html | 90 +++++++++ src/Tools/Verima/Gui/desFenetreChoix.py | 119 ++++++++++++ src/Tools/Verima/Gui/myMain.py | 72 +++++++ src/Tools/Verima/Gui/nomBase.py | 39 ++++ src/Tools/Verima/Stats/Type_Maille.py | 26 +++ src/Tools/Verima/Stats/getCritere.py | 114 +++++++++++ 10 files changed, 894 insertions(+) create mode 100644 src/Tools/Verima/Base/tableGroupeRatios.py create mode 100644 src/Tools/Verima/Base/tableGroupeTailles.py create mode 100644 src/Tools/Verima/CreeDocuments/templatesHtml/groupeRatio.html create mode 100644 src/Tools/Verima/CreeDocuments/templatesHtml/groupeTaille.html create mode 100644 src/Tools/Verima/CreeDocuments/templatesHtml/maillageEntete.html create mode 100644 src/Tools/Verima/Gui/desFenetreChoix.py create mode 100644 src/Tools/Verima/Gui/myMain.py create mode 100644 src/Tools/Verima/Gui/nomBase.py create mode 100644 src/Tools/Verima/Stats/Type_Maille.py create mode 100644 src/Tools/Verima/Stats/getCritere.py diff --git a/src/Tools/Verima/Base/tableGroupeRatios.py b/src/Tools/Verima/Base/tableGroupeRatios.py new file mode 100644 index 000000000..b74d83b7d --- /dev/null +++ b/src/Tools/Verima/Base/tableGroupeRatios.py @@ -0,0 +1,38 @@ +from PyQt4 import QtSql, QtCore +from tableDeBase import TableDeBase + +class TableGroupeRatios (TableDeBase): + def __init__(self): + TableDeBase.__init__(self,"GroupesRatios") + self.setField(('Maillage','Version','Groupe','RatioMax','RatioMin','Quartile1','Mediane','Quartile3','Moyenne')) + self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion','Groupe')) + + def createSqlTable(self): + query=QtSql.QSqlQuery() + + texteQuery ="create table GroupesRatios(idMaillage int, idVersion int, Groupe varchar(40)," + texteQuery+="RatioMax float, RatioMin float, " + texteQuery+="Q1 float," + texteQuery+="Mediane float," + texteQuery+="Q3 float," + texteQuery+="Moyenne float," + texteQuery+="foreign key (idMaillage) references Maillages(id)," + texteQuery+="foreign key (idVersion) references Versions(id)," + texteQuery+="foreign key (Groupe) references GroupesRef(nomGroupe)," + texteQuery+="primary key (idMaillage,idVersion,Groupe));" + print "Creation de TableGroupeRatios : " , query.exec_(texteQuery) + + def getVal(self,idMaillage, idVersion, Groupe, Entite): + query=QtSql.QSqlQuery() + texteQuery ='select '+ str(Entite) + ' from GroupesRatios where idMaillage='+str(idMaillage) + texteQuery+=' and idVersion='+str(idVersion) + texteQuery+=" and Groupe='" + str(Groupe) +"';" + query.exec_(texteQuery) + nb=0 + val=0 # Valeur si l enregistrement n existe pas + while (query.next()) : + val=query.value(0).toFloat()[0] + nb=nb+1 + if nb > 1 : print "Double valeur de Reference dans la table des mailles" + return val + diff --git a/src/Tools/Verima/Base/tableGroupeTailles.py b/src/Tools/Verima/Base/tableGroupeTailles.py new file mode 100644 index 000000000..6c2763c2a --- /dev/null +++ b/src/Tools/Verima/Base/tableGroupeTailles.py @@ -0,0 +1,39 @@ +from PyQt4 import QtSql, QtCore +from tableDeBase import TableDeBase + +class TableGroupeTailles (TableDeBase): + def __init__(self): + TableDeBase.__init__(self,"GroupeTailles") + self.setField(('Maillage','Version','Groupe','TailleMax','TailleMin','Quartile1','Mediane','Quartile3','Moyenne')) + self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion')) + + def createSqlTable(self): + query=QtSql.QSqlQuery() + + texteQuery ="create table GroupeTailles(idMaillage int, idVersion int, " + texteQuery+="Groupe varchar(40),TailleMax float, TailleMin float, " + texteQuery+="Q1 float, " + texteQuery+="Mediane float, " + texteQuery+="Q3 float, " + texteQuery+="Moyenne float, " + texteQuery+="foreign key (idMaillage) references Maillages(id)," + texteQuery+="foreign key (idVersion) references Versions(id)," + texteQuery+="foreign key (Groupe) references GroupesRef(nomGroupe)," + texteQuery+="primary key (idMaillage,idVersion,Groupe));" + + print "Creation de TableGroupeTailles : " , query.exec_(texteQuery) + + def getVal(self,idMaillage, idVersion, Groupe, Entite): + query=QtSql.QSqlQuery() + texteQuery ='select '+ str(Entite) + ' from GroupeTailles where idMaillage='+str(idMaillage) + texteQuery+=' and idVersion='+str(idVersion) + texteQuery+=" and Groupe='" + str(Groupe) +"';" + query.exec_(texteQuery) + nb=0 + val=0 # Valeur si l enregistrement n existe pas + while (query.next()) : + val=query.value(0).toFloat()[0] + nb=nb+1 + if nb > 1 : print "Double valeur de Reference dans la table des tailles" + return val + diff --git a/src/Tools/Verima/CreeDocuments/templatesHtml/groupeRatio.html b/src/Tools/Verima/CreeDocuments/templatesHtml/groupeRatio.html new file mode 100644 index 000000000..32b202d78 --- /dev/null +++ b/src/Tools/Verima/CreeDocuments/templatesHtml/groupeRatio.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + +

+Aspect +Ratio

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+


+

+
+

Référence

+
+

Version + courante

+
+

Différence + absolue

+
+

Différence + relative

+
+

Warning

+
+

Ratio + Max

+
+

%RMAXREF%

+
+

%RMAX%

+
+

%DIFARMAX%

+
+

%DIFRRMAX%

+
+

%WRRMAX%

+
+

Ratio + Min

+
+

%RMINREF%

+
+

%RMIN%

+
+

%DIFARMIN%

+
+

%DIFRRMIN%

+
+

%WRRMIN%

+
+

Moyenne

+
+

%RMOYREF%

+
+

%RMOY%

+
+

%DIFARMOY%

+
+

%DIFRRMOY%

+
+

%WRRMOY%

+
+

1er + Quartile

+
+

%R1QREF%

+
+

%R1Q%

+
+

%DIFAR1Q%

+
+

%DIFRR1Q%

+
+

%WRR1Q%

+
+

Elt + Médian

+
+

%RMEDREF%

+
+

%RMED%

+
+

%DIFARMED%

+
+

%DIFRRMED%

+
+

%WRRMED%

+
+

3ieme + Quartile

+
+

%R3QREF%

+
+

%R3Q%

+
+

%DIFAR3Q%

+
+

%DIFRR3Q%

+
+

%WRR3Q%

+
+

+

+ + diff --git a/src/Tools/Verima/CreeDocuments/templatesHtml/groupeTaille.html b/src/Tools/Verima/CreeDocuments/templatesHtml/groupeTaille.html new file mode 100644 index 000000000..2a5c90071 --- /dev/null +++ b/src/Tools/Verima/CreeDocuments/templatesHtml/groupeTaille.html @@ -0,0 +1,178 @@ + + + + + + + + + + + + + +

+Longueur +des arêtes des mailles +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+


+

+
+

Référence

+
+

Version + courante

+
+

Différence + absolue

+
+

Différence + relative

+
+

Warning

+
+

Taille + Max

+
+

%TMAXREF%

+
+

%TMAX%

+
+

%DIFATMAX%

+
+

%DIFRTMAX%

+
+

%WTMAX%

+
+

Taille + Min

+
+

%TMINREF%

+
+

%TMIN%

+
+

%DIFATMIN%

+
+

%DIFRTMIN%

+
+

%WTMIN%

+
+

Moyenne

+
+

%TMOYREF%

+
+

%TMOY%

+
+

%DIFATMOY%

+
+

%DIFRTMOY%

+
+

%WTMOY%

+
+

1er + Quartile

+
+

%T1QREF%

+
+

%T1Q%

+
+

%DIFAT1Q%

+
+

%DIFRT1Q%

+
+

%WT1Q%

+
+

Elt + Médian

+
+

%TMEDREF%

+
+

%TMED%

+
+

%DIFATMED%

+
+

%DIFRTMED%

+
+

%WTMED%

+
+

3ieme + Quartile

+
+

%T3QREF%

+
+

%T3Q%

+
+

%DIFAT3Q%

+
+

%DIFRT3Q%

+
+

%WT3Q%

+
+

+

+ + diff --git a/src/Tools/Verima/CreeDocuments/templatesHtml/maillageEntete.html b/src/Tools/Verima/CreeDocuments/templatesHtml/maillageEntete.html new file mode 100644 index 000000000..4ffe09df1 --- /dev/null +++ b/src/Tools/Verima/CreeDocuments/templatesHtml/maillageEntete.html @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + +


+

+

+
+

+

Cas +Test : %MAILLAGE%

+

Mailleur +testé : %MAILLEUR%

+

Version +de Réference %VERSIONREF%

+

+Performance +CPU +

+ + + + + + + + + + + + + + + + + + + + + + + +
+


+

+
+

Référence

+
+

Version + courante

+
+

Différence + absolue

+
+

Différence + relative

+
+

Warning

+
+

Nombre + de seconde CPU

+
+

%REFCPU%

+
+

%NBCPU%

+
+

%DIFCPU%

+
+

%DIFREL%

+
+

%WARNING%

+
+

+

+ + diff --git a/src/Tools/Verima/Gui/desFenetreChoix.py b/src/Tools/Verima/Gui/desFenetreChoix.py new file mode 100644 index 000000000..af7dc9118 --- /dev/null +++ b/src/Tools/Verima/Gui/desFenetreChoix.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'desFenetreChoix.ui' +# +# Created: Thu Mar 27 11:25:15 2014 +# by: PyQt4 UI code generator 4.9.6 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig) + +class Ui_Choix(object): + def setupUi(self, Choix): + Choix.setObjectName(_fromUtf8("Choix")) + Choix.resize(440, 708) + self.gridLayout = QtGui.QGridLayout(Choix) + self.gridLayout.setObjectName(_fromUtf8("gridLayout")) + self.buttonBox = QtGui.QDialogButtonBox(Choix) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName(_fromUtf8("buttonBox")) + self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1) + self.groupBox = QtGui.QGroupBox(Choix) + self.groupBox.setObjectName(_fromUtf8("groupBox")) + self.layoutWidget = QtGui.QWidget(self.groupBox) + self.layoutWidget.setGeometry(QtCore.QRect(40, 310, 311, 269)) + self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) + self.gridLayout_2 = QtGui.QGridLayout(self.layoutWidget) + self.gridLayout_2.setMargin(0) + self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) + self.PBMaille = QtGui.QPushButton(self.layoutWidget) + self.PBMaille.setObjectName(_fromUtf8("PBMaille")) + self.gridLayout_2.addWidget(self.PBMaille, 1, 0, 1, 1) + self.PBRatio = QtGui.QPushButton(self.layoutWidget) + self.PBRatio.setObjectName(_fromUtf8("PBRatio")) + self.gridLayout_2.addWidget(self.PBRatio, 3, 0, 1, 1) + self.PBPerf = QtGui.QPushButton(self.layoutWidget) + self.PBPerf.setObjectName(_fromUtf8("PBPerf")) + self.gridLayout_2.addWidget(self.PBPerf, 7, 0, 1, 1) + self.PBGroupeRatio = QtGui.QPushButton(self.layoutWidget) + self.PBGroupeRatio.setObjectName(_fromUtf8("PBGroupeRatio")) + self.gridLayout_2.addWidget(self.PBGroupeRatio, 6, 0, 1, 1) + self.PBGroupe = QtGui.QPushButton(self.layoutWidget) + self.PBGroupe.setObjectName(_fromUtf8("PBGroupe")) + self.gridLayout_2.addWidget(self.PBGroupe, 4, 0, 1, 1) + self.PBTaille = QtGui.QPushButton(self.layoutWidget) + self.PBTaille.setObjectName(_fromUtf8("PBTaille")) + self.gridLayout_2.addWidget(self.PBTaille, 2, 0, 1, 1) + self.PBGroupeTaille = QtGui.QPushButton(self.layoutWidget) + self.PBGroupeTaille.setObjectName(_fromUtf8("PBGroupeTaille")) + self.gridLayout_2.addWidget(self.PBGroupeTaille, 5, 0, 1, 1) + self.layoutWidget1 = QtGui.QWidget(self.groupBox) + self.layoutWidget1.setGeometry(QtCore.QRect(40, 50, 301, 211)) + self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1")) + self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget1) + self.verticalLayout.setMargin(0) + self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) + self.PBMailleur = QtGui.QPushButton(self.layoutWidget1) + self.PBMailleur.setObjectName(_fromUtf8("PBMailleur")) + self.verticalLayout.addWidget(self.PBMailleur) + self.PBMaillage = QtGui.QPushButton(self.layoutWidget1) + self.PBMaillage.setObjectName(_fromUtf8("PBMaillage")) + self.verticalLayout.addWidget(self.PBMaillage) + self.PBMachine = QtGui.QPushButton(self.layoutWidget1) + self.PBMachine.setObjectName(_fromUtf8("PBMachine")) + self.verticalLayout.addWidget(self.PBMachine) + self.PBVersion = QtGui.QPushButton(self.layoutWidget1) + self.PBVersion.setObjectName(_fromUtf8("PBVersion")) + self.verticalLayout.addWidget(self.PBVersion) + self.PBGroupesRef = QtGui.QPushButton(self.layoutWidget1) + self.PBGroupesRef.setObjectName(_fromUtf8("PBGroupesRef")) + self.verticalLayout.addWidget(self.PBGroupesRef) + self.gridLayout.addWidget(self.groupBox, 1, 0, 1, 1) + + self.retranslateUi(Choix) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Choix.accept) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Choix.reject) + QtCore.QMetaObject.connectSlotsByName(Choix) + + def retranslateUi(self, Choix): + Choix.setWindowTitle(_translate("Choix", "Verification de Maillage", None)) + self.groupBox.setTitle(_translate("Choix", "Tables ", None)) + self.PBMaille.setText(_translate("Choix", "Table Mailles", None)) + self.PBRatio.setText(_translate("Choix", "Table Ratios", None)) + self.PBPerf.setText(_translate("Choix", "Table Performances", None)) + self.PBGroupeRatio.setText(_translate("Choix", "Table Groupe Ratios", None)) + self.PBGroupe.setText(_translate("Choix", "Table Groupes", None)) + self.PBTaille.setText(_translate("Choix", "Table Tailles", None)) + self.PBGroupeTaille.setText(_translate("Choix", "Table Groupe Tailles", None)) + self.PBMailleur.setText(_translate("Choix", "Table Mailleurs", None)) + self.PBMaillage.setText(_translate("Choix", "Table Maillages", None)) + self.PBMachine.setText(_translate("Choix", "Table Machines", None)) + self.PBVersion.setText(_translate("Choix", "Table Versions", None)) + self.PBGroupesRef.setText(_translate("Choix", "Table Groupes Référence", None)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + Choix = QtGui.QDialog() + ui = Ui_Choix() + ui.setupUi(Choix) + Choix.show() + sys.exit(app.exec_()) + diff --git a/src/Tools/Verima/Gui/myMain.py b/src/Tools/Verima/Gui/myMain.py new file mode 100644 index 000000000..b29b99f3a --- /dev/null +++ b/src/Tools/Verima/Gui/myMain.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'myMain.ui' +# +# Created: Wed Feb 19 11:02:51 2014 +# by: PyQt4 UI code generator 4.7.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_Gestion(object): + def setupUi(self, Gestion): + Gestion.setObjectName("Gestion") + Gestion.resize(400, 525) + self.gridLayout_4 = QtGui.QGridLayout(Gestion) + self.gridLayout_4.setObjectName("gridLayout_4") + self.gridLayout_2 = QtGui.QGridLayout() + self.gridLayout_2.setObjectName("gridLayout_2") + self.gridLayout_4.addLayout(self.gridLayout_2, 2, 0, 1, 1) + spacerItem = QtGui.QSpacerItem(20, 45, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout_4.addItem(spacerItem, 1, 0, 1, 1) + self.gridLayout_3 = QtGui.QGridLayout() + self.gridLayout_3.setObjectName("gridLayout_3") + self.BExp = QtGui.QPushButton(Gestion) + self.BExp.setMinimumSize(QtCore.QSize(281, 41)) + self.BExp.setObjectName("BExp") + self.gridLayout_3.addWidget(self.BExp, 0, 0, 1, 1) + self.BImp = QtGui.QPushButton(Gestion) + self.BImp.setMinimumSize(QtCore.QSize(281, 41)) + self.BImp.setObjectName("BImp") + self.gridLayout_3.addWidget(self.BImp, 1, 0, 1, 1) + self.gridLayout_4.addLayout(self.gridLayout_3, 5, 0, 1, 1) + self.gridLayout = QtGui.QGridLayout() + self.gridLayout.setObjectName("gridLayout") + self.BCree = QtGui.QPushButton(Gestion) + self.BCree.setMinimumSize(QtCore.QSize(281, 41)) + self.BCree.setObjectName("BCree") + self.gridLayout.addWidget(self.BCree, 0, 0, 1, 1) + self.BVue = QtGui.QPushButton(Gestion) + self.BVue.setMinimumSize(QtCore.QSize(281, 41)) + self.BVue.setObjectName("BVue") + self.gridLayout.addWidget(self.BVue, 1, 0, 1, 1) + self.gridLayout_4.addLayout(self.gridLayout, 0, 0, 1, 1) + spacerItem1 = QtGui.QSpacerItem(20, 45, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout_4.addItem(spacerItem1, 4, 0, 1, 1) + self.BStat = QtGui.QPushButton(Gestion) + self.BStat.setMinimumSize(QtCore.QSize(281, 41)) + self.BStat.setObjectName("BStat") + self.gridLayout_4.addWidget(self.BStat, 3, 0, 1, 1) + + self.retranslateUi(Gestion) + QtCore.QMetaObject.connectSlotsByName(Gestion) + + def retranslateUi(self, Gestion): + Gestion.setWindowTitle(QtGui.QApplication.translate("Gestion", "Gestion de la Database", None, QtGui.QApplication.UnicodeUTF8)) + self.BExp.setText(QtGui.QApplication.translate("Gestion", "Export de la database", None, QtGui.QApplication.UnicodeUTF8)) + self.BImp.setText(QtGui.QApplication.translate("Gestion", "Import d\'une database", None, QtGui.QApplication.UnicodeUTF8)) + self.BCree.setText(QtGui.QApplication.translate("Gestion", "Creation de la database", None, QtGui.QApplication.UnicodeUTF8)) + self.BVue.setText(QtGui.QApplication.translate("Gestion", "Visualiser la database", None, QtGui.QApplication.UnicodeUTF8)) + self.BStat.setText(QtGui.QApplication.translate("Gestion", "Statistiques", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + Gestion = QtGui.QWidget() + ui = Ui_Gestion() + ui.setupUi(Gestion) + Gestion.show() + sys.exit(app.exec_()) + diff --git a/src/Tools/Verima/Gui/nomBase.py b/src/Tools/Verima/Gui/nomBase.py new file mode 100644 index 000000000..921e12c2a --- /dev/null +++ b/src/Tools/Verima/Gui/nomBase.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'nomBase.ui' +# +# Created: Wed Feb 19 11:02:51 2014 +# by: PyQt4 UI code generator 4.7.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_LEDataBaseName(object): + def setupUi(self, LEDataBaseName): + LEDataBaseName.setObjectName("LEDataBaseName") + LEDataBaseName.resize(400, 61) + self.gridLayout = QtGui.QGridLayout(LEDataBaseName) + self.gridLayout.setObjectName("gridLayout") + self.LEBaseName = QtGui.QLineEdit(LEDataBaseName) + self.LEBaseName.setMinimumSize(QtCore.QSize(341, 41)) + self.LEBaseName.setObjectName("LEBaseName") + self.gridLayout.addWidget(self.LEBaseName, 0, 0, 1, 1) + + self.retranslateUi(LEDataBaseName) + QtCore.QMetaObject.connectSlotsByName(LEDataBaseName) + + def retranslateUi(self, LEDataBaseName): + LEDataBaseName.setWindowTitle(QtGui.QApplication.translate("LEDataBaseName", "Enter DataBase File", None, QtGui.QApplication.UnicodeUTF8)) + self.LEBaseName.setText(QtGui.QApplication.translate("LEDataBaseName", "myMesh.db", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + LEDataBaseName = QtGui.QDialog() + ui = Ui_LEDataBaseName() + ui.setupUi(LEDataBaseName) + LEDataBaseName.show() + sys.exit(app.exec_()) + diff --git a/src/Tools/Verima/Stats/Type_Maille.py b/src/Tools/Verima/Stats/Type_Maille.py new file mode 100644 index 000000000..7fc73a3b5 --- /dev/null +++ b/src/Tools/Verima/Stats/Type_Maille.py @@ -0,0 +1,26 @@ +dicoDimENtite= { 'Entity_Node':0, +'Entity_0D':0, +'Entity_Ball':0, +'Entity_Edge':0, +'Entity_Quad_Edge':0, +'Entity_Triangle':1, +'Entity_Quad_Triangle':1, +'Entity_BiQuad_Triangle':1, +'Entity_Quadrangle':1, +'Entity_Quad_Quadrangle':1, +'Entity_BiQuad_Quadrangle':1, +'Entity_Polygon':1, +'Entity_Quad_Polygon':1, +'Entity_Tetra':1, +'Entity_Quad_Tetra':1, +'Entity_Hexa':1, +'Entity_Quad_Hexa':1, +'Entity_TriQuad_Hexa':1, +'Entity_Pyramid ':1, +'Entity_Quad_Pyramid':1, +'Entity_Penta ':1, +'Entity_Quad_Penta':1, +'Entity_Hexagonal_Prism':1, +'Entity_Polyhedra':1, +'Entity_Quad_Polyhedra':1, +} diff --git a/src/Tools/Verima/Stats/getCritere.py b/src/Tools/Verima/Stats/getCritere.py new file mode 100644 index 000000000..16239e170 --- /dev/null +++ b/src/Tools/Verima/Stats/getCritere.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys,os +import salome +from getStats import getGroupesRef +from Type_Maille import dicoDimENtite + +def getCritere(dim,NomMesh,acritere,theStudy): + import SMESH + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New(theStudy) + import numpy +# print dim,NomMesh,acritere + if dim == 2 : + NumElt=NomMesh.GetElementsByType(SMESH.FACE) + if dim == 3 : + NumElt=NomMesh.GetElementsByType(SMESH.VOLUME) + + critere=[] + if acritere =="Ratio" : + for i in range(len(NumElt)): + critere.append (NomMesh.GetAspectRatio(NumElt[i])) + + if acritere =="Length" : + for i in range(len(NumElt)): + critere.append (NomMesh.GetMaxElementLength(NumElt[i])) + + crit= numpy.array(critere) + max=crit.max() + min=crit.min() + moyenne=crit.mean() + M=numpy.median(crit) + Q1=numpy.percentile(crit,25) + Q3=numpy.percentile(crit,75) + + return [max,min,Q1,M,Q3,moyenne] + +def getCritereGroupe(NomMesh,NomGr,acritere,theStudy): + import SMESH + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New(theStudy) + import numpy + + # on ne traite que les mailles 2D et 3D + NumElt = NomGr.GetListOfID() + type_gr=NomMesh.GetElementGeomType(NumElt[0]) + +# print "critere",acritere +# print "type groupe",type_gr +# print dicoDimENtite[str(type_gr)] + + if dicoDimENtite[str(type_gr)]==0 : + return [0,0,0,0,0,0] + + critere=[] + if acritere =="Ratio" : + for i in range(len(NumElt)): + critere.append (NomMesh.GetAspectRatio(NumElt[i])) + + if acritere =="Length" : + for i in range(len(NumElt)): + critere.append (NomMesh.GetMaxElementLength(NumElt[i])) + + crit= numpy.array(critere) + max=crit.max() + min=crit.min() + moyenne=crit.mean() + M=numpy.median(crit) + Q1=numpy.percentile(crit,25) + Q3=numpy.percentile(crit,75) + + return [max,min,Q1,M,Q3,moyenne] + +def getObjectsGroupe(Mesh,liste,theStudy): + import SMESH + from salome.smesh import smeshBuilder + dico={} + lGroups=Mesh.GetGroups() + for g in lGroups : + name = g.GetName() + for n in liste : + if name == n : dico[name]=g + return dico + +def getStatsCritere(dim,Mesh,fichierMedResult,theStudy): + fichierStatRatio=fichierMedResult.replace('.med','.ratio') + max,min,Q1,M,Q3,moyenne = getCritere(dim,Mesh,"Ratio",theStudy) + f = open(fichierStatRatio, 'w') + f.write(str(max)+","+str(min)+","+str(Q1)+","+str(M)+","+str(Q3)+","+str(moyenne)) + f.close() + + fichierStatRatio=fichierMedResult.replace('.med','.taille') + max,min,Q1,M,Q3,moyenne = getCritere(dim,Mesh,"Length",theStudy) + f = open(fichierStatRatio, 'w') + f.write(str(max)+","+str(min)+","+str(Q1)+","+str(M)+","+str(Q3)+","+str(moyenne)) + f.close() + + liste=getGroupesRef(fichierMedResult) + dicoGroupe=getObjectsGroupe(Mesh,liste,theStudy) + for groupe in liste : + max,min,Q1,M,Q3,moyenne=getCritereGroupe(Mesh,dicoGroupe[groupe],"Ratio",theStudy) + extension="_"+groupe+'_Ratio.res' + fichier=fichierMedResult.replace('.med',extension) + f = open(fichier, 'w') + f.write(str(max)+","+str(min)+","+str(Q1)+","+str(M)+","+str(Q3)+","+str(moyenne)) + f.close() + max,min,Q1,M,Q3,moyenne=getCritereGroupe(Mesh,dicoGroupe[groupe],"Length",theStudy) + extension="_"+groupe+'_Taille.res' + fichier=fichierMedResult.replace('.med',extension) + f = open(fichier, 'w') + f.write(str(max)+","+str(min)+","+str(Q1)+","+str(M)+","+str(Q3)+","+str(moyenne)) + f.close() + -- 2.39.2