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

220 lines
8.2 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
import salome
2017-03-20 13:27:30 +01:00
from .geomsmesh import geompy
from .geomsmesh import geomPublish
from .geomsmesh import geomPublishInFather
from . import initLog
from .geomsmesh import smesh
2014-01-09 14:20:44 +00:00
import SMESH
import math
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):
"""
TODO: a completer
"""
logging.info('start')
geometrieSaine = geometriesSaines[0]
maillageSain = maillagesSains[0]
isHexa = maillagesSains[1]
shapeDefaut = shapesFissure[0]
tailleDefaut = shapesFissure[2]
pipe0 = shapesFissure[4]
gener1 = shapesFissure[5]
pipe1 = shapesFissure[6]
facefis1 = shapesFissure[7]
plane1 = shapesFissure[8]
ellipsoide1 = shapesFissure[9]
demiGrandAxe = shapeFissureParams['demiGrandAxe']
demiPetitAxe = shapeFissureParams['demiPetitAxe']
orientation = shapeFissureParams['orientation']
nomRep = maillageFissureParams['nomRep']
nomFicSain = maillageFissureParams['nomFicSain']
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-01-26 15:12:35 +01:00
fichierMaillageSain = os.path.join(nomRep, '{}.med'.format(nomFicSain))
fichierMaillageFissure = os.path.join(nomRep, '{}.med'.format(nomFicFissure))
2014-01-09 14:20:44 +00:00
facesDefaut = elementsDefaut[0]
centreDefaut = elementsDefaut[1]
normalDefaut = elementsDefaut[2]
extrusionDefaut = elementsDefaut[3]
dmoyen = elementsDefaut[4]
bordsPartages = elementsDefaut[5]
fillconts = elementsDefaut[6]
idFilToCont = elementsDefaut[7]
maillageSain = elementsDefaut[8]
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)
#ellipsoide = self.ellipsoideDefaut(demiPetitAxe, allonge, rayonTore)
## --- 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-01-26 16:37:29 +01:00
[ blocPartition, blocp, tore, \
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
[facetore1, facetore2, volumeTore1, volumeTore2] = facesVolumesToriques(tore, plane1, facesDefaut)
# --- 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
[genext, genint, gencnt] = sortGeneratrices(tore, geners)
# --- faces fissure dans et hors tore, et edges face hors tore
if step == 12:
return None
[facefissintore, facefissoutore, edgeint, edgeext, reverext] = \
facesFissure(ellipsoidep, faceFissure, extrusionDefaut, genint)
# --- identification des faces tore et fissure dans le solide hors tore
if step == 13:
return None
[blocFaceFiss, blocFaceTore1, blocFaceTore2] = \
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
extrusionFaceFissure, normfiss = shapeSurFissure(plane1)
# --- maillage du bloc partitionne
if step == 15:
return None
[bloc1, 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