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