1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2021 EDF R&D
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 """problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan"""
26 from blocFissure import gmu
27 from blocFissure.gmu.geomsmesh import geompy, smesh
28 from blocFissure.gmu.fissureGenerique import fissureGenerique
29 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
30 from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
31 from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
32 from blocFissure.gmu.putName import putName
34 class cubeAngle(fissureGenerique):
35 """problème de fissure plane coupant 2 faces (angle), débouches normaux, objet plan"""
37 nomProbleme = "cubeAngle"
38 shapeFissureParams = dict()
39 maillageFissureParams = dict()
40 referencesMaillageFissure = dict()
42 # ---------------------------------------------------------------------------
43 def genereMaillageSain(self, geometriesSaines, meshParams):
44 texte = "genereMaillageSain pour '{}'".format(self.nomCas)
47 ([objetSain], _) = smesh.CreateMeshesFromMED(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngle.med"))
48 putName(objetSain.GetMesh(), self.nomProbleme, i_pref=self.numeroCas)
50 return [objetSain, True] # True : maillage hexa
52 # ---------------------------------------------------------------------------
53 def setParamShapeFissure(self):
55 paramètres de la fissure pour méthode construitFissureGenerale
56 lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
57 rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
59 texte = "genereMaillageSain pour '{}'".format(self.nomCas)
61 self.shapeFissureParams = dict(lgInfluence = 20,
64 # ---------------------------------------------------------------------------
65 def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
67 """Importe la géométrie de la fissure"""
68 texte = "genereShapeFissure pour '{}'".format(self.nomCas)
71 lgInfluence = shapeFissureParams['lgInfluence']
73 shellFiss = geompy.ImportBREP(os.path.join(gmu.pathBloc, "materielCasTests", "CubeAngleFiss.brep"))
74 fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
75 geompy.UnionIDs(fondFiss, [3])
76 geompy.addToStudy( shellFiss, 'shellFiss' )
77 geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
79 mailleur = self.mailleur2d3d()
80 coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, 5 ,10, mailleur, self.numeroCas)
84 return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
86 # ---------------------------------------------------------------------------
87 def setParamMaillageFissure(self):
88 texte = "setParamMaillageFissure pour '{}'".format(self.nomCas)
90 self.maillageFissureParams = dict(nomRep = os.curdir,
91 nomFicSain = self.nomProbleme,
92 nomFicFissure = self.nomProbleme + "_fissure",
95 areteFaceFissure = 10)
97 # ---------------------------------------------------------------------------
98 def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
99 elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams, \
101 return elementsDefaut
103 # ---------------------------------------------------------------------------
104 def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
105 shapesFissure, shapeFissureParams, \
106 maillageFissureParams, elementsDefaut, step, \
107 mailleur="MeshGems"):
108 texte = "genereMaillageFissure pour '{}'".format(self.nomCas)
111 mailleur = self.mailleur2d3d()
112 maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
113 maillageFissureParams, elementsDefaut, \
114 mailleur, self.numeroCas)
115 return maillageFissure
117 # ---------------------------------------------------------------------------
118 def setReferencesMaillageFissure(self):
119 self.referencesMaillageFissure = dict( \
120 Entity_Quad_Quadrangle = 1630, \
121 Entity_Quad_Hexa = 3523, \
122 Entity_Node = 18874, \
123 Entity_Quad_Edge = 261, \
124 Entity_Quad_Triangle = 190, \
125 Entity_Quad_Tetra = 1322, \
126 Entity_Quad_Pyramid = 172, \
127 Entity_Quad_Penta = 64 \