Gestion des continuations

This commit is contained in:
GERALD NICOLAS 2021-01-26 16:37:29 +01:00
parent 4203b2933f
commit a37f701f67
6 changed files with 140 additions and 133 deletions

View File

@ -31,23 +31,21 @@ from .fissError import fissError
from .produitMixte import produitMixte from .produitMixte import produitMixte
from .whichSide import whichSide from .whichSide import whichSide
def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, \
edgesFondIn, edgesFondFiss, wireFondFiss, edgesFondIn, edgesFondFiss, wireFondFiss, \
aretesVivesC, fillingFaceExterne, aretesVivesC, fillingFaceExterne, \
edgesPipeIn, verticesPipePeau, rayonPipe, edgesPipeIn, verticesPipePeau, rayonPipe, \
facesInside, facesOnside): facesInside, facesOnside):
""" """elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)"""
elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
"""
logging.info('start') logging.info('start')
verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn) verticesEdgesFondIn = list() # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice) pipexts = list() # les segments de pipe associés au points de fond de fissure débouchants (même indice)
cercles = [] # les cercles de generation des pipes débouchant (même indice) cercles = list() # les cercles de generation des pipes débouchant (même indice)
facesFissExt = [] # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice) facesFissExt = list() # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
edgesFissExtPeau = [] # edges des faces de fissure externe sur la peau (même indice) edgesFissExtPeau = list() # edges des faces de fissure externe sur la peau (même indice)
edgesFissExtPipe = [] # edges des faces de fissure externe sur le pipe (même indice) edgesFissExtPipe = list() # edges des faces de fissure externe sur le pipe (même indice)
#logging.debug("edgesFondIn %s", edgesFondIn) #logging.debug("edgesFondIn %s", edgesFondIn)
for iedf, edge in enumerate(edgesFondIn): for iedf, edge in enumerate(edgesFondIn):
@ -110,7 +108,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
# --- position des points extremite du pipe sur l'edge debouchante # --- position des points extremite du pipe sur l'edge debouchante
# il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante # il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante
locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], [], [], geompy.ShapeType["EDGE"], 0, [], 0) locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False) edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)] edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
edgesLocSorted.sort() edgesLocSorted.sort()
@ -127,7 +125,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%d"%iedf) geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%d"%iedf)
geomPublishInFather(initLog.debug, wireFondFiss, p2, "p2_%d"%iedf) geomPublishInFather(initLog.debug, wireFondFiss, p2, "p2_%d"%iedf)
edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0) edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], list(), list(), geompy.ShapeType["EDGE"], 0, list(), 0)
edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True) edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
for edp in edps: for edp in edps:
if geompy.MinDistance(centre, edp) < 1.e-3: if geompy.MinDistance(centre, edp) < 1.e-3:
@ -138,9 +136,9 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
for ifa, face in enumerate(facesInside): for ifa, face in enumerate(facesInside):
logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)") logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)")
edgesPeauFis = [] edgesPeauFis = list()
edgesPipeFis = [] edgesPipeFis = list()
edgesPipeFnd = [] edgesPipeFnd = list()
try: try:
edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"]) edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
logging.debug(" faces onside %s",edgesPeauFis) logging.debug(" faces onside %s",edgesPeauFis)

View File

@ -26,9 +26,9 @@ from .trouveEdgesFissPeau import trouveEdgesFissPeau
from .identifieFacesPeau import identifieFacesPeau from .identifieFacesPeau import identifieFacesPeau
from .identifieEdgesPeau import identifieEdgesPeau from .identifieEdgesPeau import identifieEdgesPeau
def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss, def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss, \
edgesFondFiss, wireFondFiss, aretesVivesC, edgesFondFiss, wireFondFiss, aretesVivesC, \
facesDefaut, centreFondFiss, rayonPipe, facesDefaut, centreFondFiss, rayonPipe, \
aretesVivesCoupees): aretesVivesCoupees):
""" """
""" """
@ -84,7 +84,7 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
bordsVifs = bordsVifs, # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives bordsVifs = bordsVifs, # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
edgesFissurePeau = edgesFissurePeau, # pour chaque face de peau : [subshape edge en peau des faces de fissure externes] edgesFissurePeau = edgesFissurePeau, # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
verticesPipePeau = verticesPipePeau # pour chaque face de peau : [point commun edFissPeau edCircPeau] verticesPipePeau = verticesPipePeau # pour chaque face de peau : [point commun edFissPeau edCircPeau]
) )
return dataPPFF, aretesVivesCoupees return dataPPFF, aretesVivesCoupees

View File

@ -17,6 +17,7 @@
# #
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
"""Insertion d'une fissure elliptique"""
import os import os
@ -46,8 +47,8 @@ from .putName import putName
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# --- procedure complete fissure elliptique # --- procedure complete fissure elliptique
def insereFissureElliptique(geometriesSaines, maillagesSains, def insereFissureElliptique(geometriesSaines, maillagesSains, \
shapesFissure, shapeFissureParams, shapesFissure, shapeFissureParams, \
maillageFissureParams, elementsDefaut, step=-1): maillageFissureParams, elementsDefaut, step=-1):
""" """
TODO: a completer TODO: a completer
@ -132,11 +133,10 @@ def insereFissureElliptique(geometriesSaines, maillagesSains,
if step == 7: if step == 7:
return None return None
[blocPartition, blocp, tore, [ blocPartition, blocp, tore, \
faceFissure, facesExternes, facesExtBloc, facesExtElli, faceFissure, facesExternes, facesExtBloc, facesExtElli,
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \ aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, facefis1, ellipsoide1)
facefis1, ellipsoide1)
if not isHexa: if not isHexa:
edgesBords = None # maillage sain hexa ==> filling, et maillage edges Bords imposés du maillage sain edgesBords = None # maillage sain hexa ==> filling, et maillage edges Bords imposés du maillage sain
@ -193,11 +193,11 @@ def insereFissureElliptique(geometriesSaines, maillagesSains,
return None return None
[bloc1, blocComplet] = \ [bloc1, blocComplet] = \
meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle,
nbsegFis, dmoyen, lensegEllipsoide) nbsegFis, dmoyen, lensegEllipsoide) \
if step == 16: if step == 16:
return None return None

View File

@ -112,7 +112,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- peau et face de fissure # --- peau et face de fissure
# --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée # --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée
partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], [], [], [], geompy.ShapeType["FACE"], 0, [], 0) partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
geomPublish(initLog.debug, partitionPeauFissFond, 'partitionPeauFissFond' ) geomPublish(initLog.debug, partitionPeauFissFond, 'partitionPeauFissFond' )
edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False) edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False)
@ -151,7 +151,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
[facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3) [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
# --- partition peau -face fissure - pipe fond de fissure prolongé # --- partition peau -face fissure - pipe fond de fissure prolongé
partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], [], [], geompy.ShapeType["FACE"], 0, [], 0) partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
geomPublish(initLog.debug, partitionPeauFissByPipe, 'partitionPeauFissByPipe' ) geomPublish(initLog.debug, partitionPeauFissByPipe, 'partitionPeauFissByPipe' )
# --- identification face de peau # --- identification face de peau
@ -161,7 +161,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
geomPublishInFather(initLog.debug,partitionPeauFissByPipe, facePeau, "facePeau") geomPublishInFather(initLog.debug,partitionPeauFissByPipe, facePeau, "facePeau")
# --- identification edges de bord face peau # --- identification edges de bord face peau
edgesBords = [] edgesBords = list()
for i, edge in enumerate(edgesFilling): for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge) edgepeau = geompy.GetInPlace(facePeau, edge)
edgesBords.append(edgepeau) edgesBords.append(edgepeau)
@ -188,7 +188,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
edgesFacePeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False) edgesFacePeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
edgesFacePeauSorted, minlg, maxlg = sortEdges(edgesFacePeau) edgesFacePeauSorted, minlg, maxlg = sortEdges(edgesFacePeau)
demiCerclesPeau = edgesFacePeauSorted[0:4] demiCerclesPeau = edgesFacePeauSorted[0:4]
verticesDemiCerclesPeau = [] verticesDemiCerclesPeau = list()
for i, edge in enumerate(demiCerclesPeau): for i, edge in enumerate(demiCerclesPeau):
name = "demiCerclePeau_%d"%i name = "demiCerclePeau_%d"%i
geomPublishInFather(initLog.debug,facePeau, edge, name) geomPublishInFather(initLog.debug,facePeau, edge, name)
@ -203,9 +203,9 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
geomPublishInFather(initLog.debug,facePeau, vertex, name) geomPublishInFather(initLog.debug,facePeau, vertex, name)
# --- demi cercles regroupés # --- demi cercles regroupés
groupsDemiCerclesPeau = [] groupsDemiCerclesPeau = list()
for i, vertex in enumerate(verticesEdgePeauFiss): for i, vertex in enumerate(verticesEdgePeauFiss):
demis = [] demis = list()
for edge in demiCerclesPeau: for edge in demiCerclesPeau:
if geompy.MinDistance(vertex, edge) < 1.e-5: if geompy.MinDistance(vertex, edge) < 1.e-5:
demis.append(edge) demis.append(edge)
@ -218,7 +218,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- identification edges commune pipe face fissure externe au pipe # --- identification edges commune pipe face fissure externe au pipe
edgePeauFissId = geompy.GetSubShapeID(partitionPeauFissByPipe, edgePeauFiss) edgePeauFissId = geompy.GetSubShapeID(partitionPeauFissByPipe, edgePeauFiss)
edgesFaceFiss = geompy.ExtractShapes(faceFiss, geompy.ShapeType["EDGE"], False) edgesFaceFiss = geompy.ExtractShapes(faceFiss, geompy.ShapeType["EDGE"], False)
edgesFaceFissPipe = [] edgesFaceFissPipe = list()
for edge in edgesFaceFiss: for edge in edgesFaceFiss:
if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId: if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId:
edgesFaceFissPipe.append(edge) edgesFaceFissPipe.append(edge)
@ -255,13 +255,13 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
[vertexReference] = geompy.ExtractShapes(disque, geompy.ShapeType["VERTEX"], False) [vertexReference] = geompy.ExtractShapes(disque, geompy.ShapeType["VERTEX"], False)
pipeFondFiss = geompy.MakePipe(disque, wireFondFiss) pipeFondFiss = geompy.MakePipe(disque, wireFondFiss)
pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0) pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], list(), list(), geompy.ShapeType["SOLID"], 0, list(), 0)
#pipe = geompy.MakePipe(disque, WirePorteFondFissure) #pipe = geompy.MakePipe(disque, WirePorteFondFissure)
#pipe = geompy.MakePartition([pipe],[fillingFaceExterne], [], [], geompy.ShapeType["SOLID"], 0, [], 0) #pipe = geompy.MakePartition([pipe],[fillingFaceExterne], list(), list(), geompy.ShapeType["SOLID"], 0, list(), 0)
#pipes = geompy.ExtractShapes(pipe, geompy.ShapeType["SOLID"], False) #pipes = geompy.ExtractShapes(pipe, geompy.ShapeType["SOLID"], False)
#pipesSorted, volmin, volmax = sortSolids(pipes) #pipesSorted, volmin, volmax = sortSolids(pipes)
#pipeFondFiss = pipesSorted[-1] #pipeFondFiss = pipesSorted[-1]
#pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0) #pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], list(), list(), geompy.ShapeType["SOLID"], 0, list(), 0)
geomPublish(initLog.debug, disque, 'disque') geomPublish(initLog.debug, disque, 'disque')
geomPublish(initLog.debug, wireFondFiss, 'wireFondFiss') geomPublish(initLog.debug, wireFondFiss, 'wireFondFiss')
@ -271,7 +271,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
for i, v in enumerate(VerticesEndFondFiss): for i, v in enumerate(VerticesEndFondFiss):
name = "vertexEndFondFiss_%d"%i name = "vertexEndFondFiss_%d"%i
geomPublishInFather(initLog.debug,wireFondFiss, v, name) geomPublishInFather(initLog.debug,wireFondFiss, v, name)
VerticesEndPipeFiss = [] VerticesEndPipeFiss = list()
for v in VerticesEndFondFiss: for v in VerticesEndFondFiss:
VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v)) VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v))
for i, v in enumerate(VerticesEndPipeFiss): for i, v in enumerate(VerticesEndPipeFiss):
@ -307,8 +307,8 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# generatrices = edgesPipeOnplan moins rayon disques (3 grandes et 6 petites) # generatrices = edgesPipeOnplan moins rayon disques (3 grandes et 6 petites)
edgesIdPipeOnside = getSubshapeIds(pipeFondFiss, edgesPipeOnside) edgesIdPipeOnside = getSubshapeIds(pipeFondFiss, edgesPipeOnside)
edgesIdPipeOnplan = getSubshapeIds(pipeFondFiss, edgesPipeOnplan) edgesIdPipeOnplan = getSubshapeIds(pipeFondFiss, edgesPipeOnplan)
rayons = [] rayons = list()
demiCercles = [] demiCercles = list()
for i, edgeId in enumerate(edgesIdPipeOnside): for i, edgeId in enumerate(edgesIdPipeOnside):
if edgeId in edgesIdPipeOnplan: if edgeId in edgesIdPipeOnplan:
rayons.append(edgesPipeOnside[i]) rayons.append(edgesPipeOnside[i])
@ -318,13 +318,13 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
rayons = rayons + edgesSorted[:4] # les 4 plus petits sont les rayons rayons = rayons + edgesSorted[:4] # les 4 plus petits sont les rayons
demiCercles = demiCercles + edgesSorted[4:] # les suivants sont les arcs de cercle demiCercles = demiCercles + edgesSorted[4:] # les suivants sont les arcs de cercle
rayonsId = getSubshapeIds(pipeFondFiss, rayons) rayonsId = getSubshapeIds(pipeFondFiss, rayons)
generatrices = [] generatrices = list()
for i, edgeId in enumerate(edgesIdPipeOnplan): for i, edgeId in enumerate(edgesIdPipeOnplan):
if edgeId not in rayonsId: if edgeId not in rayonsId:
generatrices.append(edgesPipeOnplan[i]) generatrices.append(edgesPipeOnplan[i])
# --- generatrices en contact avec la face fissure externe au pipe # --- generatrices en contact avec la face fissure externe au pipe
generFiss = [] generFiss = list()
for edge in generatrices: for edge in generatrices:
distance = geompy.MinDistance(vertexReference, edge) distance = geompy.MinDistance(vertexReference, edge)
logging.debug("distance %s", distance) logging.debug("distance %s", distance)
@ -341,9 +341,9 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
geomPublishInFather(initLog.debug,pipeFondFiss, groupGenerFiss, "GenFiss") geomPublishInFather(initLog.debug,pipeFondFiss, groupGenerFiss, "GenFiss")
# --- demi cercles externes regroupés # --- demi cercles externes regroupés
groupsDemiCerclesPipe = [] groupsDemiCerclesPipe = list()
for i, vertex in enumerate(verticesEdgePeauFiss): for i, vertex in enumerate(verticesEdgePeauFiss):
demis = [] demis = list()
for edge in demiCerclesExternes: for edge in demiCerclesExternes:
if geompy.MinDistance(vertex, edge) < 0.1: if geompy.MinDistance(vertex, edge) < 0.1:
demis.append(edge) demis.append(edge)
@ -355,7 +355,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- faces fissure dans le pipe # --- faces fissure dans le pipe
facesFissinPipe = [] facesFissinPipe = list()
generFissId = getSubshapeIds(pipeFondFiss, generFiss) generFissId = getSubshapeIds(pipeFondFiss, generFiss)
logging.debug("generatrice fissure %s", generFissId) logging.debug("generatrice fissure %s", generFissId)
for face in facesPipeOnplan: for face in facesPipeOnplan:
@ -376,7 +376,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- edges de fond de fissure # --- edges de fond de fissure
edgesFondFiss = [] edgesFondFiss = list()
for i, edge in enumerate(edgesInside): for i, edge in enumerate(edgesInside):
anEdge = geompy.GetInPlace(pipeFondFiss, edge) anEdge = geompy.GetInPlace(pipeFondFiss, edge)
logging.debug(" edge %s ", anEdge) logging.debug(" edge %s ", anEdge)
@ -395,7 +395,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
aFilterManager = smesh.CreateFilterManager() aFilterManager = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ]) nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
criteres = [] criteres = list()
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0) unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere) criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres) filtre = smesh.GetFilterFromCriteria(criteres)
@ -452,7 +452,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
isDone = meshFondFiss.Compute() isDone = meshFondFiss.Compute()
logging.info("meshFondFiss computed") logging.info("meshFondFiss computed")
disks = [] disks = list()
for i, face in enumerate(disques[:4]): for i, face in enumerate(disques[:4]):
name = "disk%d"%i name = "disk%d"%i
disks.append(meshFondFiss.GroupOnGeom(face, name, SMESH.FACE)) disks.append(meshFondFiss.GroupOnGeom(face, name, SMESH.FACE))
@ -464,8 +464,8 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
grp = meshFondFiss.GroupOnGeom(groupFaceFissInPipe, "fisInPi", SMESH.FACE) grp = meshFondFiss.GroupOnGeom(groupFaceFissInPipe, "fisInPi", SMESH.FACE)
group_edgeFondFiss = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "FONDFISS", SMESH.EDGE) group_edgeFondFiss = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "FONDFISS", SMESH.EDGE)
noeudsFondFissure = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "nfondfis", SMESH.NODE) noeudsFondFissure = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "nfondfis", SMESH.NODE)
groups_demiCercles = [] groups_demiCercles = list()
groupnodes_demiCercles = [] groupnodes_demiCercles = list()
for i, group in enumerate(groupsDemiCerclesPipe): for i, group in enumerate(groupsDemiCerclesPipe):
name = "Cercle%d"%i name = "Cercle%d"%i
groups_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.EDGE)) groups_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.EDGE))
@ -477,12 +477,12 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
grpNode1 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[1], "Node1") grpNode1 = meshFondFiss.IntersectGroups(groupnode_generFiss, groupnodes_demiCercles[1], "Node1")
idNode0 = grpNode0.GetID(1) idNode0 = grpNode0.GetID(1)
idNode1 = grpNode1.GetID(1) idNode1 = grpNode1.GetID(1)
coordsMesh = [] coordsMesh = list()
coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode0)) coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode0))
coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode1)) coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode1))
coordsGeom = [] coordsGeom = list()
for vertex in verticesEdgePeauFiss: for vertex in verticesEdgePeauFiss:
coord = geompy.PointCoordinates(vertex); coord = geompy.PointCoordinates(vertex)
if distance2(coord, coordsMesh[0]) < 0.1: if distance2(coord, coordsMesh[0]) < 0.1:
meshFondFiss.MoveNode(idNode0, coord[0], coord[1], coord[2]) meshFondFiss.MoveNode(idNode0, coord[0], coord[1], coord[2])
if distance2(coord, coordsMesh[1]) < 0.1: if distance2(coord, coordsMesh[1]) < 0.1:
@ -526,7 +526,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
ratio = (nbSegGenBout/float(profondeur)) / (nbSegGenLong/lenEdgePeauFiss) ratio = (nbSegGenBout/float(profondeur)) / (nbSegGenLong/lenEdgePeauFiss)
logging.info("lenEdgePeauFiss %s, profondeur %s, nbSegGenLong %s, nbSegGenBout %s, frac %s, ratio %s", lenEdgePeauFiss, profondeur, nbSegGenLong, nbSegGenBout, frac, ratio) logging.info("lenEdgePeauFiss %s, profondeur %s, nbSegGenLong %s, nbSegGenBout %s, frac %s, ratio %s", lenEdgePeauFiss, profondeur, nbSegGenLong, nbSegGenBout, frac, ratio)
algo1d = meshFacePeau.Segment(geom=edgePeauFiss) algo1d = meshFacePeau.Segment(geom=edgePeauFiss)
hypo1d = algo1d.NumberOfSegments(nbSeg,[],[ ]) hypo1d = algo1d.NumberOfSegments(nbSeg,list(),[ ])
hypo1d.SetDistrType( 2 ) hypo1d.SetDistrType( 2 )
hypo1d.SetConversionMode( 1 ) hypo1d.SetConversionMode( 1 )
hypo1d.SetTableFunction( [ 0, ratio, frac, 1, (1.-frac), 1, 1, ratio ] ) hypo1d.SetTableFunction( [ 0, ratio, frac, 1, (1.-frac), 1, 1, ratio ] )
@ -589,11 +589,11 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
grp = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE) grp = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE)
meshBoiteDefaut = smesh.Concatenate([internalBoundary.GetMesh(), meshBoiteDefaut = smesh.Concatenate( [internalBoundary.GetMesh(), \
meshFondFiss.GetMesh(), meshFondFiss.GetMesh(), \
meshFacePeau.GetMesh(), meshFacePeau.GetMesh(), \
meshFaceFiss.GetMesh()], meshFaceFiss.GetMesh()], \
1, 1, 1e-05,False) 1, 1, 1e-05,False)
# pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes # pour aider l'algo hexa-tetra a ne pas mettre de pyramides a l'exterieur des volumes replies sur eux-memes
# on designe les faces de peau en quadrangles par le groupe "skinFaces" # on designe les faces de peau en quadrangles par le groupe "skinFaces"
group_faceFissOutPipe = None group_faceFissOutPipe = None

View File

@ -27,11 +27,12 @@ import SMESH
from .putName import putName from .putName import putName
def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC, def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC, \
meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad): meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad):
"""maillage faces de fissure""" """maillage faces de fissure"""
logging.info('start') logging.info('start')
logging.info("Maillage de {}".format(faceFissureExterne.GetName())) texte = "Maillage de {}".format(faceFissureExterne.GetName())
logging.info(texte)
meshFaceFiss = smesh.Mesh(faceFissureExterne) meshFaceFiss = smesh.Mesh(faceFissureExterne)
algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D) algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
@ -46,7 +47,8 @@ def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFi
putName(algo2d, "algo2d_faceFiss") putName(algo2d, "algo2d_faceFiss")
putName(hypo2d, "hypo2d_faceFiss") putName(hypo2d, "hypo2d_faceFiss")
logging.info("Récupération des arêtes de '{}'".format(edgesPipeFissureExterneC.GetName())) texte = "Récupération des arêtes de '{}'".format(edgesPipeFissureExterneC.GetName())
logging.info(texte)
algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC) algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0) hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
putName(algo1d.GetSubMesh(), "edgeFissPeau") putName(algo1d.GetSubMesh(), "edgeFissPeau")

View File

@ -29,12 +29,12 @@ from .putName import putName
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# --- maillage du bloc partitionne # --- maillage du bloc partitionne
def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circles, faces, \
gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, gencnt, facefissoutore, edgeext, facesExternes, facesExtBloc, facesExtElli, \
aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, aretesInternes, internalBoundary, ellipsoidep, sharedFaces, sharedEdges, edgesBords, \
nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegFis, dmoyen, lensegEllipsoide): nbsegExt, nbsegGen, nbsegRad, scaleRad, reverses, reverext, nbsegCercle, nbsegFis, dmoyen, lensegEllipsoide):
""" """Maillage du bloc partitionné
Maillage du bloc partitionné
TODO: a completer TODO: a completer
""" """
logging.info('start') logging.info('start')
@ -43,7 +43,7 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
aFilterManager = smesh.CreateFilterManager() aFilterManager = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ]) nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
criteres = [] criteres = list()
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0) unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere) criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres) filtre = smesh.GetFilterFromCriteria(criteres)
@ -54,8 +54,8 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
bloc1 = smesh.Mesh(blocPartition) bloc1 = smesh.Mesh(blocPartition)
for i in range(len(sharedFaces)): for i, sharedFaces_i in enumerate(sharedFaces):
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces[i]) algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN, geom=sharedFaces_i)
hypo2d = algo2d.Parameters(which=smesh.SIMPLE) hypo2d = algo2d.Parameters(which=smesh.SIMPLE)
hypo2d.SetLocalLength(lensegEllipsoide) hypo2d.SetLocalLength(lensegEllipsoide)
hypo2d.LengthFromEdges() hypo2d.LengthFromEdges()
@ -64,8 +64,8 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
putName(algo2d, "algo2d_sharedFaces", i) putName(algo2d, "algo2d_sharedFaces", i)
putName(hypo2d, "hypo2d_sharedFaces", i) putName(hypo2d, "hypo2d_sharedFaces", i)
for i in range(len(sharedEdges)): for i, sharedEdges_i in enumerate(sharedEdges):
algo1d = bloc1.Segment(geom=sharedEdges[i]) algo1d = bloc1.Segment(geom=sharedEdges_i)
hypo1d = algo1d.LocalLength(lensegEllipsoide) hypo1d = algo1d.LocalLength(lensegEllipsoide)
putName(algo1d.GetSubMesh(), "sharedEdges", i) putName(algo1d.GetSubMesh(), "sharedEdges", i)
putName(algo1d, "algo1d_sharedEdges", i) putName(algo1d, "algo1d_sharedEdges", i)
@ -89,28 +89,28 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
putName(algo1d, "algo1d_tore") putName(algo1d, "algo1d_tore")
putName(hypo1d, "hypo1d_tore") putName(hypo1d, "hypo1d_tore")
for i in range(len(faces)): for i, faces_i in enumerate(faces):
algo2d = bloc1.Quadrangle(geom=faces[i]) algo2d = bloc1.Quadrangle(geom=faces_i)
hypo2d = smesh.CreateHypothesis('QuadrangleParams') hypo2d = smesh.CreateHypothesis('QuadrangleParams')
hypo2d.SetTriaVertex( geompy.GetSubShapeID(blocPartition,centres[i]) ) hypo2d.SetTriaVertex( geompy.GetSubShapeID(blocPartition,centres[i]) )
hypo2d.SetQuadType( StdMeshersBuilder.QUAD_STANDARD ) hypo2d.SetQuadType( StdMeshersBuilder.QUAD_STANDARD )
status = bloc1.AddHypothesis(hypo2d,faces[i]) status = bloc1.AddHypothesis(hypo2d,faces_i)
putName(algo2d.GetSubMesh(), "faces", i) putName(algo2d.GetSubMesh(), "faces", i)
putName(algo2d, "algo2d_faces", i) putName(algo2d, "algo2d_faces", i)
putName(hypo2d, "hypo2d_faces", i) putName(hypo2d, "hypo2d_faces", i)
for i in range(len(edges)): for i, edges_i in enumerate(edges):
algo1d = bloc1.Segment(geom=edges[i]) algo1d = bloc1.Segment(geom=edges_i)
if reverses[i] > 0: if reverses[i] > 0:
hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges[i]) ]) hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ geompy.GetSubShapeID(blocPartition,edges_i) ])
else: else:
hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ ]) hypo1d = algo1d.NumberOfSegments(nbsegRad, scaleRad,[ ])
putName(algo1d.GetSubMesh(), "edges", i) putName(algo1d.GetSubMesh(), "edges", i)
putName(algo1d, "algo1d_edges", i) putName(algo1d, "algo1d_edges", i)
putName(hypo1d, "hypo1d_edges", i) putName(hypo1d, "hypo1d_edges", i)
for i in range(len(circles)): for i, circles_i in enumerate(circles):
algo1d = bloc1.Segment(geom=circles[i]) algo1d = bloc1.Segment(geom=circles_i)
hypo1d = algo1d.NumberOfSegments(nbsegCercle) hypo1d = algo1d.NumberOfSegments(nbsegCercle)
putName(algo1d.GetSubMesh(), "circles", i) putName(algo1d.GetSubMesh(), "circles", i)
putName(algo1d, "algo1d_circles", i) putName(algo1d, "algo1d_circles", i)
@ -128,22 +128,22 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
putName(hypo1d, "hypo1d_edgeext") putName(hypo1d, "hypo1d_edgeext")
else: else:
longTotal = 0 longTotal = 0
longEdgeExts = [] longEdgeExts = list()
for i in range(len(edgeext)): for i, edgeext_i in enumerate(edgeext):
props = geompy.BasicProperties(edgeext[i]) props = geompy.BasicProperties(edgeext_i)
longEdgeExts.append(props[0]) longEdgeExts.append(props[0])
longTotal += props[0] longTotal += props[0]
for i in range(len(edgeext)): for i, edgeext_i in enumerate(edgeext):
local = longTotal/nbsegFis local = longTotal/nbsegFis
nbLocal = int(round(nbsegFis*longEdgeExts[i]/longTotal)) nbLocal = int(round(nbsegFis*longEdgeExts[i]/longTotal))
densite = int(round(nbLocal/2)) densite = int(round(nbLocal/2))
algo1d = bloc1.Segment(geom=edgeext[i]) algo1d = bloc1.Segment(geom=edgeext_i)
hypo1d = algo1d.NumberOfSegments(nbLocal) hypo1d = algo1d.NumberOfSegments(nbLocal)
hypo1d.SetDistrType( 2 ) hypo1d.SetDistrType( 2 )
hypo1d.SetConversionMode( 1 ) hypo1d.SetConversionMode( 1 )
hypo1d.SetTableFunction( [ 0, densite, 0.8, 1, 1, 1 ] ) hypo1d.SetTableFunction( [ 0, densite, 0.8, 1, 1, 1 ] )
if reverext[i]: if reverext[i]:
hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext[i]) ]) hypo1d.SetReversedEdges([ geompy.GetSubShapeID(blocPartition, edgeext_i) ])
putName(algo1d.GetSubMesh(), "edgeext", i) putName(algo1d.GetSubMesh(), "edgeext", i)
putName(algo1d, "algo1d_edgeext", i) putName(algo1d, "algo1d_edgeext", i)
putName(hypo1d, "hypo1d_edgeext", i) putName(hypo1d, "hypo1d_edgeext", i)
@ -158,11 +158,11 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
maxElemArea = 0.5*dmoyen*dmoyen maxElemArea = 0.5*dmoyen*dmoyen
logging.debug("dmoyen %s, maxElemArea %s", dmoyen, maxElemArea) logging.debug("dmoyen %s, maxElemArea %s", dmoyen, maxElemArea)
for i in range(len(facesExternes)): for i, facesExternes_i in enumerate(facesExternes):
algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes[i]) algo2d = bloc1.Triangle(algo=smeshBuilder.NETGEN_2D, geom=facesExternes_i)
hypo2d = algo2d.MaxElementArea(maxElemArea) hypo2d = algo2d.MaxElementArea(maxElemArea)
if edgesBords is None: if edgesBords is None:
algo1d = bloc1.Segment(geom=facesExternes[i]) algo1d = bloc1.Segment(geom=facesExternes_i)
hypo1d = algo1d.NumberOfSegments(1) hypo1d = algo1d.NumberOfSegments(1)
putName(algo2d.GetSubMesh(), "facesExternes", i) putName(algo2d.GetSubMesh(), "facesExternes", i)
putName(algo2d, "algo2d_facesExternes", i) putName(algo2d, "algo2d_facesExternes", i)
@ -171,8 +171,8 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
putName(algo1d, "algo1d_facesExternes", i) putName(algo1d, "algo1d_facesExternes", i)
putName(hypo1d, "hypo1d_facesExternes", i) putName(hypo1d, "hypo1d_facesExternes", i)
for i in range(len(aretesInternes)): for i, aretesInternes_i in enumerate(aretesInternes):
algo1d = bloc1.Segment(geom=aretesInternes[i]) algo1d = bloc1.Segment(geom=aretesInternes_i)
hypo1d = algo1d.NumberOfSegments(nbsegExt) hypo1d = algo1d.NumberOfSegments(nbsegExt)
putName(algo1d.GetSubMesh(), "aretesInternes", i) putName(algo1d.GetSubMesh(), "aretesInternes", i)
putName(algo1d, "algo1d_aretesInternes", i) putName(algo1d, "algo1d_aretesInternes", i)
@ -201,26 +201,26 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
faceFissure1 = bloc1.GroupOnGeom(faceFissure,'FACE1',SMESH.FACE) faceFissure1 = bloc1.GroupOnGeom(faceFissure,'FACE1',SMESH.FACE)
noeudsFondFissure = bloc1.GroupOnGeom(gencnt,'nfondfis',SMESH.NODE) noeudsFondFissure = bloc1.GroupOnGeom(gencnt,'nfondfis',SMESH.NODE)
groups_faceCommuneEllipsoideBloc = [] groups_faceCommuneEllipsoideBloc = list()
for i in range(len(sharedFaces)): for i, sharedFaces_i in enumerate(sharedFaces):
name = "faceCommuneEllipsoideBloc_%d"%i name = "faceCommuneEllipsoideBloc_%d"%i
groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces[i], name, SMESH.FACE)) groups_faceCommuneEllipsoideBloc.append(bloc1.GroupOnGeom(sharedFaces_i, name, SMESH.FACE))
groups_faceExterneBloc = [] groups_faceExterneBloc = list()
for i in range(len(facesExtBloc)): for i, facesExtBloc_i in enumerate(facesExtBloc):
name = "faceExterneBloc_%d"%i name = "faceExterneBloc_%d"%i
groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc[i], name, SMESH.FACE)) groups_faceExterneBloc.append(bloc1.GroupOnGeom(facesExtBloc_i, name, SMESH.FACE))
skinBlocMeshes = [] skinBlocMeshes = list()
for i in range(len(groups_faceCommuneEllipsoideBloc)): for i, groups_faceCommuneEllipsoideBloc_i in enumerate(groups_faceCommuneEllipsoideBloc):
name = "faceCommuneEllipsoideBloc_%d"%i name = "faceCommuneEllipsoideBloc_%d"%i
skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc[i], name, 0, 0)) skinBlocMeshes.append(smesh.CopyMesh(groups_faceCommuneEllipsoideBloc_i, name, 0, 0))
for i in range(len(groups_faceExterneBloc)): for i, groups_faceExterneBloc_i in enumerate(groups_faceExterneBloc):
name = "faceExterneBloc_%d"%i name = "faceExterneBloc_%d"%i
skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc[i], name, 0, 0)) skinBlocMeshes.append(smesh.CopyMesh(groups_faceExterneBloc_i, name, 0, 0))
meshesBloc = [internalBoundary.GetMesh()] meshesBloc = [internalBoundary.GetMesh()]
for i in range(len(skinBlocMeshes)): for i, skinBlocMeshes_i in enumerate(skinBlocMeshes):
meshesBloc.append(skinBlocMeshes[i].GetMesh()) meshesBloc.append(skinBlocMeshes_i.GetMesh())
blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False) blocMesh = smesh.Concatenate(meshesBloc, 1, 1, 1e-05,False)
algo3d = blocMesh.Tetrahedron(algo=smeshBuilder.NETGEN) algo3d = blocMesh.Tetrahedron(algo=smeshBuilder.NETGEN)
@ -230,6 +230,13 @@ def meshBlocPart(blocPartition, faceFissure, tore, centres, edges, diams, circle
putName(hypo3d, "hypo3d_bloc") putName(hypo3d, "hypo3d_bloc")
is_done = blocMesh.Compute() is_done = blocMesh.Compute()
text = "meshBlocPart Compute"
if is_done:
logging.info(text)
else:
text = "Erreur au calcul du maillage.\n" + text
logging.info(text)
raise Exception(text)
blocComplet = smesh.Concatenate([bloc1.GetMesh(), blocMesh.GetMesh()], 1, 1, 1e-05,False) blocComplet = smesh.Concatenate([bloc1.GetMesh(), blocMesh.GetMesh()], 1, 1, 1e-05,False)