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
36 from .putName import putName
38 def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, \
39 shapeFissureParams, maillageFissureParams, \
46 geometrieSaine = geometriesSaines[0]
47 maillageSain = maillagesSains[0]
48 isHexa = maillagesSains[1]
49 shapeDefaut = shapesFissure[0]
50 tailleDefaut = shapesFissure[2]
51 coordsNoeudsFissure = shapesFissure[3]
54 if 'elliptique' in shapeFissureParams:
55 isElliptique = shapeFissureParams['elliptique']
57 if 'demiGrandAxe' in shapeFissureParams:
58 demiGrandAxe = shapeFissureParams['demiGrandAxe']
60 demiGrandAxe = shapeFissureParams['longueur']
61 lgExtrusion = 2.0*demiGrandAxe
65 nomRep = maillageFissureParams['nomRep']
66 nomFicSain = maillageFissureParams['nomFicSain']
68 fichierMaillageSain = os.path.join (nomRep , '{}.med'.format(nomFicSain))
70 # --- centre de fond de fissure et tangente
72 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, \
87 centresDefaut = list()
88 normalsDefaut = list()
89 extrusionsDefaut = list()
91 if isHexa and not isPlane:
92 meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
93 putName(meshQuad, "meshQuad", i_pref=nro_cas)
95 fillings, _, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
97 for filling in fillings:
98 [faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
99 creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
100 facesDefaut.append(faceDefaut)
101 centresDefaut.append(centreDefaut)
102 normalsDefaut.append(normalDefaut)
103 extrusionsDefaut.append(extrusionDefaut)
105 [facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
106 creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, lgExtrusion)
107 bordsPartages = list()
108 for _ in facesDefaut:
109 bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
110 fillconts = facesDefaut
111 idFilToCont = list(range(len(facesDefaut)))
113 return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, \
114 dmoyen, bordsPartages, fillconts, idFilToCont, \
115 maillageSain, internalBoundary, \
116 zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges, \
117 edgeFondExt, centreFondFiss, tgtCentre]