Salome HOME
Mise à niveau python
[modules/smesh.git] / src / Tools / blocFissure / gmu / construitMaillagePipe_d.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 """Mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure"""
21
22 import logging
23
24 import SMESH
25
26 def construitMaillagePipe_d(idisk, \
27                             idisklim, nbsegCercle, nbsegRad, \
28                             meshPipe, mptdsk, oldmpts, \
29                             fondFissGroup, edgeFaceFissGroup, faceFissGroup, \
30                             mEdges, mEdgeFaces, mFaces, mVols, nodesFondFissGroup):
31   """Mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure"""
32   #logging.info('start')
33
34   if idisk == idisklim[0]:
35     mEdges.append(0)
36     mEdgeFaces.append(0)
37     mFaces.append([0])
38     mVols.append([[0]])
39     nodesFondFissGroup.Add([mptdsk[0][0]])
40
41   else:
42     ide = meshPipe.AddEdge([oldmpts[0][0], mptdsk[0][0]])
43     mEdges.append(ide)
44     fondFissGroup.Add([ide])
45     nodesFondFissGroup.Add([mptdsk[0][0]])
46     ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]])
47     mEdgeFaces.append(ide2)
48     edgeFaceFissGroup.Add([ide2])
49
50     id_faces = list()
51     id_volumes = list()
52
53     for n_srad in range(nbsegRad):
54       idf = meshPipe.AddFace([oldmpts[0][n_srad], mptdsk[0][n_srad], mptdsk[0][n_srad+1], oldmpts[0][n_srad+1]])
55       faceFissGroup.Add([idf])
56       id_faces.append(idf)
57
58       id_vol_cercle = list()
59       for n_cercle in range(nbsegCercle):
60         n_cercle_1 = n_cercle+1
61         if n_cercle ==  nbsegCercle-1:
62           n_cercle_1 = 0
63         if n_srad == 0:
64           idv = meshPipe.AddVolume([mptdsk[n_cercle][n_srad], mptdsk[n_cercle][n_srad+1], mptdsk[n_cercle_1][n_srad+1], \
65                                     oldmpts[n_cercle][n_srad], oldmpts[n_cercle][n_srad+1], oldmpts[n_cercle_1][n_srad+1]])
66         else:
67           idv = meshPipe.AddVolume([mptdsk[n_cercle][n_srad], mptdsk[n_cercle][n_srad+1], mptdsk[n_cercle_1][n_srad+1], mptdsk[n_cercle_1][n_srad], \
68                                     oldmpts[n_cercle][n_srad], oldmpts[n_cercle][n_srad+1], oldmpts[n_cercle_1][n_srad+1], oldmpts[n_cercle_1][n_srad]])
69         id_vol_cercle.append(idv)
70       id_volumes.append(id_vol_cercle)
71
72     mFaces.append(id_faces)
73     mVols.append(id_volumes)
74
75   return