Salome HOME
Merge branch 'master' into gni/evolution
[modules/smesh.git] / src / Tools / blocFissure / gmu / mailleAretesEtJonction.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020  EDF R&D
3 #
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.
8 #
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.
13 #
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
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 import logging
22
23 from .geomsmesh import geompy
24 from .geomsmesh import smesh
25 import SMESH
26
27 from .putName import putName
28
29 def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives):
30   """
31   edges de bord, faces défaut à respecter
32   """
33   logging.info('start')
34
35   aFilterManager = smesh.CreateFilterManager()
36   nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [  ])
37   criteres = []
38   unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
39   criteres.append(unCritere)
40   filtre = smesh.GetFilterFromCriteria(criteres)
41   bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
42   smesh.SetName(bordsLibres, 'bordsLibres')
43
44   # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
45   #     on désigne les faces de peau en quadrangles par le groupe "skinFaces"
46
47   skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
48   nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
49
50   # --- maillage des éventuelles arêtes vives entre faces reconstruites
51
52   grpAretesVives = None
53   if aretesVivesCoupees:
54
55     aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
56     meshAretesVives = smesh.Mesh(aretesVivesC)
57     algo1d = meshAretesVives.Segment()
58     hypo1d = algo1d.LocalLength(lgAretesVives,[],1e-07)
59     putName(algo1d.GetSubMesh(), "aretesVives")
60     putName(algo1d, "algo1d_aretesVives")
61     putName(hypo1d, "hypo1d_aretesVives")
62
63     is_done = meshAretesVives.Compute()
64     text = "meshAretesVives.Compute"
65     if is_done:
66       logging.info(text+" OK")
67     else:
68       text = "Erreur au calcul du maillage.\n" + text
69       logging.info(text)
70       raise Exception(text)
71
72     grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
73     nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
74
75   return (internalBoundary, bordsLibres, grpAretesVives)