Salome HOME
Update of CheckDone
[modules/smesh.git] / src / Tools / blocFissure / gmu / construitMaillagePipe.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2024  EDF
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   edgesCircPipeGroup = list()
45
46   fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
47   nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis")
48   faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi")
49   edgeFaceFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeFaceFiss")
50
51   mptdsk     = list() # vertices de chaque disque au fur et à mesure
52   mptsdisks  = list() # vertices maillage de tous les disques
53   mEdges     = list() # identifiants edges maillage fond de fissure
54   mEdgeFaces = list() # identifiants edges maillage edge face de fissure externe
55   mFaces     = list() # identifiants faces maillage fissure
56   mVols      = list() # identifiants volumes maillage pipe
57
58   for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
59     #logging.info(". Prise en compte du disque n°%d", idisk)
60
61     # -----------------------------------------------------------------------
62     # --- Les points
63
64     oldmpts = mptdsk
65     mptdsk = construitMaillagePipe_a(idisk, \
66                                       gptsdisks, nbsegCercle, \
67                                       meshPipe, mptsdisks)
68
69     # -----------------------------------------------------------------------
70     # --- Les groupes des edges des cercles débouchants
71
72     if idisk in (idisklim[0],idisklim[1]):
73       construitMaillagePipe_b(idisk, \
74                               idisklim, nbsegCercle, \
75                               meshPipe, mptdsk, \
76                               edgesCircPipeGroup)
77
78     # -----------------------------------------------------------------------
79     # --- Les groupes des faces débouchantes
80
81     if idisk in (idisklim[0],idisklim[1]):
82       construitMaillagePipe_c(idisk, \
83                               idisklim, nbsegCercle, \
84                               meshPipe, mptdsk, nbsegRad)
85
86     # -----------------------------------------------------------------------
87     # --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
88
89     construitMaillagePipe_d(idisk, \
90                             idisklim, nbsegCercle, nbsegRad, \
91                             meshPipe, mptdsk, oldmpts, \
92                             fondFissGroup, edgeFaceFissGroup, faceFissGroup, \
93                             mEdges, mEdgeFaces, mFaces, mVols, nodesFondFissGroup)
94   # Bilan
95
96   pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
97   _ = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
98
99   _, _, _ = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
100
101   #if meshPipe:
102     #text = "Arrêt rapide.\n"
103     #logging.info(text)
104     #raise Exception(text)
105
106   return (meshPipe, edgeFaceFissGroup, edgesCircPipeGroup)