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

213 lines
8.0 KiB
Python
Raw Normal View History

2014-01-09 14:20:44 +00:00
# -*- coding: utf-8 -*-
2021-03-23 17:44:27 +03:00
# Copyright (C) 2014-2021 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
#
2021-01-26 16:37:29 +01:00
"""Insertion d'une fissure elliptique"""
2014-01-09 14:20:44 +00:00
2021-01-26 15:12:35 +01:00
import os
2014-01-09 14:20:44 +00:00
import logging
2021-04-01 16:19:17 +02:00
2014-01-09 14:20:44 +00:00
import salome
import SMESH
2017-03-20 13:27:30 +01:00
from .partitionBlocDefaut import partitionBlocDefaut
from .facesVolumesToriques import facesVolumesToriques
from .facesCirculaires import facesCirculaires
from .propagateTore import propagateTore
from .sortGeneratrices import sortGeneratrices
from .facesFissure import facesFissure
from .facesToreInBloc import facesToreInBloc
from .shapeSurFissure import shapeSurFissure
from .meshBlocPart import meshBlocPart
from .enleveDefaut import enleveDefaut
from .regroupeSainEtDefaut import RegroupeSainEtDefaut
from .putName import putName
2021-01-26 16:37:29 +01:00
2014-01-09 14:20:44 +00:00
# -----------------------------------------------------------------------------
# --- procedure complete fissure elliptique
2021-01-26 16:37:29 +01:00
def insereFissureElliptique(geometriesSaines, maillagesSains, \
shapesFissure, shapeFissureParams, \
2014-01-09 14:20:44 +00:00
maillageFissureParams, elementsDefaut, step=-1):
2021-04-01 16:19:17 +02:00
"""procedure complete fissure elliptique"""
2014-01-09 14:20:44 +00:00
logging.info('start')
2021-04-01 16:19:17 +02:00
#geometrieSaine = geometriesSaines[0]
2014-01-09 14:20:44 +00:00
maillageSain = maillagesSains[0]
isHexa = maillagesSains[1]
2021-04-01 16:19:17 +02:00
#shapeDefaut = shapesFissure[0]
#tailleDefaut = shapesFissure[2]
#pipe0 = shapesFissure[4]
2014-01-09 14:20:44 +00:00
gener1 = shapesFissure[5]
pipe1 = shapesFissure[6]
facefis1 = shapesFissure[7]
plane1 = shapesFissure[8]
ellipsoide1 = shapesFissure[9]
2021-04-01 16:19:17 +02:00
#demiGrandAxe = shapeFissureParams['demiGrandAxe']
#demiPetitAxe = shapeFissureParams['demiPetitAxe']
#orientation = shapeFissureParams['orientation']
2014-01-09 14:20:44 +00:00
nomRep = maillageFissureParams['nomRep']
2021-04-01 16:19:17 +02:00
#nomFicSain = maillageFissureParams['nomFicSain']
2014-01-09 14:20:44 +00:00
nomFicFissure = maillageFissureParams['nomFicFissure']
nbsegExt = maillageFissureParams['nbsegExt'] # 5
nbsegGen = maillageFissureParams['nbsegGen'] # 25
nbsegRad = maillageFissureParams['nbsegRad'] # 5
scaleRad = maillageFissureParams['scaleRad'] # 4
nbsegCercle = maillageFissureParams['nbsegCercle'] # 6
nbsegFis = maillageFissureParams['nbsegFis'] # 20
lensegEllipsoide = maillageFissureParams['lensegEllipso'] # 1.0
2021-04-01 16:19:17 +02:00
#fichierMaillageSain = os.path.join(nomRep, '{}.med'.format(nomFicSain))
2021-01-26 15:12:35 +01:00
fichierMaillageFissure = os.path.join(nomRep, '{}.med'.format(nomFicFissure))
2014-01-09 14:20:44 +00:00
facesDefaut = elementsDefaut[0]
2021-04-01 16:19:17 +02:00
#centreDefaut = elementsDefaut[1]
#normalDefaut = elementsDefaut[2]
2014-01-09 14:20:44 +00:00
extrusionDefaut = elementsDefaut[3]
dmoyen = elementsDefaut[4]
2021-04-01 16:19:17 +02:00
#bordsPartages = elementsDefaut[5]
#fillconts = elementsDefaut[6]
#idFilToCont = elementsDefaut[7]
#maillageSain = elementsDefaut[8]
2014-01-09 14:20:44 +00:00
internalBoundary = elementsDefaut[9]
zoneDefaut = elementsDefaut[10]
zoneDefaut_skin = elementsDefaut[11]
zoneDefaut_internalFaces = elementsDefaut[12]
zoneDefaut_internalEdges = elementsDefaut[13]
## --- ellipse incomplete : generatrice
#if step == 5:
#return None
#allonge = demiGrandAxe/demiPetitAxe
#rayonTore = demiPetitAxe/5.0
#generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part = self.toreFissure(demiPetitAxe, allonge, rayonTore)
2021-04-01 16:19:17 +02:00
#ellipsoide = self.ellipsoideDefaut(demiPetitAxe, allonge)
2014-01-09 14:20:44 +00:00
## --- positionnement sur le bloc defaut de generatrice, tore et plan fissure
#if step == 6:
#return None
#pipe0 = self.rotTrans(Pipe_1, orientation, centreDefaut, normalDefaut)
#gener1 = self.rotTrans(generatrice, orientation, centreDefaut, normalDefaut)
#pipe1 = self.rotTrans(Pipe1Part, orientation, centreDefaut, normalDefaut)
#facefis1 = self.rotTrans(FaceFissure, orientation, centreDefaut, normalDefaut)
#plane1 = self.rotTrans(Plane_1, orientation, centreDefaut, normalDefaut)
#ellipsoide1 = self.rotTrans(ellipsoide, orientation, centreDefaut, normalDefaut)
#geomPublish(initLog.debug, pipe0, 'pipe0' )
#geomPublish(initLog.debug, gener1, 'gener1' )
#geomPublish(initLog.debug, pipe1, 'pipe1' )
#geomPublish(initLog.debug, facefis1, 'facefis1' )
#geomPublish(initLog.debug, plane1, 'plane1' )
#geomPublish(initLog.debug, ellipsoide1, 'ellipsoide1' )
2014-01-09 14:20:44 +00:00
# --- partition du bloc défaut par génératrice, tore et plan fissure
if step == 7:
return None
2021-04-01 16:19:17 +02:00
[ blocPartition, _, tore, \
2021-01-26 16:37:29 +01:00
faceFissure, facesExternes, facesExtBloc, facesExtElli,
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, facefis1, ellipsoide1)
2014-01-09 14:20:44 +00:00
if not isHexa:
edgesBords = None # maillage sain hexa ==> filling, et maillage edges Bords imposés du maillage sain
# --- TORE
# --- faces toriques du tore
if step == 8:
return None
2021-04-01 16:19:17 +02:00
[facetore1, facetore2, _, _] = facesVolumesToriques(tore, plane1, facesDefaut)
2014-01-09 14:20:44 +00:00
# --- faces 1/2 circulaires et edges dans le plan de fissure
if step == 9:
return None
[faces, centres, edges, reverses] = facesCirculaires(extrusionDefaut, tore)
# --- recherche et classement des edges du tore par propagate
if step == 10:
return None
[diams, circles, geners] = propagateTore(tore)
# --- tri par longueur des 3 génératrices
if step == 11:
return None
2021-04-01 16:19:17 +02:00
[_, genint, gencnt] = sortGeneratrices(tore, geners)
2014-01-09 14:20:44 +00:00
# --- faces fissure dans et hors tore, et edges face hors tore
if step == 12:
return None
2021-04-01 16:19:17 +02:00
[_, facefissoutore, _, edgeext, reverext] = \
2014-01-09 14:20:44 +00:00
facesFissure(ellipsoidep, faceFissure, extrusionDefaut, genint)
# --- identification des faces tore et fissure dans le solide hors tore
if step == 13:
return None
2021-04-01 16:19:17 +02:00
[_, _, _] = \
2014-01-09 14:20:44 +00:00
facesToreInBloc(ellipsoidep, facefissoutore, facetore1, facetore2)
# --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face)
#shapesAModifier = self.shapesSurFissure(blocPartition, plane1 faceFissure, gencnt)
if step == 14:
return None
2021-04-01 16:19:17 +02:00
extrusionFaceFissure, _ = shapeSurFissure(plane1)
2014-01-09 14:20:44 +00:00
# --- maillage du bloc partitionne
if step == 15:
return None
2021-04-01 16:19:17 +02:00
[_, blocComplet] = \
2021-01-26 16:37:29 +01:00
meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle,
nbsegFis, dmoyen, lensegEllipsoide) \
2014-01-09 14:20:44 +00:00
if step == 16:
return None
maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges)
if step == 17:
return None
maillageComplet = RegroupeSainEtDefaut(maillageSain, blocComplet, extrusionFaceFissure, faceFissure, 'VOLUMES')
if step == 18:
return None
maillageComplet.ExportMED(fichierMaillageFissure)
2014-01-09 14:20:44 +00:00
putName(maillageComplet, nomFicFissure)
logging.info("fichier maillage fissure : %s", fichierMaillageFissure)
if salome.sg.hasDesktop():
2017-06-13 13:01:10 +03:00
salome.sg.updateObjBrowser()
2014-01-09 14:20:44 +00:00
return maillageComplet