Salome HOME
Copyright update 2022
[modules/smesh.git] / src / Tools / blocFissure / gmu / calculePointsAxiauxPipe_c.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2022  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 """Préparation maillage du pipe"""
21
22 import logging
23 import math
24
25 from .geomsmesh import geompy
26
27 def calculePointsAxiauxPipe_c(centres, origins, normals, \
28                               rayonPipe, nbsegCercle, nbsegRad):
29   """Préparation maillage du pipe :
30
31   - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
32   - points sur les edges de fond de fissure et edges pipe/face fissure,
33   - vecteurs tangents au fond de fissure (normal au disque maillé)
34   """
35
36   logging.info('start')
37   logging.debug("nbsegCercle = %d, nbsegRad = %d", nbsegCercle, nbsegRad)
38
39   # -----------------------------------------------------------------------
40   # --- points géométriques
41
42   gptsdisks = list() # vertices géométrie de tous les disques
43   raydisks = [list() for _ in range(nbsegCercle)]
44
45 # boucle sur les disques
46   for indice, centres_i in enumerate(centres):
47     gptdsk = list() # vertices géométrie d'un disque
48     vertcx = centres_i
49     vertpx = origins[indice]
50     normal = normals[indice]
51     vec1 = geompy.MakeVector(vertcx, vertpx)
52
53     points = [vertcx] # les points du rayon de référence
54     dist_0 = rayonPipe/float(nbsegRad)
55     for j_aux in range(nbsegRad):
56       point = geompy.MakeTranslationVectorDistance(vertcx, vec1, float(j_aux+1)*dist_0)
57       points.append(point)
58     gptdsk.append(points)
59     point = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
60     rayon = geompy.MakeLineTwoPnt(vertcx, point)
61     raydisks[0].append(rayon)
62
63     angle_0 = 2.*math.pi/float(nbsegCercle)
64     for k_aux in range(nbsegCercle-1):
65       angle = float(k_aux+1)*angle_0
66       pts = [vertcx] # les points d'un rayon obtenu par rotation
67       for j_aux in range(nbsegRad):
68         point = geompy.MakeRotation(points[j_aux+1], normal, angle)
69         pts.append(point)
70       gptdsk.append(pts)
71       ray = geompy.MakeRotation(rayon, normal, angle)
72       raydisks[k_aux+1].append(ray)
73
74     gptsdisks.append(gptdsk)
75
76   return gptsdisks, raydisks