X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FmailleAretesEtJonction.py;h=36d53fb14e56545ced027a9ad69b01cd55513e2f;hp=6c249374059d8edd607f8118d7cf7d642595ce94;hb=HEAD;hpb=5260bd00bd51567f6137d5ea7ae0564464c4290a diff --git a/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py b/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py index 6c2493740..c797d099a 100644 --- a/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py +++ b/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py @@ -1,48 +1,79 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2014-2024 EDF +# +# 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 +# +"""edges de bord, faces défaut à respecter""" import logging +import SMESH + from .geomsmesh import geompy from .geomsmesh import smesh -import SMESH +from .geomsmesh import geomPublish +from . import initLog from .putName import putName - -def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives): - """ - edges de bord, faces défaut à respecter - """ + +def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives, \ + nro_cas=None): + """edges de bord, faces défaut à respecter""" logging.info('start') + logging.info("Pour le cas n°%s", nro_cas) - aFilterManager = smesh.CreateFilterManager() - nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ]) - criteres = [] + _ = smesh.CreateFilterManager() + _, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ]) + criteres = list() unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0) criteres.append(unCritere) filtre = smesh.GetFilterFromCriteria(criteres) bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre ) - smesh.SetName(bordsLibres, 'bordsLibres') + putName(bordsLibres, 'bordsLibres', i_pref=nro_cas) - # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes + # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'extérieur des volumes repliés sur eux-mêmes # on désigne les faces de peau en quadrangles par le groupe "skinFaces" skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' ) - nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() ) + _ = skinFaces.AddFrom( internalBoundary.GetMesh() ) # --- maillage des éventuelles arêtes vives entre faces reconstruites - + grpAretesVives = None - if len(aretesVivesCoupees) > 0: + if aretesVivesCoupees: + aretesVivesC = geompy.MakeCompound(aretesVivesCoupees) + geomPublish(initLog.always, aretesVivesC, "aretesVives", nro_cas) meshAretesVives = smesh.Mesh(aretesVivesC) algo1d = meshAretesVives.Segment() + putName(algo1d.GetSubMesh(), "aretesVives", i_pref=nro_cas) hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07) - putName(algo1d.GetSubMesh(), "aretesVives") - putName(algo1d, "algo1d_aretesVives") - putName(hypo1d, "hypo1d_aretesVives") - isDone = meshAretesVives.Compute() - logging.info("aretesVives fini") + putName(hypo1d, "aretesVives={}".format(lgAretesVives), i_pref=nro_cas) + + is_done = meshAretesVives.Compute() + text = "meshAretesVives.Compute" + if is_done: + logging.info(text+" OK") + else: + text = "Erreur au calcul du maillage.\n" + text + logging.info(text) + raise Exception(text) + grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' ) - nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() ) + _ = grpAretesVives.AddFrom( meshAretesVives.GetMesh() ) - return (internalBoundary, bordsLibres, grpAretesVives) \ No newline at end of file + return (internalBoundary, bordsLibres, grpAretesVives)