Salome HOME
Mise à niveau python
[modules/smesh.git] / src / Tools / blocFissure / gmu / construitMaillagePipe.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2021  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 """Maillage du pipe"""
21
22 import logging
23
24 import SMESH
25
26 from .geomsmesh import smesh
27
28 from .construitMaillagePipe_a import construitMaillagePipe_a
29 from .construitMaillagePipe_b import construitMaillagePipe_b
30 from .construitMaillagePipe_c import construitMaillagePipe_c
31 from .construitMaillagePipe_d import construitMaillagePipe_d
32
33 def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
34   """maillage effectif du pipe"""
35   logging.info('start')
36   meshPipe = smesh.Mesh(None, "meshPipe")
37   fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
38   nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis")
39   faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi")
40   edgeFaceFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeFaceFiss")
41   edgeCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe0")
42   edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1")
43   faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0")
44   faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1")
45
46   mptdsk     = list() # vertices de chaque disque au fur et à mesure
47   mptsdisks  = list() # vertices maillage de tous les disques
48   mEdges     = list() # identifiants edges maillage fond de fissure
49   mEdgeFaces = list() # identifiants edges maillage edge face de fissure externe
50   mFaces     = list() # identifiants faces maillage fissure
51   mVols      = list() # identifiants volumes maillage pipe
52
53   for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
54     #print ("\nidisk = {}".format(idisk))
55
56     # -----------------------------------------------------------------------
57     # --- Les points
58
59     oldmpts = mptdsk
60     mptdsk = construitMaillagePipe_a(idisk, \
61                                       gptsdisks, idisklim, nbsegCercle, \
62                                       meshPipe, mptsdisks)
63
64     # -----------------------------------------------------------------------
65     # --- Les groupes des edges des cercles débouchants
66
67     if idisk in (idisklim[0],idisklim[1]):
68       construitMaillagePipe_b(idisk, \
69                               idisklim, nbsegCercle, \
70                               meshPipe, mptdsk, \
71                               edgeCircPipe0Group, edgeCircPipe1Group)
72
73     # -----------------------------------------------------------------------
74     # --- Les groupes des faces débouchantes
75
76     if idisk in (idisklim[0],idisklim[1]):
77       construitMaillagePipe_c(idisk, \
78                               idisklim, nbsegCercle, \
79                               meshPipe, mptdsk, nbsegRad, \
80                               faceCircPipe0Group, faceCircPipe1Group)
81
82     # -----------------------------------------------------------------------
83     # --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
84
85     construitMaillagePipe_d(idisk, \
86                             idisklim, nbsegCercle, nbsegRad, \
87                             meshPipe, mptdsk, oldmpts, \
88                             fondFissGroup, edgeFaceFissGroup, faceFissGroup, \
89                             mEdges, mEdgeFaces, mFaces, mVols, nodesFondFissGroup)
90   # Bilan
91
92   pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
93   _ = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
94
95   _, _, _ = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
96   edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
97
98   meshPipeGroups = dict(fondFissGroup = fondFissGroup, \
99                         nodesFondFissGroup = nodesFondFissGroup, \
100                         faceFissGroup = faceFissGroup, \
101                         edgeFaceFissGroup = edgeFaceFissGroup, \
102                         edgeCircPipe0Group = edgeCircPipe0Group, \
103                         edgeCircPipe1Group = edgeCircPipe1Group, \
104                         faceCircPipe0Group = faceCircPipe0Group, \
105                         faceCircPipe1Group = faceCircPipe1Group, \
106                         pipeFissGroup = pipeFissGroup, \
107                         edgesCircPipeGroup = edgesCircPipeGroup \
108                         )
109
110   #if meshPipe:
111     #text = "Arrêt rapide.\n"
112     #logging.info(text)
113     #raise Exception(text)
114
115   return (meshPipe, meshPipeGroups, edgesCircPipeGroup)