2014-01-09 14:20:44 +00:00
# -*- coding: utf-8 -*-
2021-03-23 17:44:27 +03:00
# Copyright (C) 2014-2021 EDF R&D
2019-02-14 14:55:47 +03:00
#
# 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
#
2021-03-17 14:13:23 +01:00
""" Lancement des cas-tests de blocFissure """
2014-01-09 14:20:44 +00:00
2021-03-17 14:13:23 +01:00
import traceback
2021-04-07 13:56:25 +02:00
2014-08-29 16:37:55 +02:00
import logging
2021-04-07 13:56:25 +02:00
2014-01-09 14:20:44 +00:00
from blocFissure import gmu
from blocFissure . gmu import initLog
2021-03-17 14:13:23 +01:00
from blocFissure . gmu import geomsmesh
from blocFissure . gmu . casStandard import casStandard
2014-12-10 17:37:21 +01:00
# -----------------------------------------------------------------------------------------------
2014-01-09 14:20:44 +00:00
#initLog.setDebug()
2021-01-21 18:13:50 +01:00
#initLog.setVerbose()
2014-12-10 17:37:21 +01:00
#initLog.setRelease()
2014-09-08 14:58:52 +02:00
#initLog.setPerfTests()
2014-01-09 14:20:44 +00:00
2021-01-21 18:13:50 +01:00
# ---tous les cas en séquence, ou les cas sélectionnés ...
2021-04-08 08:45:27 +02:00
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
2021-02-19 15:28:36 +01:00
# 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
2021-03-17 14:13:23 +01:00
#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 ]
2021-02-19 15:28:36 +01:00
# 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
else :
2021-03-17 14:13:23 +01:00
TORUNPB = list ( )
for IAUX in TORUNOK :
TORUNPB . append ( ( IAUX + 1 ) % 2 )
print ( " TORUN = {} # OK " . format ( TORUNOK ) )
print ( " TORUN = {} # PB " . format ( TORUNPB ) )
# genereMateriel
2021-04-07 16:11:37 +02:00
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
2021-03-17 14:13:23 +01:00
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
2021-04-07 16:11:37 +02:00
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 fissureGauche2
2021-03-17 14:13:23 +01:00
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
2021-01-28 15:14:16 +01:00
# 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
2021-04-08 08:45:27 +02:00
TORUN = [ 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
2014-12-10 17:37:21 +01:00
# -----------------------------------------------------------------------------------------------
2021-03-17 14:13:23 +01:00
def caract_l_problemes ( ) :
""" Caractérisation des problèmes """
d_aux = dict ( )
l_problemes = list ( )
n_cas = 0
# genereMateriel : cubeAngle
from blocFissure . CasTests . cubeAngle import cubeAngle
l_problemes . append ( cubeAngle ( n_cas ) )
n_cas = 1
# genereMateriel : cubeAngle
from blocFissure . CasTests . cubeAngle2 import cubeAngle2
l_problemes . append ( cubeAngle2 ( n_cas ) )
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 "
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 "
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 "
n_cas = 5
# genereMateriel : decoupeCylindre
from blocFissure . CasTests . cylindre import cylindre
l_problemes . append ( cylindre ( n_cas ) )
n_cas = 6
# genereMateriel : decoupeCylindre
from blocFissure . CasTests . cylindre_2 import cylindre_2
l_problemes . append ( cylindre_2 ( n_cas ) )
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 "
n_cas = 8
# genereMateriel: ellipse
# genereMateriel : fissureGauche2
from blocFissure . CasTests . ellipse_1 import ellipse_1
l_problemes . append ( ellipse_1 ( n_cas ) )
n_cas = 9
# genereMateriel: ellipse_probleme
# genereMateriel : fissureGauche2
from blocFissure . CasTests . ellipse_2 import ellipse_2
l_problemes . append ( ellipse_2 ( n_cas ) )
n_cas = 10
# genereMateriel : eprouvetteCourbe
from blocFissure . CasTests . eprouvetteCourbe import eprouvetteCourbe
l_problemes . append ( eprouvetteCourbe ( n_cas ) )
n_cas = 11
# genereMateriel : eprouvetteDroite
from blocFissure . CasTests . eprouvetteDroite import eprouvetteDroite
l_problemes . append ( eprouvetteDroite ( n_cas ) )
n_cas = 12
# genereMateriel : eprouvetteDroite
from blocFissure . CasTests . eprouvetteDroite_2 import eprouvetteDroite_2
l_problemes . append ( eprouvetteDroite_2 ( n_cas ) )
n_cas = 13
# genereMateriel : fissureGauche
from blocFissure . CasTests . faceGauche import faceGauche
l_problemes . append ( faceGauche ( n_cas ) )
n_cas = 14
2021-04-07 16:11:37 +02:00
# genereMateriel : fissureGauche2
2021-03-17 14:13:23 +01:00
from blocFissure . CasTests . faceGauche_2 import faceGauche_2
l_problemes . append ( faceGauche_2 ( n_cas ) )
2021-04-07 16:11:37 +02:00
#th. 140348470327040 - Trace /home/D68518/salome-dev/DEV_package/modules/src/SMESH/src/SMESH/SMESH_subMesh.cxx [2051] : MG-Tetra failed on sub-shape #1 with error COMPERR_ALGO_FAI
#LED "Presumably, the surface mesh is not compatible with the domain being processed (warning).
2021-03-17 14:13:23 +01:00
#An edge is unique (i.e., bounds a hole in the surface).
#The surface mesh includes at least one hole. The domain is not well defined.
2021-04-07 16:11:37 +02:00
#See /tmp/GHS3D_6406_1149841264.log for more information"
#5845 construitFissureGenerale_c[89] Erreur au calcul du maillage.
#meshBoiteDefaut.Compute
2021-03-17 14:13:23 +01:00
#Traceback (most recent call last):
2021-04-07 16:11:37 +02:00
#File "/local01/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 278, in calcul_cas
2021-03-17 14:13:23 +01:00
#ok_maillage = cas.executeProbleme()
2021-04-07 16:11:37 +02:00
#File "/local01/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/fissureGenerique.py", line 137, in executeProbleme
#elementsDefaut, step, mailleur)
#File "/local01/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/faceGauche_2.py", line 118, in genereMaillageFissure
#step, mailleur, self.numeroCas)
#File "/local01/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/construitFissureGenerale.py", line 227, in construitFissureGenerale
#mailleur, nro_cas )
#File "/local01/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/construitFissureGenerale_c.py", line 90, in construitFisureGenerale_c
2021-03-17 14:13:23 +01:00
n_cas = 15
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_1 import fissureCoude_1
l_problemes . append ( fissureCoude_1 ( n_cas ) )
n_cas = 16
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_2 import fissureCoude_2
l_problemes . append ( fissureCoude_2 ( n_cas ) )
n_cas = 17
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_3 import fissureCoude_3
l_problemes . append ( fissureCoude_3 ( n_cas ) )
n_cas = 18
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_4 import fissureCoude_4
l_problemes . append ( fissureCoude_4 ( n_cas ) )
n_cas = 19
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_5 import fissureCoude_5
l_problemes . append ( fissureCoude_5 ( n_cas ) )
n_cas = 20
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_6 import fissureCoude_6
l_problemes . append ( fissureCoude_6 ( n_cas ) )
n_cas = 21
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_7 import fissureCoude_7
l_problemes . append ( fissureCoude_7 ( n_cas ) )
n_cas = 22
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_8 import fissureCoude_8
l_problemes . append ( fissureCoude_8 ( n_cas ) )
n_cas = 23
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_9 import fissureCoude_9
l_problemes . append ( fissureCoude_9 ( n_cas ) )
n_cas = 24
# genereMateriel : aucun
from blocFissure . CasTests . fissureCoude_10 import fissureCoude_10
l_problemes . append ( fissureCoude_10 ( n_cas ) )
n_cas = 25
# genereMateriel : aucun
from blocFissure . CasTests . fissure_Coude import fissure_Coude
l_problemes . append ( fissure_Coude ( n_cas ) )
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 = 27
# genereMateriel : vis
from blocFissure . CasTests . vis_1 import vis_1
l_problemes . append ( vis_1 ( n_cas ) )
#"Mesh_22" has not been computed:
#- "algo2d_faceFiss" failed on FACE #2. Error: Algorithm failed. NgException at Surface meshing: Problem in Surface mesh generation
#- "algo1d_edgeFissPeau" failed on EDGE #9. Error: Algorithm failed. Source elements don't cover totally the geometrical edge
#Traceback (most recent call last):
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/execution_Cas.py", line 233, in <module>
#ok_maillage = cas.executeProbleme()
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/fissureGenerique.py", line 122, in executeProbleme
#self.maillageFissureParams, elementsDefaut, step)
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/CasTests/vis_1.py", line 116, in genereMaillageFissure
#maillageFissureParams, elementsDefaut, step)
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/construitFissureGenerale.py", line 282, in construitFissureGenerale
#meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad)
#File "/home/D68518/salome-dev/DEV_package/appli_DEV_package/lib/python3.6/site-packages/salome/blocFissure/gmu/mailleFacesFissure.py", line 69, in mailleFacesFissure
#raise Exception(text)
#Exception: Erreur au calcul du maillage.
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
return l_problemes , d_aux
2021-01-21 18:13:50 +01:00
#=============================================================
2021-03-17 14:13:23 +01:00
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 )
try :
ok_maillage = cas . executeProbleme ( )
except :
traceback . print_exc ( )
texte = " Problème avec le cas n° {} , ' {} ' \n " . format ( n_cas , nom )
ok_maillage = False
print ( ligne )
return ok_maillage , texte
#=============================================================
def calcul_tout ( l_problemes , d_aux ) :
""" Calcul de tous les cas """
2021-01-21 18:13:50 +01:00
ligne = " --------------------------------------------------------------------- "
texte = " "
2021-01-27 11:48:18 +01:00
nb_cas_ok = 0
nb_cas_nook = 0
2021-03-17 14:13:23 +01:00
for n_cas , cas in enumerate ( l_problemes ) :
2021-01-22 11:14:13 +01:00
#print ("Cas n° {}, '{}'".format(n_cas,cas.nomProbleme))
2021-03-17 14:13:23 +01:00
if TORUN [ n_cas ] :
ok_maillage , texte_a = calcul_cas ( n_cas , cas , d_aux , ligne )
texte + = texte_a
2021-01-26 15:38:16 +01:00
if ok_maillage :
2021-01-27 11:48:18 +01:00
nb_cas_ok + = 1
2021-01-26 15:38:16 +01:00
else :
2021-01-27 11:48:18 +01:00
nb_cas_nook + = 1
2021-01-21 18:13:50 +01:00
print ( ligne )
2021-01-27 11:48:18 +01:00
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 )
2021-01-26 18:39:03 +01:00
else :
2021-01-27 11:48:18 +01:00
texte + = " Les {} tests se sont bien passés. \n " . format ( nb_cas )
2021-01-21 18:13:50 +01:00
print ( texte + ligne )
2021-03-17 14:13:23 +01:00
return
#=============================================================
#=============================================================
while True :
2021-01-21 18:13:50 +01:00
2021-03-17 14:13:23 +01:00
L_PROBLEMES , D_AUX = caract_l_problemes ( )
if ( len ( L_PROBLEMES ) != len ( TORUN ) ) :
TEXTE = " \n Nombre de problèmes définis : {} \n " . format ( len ( L_PROBLEMES ) )
TEXTE + = " Longueur de la liste ' TORUN ' : {} \n " . format ( len ( TORUN ) )
2021-03-17 16:20:13 +01:00
TEXTE + = " \t ==> Incohérence de programmation à corriger dans {} " . format ( __name__ )
2021-03-17 14:13:23 +01:00
print ( TEXTE )
break
calcul_tout ( L_PROBLEMES , D_AUX )
break