X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FpeauInterne.py;h=640326b472879fe12b5750c09fdc7a7c6ee050cf;hp=6e6915966ddba61a814015f0b902b0aa02cd29c9;hb=b24a2d1b7692bdb21cf037b026e0273ba547cef4;hpb=a17b36970bc61da1d664453c615754997c925b18 diff --git a/src/Tools/blocFissure/gmu/peauInterne.py b/src/Tools/blocFissure/gmu/peauInterne.py index 6e6915966..640326b47 100644 --- a/src/Tools/blocFissure/gmu/peauInterne.py +++ b/src/Tools/blocFissure/gmu/peauInterne.py @@ -1,75 +1,105 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2014-2021 EDF R&D +# +# 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 +# import logging -from geomsmesh import smesh +from .geomsmesh import smesh import SMESH import traceback -from fissError import fissError +from .fissError import fissError -from listOfExtraFunctions import lookForCorner -from fusionMaillageAttributionDefaut import fusionMaillageDefaut +from .listOfExtraFunctions import lookForCorner +from .fusionMaillageAttributionDefaut import fusionMaillageDefaut # ----------------------------------------------------------------------------- # --- peau interne du defaut dans le maillage sain def peauInterne(fichierMaillage, shapeDefaut, nomZones): - """ - Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage) + """Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage) + On récupère le volume et la peau de la zone de défaut, les éventuelles faces et arêtes internes de cette zone. + Remarque : intérêt du passage par fichierMaillage plutôt que par maillageSain ? """ logging.info("start") ([maillageSain], status) = smesh.CreateMeshesFromMED(fichierMaillage) groups = maillageSain.GetGroups() + #print ("groupes :") + #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": zoneDefaut_internalEdges = grp break - + #print ("zoneDefaut_internalEdges = {}".format(zoneDefaut_internalEdges)) + # --- Le groupe ZoneDefaut ne doit contenir que des Hexaèdres" - - info=maillageSain.GetMeshInfo(zoneDefaut) - keys = info.keys(); keys.sort() - nbelem=0 - nbhexa=0 - for i in keys: - #print " %s : %d" % ( i, info[i] ) - nbelem+=info[i] - if "Entity_Hexa" in str(i): - nbhexa+=info[i] - if (nbelem == 0) or (nbhexa < nbelem) : + + info = maillageSain.GetMeshInfo(zoneDefaut) + #print ("info = {}".format(info)) + nbelem = 0 + nbhexa = 0 + for entity_type in info: + #print (". {} : {})".format(entity_type, info[entity_type])) + nbelem += info[entity_type] + if ("Entity_Hexa" == str(entity_type)): + nbhexa += info[entity_type] + nbhexa += info[entity_type] + #print ("==> nbelem = {}, nbhexa = {}".format(nbelem,nbhexa)) + + if ( (nbelem == 0) or (nbhexa < nbelem) ): + print ("==> nbelem = {}, nbhexa = {}".format(nbelem,nbhexa)) texte = "La zone a remailler est incorrecte.
" texte += "Causes possibles :" + texte += "
  • Il n'y a pas que des hexaèdres réglés linéaires dans la zone à remailler (notamment mailles quadratiques, tetraèdres non traités)
  • " raise fissError(traceback.extract_stack(),texte) nbAdded, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ]) internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' ) internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0) - + maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0) listOfCorner = lookForCorner(maillageDefautCible) - logging.debug("listOfCorner = %s", listOfCorner) - if len(listOfCorner) > 0: + logging.debug("listOfCorner = {}".format(listOfCorner)) + 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)