smesh/src/Tools/blocFissure/gmu/creeZoneDefautDansObjetSain.py

113 lines
4.2 KiB
Python
Raw Normal View History

2014-01-09 14:20:44 +00:00
# -*- coding: utf-8 -*-
2020-04-15 17:49:00 +03:00
# Copyright (C) 2014-2020 EDF R&D
2019-02-14 14:55:47 +03:00
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
2014-01-09 14:20:44 +00:00
import logging
2017-03-20 13:27:30 +01:00
from .geomsmesh import smesh
2014-01-09 14:20:44 +00:00
import SMESH
import SALOMEDS
2017-03-20 13:27:30 +01:00
from .creeZoneDefautMaillage import creeZoneDefautMaillage
from .peauInterne import peauInterne
from .quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
from .creeZoneDefautFilling import creeZoneDefautFilling
from .creeZoneDefautGeom import creeZoneDefautGeom
from .getCentreFondFiss import getCentreFondFiss
2014-01-09 14:20:44 +00:00
# -----------------------------------------------------------------------------
# ---
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
shapeFissureParams, maillageFissureParams):
"""
#TODO: a compléter
2014-01-09 14:20:44 +00:00
"""
logging.info('start')
geometrieSaine = geometriesSaines[0]
maillageSain = maillagesSains[0]
isHexa = maillagesSains[1]
shapeDefaut = shapesFissure[0]
tailleDefaut = shapesFissure[2]
coordsNoeudsFissure = shapesFissure[3]
isElliptique = False
2017-03-20 13:27:30 +01:00
if 'elliptique' in shapeFissureParams:
2014-01-09 14:20:44 +00:00
isElliptique = shapeFissureParams['elliptique']
if isElliptique:
2017-03-20 13:27:30 +01:00
if 'demiGrandAxe' in shapeFissureParams:
2014-01-09 14:20:44 +00:00
demiGrandAxe = shapeFissureParams['demiGrandAxe']
else:
demiGrandAxe = shapeFissureParams['longueur']
lgExtrusion = 2.0*demiGrandAxe
else:
lgExtrusion = 50.
nomRep = maillageFissureParams['nomRep']
nomFicSain = maillageFissureParams['nomFicSain']
fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
# --- centre de fond de fissure et tangente
edgeFondExt, centreFondFiss, tgtCentre = getCentreFondFiss(shapesFissure)
# --- zone de défaut
nomZones = "zoneDefaut"
[origShapes, verticesShapes, dmoyen] = \
creeZoneDefautMaillage(maillagesSains, shapeDefaut, tailleDefaut, nomZones, coordsNoeudsFissure)
maillageSain.ExportMED(fichierMaillageSain)
2014-01-09 14:20:44 +00:00
logging.debug("fichier maillage sain %s", fichierMaillageSain)
[maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
peauInterne(fichierMaillageSain, shapeDefaut, nomZones)
2014-01-09 14:20:44 +00:00
facesDefaut = []
centresDefaut = []
normalsDefaut =[]
extrusionsDefaut = []
isPlane = False
if isHexa and not isPlane:
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
2014-01-09 14:20:44 +00:00
for filling in fillings:
[faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
facesDefaut.append(faceDefaut)
centresDefaut.append(centreDefaut)
normalsDefaut.append(normalDefaut)
extrusionsDefaut.append(extrusionDefaut)
else:
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
bordsPartages = []
2014-01-09 14:20:44 +00:00
for face in facesDefaut:
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
fillconts = facesDefaut
2017-03-20 13:27:30 +01:00
idFilToCont = list(range(len(facesDefaut)))
2014-01-09 14:20:44 +00:00
return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, dmoyen, bordsPartages, fillconts, idFilToCont,
maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges,
edgeFondExt, centreFondFiss, tgtCentre]