1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2014-2020 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
24 from .geomsmesh import smesh
28 from .creeZoneDefautMaillage import creeZoneDefautMaillage
29 from .peauInterne import peauInterne
30 from .quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
31 from .creeZoneDefautFilling import creeZoneDefautFilling
32 from .creeZoneDefautGeom import creeZoneDefautGeom
33 from .getCentreFondFiss import getCentreFondFiss
35 # -----------------------------------------------------------------------------
38 def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
39 shapeFissureParams, maillageFissureParams):
45 geometrieSaine = geometriesSaines[0]
46 maillageSain = maillagesSains[0]
47 isHexa = maillagesSains[1]
48 shapeDefaut = shapesFissure[0]
49 tailleDefaut = shapesFissure[2]
50 coordsNoeudsFissure = shapesFissure[3]
53 if 'elliptique' in shapeFissureParams:
54 isElliptique = shapeFissureParams['elliptique']
56 if 'demiGrandAxe' in shapeFissureParams:
57 demiGrandAxe = shapeFissureParams['demiGrandAxe']
59 demiGrandAxe = shapeFissureParams['longueur']
60 lgExtrusion = 2.0*demiGrandAxe
64 nomRep = maillageFissureParams['nomRep']
65 nomFicSain = maillageFissureParams['nomFicSain']
67 fichierMaillageSain = os.path.join (nomRep , '{}.med'.format(nomFicSain))
69 # --- centre de fond de fissure et tangente
71 edgeFondExt, centreFondFiss, tgtCentre = getCentreFondFiss(shapesFissure)
75 nomZones = "zoneDefaut"
77 [origShapes, verticesShapes, dmoyen] = \
78 creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut, nomZones, coordsNoeudsFissure)
80 maillageSain.ExportMED(fichierMaillageSain)
81 logging.debug("fichier maillage sain %s", fichierMaillageSain)
82 [maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
83 peauInterne(fichierMaillageSain, shapeDefaut, nomZones)
86 centresDefaut = list()
87 normalsDefaut = list()
88 extrusionsDefaut = list()
90 if isHexa and not isPlane:
91 meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
93 fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
95 for filling in fillings:
96 [faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
97 creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
98 facesDefaut.append(faceDefaut)
99 centresDefaut.append(centreDefaut)
100 normalsDefaut.append(normalDefaut)
101 extrusionsDefaut.append(extrusionDefaut)
103 [facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
104 creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
105 bordsPartages = list()
106 for face in facesDefaut:
107 bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
108 fillconts = facesDefaut
109 idFilToCont = list(range(len(facesDefaut)))
111 return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, dmoyen, bordsPartages, fillconts, idFilToCont,
112 maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges,
113 edgeFondExt, centreFondFiss, tgtCentre]