Salome HOME
Update of CheckDone
[modules/smesh.git] / src / Tools / blocFissure / CasTests / fissure_Coude.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 """Fissure dans un coude"""
21
22 import logging
23 import os
24 import math
25
26 import GEOM
27 import SMESH
28
29 from blocFissure.gmu.geomsmesh import geompy
30 from blocFissure.gmu.geomsmesh import smesh
31 from blocFissure.gmu.geomsmesh import geomPublish
32 from blocFissure.gmu.geomsmesh import geomPublishInFather
33
34 from blocFissure.gmu import initLog
35 from blocFissure.gmu.putName import putName
36 from blocFissure.gmu.fissureGenerique import fissureGenerique
37 from blocFissure.gmu.triedreBase import triedreBase
38 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
39 from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
40 from blocFissure.gmu.insereFissureLongue import insereFissureLongue
41
42 O, OX, OY, OZ = triedreBase()
43
44 class fissure_Coude(fissureGenerique):
45   """problème de fissure du Coude : version de base
46
47   maillage hexa
48   """
49
50   nomProbleme = "fissure_Coude"
51   geomParams = dict()
52   meshParams = dict()
53   shapeFissureParams = dict()
54   maillageFissureParams = dict()
55   referencesMaillageFissure = dict()
56   circonferentielle = False
57   longitudinale = False
58
59   # ---------------------------------------------------------------------------
60   def setParamGeometrieSaine(self):
61     """
62     Paramètres géométriques du tuyau coudé sain:
63     angleCoude
64     r_cintr
65     l_tube_p1
66     l_tube_p2
67     epais
68     de
69     """
70     self.geomParams = dict(angleCoude = 60,
71                            r_cintr    = 1200,
72                            l_tube_p1  = 1600,
73                            l_tube_p2  = 1200,
74                            epais      = 40,
75                            de         = 760)
76
77   # ---------------------------------------------------------------------------
78   def genereGeometrieSaine(self, geomParams):
79     """a écrire"""
80     logging.info("genereGeometrieSaine %s", self.nomCas)
81
82     angleCoude = geomParams['angleCoude']
83     r_cintr    = geomParams['r_cintr']
84     l_tube_p1  = geomParams['l_tube_p1']
85     l_tube_p2  = geomParams['l_tube_p2']
86     epais      = geomParams['epais']
87     de         = geomParams['de']
88
89     centre = geompy.MakeVertex(0, 0, -l_tube_p1)
90     Disk_1 = geompy.MakeDiskPntVecR(centre, OZ, de/2.)
91     Disk_2 = geompy.MakeDiskPntVecR(centre, OZ, de/2. -epais)
92     Cut_1 = geompy.MakeCut(Disk_1, Disk_2)
93     Extrusion_1 = geompy.MakePrismVecH(Cut_1, OZ, l_tube_p1)
94     axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
95     Revolution_1 = geompy.MakeRevolution(Cut_1, axe, angleCoude*math.pi/180.0)
96     Rotation_1 = geompy.MakeRotation(Cut_1, axe, angleCoude*math.pi/180.0)
97     Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0)
98     Extrusion_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2)
99     Plane_1 = geompy.MakePlaneLCS(None, 100000, 3)
100     geomPublish(initLog.debug, Plane_1, "Plane_1" )
101     geomPublish(initLog.debug, Extrusion_1, "Extrusion_1" )
102     geomPublish(initLog.debug, Revolution_1, "Revolution_1" )
103     geomPublish(initLog.debug, Extrusion_2, "Extrusion_2" )
104
105     P1 = O
106     geomPublish(initLog.always, P1, "P1", self.numeroCas )
107     op2 = geompy.MakeVertex(0, 0, -l_tube_p1)
108     P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0)
109     P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2)
110     geomPublish(initLog.always, P2, "P2", self.numeroCas )
111
112     # --- tube coude sain
113
114     geometrieSaine = geompy.MakePartition([Extrusion_1, Revolution_1, Extrusion_2, P1, P2], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
115     geomPublish(initLog.always, geometrieSaine, self.nomCas, self.numeroCas )
116     [P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True)
117
118     [ep, circ_g, circ_d, long_p2, long_coude, long_p1] = geompy.Propagate(geometrieSaine)
119     geomPublishInFather(initLog.always, geometrieSaine, long_p1, 'long_p1' )
120     geomPublishInFather(initLog.always, geometrieSaine, ep, 'ep' )
121     geomPublishInFather(initLog.always, geometrieSaine, long_coude, 'long_coude' )
122     geomPublishInFather(initLog.always, geometrieSaine, circ_g, 'circ_g' )
123     geomPublishInFather(initLog.always, geometrieSaine, circ_d, 'circ_d' )
124     geomPublishInFather(initLog.always, geometrieSaine, long_p2, 'long_p2' )
125
126     # --- face extremite tube (EXTUBE)
127
128     facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON)
129     EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
130     geompy.UnionIDs(EXTUBE, facesIds)
131     geomPublishInFather(initLog.always, geometrieSaine, EXTUBE, 'EXTUBE' )
132
133     # --- edge bord extremite tube (BORDTU)
134
135     edge1Ids = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, GEOM.ST_ON)
136     edge2Ids = geompy.GetShapesOnCylinderIDs(geometrieSaine, geompy.ShapeType["EDGE"], OZ, de/2., GEOM.ST_ON)
137     edgesIds = list()
138     for edge in edge1Ids:
139       if edge in edge2Ids:
140         edgesIds.append(edge)
141     BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
142     geompy.UnionIDs(BORDTU, edgesIds)
143     geomPublishInFather(initLog.always, geometrieSaine, BORDTU, 'BORDTU' )
144
145     # --- face origine tube (CLGV)
146
147     pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10)
148     vec2 = geompy.MakeVector(P2, pp2)
149     #geomPublish(initLog.debug, vec2, 'vec2', self.numeroCas)
150     facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
151     CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
152     geompy.UnionIDs(CLGV, facesIds)
153     geomPublishInFather(initLog.always, geometrieSaine, CLGV, 'CLGV' )
154
155     # --- peau tube interieur (PEAUINT)
156
157     extru1 = geompy.MakePrismVecH(Disk_2, OZ, l_tube_p1)
158     revol1 = geompy.MakeRevolution(Disk_2, axe, angleCoude*math.pi/180.0)
159     rot1 = geompy.MakeRotation(Disk_2, axe, angleCoude*math.pi/180.0)
160     extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
161     interne = geompy.MakeFuse(extru1, revol1)
162     interne = geompy.MakeFuse(extru2, interne)
163     geomPublish(initLog.debug, interne, 'interne', self.numeroCas)
164     facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
165     PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
166     geompy.UnionIDs(PEAUINT, facesIds)
167     geomPublishInFather(initLog.always, geometrieSaine, PEAUINT, 'PEAUINT' )
168
169     # --- peau tube exterieur (PEAUEXT)
170
171     Disk_3 = geompy.MakeDiskPntVecR(centre, OZ, de/2. +epais)
172     couronne1 = geompy.MakeCut(Disk_3, Disk_1)
173     extru1 = geompy.MakePrismVecH(couronne1, OZ, l_tube_p1)
174     revol1 = geompy.MakeRevolution(couronne1, axe, angleCoude*math.pi/180.0)
175     rot1 = geompy.MakeRotation(couronne1, axe, angleCoude*math.pi/180.0)
176     extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
177     externe = geompy.MakeFuse(extru1, revol1)
178     externe = geompy.MakeFuse(extru2, externe)
179     geomPublish(initLog.debug, externe, 'externe', self.numeroCas)
180     facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON)
181     PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
182     geompy.UnionIDs(PEAUEXT, facesIds)
183     geomPublishInFather(initLog.always, geometrieSaine, PEAUEXT, 'PEAUEXT' )
184
185     # --- solide sain
186
187     volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"])
188     COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"])
189     geompy.UnionIDs(COUDE, volIds)
190     geomPublishInFather(initLog.always, geometrieSaine, COUDE, 'COUDSAIN' )
191
192     geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE]
193
194     return geometriesSaines
195
196   # ---------------------------------------------------------------------------
197   def setParamMaillageSain(self):
198     self.meshParams = dict(n_long_p1    = 16,
199                            n_ep         = 3,
200                            n_long_coude = 15,
201                            n_circ_g     = 20,
202                            n_circ_d     = 20,
203                            n_long_p2    = 12)
204
205   # ---------------------------------------------------------------------------
206   def genereMaillageSain(self, geometriesSaines, meshParams):
207     logging.info("genereMaillageSain %s", self.nomCas)
208
209     geometrieSaine = geometriesSaines[0]
210     long_p1        = geometriesSaines[1]
211     ep             = geometriesSaines[2]
212     long_coude     = geometriesSaines[3]
213     circ_g         = geometriesSaines[4]
214     circ_d         = geometriesSaines[5]
215     long_p2        = geometriesSaines[6]
216     P1             = geometriesSaines[7]
217     P2             = geometriesSaines[8]
218     EXTUBE         = geometriesSaines[9]
219     BORDTU         = geometriesSaines[10]
220     CLGV           = geometriesSaines[11]
221     PEAUINT        = geometriesSaines[12]
222     PEAUEXT        = geometriesSaines[13]
223     COUDE          = geometriesSaines[14]
224
225     n_long_p1    = meshParams['n_long_p1']
226     n_ep         = meshParams['n_ep']
227     n_long_coude = meshParams['n_long_coude']
228     n_circ_g     = meshParams['n_circ_g']
229     n_circ_d     = meshParams['n_circ_d']
230     n_long_p2    = meshParams['n_long_p2']
231
232     maillageSain = smesh.Mesh(geometrieSaine)
233     putName(maillageSain, "maillageSain", i_pref=self.numeroCas)
234
235     algo3d = maillageSain.Hexahedron()
236     algo2d = maillageSain.Quadrangle()
237
238     algo1d_long_p1 = maillageSain.Segment(geom=long_p1)
239     hypo1d_long_p1 = algo1d_long_p1.NumberOfSegments(n_long_p1)
240     putName(hypo1d_long_p1, "n_long_p1={}".format(n_long_p1), i_pref=self.numeroCas)
241
242     algo1d_ep = maillageSain.Segment(geom=ep)
243     hypo1d_ep = algo1d_ep.NumberOfSegments(n_ep)
244     putName(hypo1d_ep, "n_ep={}".format(n_ep), i_pref=self.numeroCas)
245
246     algo1d_long_coude = maillageSain.Segment(geom=long_coude)
247     hypo1d_long_coude = algo1d_long_coude.NumberOfSegments(n_long_coude)
248     putName(hypo1d_long_coude, "n_long_coude={}".format(n_long_coude), i_pref=self.numeroCas)
249
250     algo1d_circ_g = maillageSain.Segment(geom=circ_g)
251     hypo1d_circ_g = algo1d_circ_g.NumberOfSegments(n_circ_g)
252     putName(hypo1d_circ_g, "n_circ_g={}".format(n_circ_g), i_pref=self.numeroCas)
253
254     algo1d_circ_d = maillageSain.Segment(geom=circ_d)
255     hypo1d_circ_d = algo1d_circ_d.NumberOfSegments(n_circ_d)
256     putName(hypo1d_circ_d, "n_circ_d={}".format(n_circ_d), i_pref=self.numeroCas)
257
258     algo1d_long_p2 = maillageSain.Segment(geom=long_p2)
259     hypo1d_long_p2 = algo1d_long_p2.NumberOfSegments(n_long_p2)
260     putName(hypo1d_long_p2, "n_long_p2={}".format(n_long_p2), i_pref=self.numeroCas)
261
262     _ = maillageSain.GroupOnGeom(P1,'P1',SMESH.NODE)
263     _ = maillageSain.GroupOnGeom(P2,'P2',SMESH.NODE)
264     _ = maillageSain.GroupOnGeom(EXTUBE,'EXTUBE',SMESH.FACE)
265     _ = maillageSain.GroupOnGeom(BORDTU,'BORDTU',SMESH.EDGE)
266     _ = maillageSain.GroupOnGeom(CLGV,'CLGV',SMESH.FACE)
267     _ = maillageSain.GroupOnGeom(PEAUINT,'PEAUINT',SMESH.FACE)
268     _ = maillageSain.GroupOnGeom(PEAUEXT,'PEAUEXT',SMESH.FACE)
269     _ = maillageSain.GroupOnGeom(COUDE,'COUDSAIN',SMESH.VOLUME)
270
271     is_done = maillageSain.Compute()
272     text = "maillageSain.Compute"
273     if is_done:
274       logging.info(text+" OK")
275     else:
276       text = "Erreur au calcul du maillage.\n" + text
277       logging.info(text)
278       raise Exception(text)
279
280     return [maillageSain, True] # True : maillage hexa
281
282   # ---------------------------------------------------------------------------
283   def setParamShapeFissure(self):
284     """
285     paramètres de la fissure pour le tuyau coude
286     profondeur  : 0 < profondeur <= épaisseur
287     azimut      : entre 0 et 360°
288     alpha       : 0 < alpha < angleCoude
289     longueur    : <=2*profondeur ==> ellipse, >2*profondeur = fissure longue
290     lgInfluence : distance autour de la shape de fissure a remailler (si 0, pris égal à profondeur. A ajuster selon le maillage)
291     orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
292     externe     : True : fissure face externe, False : fissure face interne
293     """
294     logging.info("setParamShapeFissure %s", self.nomCas)
295     self.shapeFissureParams = dict(profondeur  = 10,
296                                    azimut      = 160,
297                                    alpha       = 20,
298                                    longueur    = 400,
299                                    orientation = 90,
300                                    lgInfluence = 0,
301                                    elliptique  = False,
302                                    externe     = True)
303
304   # ---------------------------------------------------------------------------
305   def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
306                                 mailleur="MeshGems"):
307     logging.info("genereShapeFissure %s", self.nomCas)
308     logging.info("shapeFissureParams %s", shapeFissureParams)
309
310     #angleCoude = geomParams['angleCoude']
311     r_cintr    = geomParams['r_cintr']
312     l_tube_p1  = geomParams['l_tube_p1']
313     #l_tube_p2  = geomParams['l_tube_p2']
314     epais      = geomParams['epais']
315     de         = geomParams['de']
316
317     profondeur  = shapeFissureParams['profondeur']
318     azimut      = shapeFissureParams['azimut']
319     alpha       = shapeFissureParams['alpha']
320     longueur    = shapeFissureParams['longueur']
321     orientation = shapeFissureParams['orientation']
322     externe     = shapeFissureParams['externe']
323     lgInfluence = shapeFissureParams['lgInfluence']
324
325     azimut = -azimut # axe inverse / ASCOUF
326     axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
327
328     if not lgInfluence:
329       lgInfluence = profondeur
330
331     self.fissureLongue = bool(longueur > 2*profondeur)
332
333     if self.fissureLongue and (abs(orientation) < 45.) :
334       self.longitudinale = True
335     elif self.fissureLongue:
336       self.circonferentielle = True
337     #logging.info("longitudinale %s", self.longitudinale)
338     #logging.info("circonferentielle %s", self.circonferentielle)
339
340     if self.circonferentielle:
341       if externe:
342         raybor = de/2.
343         rayint = raybor - profondeur
344         rayext = raybor + profondeur
345       else:
346         rayext = de/2. - epais
347         rayint = raybor + profondeur
348         rayext = raybor - profondeur
349       lgfond = longueur -2*profondeur
350       angle = lgfond/(2*raybor)
351       pb = geompy.MakeVertex(raybor, 0, 0)
352       pi = geompy.MakeVertex(rayint, 0, 0)
353       pe = geompy.MakeVertex(rayext, 0, 0)
354       pl = geompy.MakeVertex(raybor, profondeur, 0)
355       pr = geompy.MakeVertex(raybor, -profondeur, 0)
356       pil = geompy.MakeRotation(pi, OZ, angle)
357       pll = geompy.MakeRotation(pl, OZ, angle)
358       pel = geompy.MakeRotation(pe, OZ, angle)
359       pir = geompy.MakeRotation(pi, OZ, -angle)
360       prr = geompy.MakeRotation(pr, OZ, -angle)
361       per = geompy.MakeRotation(pe, OZ, -angle)
362       arcl = geompy.MakeArc(pil, pll, pel)
363       arcr = geompy.MakeArc(pir, prr, per)
364       arci = geompy.MakeArc(pil, pi, pir)
365       arce = geompy.MakeArc(pel, pe, per)
366       wire0 = geompy.MakeWire([arcr, arci, arcl])
367       cercle0 = geompy.MakeCircle(O, OY, profondeur/4.0)
368       cercle0 = geompy.MakeRotation(cercle0, OY, math.pi/2.0)
369       cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi)
370       facetube0 = geompy.MakeFaceWires([cercle0], 1)
371       facetubel = geompy.MakeRotation(facetube0, OZ, angle)
372       facetuber = geompy.MakeRotation(facetube0, OZ, -angle)
373       face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1)
374       plan0 = geompy.MakePlane(O, OZ, 10000)
375       geomPublish(initLog.debug, face0, 'facefissOrig' )
376       face1 = geompy.MakeRotation(face0, OZ, azimut*math.pi/180.)
377       face2 = geompy.MakeTranslation(face1, 0, 0, -l_tube_p1)
378       facefiss = geompy.MakeRotation(face2, axe, alpha*math.pi/180.)
379       geomPublish(initLog.always, facefiss, "facefissPlace", self.numeroCas )
380       centre = geompy.MakeRotation(pb, OZ, azimut*math.pi/180.)
381       centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1)
382       centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.)
383       geomPublish(initLog.always, centre, "centrefissPlace", self.numeroCas )
384       arcr = geompy.MakeRotation(arcr, OZ, azimut*math.pi/180.)
385       arcr = geompy.MakeTranslation(arcr, 0, 0, -l_tube_p1)
386       arcr = geompy.MakeRotation(arcr, axe, alpha*math.pi/180.)
387       arci = geompy.MakeRotation(arci, OZ, azimut*math.pi/180.)
388       arci = geompy.MakeTranslation(arci, 0, 0, -l_tube_p1)
389       arci = geompy.MakeRotation(arci, axe, alpha*math.pi/180.)
390       arcl = geompy.MakeRotation(arcl, OZ, azimut*math.pi/180.)
391       arcl = geompy.MakeTranslation(arcl, 0, 0, -l_tube_p1)
392       arcl = geompy.MakeRotation(arcl, axe, alpha*math.pi/180.)
393       wiretube = geompy.MakeRotation(wire0, OZ, azimut*math.pi/180.)
394       wiretube = geompy.MakeTranslation(wiretube, 0, 0, -l_tube_p1)
395       wiretube = geompy.MakeRotation(wiretube, axe, alpha*math.pi/180.)
396       geomPublish(initLog.always,wiretube, "wiretubePlace", self.numeroCas )
397       facetubel = geompy.MakeRotation(facetubel, OZ, azimut*math.pi/180.)
398       facetubel = geompy.MakeTranslation(facetubel, 0, 0, -l_tube_p1)
399       facetubel = geompy.MakeRotation(facetubel, axe, alpha*math.pi/180.)
400       geomPublish(initLog.debug,facetubel, 'facetubeGauche' )
401       facetuber = geompy.MakeRotation(facetuber, OZ, azimut*math.pi/180.)
402       facetuber = geompy.MakeTranslation(facetuber, 0, 0, -l_tube_p1)
403       facetuber = geompy.MakeRotation(facetuber, axe, alpha*math.pi/180.)
404       geomPublish(initLog.debug,facetuber, 'facetubeDroit' )
405       planfiss = geompy.MakeRotation(plan0, OZ, azimut*math.pi/180.)
406       planfiss = geompy.MakeTranslation(planfiss, 0, 0, -l_tube_p1)
407       planfiss = geompy.MakeRotation(planfiss, axe, alpha*math.pi/180.)
408       geomPublish(initLog.always,planfiss, "planfissPlace", self.numeroCas )
409       pipefissl = geompy.MakePipe(facetubel, arcl)
410       pipefissi = geompy.MakePipe(facetubel, arci)
411       pipefissr = geompy.MakePipe(facetuber, arcr)
412       pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
413       geomPublish(initLog.always,pipefiss, "pipefissPlace", self.numeroCas )
414
415
416     elif self.longitudinale:
417       if externe:
418         raybor = r_cintr + de/2.
419         rayint = raybor - profondeur
420         rayext = raybor + profondeur
421       else:
422         rayext = r_cintr + de/2. - epais
423         rayint = raybor + profondeur
424         rayext = raybor - profondeur
425       lgfond = longueur -2*profondeur
426       angle = lgfond/(2*raybor)
427       pb = geompy.MakeVertex(-raybor, 0, 0)
428       pi = geompy.MakeVertex(-rayint, 0, 0)
429       pe = geompy.MakeVertex(-rayext, 0, 0)
430       pl = geompy.MakeVertex(-raybor, 0, -profondeur)
431       pr = geompy.MakeVertex(-raybor, 0, profondeur)
432       pil = geompy.MakeRotation(pi, OY, -angle)
433       pll = geompy.MakeRotation(pl, OY, -angle)
434       pel = geompy.MakeRotation(pe, OY, -angle)
435       pir = geompy.MakeRotation(pi, OY, angle)
436       prr = geompy.MakeRotation(pr, OY, angle)
437       per = geompy.MakeRotation(pe, OY, angle)
438       arcl = geompy.MakeArc(pil, pll, pel)
439       arcr = geompy.MakeArc(pir, prr, per)
440       arci = geompy.MakeArc(pil, pi, pir)
441       arce = geompy.MakeArc(pel, pe, per)
442       geomPublish(initLog.debug, arcl, 'arcl' )
443       geomPublish(initLog.debug, arcr, 'arcr' )
444       geomPublish(initLog.debug, arci, 'arci' )
445       geomPublish(initLog.debug, arce, 'arce' )
446       wire0 = geompy.MakeWire([arcr, arci, arcl])
447       cercle0 = geompy.MakeCircle(O, OZ, profondeur/4.0)
448       #cercle0 = geompy.MakeRotation(cercle0, OZ, math.pi/2.0)
449       cercle0 = geompy.MakeTranslationTwoPoints(cercle0, O, pi)
450       geomPublish(initLog.debug, cercle0, 'cercle0' )
451       facetube0 = geompy.MakeFaceWires([cercle0], 1)
452       facetubel = geompy.MakeRotation(facetube0, OY, -angle)
453       facetuber = geompy.MakeRotation(facetube0, OY, angle)
454       geomPublish(initLog.debug,facetubel , 'facetubel' )
455       geomPublish(initLog.debug, facetuber, 'facetuber' )
456       face0 = geompy.MakeFaceWires([arcl,arci, arce, arcr], 1)
457       plan0 = geompy.MakePlane(O, OY, 10000)
458       geomPublish(initLog.debug, face0, 'facefissOrig' )
459       facefiss = geompy.MakeRotation(face0, OY, alpha*math.pi/180.)
460       geomPublish(initLog.always, facefiss, "facefissPlace", self.numeroCas )
461       centre = geompy.MakeRotation(pb, OY, alpha*math.pi/180.)
462       geomPublish(initLog.always, centre, "centrefissPlace", self.numeroCas )
463       arcr = geompy.MakeRotation(arcr, OY, alpha*math.pi/180.)
464       arci = geompy.MakeRotation(arci, OY, alpha*math.pi/180.)
465       arcl = geompy.MakeRotation(arcl, OY, alpha*math.pi/180.)
466       wiretube = geompy.MakeRotation(wire0, OY, alpha*math.pi/180.)
467       geomPublish(initLog.always,wiretube, "wiretubePlace", self.numeroCas )
468       facetubel = geompy.MakeRotation(facetubel, OY, alpha*math.pi/180.)
469       geomPublish(initLog.debug,facetubel, 'facetubeGauche' )
470       facetuber = geompy.MakeRotation(facetuber, OY, alpha*math.pi/180.)
471       geomPublish(initLog.debug,facetubel, 'facetubeDroit' )
472       planfiss = geompy.MakeRotation(plan0, OY, alpha*math.pi/180.)
473       geomPublish(initLog.always,planfiss, "planfissPlace", self.numeroCas )
474       pipefissl = geompy.MakePipe(facetubel, arcl)
475       pipefissi = geompy.MakePipe(facetubel, arci)
476       pipefissr = geompy.MakePipe(facetuber, arcr)
477       pipefiss = geompy.MakePartition([pipefissl, pipefissi, pipefissr], [planfiss, wiretube], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
478       geomPublish(initLog.always,pipefiss, "pipefissPlace", self.numeroCas )
479     else:
480       pass
481
482     mailleur = self.mailleur2d3d()
483     coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, 5 ,10, mailleur, self.numeroCas)
484
485     return [facefiss, centre, lgInfluence, coordsNoeudsFissure, wiretube, facetubel, facetuber, planfiss, pipefiss]
486
487   # ---------------------------------------------------------------------------
488   def setParamMaillageFissure(self):
489     self.maillageFissureParams = dict(nomRep        = os.curdir,
490                                       nomFicSain    = self.nomProbleme,
491                                       nomFicFissure = self.nomProbleme + "_fissure",
492                                       nbsegExt      = 5,
493                                       nbsegGen      = 25,
494                                       nbsegRad      = 5,
495                                       scaleRad      = 4,
496                                       nbsegCercle   = 6,
497                                       nbsegFis      = 20,
498                                       lensegEllipso = 1.0)
499
500   # ---------------------------------------------------------------------------
501   def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
502     elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams, \
503                                                  self.numeroCas)
504     return elementsDefaut
505
506   # ---------------------------------------------------------------------------
507   def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
508                                   shapesFissure, shapeFissureParams, \
509                                   maillageFissureParams, elementsDefaut, step, \
510                                   mailleur="MeshGems"):
511
512     mailleur = self.mailleur2d3d()
513     maillageFissure = insereFissureLongue(shapesFissure, shapeFissureParams, \
514                                           maillageFissureParams, elementsDefaut, \
515                                           mailleur, self.numeroCas)
516     return maillageFissure
517
518   # ---------------------------------------------------------------------------
519   def setReferencesMaillageFissure(self):
520     from salome.smesh import smeshBuilder
521     if smeshBuilder.NETGEN_VERSION_MAJOR < 6:
522       self.referencesMaillageFissure = dict( \
523                                              Entity_Quad_Quadrangle = 6710, \
524                                              Entity_Quad_Hexa = 8656, \
525                                              Entity_Node = 76807, \
526                                              Entity_Quad_Edge = 1006, \
527                                              Entity_Quad_Triangle = 2342, \
528                                              Entity_Quad_Tetra = 20392, \
529                                              Entity_Quad_Pyramid = 1232, \
530                                              Entity_Quad_Penta = 1176 \
531       )
532     else:
533       self.referencesMaillageFissure = dict( \
534                                              Entity_Quad_Quadrangle = 6710, \
535                                              Entity_Quad_Hexa = 8656, \
536                                              Entity_Node = 77391, \
537                                              Entity_Quad_Edge = 1006, \
538                                              Entity_Quad_Triangle = 2496, \
539                                              Entity_Quad_Tetra = 20711, \
540                                              Entity_Quad_Pyramid = 1232, \
541                                              Entity_Quad_Penta = 1176 \
542       )