diff --git a/doc/salome/examples/blocFissure_without_session.py b/doc/salome/examples/blocFissure_without_session.py new file mode 100644 index 000000000..0be55d4c6 --- /dev/null +++ b/doc/salome/examples/blocFissure_without_session.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +"""Tests de blocFissure ; en standalone + +Copyright 2021 EDF +Gérald NICOLAS ++33.1.78.19.43.52 +""" + +__revision__ = "V02.01" + +import os +import tempfile +import sys + +# Fichier de diagnostic +LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log") +if os.path.isfile(LOGFILE): + os.remove(LOGFILE) + +# Lancement des cas-tests +import salome +salome.standalone() +salome.salome_init() + +from blocFissure.materielCasTests import genereMateriel + +from blocFissure.CasTests import execution_Cas + +# Diagnostic +ERREUR = 0 +if os.path.isfile(LOGFILE): + with open(LOGFILE, 'r') as FICHIER: + LES_LIGNES = FICHIER.readlines() + for LIGNE in LES_LIGNES: + #print (LIGNE[:-1]) + if ( "NOOK" in LIGNE ): + MESSAGE_ERREUR = LIGNE + ERREUR = int(LIGNE.split()[-1]) + break +else: + MESSAGE_ERREUR = "Impossible de trouver le fichier de diagnostic {}".format(LOGFILE) + ERREUR = -1 + +if ERREUR: + sys.stderr.write(MESSAGE_ERREUR) + #raise Exception(MESSAGE_ERREUR) + assert(False) diff --git a/doc/salome/examples/tests.set b/doc/salome/examples/tests.set index e9b6e6375..99000efd5 100644 --- a/doc/salome/examples/tests.set +++ b/doc/salome/examples/tests.set @@ -46,6 +46,7 @@ SET(BAD_TESTS test_smeshplugin_mg_tetra_parallele.py test_smeshplugins.py MGAdaptTests_without_session.py + blocFissure_without_session.py ) SET(GOOD_TESTS diff --git a/src/Tools/blocFissure/CasTests/cubeAngle.py b/src/Tools/blocFissure/CasTests/cubeAngle.py index ef04109da..1a34beb3d 100644 --- a/src/Tools/blocFissure/CasTests/cubeAngle.py +++ b/src/Tools/blocFissure/CasTests/cubeAngle.py @@ -45,7 +45,7 @@ class cubeAngle(fissureGenerique): logging.info(texte) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -88,8 +88,8 @@ class cubeAngle(fissureGenerique): texte = "setParamMaillageFissure pour '{}'".format(self.nomCas) logging.info(texte) self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 10) diff --git a/src/Tools/blocFissure/CasTests/cubeAngle2.py b/src/Tools/blocFissure/CasTests/cubeAngle2.py index aa35b6225..f2ede5d65 100644 --- a/src/Tools/blocFissure/CasTests/cubeAngle2.py +++ b/src/Tools/blocFissure/CasTests/cubeAngle2.py @@ -44,8 +44,8 @@ class cubeAngle2(cubeAngle): # --------------------------------------------------------------------------- def setParamMaillageFissure(self): self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 32, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/cubeCoin.py b/src/Tools/blocFissure/CasTests/cubeCoin.py index e6221be87..f068a96ef 100644 --- a/src/Tools/blocFissure/CasTests/cubeCoin.py +++ b/src/Tools/blocFissure/CasTests/cubeCoin.py @@ -24,6 +24,7 @@ import os from blocFissure import gmu dicoParams = dict(nomCas = "cubeCoin", + nomProbleme = "cubeCoin", maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"), CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Coin.brep"), edgeFiss = [3], diff --git a/src/Tools/blocFissure/CasTests/cubeMilieu.py b/src/Tools/blocFissure/CasTests/cubeMilieu.py index 96d069e35..3366b210f 100644 --- a/src/Tools/blocFissure/CasTests/cubeMilieu.py +++ b/src/Tools/blocFissure/CasTests/cubeMilieu.py @@ -24,6 +24,7 @@ import os from blocFissure import gmu dicoParams = dict(nomCas = "cubeMilieu", + nomProbleme = "cubeMilieu", maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"), CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Milieu.brep"), edgeFiss = [3], diff --git a/src/Tools/blocFissure/CasTests/cubeTransverse.py b/src/Tools/blocFissure/CasTests/cubeTransverse.py index bc05c37a4..161805e81 100644 --- a/src/Tools/blocFissure/CasTests/cubeTransverse.py +++ b/src/Tools/blocFissure/CasTests/cubeTransverse.py @@ -24,6 +24,7 @@ import os from blocFissure import gmu dicoParams = dict(nomCas = "cubeTransverse", + nomProbleme = "cubeTransverse", maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin.med"), CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "cubeFin_Transverse.brep"), edgeFiss = [6], diff --git a/src/Tools/blocFissure/CasTests/cylindre.py b/src/Tools/blocFissure/CasTests/cylindre.py index 6aacd332f..8960188d7 100644 --- a/src/Tools/blocFissure/CasTests/cylindre.py +++ b/src/Tools/blocFissure/CasTests/cylindre.py @@ -48,7 +48,7 @@ class cylindre(fissureGenerique): logging.info("genereMaillageSain %s", self.nomCas) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "CylindreSain.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -85,8 +85,8 @@ class cylindre(fissureGenerique): # --------------------------------------------------------------------------- def setParamMaillageFissure(self): self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 20) diff --git a/src/Tools/blocFissure/CasTests/disquePerce.py b/src/Tools/blocFissure/CasTests/disquePerce.py index 368cdc555..558afb038 100644 --- a/src/Tools/blocFissure/CasTests/disquePerce.py +++ b/src/Tools/blocFissure/CasTests/disquePerce.py @@ -24,6 +24,7 @@ import os from blocFissure import gmu dicoParams = dict(nomCas = 'disque', + nomProbleme = "disque", maillageSain = os.path.join(gmu.pathBloc, "materielCasTests", "disque.med"), CAOFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_disque.brep"), edgeFiss = [3], diff --git a/src/Tools/blocFissure/CasTests/ellipse_1.py b/src/Tools/blocFissure/CasTests/ellipse_1.py index fce709094..764e75c48 100644 --- a/src/Tools/blocFissure/CasTests/ellipse_1.py +++ b/src/Tools/blocFissure/CasTests/ellipse_1.py @@ -51,7 +51,7 @@ class ellipse_1(fissureGenerique): logging.info(texte) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -96,8 +96,8 @@ class ellipse_1(fissureGenerique): texte = "setParamMaillageFissure pour '{}'".format(self.nomCas) logging.info(texte) self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 1000) diff --git a/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py b/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py index f587b8cb3..d214d6c0e 100644 --- a/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py +++ b/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py @@ -45,7 +45,7 @@ class eprouvetteCourbe(fissureGenerique): logging.info(texte) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "EprouvetteCourbe.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -90,8 +90,8 @@ class eprouvetteCourbe(fissureGenerique): texte = "setParamMaillageFissure pour '{}'".format(self.nomCas) logging.info(texte) self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 15) diff --git a/src/Tools/blocFissure/CasTests/eprouvetteDroite.py b/src/Tools/blocFissure/CasTests/eprouvetteDroite.py index 7484c1da1..b990ba7f0 100644 --- a/src/Tools/blocFissure/CasTests/eprouvetteDroite.py +++ b/src/Tools/blocFissure/CasTests/eprouvetteDroite.py @@ -49,7 +49,7 @@ class eprouvetteDroite(fissureGenerique): logging.info("genereMaillageSain %s", self.nomCas) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "eprouvetteDroite.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -89,8 +89,8 @@ class eprouvetteDroite(fissureGenerique): # --------------------------------------------------------------------------- def setParamMaillageFissure(self): self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 15) diff --git a/src/Tools/blocFissure/CasTests/execution_Cas.py b/src/Tools/blocFissure/CasTests/execution_Cas.py index 553e3b103..2213dbce7 100644 --- a/src/Tools/blocFissure/CasTests/execution_Cas.py +++ b/src/Tools/blocFissure/CasTests/execution_Cas.py @@ -19,27 +19,31 @@ # """Lancement des cas-tests de blocFissure""" -import traceback - import logging +import os +import tempfile +import traceback from blocFissure.gmu import initLog from blocFissure.gmu.casStandard import casStandard # ----------------------------------------------------------------------------------------------- -#initLog.setDebug() -#initLog.setVerbose() -#initLog.setRelease() -#initLog.setPerfTests() +LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log") +#initLog.setDebug(LOGFILE) # debug = 10 +#initLog.setVerbose(LOGFILE) # info = 20 +#initLog.setRelease(LOGFILE) # warning = 30 +#initLog.setPerfTests(LOGFILE) # critical = 50 +#initLog.setAlways(LOGFILE) # critical = 50 # ---tous les cas en séquence, ou les cas sélectionnés ... -TORUNOK = [ 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 +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 = [ 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: @@ -238,6 +242,7 @@ def calcul_cas (n_cas, cas, d_aux, ligne): 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: @@ -246,13 +251,14 @@ def calcul_cas (n_cas, cas, d_aux, ligne): if not ok_maillage: texte = "Problème avec le cas n° {}, '{}'\n".format(n_cas,nom) print(ligne) + return ok_maillage, texte #============================================================= def calcul_tout (l_problemes, d_aux): """Calcul de tous les cas""" ligne = "---------------------------------------------------------------------" - texte = "" + texte = "\n" nb_cas_ok = 0 nb_cas_nook = 0 for n_cas, cas in enumerate(l_problemes): @@ -274,6 +280,7 @@ def calcul_tout (l_problemes, d_aux): else: texte += "Les {} tests se sont bien passés.\n".format(nb_cas) print (texte+ligne) + logging.critical(ligne+texte) return #============================================================= diff --git a/src/Tools/blocFissure/CasTests/faceGauche.py b/src/Tools/blocFissure/CasTests/faceGauche.py index a63053ae7..b04c9a551 100644 --- a/src/Tools/blocFissure/CasTests/faceGauche.py +++ b/src/Tools/blocFissure/CasTests/faceGauche.py @@ -48,7 +48,7 @@ class faceGauche(fissureGenerique): logging.info("genereMaillageSain %s", self.nomCas) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "faceGaucheSain.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -87,8 +87,8 @@ class faceGauche(fissureGenerique): # --------------------------------------------------------------------------- def setParamMaillageFissure(self): self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 1000) diff --git a/src/Tools/blocFissure/CasTests/faceGauche_2.py b/src/Tools/blocFissure/CasTests/faceGauche_2.py index abe51ca03..9c0f33d03 100644 --- a/src/Tools/blocFissure/CasTests/faceGauche_2.py +++ b/src/Tools/blocFissure/CasTests/faceGauche_2.py @@ -46,7 +46,7 @@ class faceGauche_2(fissureGenerique): logging.info("genereMaillageSain %s", self.nomCas) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "boiteSaine.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -85,8 +85,8 @@ class faceGauche_2(fissureGenerique): # --------------------------------------------------------------------------- def setParamMaillageFissure(self): self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 1000) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_1.py b/src/Tools/blocFissure/CasTests/fissureCoude_1.py index f26031baf..225f7a88b 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_1.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_1.py @@ -97,8 +97,8 @@ class fissureCoude_1(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 6, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_10.py b/src/Tools/blocFissure/CasTests/fissureCoude_10.py index b135dfcb7..e9a83799d 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_10.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_10.py @@ -99,8 +99,8 @@ class fissureCoude_10(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 3, nbsegCercle = 8, areteFaceFissure = 2.5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_2.py b/src/Tools/blocFissure/CasTests/fissureCoude_2.py index 1282b122b..8b981329b 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_2.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_2.py @@ -97,8 +97,8 @@ class fissureCoude_2(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 6, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_3.py b/src/Tools/blocFissure/CasTests/fissureCoude_3.py index 9adc4f5b4..b9f5b44b1 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_3.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_3.py @@ -97,8 +97,8 @@ class fissureCoude_3(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 6, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_4.py b/src/Tools/blocFissure/CasTests/fissureCoude_4.py index b897d5d2a..57496ebf9 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_4.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_4.py @@ -97,8 +97,8 @@ class fissureCoude_4(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 6, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_5.py b/src/Tools/blocFissure/CasTests/fissureCoude_5.py index e5865ce7e..5874a54dd 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_5.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_5.py @@ -97,8 +97,8 @@ class fissureCoude_5(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_6.py b/src/Tools/blocFissure/CasTests/fissureCoude_6.py index 4cdba6d83..394e29aee 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_6.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_6.py @@ -98,8 +98,8 @@ class fissureCoude_6(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 12, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_7.py b/src/Tools/blocFissure/CasTests/fissureCoude_7.py index 86bfbfb01..f9e261752 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_7.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_7.py @@ -99,8 +99,8 @@ class fissureCoude_7(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 12, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_8.py b/src/Tools/blocFissure/CasTests/fissureCoude_8.py index 7ca8505d8..490762022 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_8.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_8.py @@ -99,8 +99,8 @@ class fissureCoude_8(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 4, nbsegCercle = 16, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/CasTests/fissureCoude_9.py b/src/Tools/blocFissure/CasTests/fissureCoude_9.py index c20ce91ed..79485fcbf 100644 --- a/src/Tools/blocFissure/CasTests/fissureCoude_9.py +++ b/src/Tools/blocFissure/CasTests/fissureCoude_9.py @@ -97,8 +97,8 @@ class fissureCoude_9(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 6, nbsegCercle = 20, areteFaceFissure = 2.5) diff --git a/src/Tools/blocFissure/CasTests/fissure_Coude.py b/src/Tools/blocFissure/CasTests/fissure_Coude.py index 75f584c0c..71dadf336 100644 --- a/src/Tools/blocFissure/CasTests/fissure_Coude.py +++ b/src/Tools/blocFissure/CasTests/fissure_Coude.py @@ -76,6 +76,7 @@ class fissure_Coude(fissureGenerique): # --------------------------------------------------------------------------- def genereGeometrieSaine(self, geomParams): + """a écrire""" logging.info("genereGeometrieSaine %s", self.nomCas) angleCoude = geomParams['angleCoude'] @@ -108,7 +109,6 @@ class fissure_Coude(fissureGenerique): P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2) geomPublish(initLog.always, P2, "P2", self.numeroCas ) - # --- tube coude sain geometrieSaine = geompy.MakePartition([Extrusion_1, Revolution_1, Extrusion_2, P1, P2], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1) @@ -146,7 +146,7 @@ class fissure_Coude(fissureGenerique): pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10) vec2 = geompy.MakeVector(P2, pp2) - #geomPublish(initLog.debug,vec2, 'vec2') + #geomPublish(initLog.debug, vec2, 'vec2', self.numeroCas) facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON) CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) geompy.UnionIDs(CLGV, facesIds) @@ -160,7 +160,7 @@ class fissure_Coude(fissureGenerique): extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) interne = geompy.MakeFuse(extru1, revol1) interne = geompy.MakeFuse(extru2, interne) - geomPublish(initLog.debug,interne, 'interne') + geomPublish(initLog.debug, interne, 'interne', self.numeroCas) facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN) PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) geompy.UnionIDs(PEAUINT, facesIds) @@ -176,7 +176,7 @@ class fissure_Coude(fissureGenerique): extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2) externe = geompy.MakeFuse(extru1, revol1) externe = geompy.MakeFuse(extru2, externe) - geomPublish(initLog.debug,externe, 'externe') + geomPublish(initLog.debug, externe, 'externe', self.numeroCas) facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON) PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"]) geompy.UnionIDs(PEAUEXT, facesIds) @@ -230,41 +230,34 @@ class fissure_Coude(fissureGenerique): n_long_p2 = meshParams['n_long_p2'] maillageSain = smesh.Mesh(geometrieSaine) + putName(maillageSain, "maillageSain", i_pref=self.numeroCas) algo3d = maillageSain.Hexahedron() algo2d = maillageSain.Quadrangle() - putName(algo3d, "3d_maillageSain", i_pref=self.numeroCas) - putName(algo2d, "2d_maillageSain", i_pref=self.numeroCas) algo1d_long_p1 = maillageSain.Segment(geom=long_p1) hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1) - putName(algo1d_long_p1, "algo1d_long_p1", i_pref=self.numeroCas) - putName(hypo1d_long_p1, "hypo1d_long_p1", i_pref=self.numeroCas) + putName(hypo1d_long_p1, "n_long_p1={}".format(n_long_p1), i_pref=self.numeroCas) algo1d_ep = maillageSain.Segment(geom=ep) hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep) - putName(algo1d_ep, "algo1d_ep", i_pref=self.numeroCas) - putName(hypo1d_ep, "hypo1d_ep", i_pref=self.numeroCas) + putName(hypo1d_ep, "n_ep={}".format(n_ep), i_pref=self.numeroCas) algo1d_long_coude = maillageSain.Segment(geom=long_coude) hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude) - putName(algo1d_long_coude, "algo1d_long_coude", i_pref=self.numeroCas) - putName(hypo1d_long_coude, "hypo1d_long_coude", i_pref=self.numeroCas) + putName(hypo1d_long_coude, "n_long_coude={}".format(n_long_coude), i_pref=self.numeroCas) algo1d_circ_g = maillageSain.Segment(geom=circ_g) hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g) - putName(algo1d_circ_g, "algo1d_circ_g", i_pref=self.numeroCas) - putName(hypo1d_circ_g, "hypo1d_circ_g", i_pref=self.numeroCas) + putName(hypo1d_circ_g, "n_circ_g={}".format(n_circ_g), i_pref=self.numeroCas) algo1d_circ_d = maillageSain.Segment(geom=circ_d) hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d) - putName(algo1d_circ_d, "algo1d_circ_d", i_pref=self.numeroCas) - putName(hypo1d_circ_d, "hypo1d_circ_d", i_pref=self.numeroCas) + putName(hypo1d_circ_d, "n_circ_d={}".format(n_circ_d), i_pref=self.numeroCas) algo1d_long_p2 = maillageSain.Segment(geom=long_p2) hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2) - putName(algo1d_long_p2, "algo1d_long_p2", i_pref=self.numeroCas) - putName(hypo1d_long_p2, "hypo1d_long_p2", i_pref=self.numeroCas) + putName(hypo1d_long_p2, "n_long_p2={}".format(n_long_p2), i_pref=self.numeroCas) _ = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE) _ = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE) @@ -275,14 +268,21 @@ class fissure_Coude(fissureGenerique): _ = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE) _ = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME) - _ = maillageSain.Compute() + is_done = maillageSain.Compute() + text = "maillageSain.Compute" + if is_done: + logging.info(text+" OK") + else: + text = "Erreur au calcul du maillage.\n" + text + logging.info(text) + raise Exception(text) return [maillageSain, True] # True : maillage hexa # --------------------------------------------------------------------------- def setParamShapeFissure(self): """ - paramètres de la fissure + paramètres de la fissure pour le tuyau coude profondeur : 0 < profondeur <= épaisseur azimut : entre 0 et 360° alpha : 0 < alpha < angleCoude @@ -487,8 +487,8 @@ class fissure_Coude(fissureGenerique): # --------------------------------------------------------------------------- def setParamMaillageFissure(self): self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegExt = 5, nbsegGen = 25, nbsegRad = 5, diff --git a/src/Tools/blocFissure/CasTests/fissure_Coude_4.py b/src/Tools/blocFissure/CasTests/fissure_Coude_4.py index c697198bb..89817efe3 100644 --- a/src/Tools/blocFissure/CasTests/fissure_Coude_4.py +++ b/src/Tools/blocFissure/CasTests/fissure_Coude_4.py @@ -76,7 +76,7 @@ class fissure_Coude_4(fissure_Coude): """ self.shapeFissureParams = dict(nomRep = os.curdir, nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicFissure = self.nomProbleme + "_fissure", profondeur = 10, azimut = 90, alpha = 20, diff --git a/src/Tools/blocFissure/CasTests/tube.py b/src/Tools/blocFissure/CasTests/tube.py index c1b22f369..3b2e724d1 100644 --- a/src/Tools/blocFissure/CasTests/tube.py +++ b/src/Tools/blocFissure/CasTests/tube.py @@ -49,7 +49,7 @@ class tube(fissureGenerique): logging.info(texte) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "Tube.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -96,8 +96,8 @@ class tube(fissureGenerique): texte = "setParamMaillageFissure pour '{}'".format(self.nomCas) logging.info(texte) self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 8, areteFaceFissure = 0.5) diff --git a/src/Tools/blocFissure/CasTests/vis_1.py b/src/Tools/blocFissure/CasTests/vis_1.py index 6de374e88..58c59e2e3 100644 --- a/src/Tools/blocFissure/CasTests/vis_1.py +++ b/src/Tools/blocFissure/CasTests/vis_1.py @@ -51,7 +51,7 @@ class vis_1(fissureGenerique): logging.info(texte) ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "visSain.med")) - putName(objetSain.GetMesh(), "{}_objetSain".format(self.nomProbleme), i_pref=self.numeroCas) + putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -96,8 +96,8 @@ class vis_1(fissureGenerique): texte = "setParamMaillageFissure pour '{}'".format(self.nomCas) logging.info(texte) self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = self.nomCas + "_fissure", + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 32, areteFaceFissure = 0.1) diff --git a/src/Tools/blocFissure/gmu/calculePointsAxiauxPipe_a.py b/src/Tools/blocFissure/gmu/calculePointsAxiauxPipe_a.py index a0e07a1ef..35b32a973 100644 --- a/src/Tools/blocFissure/gmu/calculePointsAxiauxPipe_a.py +++ b/src/Tools/blocFissure/gmu/calculePointsAxiauxPipe_a.py @@ -56,10 +56,9 @@ def calculePointsAxiauxPipe_a(facesDefaut, centreFondFiss, wireFondFiss, \ meshFondFiss = smesh.Mesh(wireFondFiss) putName(meshFondFiss, "wireFondFiss", i_pref=nro_cas) algo1d = meshFondFiss.Segment() - hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure putName(algo1d.GetSubMesh(), "wireFondFiss", i_pref=nro_cas) - putName(algo1d, "algo1d_wireFondFiss", i_pref=nro_cas) - putName(hypo1d, "hypo1d_wireFondFiss", i_pref=nro_cas) + hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure + putName(hypo1d, "Adaptive_wireFondFiss", i_pref=nro_cas) is_done = meshFondFiss.Compute() text = "calculePointsAxiauxPipe meshFondFiss.Compute" diff --git a/src/Tools/blocFissure/gmu/casStandard.py b/src/Tools/blocFissure/gmu/casStandard.py index 0243a84e9..bc2ab6d71 100644 --- a/src/Tools/blocFissure/gmu/casStandard.py +++ b/src/Tools/blocFissure/gmu/casStandard.py @@ -50,36 +50,44 @@ class casStandard(fissureGenerique): referencesMaillageFissure = None # --------------------------------------------------------------------------- - def __init__ (self, dicoParams, references = None, numeroCas = 0): + def __init__ (self, dicoParams, references = None, numeroCas = None): initEtude() self.references = references self.dicoParams = dicoParams + self.numeroCas = numeroCas + + if 'nomProbleme' in self.dicoParams: + self.nomProbleme = self.dicoParams['nomProbleme'] + if 'nomCas' in self.dicoParams: self.nomCas = self.dicoParams['nomCas'] elif 'nomres' in self.dicoParams: self.nomCas = os.path.splitext(os.path.split(self.dicoParams['nomres'])[1])[0] + elif ( self.numeroCas is not None ): + self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas) else: self.nomCas = 'casStandard' + if 'reptrav' in self.dicoParams: self.reptrav = self.dicoParams['reptrav'] else: self.reptrav = os.curdir - self.numeroCas = numeroCas - if self.numeroCas != 0: - self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas) - else: - self.nomProbleme = self.nomCas + if 'lenSegPipe' in self.dicoParams: self.lenSegPipe = self.dicoParams['lenSegPipe'] else: - self.lenSegPipe =self.dicoParams['rayonPipe'] + self.lenSegPipe = self.dicoParams['rayonPipe'] + if 'step' in self.dicoParams: step = self.dicoParams['step'] else: step = -1 # exécuter toutes les étapes + if 'aretesVives' not in self.dicoParams: self.dicoParams['aretesVives'] = 0 - if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes + + # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes + if ( self.numeroCas is None ): self.executeProbleme(step) # --------------------------------------------------------------------------- @@ -87,7 +95,7 @@ class casStandard(fissureGenerique): logging.info("genereMaillageSain %s", self.nomCas) ([objetSain], _) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain']) - putName(objetSain.GetMesh(), 'objetSain', i_pref=self.numeroCas) + putName(objetSain.GetMesh(), objetSain.GetName(), i_pref=self.numeroCas) return [objetSain, True] # True : maillage hexa @@ -154,8 +162,8 @@ class casStandard(fissureGenerique): # --------------------------------------------------------------------------- def setParamMaillageFissure(self): self.maillageFissureParams = dict(nomRep = self.reptrav, - nomFicSain = self.nomCas +'_sain', - nomFicFissure = self.nomCas, + nomFicSain = self.nomCas, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = self.dicoParams['nbSegRad'], nbsegCercle = self.dicoParams['nbSegCercle'], areteFaceFissure = self.dicoParams['areteFaceFissure'], diff --git a/src/Tools/blocFissure/gmu/construitFissureGenerale_c.py b/src/Tools/blocFissure/gmu/construitFissureGenerale_c.py index e46ddf28d..af3fa001d 100644 --- a/src/Tools/blocFissure/gmu/construitFissureGenerale_c.py +++ b/src/Tools/blocFissure/gmu/construitFissureGenerale_c.py @@ -75,7 +75,6 @@ def construitFissureGenerale_c(maillageSain, meshBoiteDefaut, \ hypo3d.SetStandardOutputLog( 0 ) hypo3d.SetRemoveLogOnSuccess( 1 ) putName(algo3d.GetSubMesh(), "boiteDefaut", i_pref=nro_cas) - putName(algo3d, "{}_3d_boiteDefaut".format(mailleur), i_pref=nro_cas) is_done = meshBoiteDefaut.Compute() text = "meshBoiteDefaut.Compute" @@ -94,9 +93,11 @@ def construitFissureGenerale_c(maillageSain, meshBoiteDefaut, \ _, normfiss = shapeSurFissure(facesPortFissure) maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut, \ None, None, 'COMPLET', normfiss) + putName(maillageComplet, nomFicFissure) logging.info("conversion quadratique") maillageComplet.ConvertToQuadratic( 1 ) + logging.info("groupes") groups = maillageComplet.GetGroups() grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS'] @@ -116,7 +117,6 @@ def construitFissureGenerale_c(maillageSain, meshBoiteDefaut, \ logging.info("export maillage fini") fichierMaillageFissure = os.path.join (nomRep , '{}.med'.format(nomFicFissure)) maillageComplet.ExportMED(fichierMaillageFissure) - putName(maillageComplet, nomFicFissure) logging.info("fichier maillage fissure %s", fichierMaillageFissure) return maillageComplet diff --git a/src/Tools/blocFissure/gmu/creePointsPipePeau.py b/src/Tools/blocFissure/gmu/creePointsPipePeau.py index 5d967dffb..39ad5dbed 100644 --- a/src/Tools/blocFissure/gmu/creePointsPipePeau.py +++ b/src/Tools/blocFissure/gmu/creePointsPipePeau.py @@ -34,12 +34,14 @@ def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout, for n_edges, edges in enumerate(listEdges): - idf = idFacesDebouchantes[n_edges] # indice de face débouchante (facesPipePeau) + # idf = indice de face débouchante (facesPipePeau) ; idf vaut 0 ou 1 + idf = idFacesDebouchantes[n_edges] logging.info("idf: %d", idf) - if idf >= 0: + if ( idf >= 0 ): gptdsk = list() - if idf > 0: # idf vaut 0 ou 1 - idf = -1 # si idf vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face) + # si idf vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face) + if ( idf > 0 ): + idf = -1 centre = ptEdgeFond[idFillingFromBout[n_edges]][idf] name = "centre_{}".format(idf) geomPublish(initLog.debug, centre, name) @@ -50,7 +52,7 @@ def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout, edgesCirc = list() for grpEdgesCirc in grpsEdgesCirc: edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False) - logging.info("edgesCirc: %s", edgesCirc) + logging.debug("edgesCirc: %s", edgesCirc) for i_aux, edge in enumerate(edges): extrems = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True) diff --git a/src/Tools/blocFissure/gmu/fissureCoude.py b/src/Tools/blocFissure/gmu/fissureCoude.py index e5b22727d..929f60c7f 100644 --- a/src/Tools/blocFissure/gmu/fissureCoude.py +++ b/src/Tools/blocFissure/gmu/fissureCoude.py @@ -19,10 +19,10 @@ # """Fissure dans un coude""" -import os - import logging +import os import math + import GEOM import SMESH @@ -259,50 +259,34 @@ class fissureCoude(fissureGenerique): n_long_p2 = meshParams['n_long_p2'] maillageSain = smesh.Mesh(geometrieSaine) + putName(maillageSain, "maillageSain", i_pref=self.numeroCas) algo3d = maillageSain.Hexahedron() algo2d = maillageSain.Quadrangle() - putName(algo3d, "{}_3d_maillageSain".format(self.mailleur2d3d()), i_pref=self.numeroCas) - putName(algo2d, "{}_2d_maillageSain".format(self.mailleur2d3d()), i_pref=self.numeroCas) algo1d_long_p1 = maillageSain.Segment(geom=long_p1) hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1) - putName(algo1d_long_p1, "algo1d_long_p1", i_pref=self.numeroCas) - putName(hypo1d_long_p1, "hypo1d_long_p1", i_pref=self.numeroCas) + putName(hypo1d_long_p1, "n_long_p1={}".format(n_long_p1), i_pref=self.numeroCas) algo1d_ep = maillageSain.Segment(geom=ep) hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep) - putName(algo1d_ep, "algo1d_ep", i_pref=self.numeroCas) - putName(hypo1d_ep, "hypo1d_ep", i_pref=self.numeroCas) + putName(hypo1d_ep, "n_ep={}".format(n_ep), i_pref=self.numeroCas) algo1d_long_coude = maillageSain.Segment(geom=long_coude) hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude) - putName(algo1d_long_coude, "algo1d_long_coude", i_pref=self.numeroCas) - putName(hypo1d_long_coude, "hypo1d_long_coude", i_pref=self.numeroCas) + putName(hypo1d_long_coude, "n_long_coude={}".format(n_long_coude), i_pref=self.numeroCas) algo1d_circ_g = maillageSain.Segment(geom=circ_g) hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g) - putName(algo1d_circ_g, "algo1d_circ_g", i_pref=self.numeroCas) - putName(hypo1d_circ_g, "hypo1d_circ_g", i_pref=self.numeroCas) + putName(hypo1d_circ_g, "n_circ_g={}".format(n_circ_g), i_pref=self.numeroCas) algo1d_circ_d = maillageSain.Segment(geom=circ_d) hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d) - putName(algo1d_circ_d, "algo1d_circ_d", i_pref=self.numeroCas) - putName(hypo1d_circ_d, "hypo1d_circ_d", i_pref=self.numeroCas) + putName(hypo1d_circ_d, "n_circ_d={}".format(n_circ_d), i_pref=self.numeroCas) algo1d_long_p2 = maillageSain.Segment(geom=long_p2) hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2) - putName(algo1d_long_p2, "algo1d_long_p2", i_pref=self.numeroCas) - putName(hypo1d_long_p2, "hypo1d_long_p2", i_pref=self.numeroCas) - - is_done = maillageSain.Compute() - text = "maillageSain.Compute" - if is_done: - logging.info(text+" OK") - else: - text = "Erreur au calcul du maillage.\n" + text - logging.info(text) - raise Exception(text) + putName(hypo1d_long_p2, "n_long_p2={}".format(n_long_p2), i_pref=self.numeroCas) _ = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE) _ = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE) @@ -313,6 +297,15 @@ class fissureCoude(fissureGenerique): _ = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE) _ = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME) + is_done = maillageSain.Compute() + text = "maillageSain.Compute" + if is_done: + logging.info(text+" OK") + else: + text = "Erreur au calcul du maillage.\n" + text + logging.info(text) + raise Exception(text) + return [maillageSain, True] # True : maillage hexa # --------------------------------------------------------------------------- @@ -367,7 +360,7 @@ class fissureCoude(fissureGenerique): azimut = -azimut # axe inverse / ASCOUF axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1) - geomPublish(initLog.debug, axe,"axe", self.numeroCas) + geomPublish(initLog.debug, axe, "axe", self.numeroCas) if not lgInfluence: lgInfluence = profondeur @@ -662,8 +655,8 @@ class fissureCoude(fissureGenerique): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, - nomFicSain = self.nomCas, - nomFicFissure = 'fissure_' + self.nomCas, + nomFicSain = self.nomProbleme, + nomFicFissure = self.nomProbleme + "_fissure", nbsegRad = 5, nbsegCercle = 6, areteFaceFissure = 5) diff --git a/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py b/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py index 22827d280..76147ee31 100644 --- a/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py +++ b/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py @@ -49,7 +49,7 @@ def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible maillagesCoupes = list() # On crée une liste contenant le maillage de chaque face. - listOfNewMeshes = createNewMeshesFromCorner(maillageDefautCible, listOfCorners) + listOfNewMeshes = createNewMeshesFromCorner(maillageDefautCible, listOfCorners, nro_cas) i_aux = 0 while i_aux < len(listOfNewMeshes): @@ -89,6 +89,7 @@ def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible listOfInternMeshes = [maillageInterneCible] + [msh.GetMesh() for msh in maillagesNonCoupes] newMaillageInterne = smesh.Concatenate(listOfInternMeshes, 1, 1, 1e-05, False) + putName(newMaillageInterne, 'newInternalBoundary', i_pref=nro_cas) facesEnTrop = list() criteres = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGenSurface, SMESH.FT_Undefined, face) for face in facesNonCoupees] @@ -100,6 +101,4 @@ def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible newZoneDefaut_skin = maillageSain.GetMesh().CutListOfGroups([zoneDefaut_skin], facesEnTrop, 'newZoneDefaut_skin') - putName(newMaillageInterne, 'newInternalBoundary', i_pref=nro_cas) - return newZoneDefaut_skin, newMaillageInterne diff --git a/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py b/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py index f245e9c8e..d211b38e7 100644 --- a/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py +++ b/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py @@ -75,9 +75,11 @@ def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize, \ hypo2d.SetOptimize( 1 ) hypo2d.SetFineness( 2 ) hypo2d.SetMinSize( minSize ) + hypo2d.SetChordalErrorEnabled (True) + hypo2d.SetChordalError( maxSize*0.25 ) + hypo2d.SetUseSurfaceCurvature (True) hypo2d.SetQuadAllowed( 0 ) - putName(algo2d, "{}_2d_zoneFiss".format(mailleur), i_pref=nro_cas) - putName(hypo2d, "hypo1d_zoneFiss", i_pref=nro_cas) + putName(hypo2d, "zoneFiss", i_pref=nro_cas) is_done = meshFissure.Compute() text = "meshFissure.Compute" diff --git a/src/Tools/blocFissure/gmu/identifieEdgesPeau.py b/src/Tools/blocFissure/gmu/identifieEdgesPeau.py index ca1972af5..c4cbe095c 100644 --- a/src/Tools/blocFissure/gmu/identifieEdgesPeau.py +++ b/src/Tools/blocFissure/gmu/identifieEdgesPeau.py @@ -30,13 +30,15 @@ def identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSo nro_cas=None): """Identification précise des edges et disques des faces de peau selon index extremité fissure""" logging.info('start') + logging.info('Nombre de sommets : len(verticesPipePeau) = %d', len(verticesPipePeau)) facesPipePeau = [None for _ in range(len(edgesFissExtPipe))] endsEdgeFond = [None for _ in range(len(edgesFissExtPipe))] edgeRadFacePipePeau = [None for _ in range(len(edgesFissExtPipe))] edgesListees = list() - if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau + # --- au moins une extrémité du pipe sur cette face de peau + if verticesPipePeau: edgesCircPeau, verticesCircPeau = identifieEdgesPeau_a(edgesFissExtPipe, facePeau, facesPeauSorted, edgesPeauFondIn, \ endsEdgeFond, facesPipePeau, edgeRadFacePipePeau, edgesListees, \ @@ -53,7 +55,6 @@ def identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSo nro_cas) # --- edges de la face de peau partagées avec la face de fissure - edgesFissurePeau = identifieEdgesPeau_c(verticesPipePeau, facePeau, edgesListees, verticesCircPeau) return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau, diff --git a/src/Tools/blocFissure/gmu/identifieEdgesPeau_a.py b/src/Tools/blocFissure/gmu/identifieEdgesPeau_a.py index 1f10ceb5e..b13a9ec49 100644 --- a/src/Tools/blocFissure/gmu/identifieEdgesPeau_a.py +++ b/src/Tools/blocFissure/gmu/identifieEdgesPeau_a.py @@ -44,9 +44,9 @@ def identifieEdgesPeau_a(edgesFissExtPipe, facePeau, facesPeauSorted, edgesPeauF j_aux_0 = j_aux break sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[j_aux_0]], geompy.ShapeType["VERTEX"]) - nameFace = "facePipePeau{}".format(i_aux) - nameVert = "endEdgeFond{}".format(i_aux) - nameEdge = "edgeRadFacePipePeau{}".format(i_aux) + nameFace = "facePipePeau_{}".format(i_aux) + nameVert = "endEdgeFond_{}".format(i_aux) + nameEdge = "edgeRadFacePipePeau_{}".format(i_aux) facesPipePeau[i_aux] = face endsEdgeFond[i_aux] = sharedVertices[0] geomPublish(initLog.debug, face, nameFace, nro_cas) @@ -58,23 +58,26 @@ def identifieEdgesPeau_a(edgesFissExtPipe, facePeau, facesPeauSorted, edgesPeauF geomPublish(initLog.debug, edge, nameEdge, nro_cas) break - # --- edges circulaires de la face de peau et points de jonction de la face externe de fissure - logging.debug("facesPipePeau: %s", facesPipePeau) + # --- edges elliptiques de la face de peau et points de jonction de la face externe de fissure + logging.info("Traitement des arêtes de '%s'", facePeau.GetName()) edgesCircPeau = [None for _ in range(len(facesPipePeau))] verticesCircPeau = [None for _ in range(len(facesPipePeau))] for i_aux,fcirc in enumerate(facesPipePeau): + logging.info(". Partage avec la face '%s'", fcirc.GetName()) edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"]) grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) geompy.UnionList(grpEdgesCirc, edges) edgesCircPeau[i_aux] = grpEdgesCirc - name = "edgeCirc{}".format(i_aux) + name = "edgeCirc_{}".format(i_aux) geomPublishInFather(initLog.always, facePeau, grpEdgesCirc, name) edgesListees = edgesListees + edges vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"]) grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"]) geompy.UnionList(grpVertCircPeau, vertices) verticesCircPeau[i_aux] = grpVertCircPeau - name = "pointEdgeCirc{}".format(i_aux) - geomPublishInFather(initLog.debug, facePeau, grpVertCircPeau, name) + name = "pointEdgeCirc_{}".format(i_aux) + geomPublishInFather(initLog.info, facePeau, grpVertCircPeau, name) + + logging.info('==> Nombre de sommets : len(verticesCircPeau) = %d', len(verticesCircPeau)) return edgesCircPeau, verticesCircPeau diff --git a/src/Tools/blocFissure/gmu/identifieEdgesPeau_b.py b/src/Tools/blocFissure/gmu/identifieEdgesPeau_b.py index df79b8b1e..3044d61de 100644 --- a/src/Tools/blocFissure/gmu/identifieEdgesPeau_b.py +++ b/src/Tools/blocFissure/gmu/identifieEdgesPeau_b.py @@ -36,7 +36,7 @@ def identifieEdgesPeau_b(facePeau, edgesListees, \ edgesBords = list() for i_aux, edge in enumerate(edgesFilling): edgepeau = geompy.GetInPlace(facePeau, edge) - name = "edgepeau{}".format(i_aux) + name = "edgepeau_{}".format(i_aux) geomPublishInFather(initLog.debug, facePeau,edgepeau, name) logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau)) if geompy.ShapeInfo(edgepeau)['EDGE'] > 1: diff --git a/src/Tools/blocFissure/gmu/identifieEdgesPeau_c.py b/src/Tools/blocFissure/gmu/identifieEdgesPeau_c.py index ffcdd0c32..afe027f1f 100644 --- a/src/Tools/blocFissure/gmu/identifieEdgesPeau_c.py +++ b/src/Tools/blocFissure/gmu/identifieEdgesPeau_c.py @@ -31,27 +31,42 @@ from .substractSubShapes import substractSubShapes def identifieEdgesPeau_c(verticesPipePeau, facePeau, edgesListees, verticesCircPeau): """edges de la face de peau partagées avec la face de fissure""" logging.info('start') + logging.info("Traitement des arêtes de '%s'", facePeau.GetName()) + logging.info('Nombre de sommets : len(verticesPipePeau) = %d', len(verticesPipePeau)) + #logging.info('verticesPipePeau = %s', verticesPipePeau) + logging.info('Nombre de sommets : len(verticesCircPeau) = %d', len(verticesCircPeau)) + #logging.info('verticesCircPeau = %s', verticesCircPeau) edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False) - edges = substractSubShapes(facePeau, edgesPeau, edgesListees) - edgesFissurePeau = list() + logging.info('Nombre total d arêtes de la peau : len(edgesPeau) = %d', len(edgesPeau)) - if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau - edgesFissurePeau = [None for _ in range(len(verticesCircPeau))] # edges associés aux extrémités du pipe, en premier + edges = substractSubShapes(facePeau, edgesPeau, edgesListees) + + edgesFissurePeau = list() +# --- au moins une extrémité du pipe sur cette face de peau + if verticesPipePeau: + # En premier, les edges associés aux extrémités du pipe + edgesFissurePeau = [None for _ in range(len(verticesCircPeau))] for edge in edges: - for i_aux, grpVert in enumerate(verticesCircPeau): - if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau): + for i_aux, vertex in enumerate(verticesCircPeau): + logging.info(".. distance %s", geompy.MinDistance(vertex, edge)) + if ( ( geompy.MinDistance(vertex, edge) < 1.e-3 ) and ( edge not in edgesFissurePeau ) ): edgesFissurePeau[i_aux] = edge - name = "edgeFissurePeau{}".format(i_aux) - geomPublishInFather(initLog.debug, facePeau, edge, name) - for edge in edges: # on ajoute après les edges manquantes + name = "edgeFissurePeau_{}".format(i_aux) + logging.info("... entrée de %s à la place %d", edge, i_aux) + geomPublishInFather(initLog.debug, facePeau, edge, name) + # Ensuite, on ajoute les edges manquantes + for edge in edges: if edge not in edgesFissurePeau: + logging.info("... ajout") edgesFissurePeau.append(edge) else: for i_aux, edge in enumerate(edges): edgesFissurePeau.append(edge) name = "edgeFissurePeau{}".format(i_aux) - geomPublishInFather(initLog.debug, facePeau, edge, name) + geomPublishInFather(initLog.debug, facePeau, edge, name) + + logging.info('==> Nombre d arêtes : len(edgesFissurePeau) = %d', len(edgesFissurePeau)) return edgesFissurePeau diff --git a/src/Tools/blocFissure/gmu/initLog.py b/src/Tools/blocFissure/gmu/initLog.py index 30e82eebf..ee9d1863d 100644 --- a/src/Tools/blocFissure/gmu/initLog.py +++ b/src/Tools/blocFissure/gmu/initLog.py @@ -30,13 +30,13 @@ error = 40 critical = 50 always = 100 -filelog = os.path.join(tempfile.gettempdir(),"blocFissure.log") +LOGFILE = os.path.join(tempfile.gettempdir(),"blocFissure.log") -loglevel = warning +LOG_LEVEL = warning logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s', \ level=logging.WARNING, \ - filename=filelog, filemode='w') + filename=LOGFILE, filemode='w') ch = None fh = None @@ -64,49 +64,58 @@ def setLogger(logfile, level, formatter): def setDebug(logfile=None): """setDebug""" - global loglevel - loglevel = debug + global LOG_LEVEL + LOG_LEVEL = debug level = logging.DEBUG formatter = logging.Formatter('%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s') setLogger(logfile, level, formatter) - logging.info('start Debug %s', loglevel) + logging.info('start Debug %s', LOG_LEVEL) def setVerbose(logfile=None): """setVerbose""" - global loglevel - loglevel = info + global LOG_LEVEL + LOG_LEVEL = info level = logging.INFO formatter = logging.Formatter('%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s') setLogger(logfile, level, formatter) - logging.info('start Verbose %s', loglevel) + logging.info('start Verbose %s', LOG_LEVEL) def setRelease(logfile=None): """setRelease""" - global loglevel - loglevel = warning + global LOG_LEVEL + LOG_LEVEL = warning level = logging.WARNING formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s') setLogger(logfile, level, formatter) - logging.warning('start Release %s', loglevel) + logging.warning('start Release %s', LOG_LEVEL) def setUnitTests(logfile=None): """setUnitTests""" - global loglevel - loglevel = critical + global LOG_LEVEL + LOG_LEVEL = critical level = logging.CRITICAL formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s') setLogger(logfile, level, formatter) - logging.critical('start UnitTests %s', loglevel) + logging.critical('start UnitTests %s', LOG_LEVEL) def setPerfTests(logfile=None): """setPerfTests""" - global loglevel - loglevel = critical + global LOG_LEVEL + LOG_LEVEL = critical level = logging.CRITICAL formatter = logging.Formatter('%(funcName)s[%(lineno)d] %(message)s') setLogger(logfile, level, formatter) - logging.info('start PerfTests %s', loglevel) + logging.info('start PerfTests %s', LOG_LEVEL) + +def setAlways(logfile=None): + """setAlways""" + global LOG_LEVEL + LOG_LEVEL = always + level = logging.CRITICAL + formatter = logging.Formatter('%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s') + setLogger(logfile, level, formatter) + logging.info('start Always %s', LOG_LEVEL) def getLogLevel(): """getLogLevel""" - return loglevel + return LOG_LEVEL diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_c.py b/src/Tools/blocFissure/gmu/insereFissureLongue_c.py index c8b8578d4..49d94acf5 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_c.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_c.py @@ -45,32 +45,26 @@ def insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCercl putName(meshFondFiss, "pipeFondFiss", i_pref=nro_cas) algo3d = meshFondFiss.Prism() - putName(algo3d.GetSubMesh(), "pipe", i_pref=nro_cas) - putName(algo3d, "Prism", i_pref=nro_cas) algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.QUADRANGLE) - putName(algo2d, "QUADRANGLE", i_pref=nro_cas) for i_aux, face in enumerate(disques): #print (i_aux) # la commande suivante entraîne addToStudy() failed algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.RADIAL_QUAD,geom=face) putName(algo2d.GetSubMesh(), "disque", i_aux, nro_cas) - putName(algo2d, "RADIAL_QUAD", i_aux, nro_cas) for i_aux, edge in enumerate(rayons): algo1d = meshFondFiss.Segment(geom=edge) - hypo1d = algo1d.NumberOfSegments(4) putName(algo1d.GetSubMesh(), "rayon", i_aux, nro_cas) - putName(algo1d, "algo1d_rayon", i_aux, nro_cas) - putName(hypo1d, "hypo1d_rayon", i_aux, nro_cas) + hypo1d = algo1d.NumberOfSegments(4) + putName(hypo1d, "rayon={}".format(4), i_aux, nro_cas) for i_aux, edge in enumerate(demiCercles): algo1d = meshFondFiss.Segment(geom=edge) - hypo1d = algo1d.NumberOfSegments(6) putName(algo1d.GetSubMesh(), "demiCercle", i_aux, nro_cas) - putName(algo1d, "algo1d_demiCercle", i_aux, nro_cas) - putName(hypo1d, "hypo1d_demiCercle", i_aux, nro_cas) + hypo1d = algo1d.NumberOfSegments(6) + putName(hypo1d, "demiCercle={}".format(6), i_aux, nro_cas) generSorted, minlg, maxlg = sortEdges(generatrices) nbSegGenLong = int(math.sqrt(3.0)*maxlg/(profondeur - rayonPipe)) # on veut 2 triangles equilateraux dans la largeur de la face @@ -78,13 +72,13 @@ def insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCercl logging.info("min %s, max %s, nombre de segments %s, nombre de generatrices %s", minlg, maxlg, nbSegGenLong, len(generSorted)) for i_aux, edge in enumerate(generSorted): algo1d = meshFondFiss.Segment(geom=edge) - if i_aux < 6: - hypo1d = algo1d.NumberOfSegments(nbSegGenBout) - else: - hypo1d = algo1d.NumberOfSegments(nbSegGenLong) putName(algo1d.GetSubMesh(), "generatrice", i_aux, nro_cas) - putName(algo1d, "algo1d_generatrice", i_aux, nro_cas) - putName(hypo1d, "hypo1d_generatrice", i_aux, nro_cas) + if i_aux < 6: + nbSeg = nbSegGenBout + else: + nbSeg = nbSegGenLong + hypo1d = algo1d.NumberOfSegments(nbSeg) + putName(hypo1d, "generatrice={}".format(nbSeg), i_aux, nro_cas) disks = list() for i_aux, face in enumerate(disques[:4]): diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_d.py b/src/Tools/blocFissure/gmu/insereFissureLongue_d.py index 206b71c6b..0a68df106 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_d.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_d.py @@ -55,10 +55,12 @@ def insereFissureLongue_d (facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibr hypo2d.SetOptimize( 1 ) hypo2d.SetFineness( 2 ) hypo2d.SetMinSize( 2 ) + hypo2d.SetChordalErrorEnabled (True) + hypo2d.SetChordalError( 250. ) + hypo2d.SetUseSurfaceCurvature (True) hypo2d.SetQuadAllowed( 0 ) putName(algo2d.GetSubMesh(), "facePeau", i_pref=nro_cas) - putName(algo2d, "{}_2d_facePeau".format(mailleur), i_pref=nro_cas) - putName(hypo2d, "hypo2d_facePeau", i_pref=nro_cas) + putName(hypo2d, "facePeau", i_pref=nro_cas) # lenEdgePeauFiss = geompy.BasicProperties(edgePeauFiss)[0] frac = profondeur/lenEdgePeauFiss @@ -72,21 +74,18 @@ def insereFissureLongue_d (facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibr hypo1d.SetConversionMode( 1 ) hypo1d.SetTableFunction( [ 0, ratio, frac, 1, (1.-frac), 1, 1, ratio ] ) putName(algo1d.GetSubMesh(), "edgePeauFiss", i_pref=nro_cas) - putName(algo1d, "algo1d_edgePeauFiss", i_pref=nro_cas) - putName(hypo1d, "hypo1d_edgePeauFiss", i_pref=nro_cas) + putName(hypo1d, "edgePeauFiss", i_pref=nro_cas) # algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) putName(algo1d.GetSubMesh(), "bordsLibres", i_pref=nro_cas) - putName(algo1d, "algo1d_bordsLibres", i_pref=nro_cas) - putName(hypo1d, "hypo1d_bordsLibres", i_pref=nro_cas) + putName(hypo1d, "bordsLibres", i_pref=nro_cas) # for i_aux in range(2): algo1d = meshFacePeau.UseExisting1DElements(geom=groupsDemiCerclesPeau[i_aux]) hypo1d = algo1d.SourceEdges([ groups_demiCercles[i_aux] ],0,0) putName(algo1d.GetSubMesh(), "DemiCercles", i_aux, nro_cas) - putName(algo1d, "algo1d_groupDemiCercles", i_aux, nro_cas) - putName(hypo1d, "hypo1d_groupDemiCercles", i_aux, nro_cas) + putName(hypo1d, "groupDemiCercles", i_aux, nro_cas) _ = meshFacePeau.GroupOnGeom(verticesOutCercles[0], "THOR", SMESH.NODE) _ = meshFacePeau.GroupOnGeom(verticesOutCercles[1], "THEX", SMESH.NODE) diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_e.py b/src/Tools/blocFissure/gmu/insereFissureLongue_e.py index 3a505845e..6fa5fe8ca 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_e.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_e.py @@ -55,22 +55,22 @@ def insereFissureLongue_e (faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_gen hypo2d.SetOptimize( 1 ) hypo2d.SetFineness( 2 ) hypo2d.SetMinSize( 2 ) + hypo2d.SetChordalErrorEnabled (True) + hypo2d.SetChordalError( mesh_size*0.25 ) + hypo2d.SetUseSurfaceCurvature (True) hypo2d.SetQuadAllowed( 0 ) putName(algo2d.GetSubMesh(), "faceFiss", i_pref=nro_cas) - putName(algo2d, "{}_2d_faceFiss".format(mailleur), i_pref=nro_cas) - putName(hypo2d, "hypo2d_faceFiss", i_pref=nro_cas) + putName(hypo2d, "faceFiss", i_pref=nro_cas) # algo1d = meshFaceFiss.UseExisting1DElements(geom=edgePeauFiss) hypo1d = algo1d.SourceEdges([ groupEdgesPeauFiss ],0,0) putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas) - putName(algo1d, "algo1d_edgeFissPeau", i_pref=nro_cas) - putName(hypo1d, "hypo1d_edgeFissPeau", i_pref=nro_cas) + putName(hypo1d, "edgeFissPeau", i_pref=nro_cas) # algo1d = meshFaceFiss.UseExisting1DElements(geom=groupEdgesFaceFissPipe) hypo1d = algo1d.SourceEdges([ group_generFiss ],0,0) putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas) - putName(algo1d, "algo1d_edgeFissPeau", i_pref=nro_cas) - putName(hypo1d, "hypo1d_edgeFissPeau", i_pref=nro_cas) + putName(hypo1d, "edgeFissPeau", i_pref=nro_cas) _ = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE) diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_f.py b/src/Tools/blocFissure/gmu/insereFissureLongue_f.py index 034d5b0ec..cc57705cb 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_f.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_f.py @@ -65,7 +65,6 @@ def insereFissureLongue_f (internalBoundary, meshFondFiss, meshFacePeau, meshFac hypo3d.SetStandardOutputLog( 0 ) hypo3d.SetRemoveLogOnSuccess( 1 ) putName(algo3d.GetSubMesh(), "boiteDefaut", i_pref=nro_cas) - putName(algo3d, "{}_3d_boiteDefaut".format(mailleur), i_pref=nro_cas) putName(meshBoiteDefaut, "boiteDefaut", i_pref=nro_cas) is_done = meshBoiteDefaut.Compute() diff --git a/src/Tools/blocFissure/gmu/listOfExtraFunctions.py b/src/Tools/blocFissure/gmu/listOfExtraFunctions.py index 70a0fdbf1..a862f796e 100644 --- a/src/Tools/blocFissure/gmu/listOfExtraFunctions.py +++ b/src/Tools/blocFissure/gmu/listOfExtraFunctions.py @@ -17,16 +17,19 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -"""Cette fonction permet de scanner la liste de noeuds qui composent le maillage passé en paramètre +"""Fonctions générrales sur les maillages Created on Mon Jun 23 14:49:36 2014 @author: I48174 (Olivier HOAREAU) """ import logging + import SMESH from .geomsmesh import smesh +from .putName import putName + def lookForCorner(maillageAScanner): """ Cette fonction permet de scanner la liste de noeuds qui composent le @@ -188,7 +191,8 @@ def createLinesFromMesh(maillageSupport): return nodelines -def createNewMeshesFromCorner(maillageSupport, listOfCorners): +def createNewMeshesFromCorner(maillageSupport, listOfCorners, \ + nro_cas=None): """ Cette fonction permet de générer un nouveau maillage plus facile à utiliser. On démarre d'un coin et on récupère les trois éléments @@ -200,21 +204,26 @@ def createNewMeshesFromCorner(maillageSupport, listOfCorners): tmp = list() listOfNewMeshes = list() + n_msh = -1 for corner in listOfCorners: elems = maillageSupport.GetNodeInverseElements(corner) - for i_aux, elem in enumerate(elems): + for elem in elems: # --- Filtre selon le critère 'coplanar' --- # critere = smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \ SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30) filtre = smesh.GetFilterFromCriteria([critere]) - grp = maillageSupport.GroupOnFilter(SMESH.FACE, 'grp', filtre) + n_msh += 1 + nom = "coin_{}".format(n_msh) + grp = maillageSupport.GroupOnFilter(SMESH.FACE, nom, filtre) # On copie le maillage en fonction du filtre - msh = smesh.CopyMesh(grp, 'new_{0}'.format(i_aux+1), False, True) + msh = smesh.CopyMesh(grp, nom, False, True) + putName(msh, nom, i_pref=nro_cas) # On stocke l'ensemble des noeuds du maillage dans tmp # On ajoute le maillage à la liste des nouveaux maillages # seulement s'il n'y est pas déjà tmp.append(msh.GetNodesId()) if ( tmp.count(msh.GetNodesId()) <= 1 ): + putName(msh, "Face", len(listOfNewMeshes), nro_cas) listOfNewMeshes.append(msh) return listOfNewMeshes diff --git a/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py b/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py index 79bb48190..36d53fb14 100644 --- a/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py +++ b/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py @@ -60,10 +60,9 @@ def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives, geomPublish(initLog.always, aretesVivesC, "aretesVives", nro_cas) meshAretesVives = smesh.Mesh(aretesVivesC) algo1d = meshAretesVives.Segment() - hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07) putName(algo1d.GetSubMesh(), "aretesVives", i_pref=nro_cas) - putName(algo1d, "algo1d_aretesVives", i_pref=nro_cas) - putName(hypo1d, "hypo1d_aretesVives", i_pref=nro_cas) + hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07) + putName(hypo1d, "aretesVives={}".format(lgAretesVives), i_pref=nro_cas) is_done = meshAretesVives.Compute() text = "meshAretesVives.Compute" diff --git a/src/Tools/blocFissure/gmu/mailleFacesFissure.py b/src/Tools/blocFissure/gmu/mailleFacesFissure.py index 0b63cfa9d..546525af9 100644 --- a/src/Tools/blocFissure/gmu/mailleFacesFissure.py +++ b/src/Tools/blocFissure/gmu/mailleFacesFissure.py @@ -37,7 +37,7 @@ def mailleFacesFissure(faceFissureExterne, \ logging.info("Maillage avec %s pour le cas n°%s", mailleur, nro_cas) meshFaceFiss = smesh.Mesh(faceFissureExterne) - logging.info("Maillage avec %s", mailleur) + putName(meshFaceFiss.GetMesh(), "faceFiss", i_pref=nro_cas) if ( mailleur == "MeshGems"): algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.MG_CADSurf) hypo2d = algo2d.Parameters() @@ -54,22 +54,21 @@ def mailleFacesFissure(faceFissureExterne, \ hypo2d.SetOptimize( 1 ) hypo2d.SetFineness( 2 ) hypo2d.SetMinSize( rayonPipe/float(nbsegRad) ) + hypo2d.SetChordalErrorEnabled (True) hypo2d.SetChordalError( areteFaceFissure*0.25 ) + hypo2d.SetUseSurfaceCurvature (True) hypo2d.SetQuadAllowed( 0 ) - putName(algo2d.GetSubMesh(), "faceFiss", i_pref=nro_cas) - putName(algo2d, "{}_2d_faceFiss".format(mailleur), i_pref=nro_cas) - putName(hypo2d, "hypo2d_faceFiss", i_pref=nro_cas) + putName(hypo2d, "faceFiss", i_pref=nro_cas) logging.info("UseExisting1DElements depuis '%s'", edgesPipeFissureExterneC.GetName()) algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC) - hypo1d = algo1d.SourceEdges([ edgeFaceFissGroup ],0,0) putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas) - putName(algo1d, "algo1d_edgeFissPeau", i_pref=nro_cas) - putName(hypo1d, "hypo1d_edgeFissPeau", i_pref=nro_cas) + hypo1d = algo1d.SourceEdges([ edgeFaceFissGroup ],0,0) + putName(hypo1d, "SourceEdges_edgeFissPeau", i_pref=nro_cas) - grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE) - grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE) grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE) + grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE) + grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE) is_done = meshFaceFiss.Compute() text = "meshFaceFiss.Compute" diff --git a/src/Tools/blocFissure/gmu/mailleFacesPeau.py b/src/Tools/blocFissure/gmu/mailleFacesPeau.py index e8289c22f..9e56f5815 100644 --- a/src/Tools/blocFissure/gmu/mailleFacesPeau.py +++ b/src/Tools/blocFissure/gmu/mailleFacesPeau.py @@ -79,10 +79,11 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ hypo2d.SetOptimize( 1 ) hypo2d.SetFineness( 2 ) hypo2d.SetMinSize( rayonPipe/float(nbsegRad) ) + hypo2d.SetChordalErrorEnabled (True) hypo2d.SetChordalError( dmoyen*0.25 ) + hypo2d.SetUseSurfaceCurvature (True) hypo2d.SetQuadAllowed( 0 ) - putName(algo2d, "{}_2d_facePeau".format(mailleur), ifil, nro_cas) - putName(hypo2d, "hypo2d_facePeau", ifil, nro_cas) + putName(hypo2d, "{}_2d_facePeau".format(mailleur), ifil, nro_cas) if partitionsPeauFissFond[ifil] is None: # face de peau maillage sain intacte @@ -94,12 +95,12 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ geompy.UnionList(groupEdgesBordPeau, edgesFilling) geomPublishInFather(initLog.always, filling, groupEdgesBordPeau, "EdgesBords", nro_cas) - logging.info("UseExisting1DElements depuis '%s'", groupEdgesBordPeau.GetName()) + logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \ + groupEdgesBordPeau.GetName(), bordsLibres.GetName()) algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) - hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) putName(algo1d.GetSubMesh(), "bordsLibres", ifil, nro_cas) - putName(algo1d, "algo1d_bordsLibres", ifil, nro_cas) - putName(hypo1d, "hypo1d_bordsLibres", ifil, nro_cas) + hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) + putName(hypo1d, "SourceEdges_{}".format(bordsLibres.GetName()), ifil, nro_cas) else: @@ -110,44 +111,44 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ bordsVifs = gpedgeVifs[ifil] # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes] - logging.info("UseExisting1DElements depuis groupEdgesBordPeau = '%s'", groupEdgesBordPeau.GetName()) + logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \ + groupEdgesBordPeau.GetName(), bordsLibres.GetName()) algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) - hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) putName(algo1d.GetSubMesh(), "bordsLibres", ifil, nro_cas) - putName(algo1d, "algo1d_bordsLibres", ifil, nro_cas) - putName(hypo1d, "hypo1d_bordsLibres", ifil, nro_cas) + hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) + putName(hypo1d, "SourceEdges_{}".format(bordsLibres.GetName()), i_pref=nro_cas) objet = geompy.MakeCompound(edgesFissurePeau) geomPublishInFather(initLog.always, facePeau, objet, "edgesFissurePeau") - logging.info("UseExisting1DElements depuis objet = '%s'", objet.GetName()) + logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \ + objet.GetName(), grpEdgesPeauFissureExterne.GetName()) algo1d = meshFacePeau.UseExisting1DElements(geom=objet) + putName(algo1d.GetSubMesh(), objet.GetName(), i_pref=nro_cas) hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0) - putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil, nro_cas) - putName(algo1d, "algo1d_edgePeauFiss", ifil, nro_cas) - putName(hypo1d, "hypo1d_edgePeauFiss", ifil, nro_cas) + putName(hypo1d, "SourceEdges_{}".format(grpEdgesPeauFissureExterne.GetName()), i_pref=nro_cas) if bordsVifs is not None: - logging.info("UseExisting1DElements depuis bordsVifs = '%s'", bordsVifs.GetName()) + logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \ + bordsVifs.GetName(), grpAretesVives.GetName()) algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs) - hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0) putName(algo1d.GetSubMesh(), "bordsVifs", ifil, nro_cas) - putName(algo1d, "algo1d_bordsVifs", ifil, nro_cas) - putName(hypo1d, "hypo1d_bordsVifs", ifil, nro_cas) + hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0) + putName(hypo1d, "SourceEdges_{}".format(grpAretesVives.GetName()), i_pref=nro_cas) for i_aux, edgeCirc in enumerate(edgesCircPeau): texte = "i_aux = {}".format(i_aux) logging.info(texte) if edgeCirc is not None: - logging.info("UseExisting1DElements depuis edgeCirc = '%s'", edgeCirc.GetName()) - algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc) # addToStudy() failed ? if boutFromIfil[ifil] is None: - hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i_aux] ],0,0) + groupe = edgesCircPipeGroup[i_aux] else: - hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0) - name = "cercle{}".format(i_aux) - putName(algo1d.GetSubMesh(), name, ifil, nro_cas) - putName(algo1d, "algo1d_" + name, ifil, nro_cas) - putName(hypo1d, "hypo1d_" + name, ifil, nro_cas) + groupe = edgesCircPipeGroup[boutFromIfil[ifil]] + logging.info("UseExisting1DElements sur la géométrie '%s' avec les mailles de '%s'", \ + edgeCirc.GetName(), groupe.GetName()) + algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc) # addToStudy() failed ? + putName(algo1d.GetSubMesh(), groupe.GetName(), i_pref=nro_cas) + hypo1d = algo1d.SourceEdges([ groupe ],0,0) + putName(hypo1d, "SourceEdges_{}".format(groupe.GetName()), i_pref=nro_cas) is_done = meshFacePeau.Compute() text = "meshFacePeau {} .Compute".format(ifil) diff --git a/src/Tools/blocFissure/gmu/meshBlocPart.py b/src/Tools/blocFissure/gmu/meshBlocPart.py index 9d399c60b..a2d051ef3 100644 --- a/src/Tools/blocFissure/gmu/meshBlocPart.py +++ b/src/Tools/blocFissure/gmu/meshBlocPart.py @@ -58,76 +58,66 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle for i_aux, sharedFaces_i in enumerate(sharedFaces): algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces_i) + putName(algo2d.GetSubMesh(), "sharedFaces", i_aux, nro_cas) hypo2d = algo2d.Parameters(which=smesh.SIMPLE) hypo2d.SetLocalLength(lensegEllipsoide) hypo2d.LengthFromEdges() hypo2d.SetAllowQuadrangles(0) - putName(algo2d.GetSubMesh(), "sharedFaces", i_aux, nro_cas) - putName(algo2d, "{}_2d_sharedFaces".format(mailleur), i_aux, nro_cas) - putName(hypo2d, "hypo2d_sharedFaces", i_aux, nro_cas) + putName(hypo2d, "sharedFaces", i_aux, nro_cas) for i_aux, sharedEdges_i in enumerate(sharedEdges): algo1d = bloc1.Segment(geom=sharedEdges_i) - hypo1d = algo1d.LocalLength(lensegEllipsoide) putName(algo1d.GetSubMesh(), "sharedEdges", i_aux, nro_cas) - putName(algo1d, "algo1d_sharedEdges", i_aux, nro_cas) - putName(hypo1d, "hypo1d_sharedEdges", i_aux, nro_cas) + hypo1d = algo1d.LocalLength(lensegEllipsoide) + putName(hypo1d, "sharedEdges={}".format(lensegEllipsoide), i_aux, nro_cas) declareAlgoEllipsoideFirst = False if declareAlgoEllipsoideFirst: algo3d = bloc1.Tetrahedron(algo=smeshBuilder.NETGEN,geom=ellipsoidep) - hypo3d = algo3d.MaxElementVolume(1000.0) putName(algo3d.GetSubMesh(), "ellipsoide", i_pref=nro_cas) - putName(algo3d, "{}_3d_ellipsoide".format(mailleur), i_pref=nro_cas) - putName(hypo3d, "hypo3d_ellipsoide", i_pref=nro_cas) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(hypo3d, "ellipsoide", i_pref=nro_cas) algo3d = bloc1.Prism(geom=tore) + putName(algo3d.GetSubMesh(), "tore", i_pref=nro_cas) algo2d = bloc1.Quadrangle(geom=tore) algo1d = bloc1.Segment(geom=tore) hypo1d = algo1d.NumberOfSegments(nbsegGen) - putName(algo3d.GetSubMesh(), "tore", i_pref=nro_cas) - putName(algo3d, "{}_3d_tore".format(mailleur), i_pref=nro_cas) - putName(algo2d, "{}_2d_tore".format(mailleur), i_pref=nro_cas) - putName(algo1d, "algo1d_tore", i_pref=nro_cas) - putName(hypo1d, "hypo1d_tore", i_pref=nro_cas) + putName(hypo1d, "tore={}".format(nbsegGen), i_pref=nro_cas) for i_aux, faces_i in enumerate(faces): algo2d = bloc1.Quadrangle(geom=faces_i) + putName(algo2d.GetSubMesh(), "faces", i_aux, nro_cas) hypo2d = smesh.CreateHypothesis('QuadrangleParams') hypo2d.SetTriaVertex( geompy.GetSubShapeID(blocPartition,centres[i_aux]) ) hypo2d.SetQuadType( StdMeshersBuilder.QUAD_STANDARD ) _ = bloc1.AddHypothesis(hypo2d,faces_i) - putName(algo2d.GetSubMesh(), "faces", i_aux, nro_cas) - putName(algo2d, "{}_2d_faces".format(mailleur), i_aux, nro_cas) - putName(hypo2d, "hypo2d_faces", i_aux, nro_cas) + putName(hypo2d, "faces", i_aux, nro_cas) for i_aux, edges_i in enumerate(edges): algo1d = bloc1.Segment(geom=edges_i) + putName(algo1d.GetSubMesh(), "edges", i_aux, nro_cas) if reverses[i_aux] > 0: hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges_i) ]) else: hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ ]) - putName(algo1d.GetSubMesh(), "edges", i_aux, nro_cas) - putName(algo1d, "algo1d_edges", i_aux, nro_cas) - putName(hypo1d, "hypo1d_edges", i_aux, nro_cas) + putName(hypo1d, "edges", i_aux, nro_cas) for i_aux, circles_i in enumerate(circles): algo1d = bloc1.Segment(geom=circles_i) - hypo1d = algo1d.NumberOfSegments(nbsegCercle) putName(algo1d.GetSubMesh(), "circles", i_aux, nro_cas) - putName(algo1d, "algo1d_circles", i_aux, nro_cas) - putName(hypo1d, "hypo1d_circles", i_aux, nro_cas) + hypo1d = algo1d.NumberOfSegments(nbsegCercle) + putName(hypo1d, "circles={}".format(nbsegCercle), i_aux, nro_cas) if len(edgeext) == 1: densite = int(round(nbsegFis/2)) algo1d = bloc1.Segment(geom=edgeext[0]) + putName(algo1d.GetSubMesh(), "edgeext", i_pref=nro_cas) hypo1d = algo1d.NumberOfSegments(nbsegFis) hypo1d.SetDistrType( 2 ) hypo1d.SetConversionMode( 1 ) hypo1d.SetTableFunction( [ 0, densite, 0.4, 1, 0.6, 1, 1, densite ] ) - putName(algo1d.GetSubMesh(), "edgeext", i_pref=nro_cas) - putName(algo1d, "algo1d_edgeext", i_pref=nro_cas) - putName(hypo1d, "hypo1d_edgeext", i_pref=nro_cas) + putName(hypo1d, "edgeext", i_pref=nro_cas) else: longTotal = 0 longEdgeExts = list() @@ -139,21 +129,19 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle nbLocal = int(round(nbsegFis*longEdgeExts[i_aux]/longTotal)) densite = int(round(nbLocal/2)) algo1d = bloc1.Segment(geom=edgeext_i) + putName(algo1d.GetSubMesh(), "edgeext", i_aux, nro_cas) hypo1d = algo1d.NumberOfSegments(nbLocal) hypo1d.SetDistrType( 2 ) hypo1d.SetConversionMode( 1 ) hypo1d.SetTableFunction( [ 0, densite, 0.8, 1, 1, 1 ] ) if reverext[i_aux]: hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext_i) ]) - putName(algo1d.GetSubMesh(), "edgeext", i_aux, nro_cas) - putName(algo1d, "algo1d_edgeext", i_aux, nro_cas) - putName(hypo1d, "hypo1d_edgeext", i_aux, nro_cas) + putName(hypo1d, "edgeext", i_aux, nro_cas) algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facefissoutore) - hypo2d = algo2d.LengthFromEdges() putName(algo2d.GetSubMesh(), "facefissoutore", i_pref=nro_cas) - putName(algo2d, "{}_2d_facefissoutore".format(mailleur), i_pref=nro_cas) - putName(hypo2d, "hypo2d_facefissoutore", i_pref=nro_cas) + hypo2d = algo2d.LengthFromEdges() + putName(hypo2d, "facefissoutore", i_pref=nro_cas) maxElemArea = 0.5*dmoyen*dmoyen @@ -161,37 +149,31 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle for i_aux, facesExternes_i in enumerate(facesExternes): algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes_i) + putName(algo2d.GetSubMesh(), "facesExternes", i_aux, nro_cas) hypo2d = algo2d.MaxElementArea(maxElemArea) + putName(hypo2d, "facesExternes={}".format(maxElemArea), i_aux, nro_cas) if edgesBords is None: algo1d = bloc1.Segment(geom=facesExternes_i) hypo1d = algo1d.NumberOfSegments(1) - putName(algo2d.GetSubMesh(), "facesExternes", i_aux, nro_cas) - putName(algo2d, "{}2d_facesExternes".format(mailleur), i_aux, nro_cas) - putName(hypo2d, "hypo2d_facesExternes", i_aux, nro_cas) - if edgesBords is None: - putName(algo1d, "algo1d_facesExternes", i_aux, nro_cas) - putName(hypo1d, "hypo1d_facesExternes", i_aux, nro_cas) + putName(hypo1d, "facesExternes", i_aux, nro_cas) for i_aux, aretesInternes_i in enumerate(aretesInternes): algo1d = bloc1.Segment(geom=aretesInternes_i) - hypo1d = algo1d.NumberOfSegments(nbsegExt) putName(algo1d.GetSubMesh(), "aretesInternes", i_aux, nro_cas) - putName(algo1d, "algo1d_aretesInternes", i_aux, nro_cas) - putName(hypo1d, "hypo1d_aretesInternes", i_aux, nro_cas) + hypo1d = algo1d.NumberOfSegments(nbsegExt) + putName(hypo1d, "aretesInternes={}".format(nbsegExt), i_aux, nro_cas) if edgesBords is not None: algo1d = bloc1.UseExisting1DElements(geom=edgesBords) - hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) putName(algo1d.GetSubMesh(), "bordsLibres", i_pref=nro_cas) - putName(algo1d, "algo1d_bordsLibres", i_pref=nro_cas) - putName(hypo1d, "hypo1d_bordsLibres", i_pref=nro_cas) + hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) + putName(hypo1d, "bordsLibres", i_pref=nro_cas) if not declareAlgoEllipsoideFirst: algo3d = bloc1.Tetrahedron(algo=smeshBuilder.NETGEN,geom=ellipsoidep) - hypo3d = algo3d.MaxElementVolume(1000.0) putName(algo3d.GetSubMesh(), "ellipsoide", i_pref=nro_cas) - putName(algo3d, "{}_3d_ellipsoide".format(mailleur), i_pref=nro_cas) - putName(hypo3d, "hypo3d_ellipsoide", i_pref=nro_cas) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(hypo3d, "ellipsoide", i_pref=nro_cas) _ = bloc1.GroupOnGeom(faceFissure,'FACE1',SMESH.FACE) _ = bloc1.GroupOnGeom(gencnt,'nfondfis',SMESH.NODE) @@ -230,10 +212,9 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False) algo3d = blocMesh.Tetrahedron(algo=smeshBuilder.NETGEN) - hypo3d = algo3d.MaxElementVolume(1000.0) putName(algo3d.GetSubMesh(), "bloc", i_pref=nro_cas) - putName(algo3d, "{}_3d_bloc".format(mailleur), i_pref=nro_cas) - putName(hypo3d, "hypo3d_bloc", i_pref=nro_cas) + hypo3d = algo3d.MaxElementVolume(1000.0) + putName(hypo3d, "bloc", i_pref=nro_cas) is_done = blocMesh.Compute() text = "blocMesh.Compute" diff --git a/src/Tools/blocFissure/gmu/peauInterne.py b/src/Tools/blocFissure/gmu/peauInterne.py index ccc1f4f91..953241e1a 100644 --- a/src/Tools/blocFissure/gmu/peauInterne.py +++ b/src/Tools/blocFissure/gmu/peauInterne.py @@ -46,31 +46,20 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones, \ #for grp in groups: #print ("\t{}".format(grp.GetName())) zoneDefaut = None - for grp in groups: - logging.debug("groupe %s",grp.GetName()) - if grp.GetName() == nomZones + "_vol": - zoneDefaut = grp - break - #print ("zoneDefaut = {}".format(zoneDefaut)) zoneDefaut_skin = None - for grp in groups: - if grp.GetName() == nomZones + "_skin": - zoneDefaut_skin = grp - break - #print ("zoneDefaut_skin = {}".format(zoneDefaut_skin)) zoneDefaut_internalFaces = None - for grp in groups: - if grp.GetName() == nomZones + "_internalFaces": - zoneDefaut_internalFaces = grp - break - #print ("zoneDefaut_internalFaces = {}".format(zoneDefaut_internalFaces)) zoneDefaut_internalEdges = None for grp in groups: - if grp.GetName() == nomZones + "_internalEdges": + nom = grp.GetName() + logging.debug("groupe %s",nom) + if ( nom == nomZones + "_vol" ): + zoneDefaut = grp + elif ( nom == nomZones + "_skin" ): + zoneDefaut_skin = grp + elif ( nom == nomZones + "_internalFaces" ): + zoneDefaut_internalFaces = grp + elif ( nom == nomZones + "_internalEdges" ): zoneDefaut_internalEdges = grp - break - #print ("zoneDefaut_internalEdges = {}".format(zoneDefaut_internalEdges)) - # --- Le groupe ZoneDefaut ne doit contenir que des Hexaèdres" info = maillageSain.GetMeshInfo(zoneDefaut) @@ -106,6 +95,8 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones, \ logging.debug(texte) if listOfCorner: logging.info("présence de coins à la surface externe de la zone à reconstruire") - zoneDefaut_skin, internalBoundary = fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner) + zoneDefaut_skin, internalBoundary = \ + fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner, \ + nro_cas) return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges diff --git a/src/Tools/blocFissure/ihm/fissureCoude_ihm.py b/src/Tools/blocFissure/ihm/fissureCoude_ihm.py index c6cbed803..8c3905cb4 100644 --- a/src/Tools/blocFissure/ihm/fissureCoude_ihm.py +++ b/src/Tools/blocFissure/ihm/fissureCoude_ihm.py @@ -97,8 +97,8 @@ class fissureCoude_ihm(fissureCoude): areteFaceFissure = taille cible de l'arête des triangles en face de fissure. """ self.maillageFissureParams = dict(nomRep = os.curdir, \ - nomFicSain = self.nomCas, \ - nomFicFissure = 'fissure_' + self.nomCas, \ + nomFicSain = self.nomProbleme, \ + nomFicFissure = self.nomProbleme + '_fissure', \ nbsegRad = self.dico['nbCouronnes'], \ nbsegCercle = self.dico['nbSecteurs'], \ areteFaceFissure = self.dico['aretesFaceFissure'])