1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2021 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 """edges de bord, faces défaut à respecter"""
26 from .geomsmesh import geompy
27 from .geomsmesh import smesh
29 from .putName import putName
31 def mailleAretesEtJonction (internalBoundary, aretesVivesCoupees, lgAretesVives, \
33 """edges de bord, faces défaut à respecter"""
35 logging.info("Pour le cas n°%d", nro_cas)
37 _ = smesh.CreateFilterManager()
38 _, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
40 unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
41 criteres.append(unCritere)
42 filtre = smesh.GetFilterFromCriteria(criteres)
43 bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
44 putName(bordsLibres, 'bordsLibres', i_pref=nro_cas)
46 # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
47 # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
49 skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
50 _ = skinFaces.AddFrom( internalBoundary.GetMesh() )
52 # --- maillage des éventuelles arêtes vives entre faces reconstruites
55 if aretesVivesCoupees:
57 aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
58 meshAretesVives = smesh.Mesh(aretesVivesC)
59 algo1d = meshAretesVives.Segment()
60 hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07)
61 putName(algo1d.GetSubMesh(), "aretesVives", i_pref=nro_cas)
62 putName(algo1d, "algo1d_aretesVives", i_pref=nro_cas)
63 putName(hypo1d, "hypo1d_aretesVives", i_pref=nro_cas)
65 is_done = meshAretesVives.Compute()
66 text = "meshAretesVives.Compute"
68 logging.info(text+" OK")
70 text = "Erreur au calcul du maillage.\n" + text
74 grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
75 _ = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
77 return (internalBoundary, bordsLibres, grpAretesVives)