Salome HOME
Copyright update 2022
[modules/smesh.git] / src / Tools / blocFissure / CasTests / ellipse_2.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
21 """problème de fissure non plane, débouchante non normale"""
22
23 import os
24 import logging
25
26 from blocFissure import gmu
27 from blocFissure.gmu.geomsmesh import geompy
28 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
29
30 from .ellipse_1 import ellipse_1
31
32 class ellipse_2(ellipse_1):
33   """problème de fissure non plane, débouchante non normale"""
34
35   nomProbleme = "ellipse_2"
36
37   # ---------------------------------------------------------------------------
38   def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
39                                 mailleur="MeshGems"):
40     """Importe la géométrie de la fissure"""
41     texte = "genereShapeFissure pour '{}'".format(self.nomCas)
42     logging.info(texte)
43
44     lgInfluence = shapeFissureParams['lgInfluence']
45
46     shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "ellipse_1_pb.brep"))
47     fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
48     geompy.UnionIDs(fondFiss, [3])
49     geompy.addToStudy( shellFiss, 'shellFiss' )
50     geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
51
52     mailleur = self.mailleur2d3d()
53     coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,25, mailleur, self.numeroCas)
54
55     centre = None
56
57     return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
58
59   # ---------------------------------------------------------------------------
60   def setReferencesMaillageFissure(self):
61     from salome.smesh import smeshBuilder
62     if smeshBuilder.NETGEN_VERSION_MAJOR < 6:
63       self.referencesMaillageFissure = dict( \
64                                              Entity_Quad_Quadrangle = 1748, \
65                                              Entity_Quad_Hexa = 3795, \
66                                              Entity_Node = 21772, \
67                                              Entity_Quad_Edge = 258, \
68                                              Entity_Quad_Triangle = 434, \
69                                              Entity_Quad_Tetra = 2239, \
70                                              Entity_Quad_Pyramid = 199, \
71                                              Entity_Quad_Penta = 120 \
72       )
73     else:
74       self.referencesMaillageFissure = dict( \
75                                              Entity_Quad_Quadrangle = 1748, \
76                                              Entity_Quad_Hexa = 3795, \
77                                              Entity_Node = 21579, \
78                                              Entity_Quad_Edge = 258, \
79                                              Entity_Quad_Triangle = 412, \
80                                              Entity_Quad_Tetra = 2113, \
81                                              Entity_Quad_Pyramid = 199, \
82                                              Entity_Quad_Penta = 120 \
83       )
84