mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
passage en classe
This commit is contained in:
parent
14c45e1f6f
commit
e55b4566a4
@ -17,10 +17,13 @@
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
__revision__ = "V02.01"
|
||||
|
||||
"""Lancement des cas-tests de blocFissure"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
@ -35,236 +38,437 @@ LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log")
|
||||
#initLog.setPerfTests(LOGFILE) # critical = 50
|
||||
#initLog.setAlways(LOGFILE) # critical = 50
|
||||
|
||||
# ---tous les cas en séquence, ou les cas sélectionnés ...
|
||||
# Les cas qui marchent ...
|
||||
TORUNOK = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ] # OK 19/04/2021
|
||||
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
|
||||
#RUNALL = False
|
||||
RUNALL = True
|
||||
if RUNALL:
|
||||
TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
|
||||
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
|
||||
TORUN = TORUNOK
|
||||
else:
|
||||
TORUNPB = list()
|
||||
for IAUX in TORUNOK:
|
||||
TORUNPB.append((IAUX+1)%2)
|
||||
print ("TORUN = {} # OK".format(TORUNOK))
|
||||
print ("TORUN = {} # PB".format(TORUNPB))
|
||||
# genereMateriel
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0] # aucun
|
||||
TORUN = [ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeAngle
|
||||
TORUN = [ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # cubeFin
|
||||
TORUN = [ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # decoupeCylindre
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # disque_perce + ellipse_disque
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # ellipse + fissureGauche2
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # ellipse_probleme + fissureGauche2
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteCourbe
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # eprouvetteDroite
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # fissureGauche2
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] # vis
|
||||
TORUN = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] # tube
|
||||
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28
|
||||
TORUN = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0] # OK
|
||||
# -----------------------------------------------------------------------------------------------
|
||||
TORUNPB = list()
|
||||
for IAUX in TORUNOK:
|
||||
TORUNPB.append((IAUX+1)%2)
|
||||
print ("TORUN = {} # OK".format(TORUNOK))
|
||||
print ("TORUN = {} # PB".format(TORUNPB))
|
||||
|
||||
def caract_l_problemes ():
|
||||
"""Caractérisation des problèmes"""
|
||||
d_aux = dict()
|
||||
l_problemes = list()
|
||||
# Numéro de référence associé à chaque problème
|
||||
NREF_PB = dict()
|
||||
NREF_PB["cubeAngle"] = 0
|
||||
NREF_PB["cubeAngle2"] = 1
|
||||
NREF_PB["cubeCoin"] = 2
|
||||
NREF_PB["cubeMilieu"] = 3
|
||||
NREF_PB["cubeTransverse"] = 4
|
||||
NREF_PB["cylindre"] = 5
|
||||
NREF_PB["cylindre2"] = 6
|
||||
NREF_PB["disquePerce"] = 7
|
||||
NREF_PB["ellipse1"] = 8
|
||||
NREF_PB["ellipse2"] = 9
|
||||
NREF_PB["eprouvetteCourbe"] = 10
|
||||
NREF_PB["eprouvetteDroite"] = 11
|
||||
NREF_PB["eprouvetteDroite_2"] = 12
|
||||
NREF_PB["faceGauche"] = 13
|
||||
NREF_PB["faceGauche_2"] = 14
|
||||
NREF_PB["fissureCoude_1"] = 15
|
||||
NREF_PB["fissureCoude_2"] = 16
|
||||
NREF_PB["fissureCoude_3"] = 17
|
||||
NREF_PB["fissureCoude_4"] = 18
|
||||
NREF_PB["fissureCoude_5"] = 19
|
||||
NREF_PB["fissureCoude_6"] = 20
|
||||
NREF_PB["fissureCoude_7"] = 21
|
||||
NREF_PB["fissureCoude_8"] = 22
|
||||
NREF_PB["fissureCoude_9"] = 23
|
||||
NREF_PB["fissureCoude_10"] = 24
|
||||
NREF_PB["fissure_Coude"] = 25
|
||||
NREF_PB["fissure_Coude_4"] = 26
|
||||
NREF_PB["vis_1"] = 27
|
||||
NREF_PB["tube"] = 28
|
||||
|
||||
n_cas = 0
|
||||
# genereMateriel : cubeAngle
|
||||
from blocFissure.CasTests.cubeAngle import cubeAngle
|
||||
l_problemes.append(cubeAngle(n_cas))
|
||||
#========================= Début de la classe ===================================
|
||||
|
||||
n_cas = 1
|
||||
# genereMateriel : cubeAngle
|
||||
from blocFissure.CasTests.cubeAngle2 import cubeAngle2
|
||||
l_problemes.append(cubeAngle2(n_cas))
|
||||
class blocFissureTest (object):
|
||||
|
||||
n_cas = 2
|
||||
# genereMateriel : cubeFin
|
||||
from blocFissure.CasTests import cubeCoin
|
||||
l_problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, n_cas))
|
||||
d_aux[n_cas] = "cubeCoin"
|
||||
"""Test de blocFissure
|
||||
|
||||
n_cas = 3
|
||||
# genereMateriel : cubeFin
|
||||
from blocFissure.CasTests import cubeMilieu
|
||||
l_problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, n_cas))
|
||||
d_aux[n_cas] = "cubeMilieu"
|
||||
Options facultatives
|
||||
********************
|
||||
Le(s) numéro/nom du/des tests à passer. Si aucun n'est donné, tous les cas sont passés.
|
||||
"""
|
||||
|
||||
n_cas = 4
|
||||
# genereMateriel : cubeFin
|
||||
from blocFissure.CasTests import cubeTransverse
|
||||
l_problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, n_cas))
|
||||
d_aux[n_cas] = "cubeTransverse"
|
||||
# A. La base
|
||||
|
||||
n_cas = 5
|
||||
# genereMateriel : decoupeCylindre
|
||||
from blocFissure.CasTests.cylindre import cylindre
|
||||
l_problemes.append(cylindre(n_cas))
|
||||
message_info = ""
|
||||
_verbose = 0
|
||||
_verbose_max = 0
|
||||
affiche_aide_globale = 0
|
||||
|
||||
n_cas = 6
|
||||
# genereMateriel : decoupeCylindre
|
||||
from blocFissure.CasTests.cylindre_2 import cylindre_2
|
||||
l_problemes.append(cylindre_2(n_cas))
|
||||
# B. Les variables
|
||||
|
||||
n_cas = 7
|
||||
# genereMateriel : disque_perce
|
||||
# genereMateriel : ellipse_disque
|
||||
from blocFissure.CasTests import disquePerce
|
||||
l_problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, n_cas))
|
||||
d_aux[n_cas] = "disquePerce"
|
||||
l_cas = None
|
||||
l_problemes = None
|
||||
d_nom_probleme = None
|
||||
l_materiels = None
|
||||
|
||||
n_cas = 8
|
||||
# genereMateriel: ellipse
|
||||
# genereMateriel : fissureGauche2
|
||||
from blocFissure.CasTests.ellipse_1 import ellipse_1
|
||||
l_problemes.append(ellipse_1(n_cas))
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
n_cas = 9
|
||||
# genereMateriel: ellipse_probleme
|
||||
# genereMateriel : fissureGauche2
|
||||
from blocFissure.CasTests.ellipse_2 import ellipse_2
|
||||
l_problemes.append(ellipse_2(n_cas))
|
||||
def __init__ ( self, liste_option ):
|
||||
|
||||
n_cas = 10
|
||||
# genereMateriel : eprouvetteCourbe
|
||||
from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
|
||||
l_problemes.append(eprouvetteCourbe(n_cas))
|
||||
"""Le constructeur de la classe blocFissureTest"""
|
||||
|
||||
n_cas = 11
|
||||
# genereMateriel : eprouvetteDroite
|
||||
from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
|
||||
l_problemes.append(eprouvetteDroite(n_cas))
|
||||
self.l_cas = list()
|
||||
erreur = False
|
||||
|
||||
n_cas = 12
|
||||
# genereMateriel : eprouvetteDroite
|
||||
from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
|
||||
l_problemes.append(eprouvetteDroite_2(n_cas))
|
||||
for option in liste_option :
|
||||
|
||||
n_cas = 13
|
||||
# genereMateriel : fissureGauche
|
||||
from blocFissure.CasTests.faceGauche import faceGauche
|
||||
l_problemes.append(faceGauche(n_cas))
|
||||
#print (option, type(option))
|
||||
if isinstance(option, str):
|
||||
saux = option.upper()
|
||||
else:
|
||||
saux = option
|
||||
#print (saux)
|
||||
# Options générales de pilotage
|
||||
if saux in ( "-H", "-HELP" ):
|
||||
self.affiche_aide_globale = 1
|
||||
elif saux == "-V" :
|
||||
self._verbose = 1
|
||||
elif saux == "-VMAX" :
|
||||
self._verbose = 1
|
||||
self._verbose_max = 1
|
||||
|
||||
n_cas = 14
|
||||
# genereMateriel : fissureGauche2
|
||||
from blocFissure.CasTests.faceGauche_2 import faceGauche_2
|
||||
l_problemes.append(faceGauche_2(n_cas))
|
||||
else :
|
||||
# Options du traitement
|
||||
if isinstance(option, int):
|
||||
self.l_cas.append(option)
|
||||
elif ( option in NREF_PB ):
|
||||
self.l_cas.append(NREF_PB[option])
|
||||
else:
|
||||
print ("Option inconnue : {}".format(option))
|
||||
erreur = True
|
||||
|
||||
n_cas = 15
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
|
||||
l_problemes.append(fissureCoude_1(n_cas))
|
||||
# Si aucun cas n'est donné, on prend tous ceux par défaut
|
||||
if not self.l_cas:
|
||||
for i_aux, valeur in enumerate(TORUNOK):
|
||||
if valeur:
|
||||
self.l_cas.append(i_aux)
|
||||
|
||||
n_cas = 16
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
|
||||
l_problemes.append(fissureCoude_2(n_cas))
|
||||
if erreur:
|
||||
self.l_cas = list()
|
||||
|
||||
n_cas = 17
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
|
||||
l_problemes.append(fissureCoude_3(n_cas))
|
||||
if self._verbose_max:
|
||||
print ("Liste des cas : {}".format(self.l_cas))
|
||||
|
||||
n_cas = 18
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
|
||||
l_problemes.append(fissureCoude_4(n_cas))
|
||||
if self._verbose_max:
|
||||
initLog.setVerbose(LOGFILE) # info = 20
|
||||
#if self._verbose_max:
|
||||
#initLog.setDebug(LOGFILE) # debug = 10
|
||||
|
||||
n_cas = 19
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
|
||||
l_problemes.append(fissureCoude_5(n_cas))
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
n_cas = 20
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
|
||||
l_problemes.append(fissureCoude_6(n_cas))
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
n_cas = 21
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
|
||||
l_problemes.append(fissureCoude_7(n_cas))
|
||||
def __del__(self):
|
||||
"""A la suppression de l'instance de classe"""
|
||||
if self._verbose_max:
|
||||
print ("Suppression de l'instance de la classe.")
|
||||
|
||||
n_cas = 22
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
|
||||
l_problemes.append(fissureCoude_8(n_cas))
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
n_cas = 23
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
|
||||
l_problemes.append(fissureCoude_9(n_cas))
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
n_cas = 24
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
|
||||
l_problemes.append(fissureCoude_10(n_cas))
|
||||
def caract_l_problemes (self):
|
||||
"""Caractérisation des problèmes"""
|
||||
self.d_nom_probleme = dict()
|
||||
self.l_problemes = list()
|
||||
self.l_materiels = list()
|
||||
|
||||
n_cas = 25
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissure_Coude import fissure_Coude
|
||||
l_problemes.append(fissure_Coude(n_cas))
|
||||
n_cas = 0
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : cubeAngle
|
||||
from blocFissure.CasTests.cubeAngle import cubeAngle
|
||||
self.l_problemes.append(cubeAngle(n_cas))
|
||||
self.l_materiels.append("cubeAngle")
|
||||
|
||||
n_cas = 26
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
|
||||
l_problemes.append(fissure_Coude_4(n_cas))
|
||||
n_cas = 1
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : cubeAngle
|
||||
from blocFissure.CasTests.cubeAngle2 import cubeAngle2
|
||||
self.l_problemes.append(cubeAngle2(n_cas))
|
||||
self.l_materiels.append("cubeAngle")
|
||||
|
||||
n_cas = 27
|
||||
# genereMateriel : vis
|
||||
from blocFissure.CasTests.vis_1 import vis_1
|
||||
l_problemes.append(vis_1(n_cas))
|
||||
n_cas = 2
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : cubeFin
|
||||
from blocFissure.CasTests import cubeCoin
|
||||
self.l_problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, n_cas))
|
||||
self.d_nom_probleme[n_cas] = "cubeCoin"
|
||||
self.l_materiels.append("cubeFin")
|
||||
|
||||
n_cas = 28
|
||||
# genereMateriel : tube
|
||||
from blocFissure.CasTests.tube import tube
|
||||
l_problemes.append(tube(n_cas))
|
||||
#"Mesh_13" has not been computed:
|
||||
#- "algo2d_facePeau_0" failed on "FACE_12 to mesh". Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
|
||||
#- "algo1d_cercle1_0" failed on EDGE #20. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
#- "algo1d_cercle1_0" failed on EDGE #17. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
#- "algo1d_cercle1_0" failed on EDGE #15. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
#- "algo1d_cercle1_0" failed on EDGE #12. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
n_cas = 3
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : cubeFin
|
||||
from blocFissure.CasTests import cubeMilieu
|
||||
self.l_problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, n_cas))
|
||||
self.d_nom_probleme[n_cas] = "cubeMilieu"
|
||||
self.l_materiels.append("cubeFin")
|
||||
|
||||
return l_problemes, d_aux
|
||||
#=============================================================
|
||||
def calcul_cas (n_cas, cas, d_aux, ligne):
|
||||
"""Calcul d'un cas"""
|
||||
texte = ""
|
||||
if n_cas in d_aux:
|
||||
nom = d_aux[n_cas]
|
||||
else:
|
||||
nom = cas.nomProbleme
|
||||
texte_a = "\n=== Exécution du cas n° {}, '{}'".format(n_cas,nom)
|
||||
logging.critical(ligne+texte_a)
|
||||
n_cas = 4
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : cubeFin
|
||||
from blocFissure.CasTests import cubeTransverse
|
||||
self.l_problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, n_cas))
|
||||
self.d_nom_probleme[n_cas] = "cubeTransverse"
|
||||
self.l_materiels.append("cubeFin")
|
||||
|
||||
try:
|
||||
ok_maillage = cas.executeProbleme()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
ok_maillage = False
|
||||
if not ok_maillage:
|
||||
texte = "Problème avec le cas n° {}, '{}'\n".format(n_cas,nom)
|
||||
print(ligne)
|
||||
n_cas = 5
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : decoupeCylindre
|
||||
from blocFissure.CasTests.cylindre import cylindre
|
||||
self.l_problemes.append(cylindre(n_cas))
|
||||
self.l_materiels.append("decoupeCylindre")
|
||||
|
||||
return ok_maillage, texte
|
||||
#=============================================================
|
||||
def calcul_tout (l_problemes, d_aux):
|
||||
"""Calcul de tous les cas"""
|
||||
n_cas = 6
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : decoupeCylindre
|
||||
from blocFissure.CasTests.cylindre_2 import cylindre_2
|
||||
self.l_problemes.append(cylindre_2(n_cas))
|
||||
self.l_materiels.append("decoupeCylindre")
|
||||
|
||||
ligne = "---------------------------------------------------------------------"
|
||||
texte = "\n"
|
||||
nb_cas_ok = 0
|
||||
nb_cas_nook = 0
|
||||
for n_cas, cas in enumerate(l_problemes):
|
||||
#print ("Cas n° {}, '{}'".format(n_cas,cas.nomProbleme))
|
||||
if TORUN[n_cas]:
|
||||
ok_maillage, texte_a = calcul_cas (n_cas, cas, d_aux, ligne)
|
||||
n_cas = 7
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : disque_perce
|
||||
# genereMateriel : ellipse_disque
|
||||
from blocFissure.CasTests import disquePerce
|
||||
self.l_problemes.append(casStandard(disquePerce.dicoParams, disquePerce.referencesMaillageFissure, n_cas))
|
||||
self.d_nom_probleme[n_cas] = "disquePerce"
|
||||
self.l_materiels.append("disque_perce")
|
||||
self.l_materiels.append("ellipse_disque")
|
||||
|
||||
n_cas = 8
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel: ellipse
|
||||
# genereMateriel : fissureGauche2
|
||||
from blocFissure.CasTests.ellipse_1 import ellipse_1
|
||||
self.l_problemes.append(ellipse_1(n_cas))
|
||||
self.l_materiels.append("ellipse")
|
||||
self.l_materiels.append("fissureGauche2")
|
||||
|
||||
n_cas = 9
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel: ellipse_probleme
|
||||
# genereMateriel : fissureGauche2
|
||||
from blocFissure.CasTests.ellipse_2 import ellipse_2
|
||||
self.l_problemes.append(ellipse_2(n_cas))
|
||||
self.l_materiels.append("ellipse_probleme")
|
||||
self.l_materiels.append("fissureGauche2")
|
||||
|
||||
n_cas = 10
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : eprouvetteCourbe
|
||||
from blocFissure.CasTests.eprouvetteCourbe import eprouvetteCourbe
|
||||
self.l_problemes.append(eprouvetteCourbe(n_cas))
|
||||
self.l_materiels.append("eprouvetteCourbe")
|
||||
|
||||
n_cas = 11
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : eprouvetteDroite
|
||||
from blocFissure.CasTests.eprouvetteDroite import eprouvetteDroite
|
||||
self.l_problemes.append(eprouvetteDroite(n_cas))
|
||||
self.l_materiels.append("eprouvetteDroite")
|
||||
|
||||
n_cas = 12
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : eprouvetteDroite
|
||||
from blocFissure.CasTests.eprouvetteDroite_2 import eprouvetteDroite_2
|
||||
self.l_problemes.append(eprouvetteDroite_2(n_cas))
|
||||
self.l_materiels.append("eprouvetteDroite")
|
||||
|
||||
n_cas = 13
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : fissureGauche
|
||||
from blocFissure.CasTests.faceGauche import faceGauche
|
||||
self.l_problemes.append(faceGauche(n_cas))
|
||||
self.l_materiels.append("fissureGauche")
|
||||
|
||||
n_cas = 14
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : fissureGauche2
|
||||
from blocFissure.CasTests.faceGauche_2 import faceGauche_2
|
||||
self.l_problemes.append(faceGauche_2(n_cas))
|
||||
self.l_materiels.append("fissureGauche2")
|
||||
|
||||
n_cas = 15
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_1 import fissureCoude_1
|
||||
self.l_problemes.append(fissureCoude_1(n_cas))
|
||||
|
||||
n_cas = 16
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_2 import fissureCoude_2
|
||||
self.l_problemes.append(fissureCoude_2(n_cas))
|
||||
|
||||
n_cas = 17
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_3 import fissureCoude_3
|
||||
self.l_problemes.append(fissureCoude_3(n_cas))
|
||||
|
||||
n_cas = 18
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_4 import fissureCoude_4
|
||||
self.l_problemes.append(fissureCoude_4(n_cas))
|
||||
|
||||
n_cas = 19
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_5 import fissureCoude_5
|
||||
self.l_problemes.append(fissureCoude_5(n_cas))
|
||||
|
||||
n_cas = 20
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_6 import fissureCoude_6
|
||||
self.l_problemes.append(fissureCoude_6(n_cas))
|
||||
|
||||
n_cas = 21
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_7 import fissureCoude_7
|
||||
self.l_problemes.append(fissureCoude_7(n_cas))
|
||||
|
||||
n_cas = 22
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_8 import fissureCoude_8
|
||||
self.l_problemes.append(fissureCoude_8(n_cas))
|
||||
|
||||
n_cas = 23
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_9 import fissureCoude_9
|
||||
self.l_problemes.append(fissureCoude_9(n_cas))
|
||||
|
||||
n_cas = 24
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissureCoude_10 import fissureCoude_10
|
||||
self.l_problemes.append(fissureCoude_10(n_cas))
|
||||
|
||||
n_cas = 25
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissure_Coude import fissure_Coude
|
||||
self.l_problemes.append(fissure_Coude(n_cas))
|
||||
|
||||
n_cas = 26
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : aucun
|
||||
from blocFissure.CasTests.fissure_Coude_4 import fissure_Coude_4
|
||||
self.l_problemes.append(fissure_Coude_4(n_cas))
|
||||
|
||||
n_cas = 27
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : vis
|
||||
from blocFissure.CasTests.vis_1 import vis_1
|
||||
self.l_problemes.append(vis_1(n_cas))
|
||||
self.l_materiels.append("vis")
|
||||
|
||||
n_cas = 28
|
||||
if n_cas in self.l_cas:
|
||||
# genereMateriel : tube
|
||||
from blocFissure.CasTests.tube import tube
|
||||
self.l_problemes.append(tube(n_cas))
|
||||
self.l_materiels.append("tube")
|
||||
#"Mesh_13" has not been computed:
|
||||
#- "algo2d_facePeau_0" failed on "FACE_12 to mesh". Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
|
||||
#- "algo1d_cercle1_0" failed on EDGE #20. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
#- "algo1d_cercle1_0" failed on EDGE #17. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
#- "algo1d_cercle1_0" failed on EDGE #15. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
#- "algo1d_cercle1_0" failed on EDGE #12. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
|
||||
|
||||
return
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def cree_materiels (self):
|
||||
"""Création des matériels"""
|
||||
|
||||
if "cubeAngle" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import cubeAngle
|
||||
|
||||
if "cubeFin" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import cubeFin
|
||||
|
||||
if "decoupeCylindre" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import decoupeCylindre
|
||||
|
||||
if "disque_perce" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import disque_perce
|
||||
|
||||
if "ellipse_disque" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import ellipse_disque
|
||||
|
||||
if "ellipse" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import ellipse
|
||||
|
||||
if "fissureGauche" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import fissureGauche
|
||||
|
||||
if "fissureGauche2" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import fissureGauche2
|
||||
|
||||
if "eprouvetteCourbe" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import eprouvetteCourbe
|
||||
|
||||
if "eprouvetteDroite" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import eprouvetteDroite
|
||||
|
||||
if "vis" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import vis
|
||||
|
||||
if "tube" in self.l_materiels:
|
||||
from blocFissure.materielCasTests import tube
|
||||
|
||||
return
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def calcul_cas (self, n_cas, cas, ligne):
|
||||
"""Calcul d'un cas"""
|
||||
texte = ""
|
||||
if n_cas in self.d_nom_probleme:
|
||||
nom = self.d_nom_probleme[n_cas]
|
||||
else:
|
||||
nom = cas.nomProbleme
|
||||
texte_a = "\n=== Exécution du cas n° {}, '{}'".format(NREF_PB[nom],nom)
|
||||
logging.critical(ligne+texte_a)
|
||||
|
||||
try:
|
||||
ok_maillage = cas.executeProbleme()
|
||||
except:
|
||||
traceback.print_exc()
|
||||
ok_maillage = False
|
||||
if not ok_maillage:
|
||||
texte = "Problème avec le cas n° {}, '{}'\n".format(NREF_PB[nom],nom)
|
||||
print(ligne)
|
||||
|
||||
return ok_maillage, texte
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
def calcul_tout (self):
|
||||
"""Calcul de tous les cas"""
|
||||
|
||||
ligne = "---------------------------------------------------------------------"
|
||||
texte = "\n"
|
||||
nb_cas_ok = 0
|
||||
nb_cas_nook = 0
|
||||
for n_cas, cas in enumerate(self.l_problemes):
|
||||
#print ("Cas n° {}, '{}'".format(n_cas,cas.nomProbleme))
|
||||
ok_maillage, texte_a = self.calcul_cas (n_cas, cas, ligne)
|
||||
texte += texte_a
|
||||
if ok_maillage:
|
||||
nb_cas_ok += 1
|
||||
@ -272,31 +476,81 @@ def calcul_tout (l_problemes, d_aux):
|
||||
nb_cas_nook += 1
|
||||
print(ligne)
|
||||
|
||||
nb_cas = nb_cas_nook + nb_cas_ok
|
||||
if ( nb_cas > 1):
|
||||
if nb_cas_nook:
|
||||
texte += ". Nombre de cas_tests OK : {}\n".format(nb_cas_ok)
|
||||
texte += ". Nombre de cas_tests NOOK : {}\n".format(nb_cas_nook)
|
||||
else:
|
||||
texte += "Les {} tests se sont bien passés.\n".format(nb_cas)
|
||||
print (texte+ligne)
|
||||
logging.critical(ligne+texte)
|
||||
nb_cas = nb_cas_nook + nb_cas_ok
|
||||
if ( nb_cas > 1):
|
||||
if nb_cas_nook:
|
||||
texte += ". Nombre de cas_tests OK : {}\n".format(nb_cas_ok)
|
||||
texte += ". Nombre de cas_tests NOOK : {}\n".format(nb_cas_nook)
|
||||
else:
|
||||
texte += "Les {} tests se sont bien passés.\n".format(nb_cas)
|
||||
print (texte+ligne)
|
||||
logging.critical(ligne+texte)
|
||||
|
||||
return
|
||||
#=============================================================
|
||||
#=============================================================
|
||||
return texte
|
||||
|
||||
while True:
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
L_PROBLEMES, D_AUX = caract_l_problemes()
|
||||
#=========================== Début de la méthode =================================
|
||||
|
||||
if ( len(L_PROBLEMES) != len(TORUN) ):
|
||||
TEXTE = "\nNombre de problèmes définis : {}\n".format(len(L_PROBLEMES))
|
||||
TEXTE += "Longueur de la liste 'TORUN' : {}\n".format(len(TORUN))
|
||||
TEXTE += "\t==> Incohérence de programmation à corriger dans {}".format(__name__)
|
||||
print (TEXTE)
|
||||
break
|
||||
def lancement (self):
|
||||
"""Lancement général"""
|
||||
|
||||
calcul_tout (L_PROBLEMES, D_AUX)
|
||||
# Tri des problèmes
|
||||
self.caract_l_problemes ()
|
||||
|
||||
break
|
||||
# Création des matériels
|
||||
self.cree_materiels ()
|
||||
|
||||
# Calcul des fissures
|
||||
texte = self.calcul_tout ()
|
||||
|
||||
return texte
|
||||
|
||||
#=========================== Fin de la méthode ==================================
|
||||
|
||||
#========================== Fin de la classe ====================================
|
||||
|
||||
#==================================================================================
|
||||
# Lancement
|
||||
#==================================================================================
|
||||
|
||||
if __name__ == "__main__" :
|
||||
|
||||
# 1. Options
|
||||
|
||||
L_OPTIONS = sys.argv[1:]
|
||||
L_OPTIONS.append("-v")
|
||||
|
||||
# 2. Lancement de la classe
|
||||
|
||||
#print ("L_OPTIONS :", L_OPTIONS)
|
||||
BLOCFISSURE_TEST = blocFissureTest(L_OPTIONS)
|
||||
|
||||
if BLOCFISSURE_TEST.affiche_aide_globale:
|
||||
sys.stdout.write(BLOCFISSURE_TEST.__doc__+"\n")
|
||||
else:
|
||||
TEXTE = BLOCFISSURE_TEST.lancement()
|
||||
sys.stdout.write(TEXTE)
|
||||
|
||||
del BLOCFISSURE_TEST
|
||||
|
||||
#sys.exit(0)
|
||||
|
||||
|
||||
#while True:
|
||||
|
||||
#import sys
|
||||
#print ("arguments = '{}'".format(sys.argv[1:]))
|
||||
|
||||
#L_PROBLEMES, D_AUX = caract_l_problemes()
|
||||
|
||||
#if ( len(L_PROBLEMES) != len(TORUN) ):
|
||||
#TEXTE = "\nNombre de problèmes définis : {}\n".format(len(L_PROBLEMES))
|
||||
#TEXTE += "Longueur de la liste 'TORUN' : {}\n".format(len(TORUN))
|
||||
#TEXTE += "\t==> Incohérence de programmation à corriger dans {}".format(__name__)
|
||||
#print (TEXTE)
|
||||
#break
|
||||
|
||||
#calcul_tout (L_PROBLEMES, D_AUX)
|
||||
|
||||
#break
|
||||
|
Loading…
Reference in New Issue
Block a user