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
20 """TODO: a compléter"""
28 from .geomsmesh import smesh
30 from .creeZoneDefautMaillage import creeZoneDefautMaillage
31 from .peauInterne import peauInterne
32 from .quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
33 from .creeZoneDefautFilling import creeZoneDefautFilling
34 from .creeZoneDefautGeom import creeZoneDefautGeom
35 from .getCentreFondFiss import getCentreFondFiss
37 def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, \
38 shapeFissureParams, maillageFissureParams):
44 geometrieSaine = geometriesSaines[0]
45 maillageSain = maillagesSains[0]
46 isHexa = maillagesSains[1]
47 shapeDefaut = shapesFissure[0]
48 tailleDefaut = shapesFissure[2]
49 coordsNoeudsFissure = shapesFissure[3]
52 if 'elliptique' in shapeFissureParams:
53 isElliptique = shapeFissureParams['elliptique']
55 if 'demiGrandAxe' in shapeFissureParams:
56 demiGrandAxe = shapeFissureParams['demiGrandAxe']
58 demiGrandAxe = shapeFissureParams['longueur']
59 lgExtrusion = 2.0*demiGrandAxe
63 nomRep = maillageFissureParams['nomRep']
64 nomFicSain = maillageFissureParams['nomFicSain']
66 fichierMaillageSain = os.path.join (nomRep , '{}.med'.format(nomFicSain))
68 # --- centre de fond de fissure et tangente
70 edgeFondExt, centreFondFiss, tgtCentre = getCentreFondFiss(shapesFissure)
73 nomZones = "zoneDefaut"
75 [origShapes, verticesShapes, dmoyen] = \
76 creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut, nomZones, coordsNoeudsFissure)
78 maillageSain.ExportMED(fichierMaillageSain)
79 logging.debug("fichier maillage sain %s", fichierMaillageSain)
80 [maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
81 peauInterne(fichierMaillageSain, shapeDefaut, nomZones)
84 centresDefaut = list()
85 normalsDefaut = list()
86 extrusionsDefaut = list()
88 if isHexa and not isPlane:
89 meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
91 fillings, _, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
93 for filling in fillings:
94 [faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
95 creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
96 facesDefaut.append(faceDefaut)
97 centresDefaut.append(centreDefaut)
98 normalsDefaut.append(normalDefaut)
99 extrusionsDefaut.append(extrusionDefaut)
101 [facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
102 creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, lgExtrusion)
103 bordsPartages = list()
104 for _ in facesDefaut:
105 bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
106 fillconts = facesDefaut
107 idFilToCont = list(range(len(facesDefaut)))
109 return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, \
110 dmoyen, bordsPartages, fillconts, idFilToCont, \
111 maillageSain, internalBoundary, \
112 zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges, \
113 edgeFondExt, centreFondFiss, tgtCentre]