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

@ -30,24 +30,22 @@ from .fissError import fissError
from .produitMixte import produitMixte
from .whichSide import whichSide
def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
edgesFondIn, edgesFondFiss, wireFondFiss,
aretesVivesC, fillingFaceExterne,
edgesPipeIn, verticesPipePeau, rayonPipe,
def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, \
edgesFondIn, edgesFondFiss, wireFondFiss, \
aretesVivesC, fillingFaceExterne, \
edgesPipeIn, verticesPipePeau, rayonPipe, \
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')
verticesEdgesFondIn = [] # 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)
cercles = [] # 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)
edgesFissExtPeau = [] # 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)
verticesEdgesFondIn = list() # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
pipexts = list() # les segments de pipe associés au points de fond de fissure débouchants (même indice)
cercles = list() # les cercles de generation des pipes débouchant (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 = list() # edges des faces de fissure externe sur la peau (même indice)
edgesFissExtPipe = list() # edges des faces de fissure externe sur le pipe (même indice)
#logging.debug("edgesFondIn %s", edgesFondIn)
for iedf, edge in enumerate(edgesFondIn):
@ -78,8 +76,8 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
# La partition filling / pipe reconstruit échoue.
# - Si on partitionne le filling avec un simple pipe obtenu par extrusion droite du cercle,
# cela donne un point en trop sur le cercle.
# - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
# les pipes reconstruits
# - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
# les pipes reconstruits
logging.debug("angle=%s", angle)
#if abs(angle) > 1.e-7:
sommetAxe = geompy.MakeTranslationVector(centre, norm)
@ -102,15 +100,15 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
locPt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0)
sidePt0 = whichSide(faceTestPeau, locPt0)
sidePt1 = whichSide(faceTestPeau, locPt1)
logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
normFace = geompy.GetNormal(faceTestPeau, ptPeau)
inclPipe = abs(geompy.GetAngleRadians(norm, normFace))
lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(inclPipe)))
logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", inclPipe*180/math.pi, lgp)
# --- 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
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)
edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
edgesLocSorted.sort()
@ -127,7 +125,7 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%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)
for edp in edps:
if geompy.MinDistance(centre, edp) < 1.e-3:
@ -138,9 +136,9 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
for ifa, face in enumerate(facesInside):
logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)")
edgesPeauFis = []
edgesPipeFis = []
edgesPipeFnd = []
edgesPeauFis = list()
edgesPipeFis = list()
edgesPipeFnd = list()
try:
edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
logging.debug(" faces onside %s",edgesPeauFis)
@ -174,4 +172,4 @@ def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
if dist < 1.e-3:
break
return (verticesEdgesFondIn, pipexts, cercles, facesFissExt, edgesFissExtPeau, edgesFissExtPipe)
return (verticesEdgesFondIn, pipexts, cercles, facesFissExt, edgesFissExtPeau, edgesFissExtPipe)

View File

@ -26,9 +26,9 @@ from .trouveEdgesFissPeau import trouveEdgesFissPeau
from .identifieFacesPeau import identifieFacesPeau
from .identifieEdgesPeau import identifieEdgesPeau
def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
edgesFondFiss, wireFondFiss, aretesVivesC,
facesDefaut, centreFondFiss, rayonPipe,
def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss, \
edgesFondFiss, wireFondFiss, aretesVivesC, \
facesDefaut, centreFondFiss, rayonPipe, \
aretesVivesCoupees):
"""
"""
@ -36,16 +36,16 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
fillingFaceExterne = facesDefaut[ifil]
logging.debug("traitement partitionPeauFissFond %s", ifil)
# --- identification edges fond de fissure, edges pipe sur la face de fissure, edges prolongées
# edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
(edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside) = identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
edgesPipeFiss, edgesFondFiss, aretesVivesC,
fillingFaceExterne, centreFondFiss)
# --- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
(verticesEdgesFondIn, pipexts, cercles,
facesFissExt, edgesFissExtPeau, edgesFissExtPipe) = identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
edgesFondIn, edgesFondFiss, wireFondFiss,
@ -57,20 +57,20 @@ def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss
if len(verticesPipePeau) == 0: # aucune extrémité du pipe sur cette face de peau
edgesFissExtPeau = trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau)
# --- inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
(facePeau, facesPeauSorted, edgesPeauFondIn) = identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
verticesEdgesFondIn, pipexts, cercles,
fillingFaceExterne, centreFondFiss)
# --- identification précise des edges et disques des faces de peau selon index extremité fissure
(endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
bordsVifs, edgesFissurePeau, aretesVivesCoupees) = identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted,
edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees)
dataPPFF = dict(endsEdgeFond = endsEdgeFond, # pour chaque face [points edge fond de fissure aux débouchés du pipe]
facesPipePeau = facesPipePeau, # pour chaque face [faces du pipe débouchantes]
edgeRadFacePipePeau = edgeRadFacePipePeau, # pour chaque face [edge radiale des faces du pipe débouchantes ]
@ -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
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]
)
)
return dataPPFF, aretesVivesCoupees

View File

@ -17,6 +17,7 @@
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
"""Insertion d'une fissure elliptique"""
import os
@ -42,12 +43,12 @@ from .meshBlocPart import meshBlocPart
from .enleveDefaut import enleveDefaut
from .regroupeSainEtDefaut import RegroupeSainEtDefaut
from .putName import putName
# -----------------------------------------------------------------------------
# --- procedure complete fissure elliptique
def insereFissureElliptique(geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
def insereFissureElliptique(geometriesSaines, maillagesSains, \
shapesFissure, shapeFissureParams, \
maillageFissureParams, elementsDefaut, step=-1):
"""
TODO: a completer
@ -132,11 +133,10 @@ def insereFissureElliptique(geometriesSaines, maillagesSains,
if step == 7:
return None
[blocPartition, blocp, tore,
faceFissure, facesExternes, facesExtBloc, facesExtElli,
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1,
facefis1, ellipsoide1)
[ blocPartition, blocp, tore, \
faceFissure, facesExternes, facesExtBloc, facesExtElli,
aretesInternes, ellipsoidep, sharedFaces, sharedEdges, edgesBords] = \
partitionBlocDefaut(extrusionDefaut, facesDefaut, gener1, pipe1, facefis1, ellipsoide1)
if not isHexa:
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
[bloc1, blocComplet] = \
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)
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) \
if step == 16:
return None

View File

@ -107,12 +107,12 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
O, OX, OY, OZ = triedreBase()
# -----------------------------------------------------------------------------
# --- peau et face de fissure
# --- 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' )
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)
# --- 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' )
# --- identification face de peau
@ -161,7 +161,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
geomPublishInFather(initLog.debug,partitionPeauFissByPipe, facePeau, "facePeau")
# --- identification edges de bord face peau
edgesBords = []
edgesBords = list()
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
edgesBords.append(edgepeau)
@ -188,7 +188,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
edgesFacePeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
edgesFacePeauSorted, minlg, maxlg = sortEdges(edgesFacePeau)
demiCerclesPeau = edgesFacePeauSorted[0:4]
verticesDemiCerclesPeau = []
verticesDemiCerclesPeau = list()
for i, edge in enumerate(demiCerclesPeau):
name = "demiCerclePeau_%d"%i
geomPublishInFather(initLog.debug,facePeau, edge, name)
@ -203,9 +203,9 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
geomPublishInFather(initLog.debug,facePeau, vertex, name)
# --- demi cercles regroupés
groupsDemiCerclesPeau = []
groupsDemiCerclesPeau = list()
for i, vertex in enumerate(verticesEdgePeauFiss):
demis = []
demis = list()
for edge in demiCerclesPeau:
if geompy.MinDistance(vertex, edge) < 1.e-5:
demis.append(edge)
@ -218,7 +218,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- identification edges commune pipe face fissure externe au pipe
edgePeauFissId = geompy.GetSubShapeID(partitionPeauFissByPipe, edgePeauFiss)
edgesFaceFiss = geompy.ExtractShapes(faceFiss, geompy.ShapeType["EDGE"], False)
edgesFaceFissPipe = []
edgesFaceFissPipe = list()
for edge in edgesFaceFiss:
if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId:
edgesFaceFissPipe.append(edge)
@ -255,13 +255,13 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
[vertexReference] = geompy.ExtractShapes(disque, geompy.ShapeType["VERTEX"], False)
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.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)
#pipesSorted, volmin, volmax = sortSolids(pipes)
#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, wireFondFiss, 'wireFondFiss')
@ -271,7 +271,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
for i, v in enumerate(VerticesEndFondFiss):
name = "vertexEndFondFiss_%d"%i
geomPublishInFather(initLog.debug,wireFondFiss, v, name)
VerticesEndPipeFiss = []
VerticesEndPipeFiss = list()
for v in VerticesEndFondFiss:
VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v))
for i, v in enumerate(VerticesEndPipeFiss):
@ -307,8 +307,8 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# generatrices = edgesPipeOnplan moins rayon disques (3 grandes et 6 petites)
edgesIdPipeOnside = getSubshapeIds(pipeFondFiss, edgesPipeOnside)
edgesIdPipeOnplan = getSubshapeIds(pipeFondFiss, edgesPipeOnplan)
rayons = []
demiCercles = []
rayons = list()
demiCercles = list()
for i, edgeId in enumerate(edgesIdPipeOnside):
if edgeId in edgesIdPipeOnplan:
rayons.append(edgesPipeOnside[i])
@ -318,13 +318,13 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
rayons = rayons + edgesSorted[:4] # les 4 plus petits sont les rayons
demiCercles = demiCercles + edgesSorted[4:] # les suivants sont les arcs de cercle
rayonsId = getSubshapeIds(pipeFondFiss, rayons)
generatrices = []
generatrices = list()
for i, edgeId in enumerate(edgesIdPipeOnplan):
if edgeId not in rayonsId:
generatrices.append(edgesPipeOnplan[i])
# --- generatrices en contact avec la face fissure externe au pipe
generFiss = []
generFiss = list()
for edge in generatrices:
distance = geompy.MinDistance(vertexReference, edge)
logging.debug("distance %s", distance)
@ -341,9 +341,9 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
geomPublishInFather(initLog.debug,pipeFondFiss, groupGenerFiss, "GenFiss")
# --- demi cercles externes regroupés
groupsDemiCerclesPipe = []
groupsDemiCerclesPipe = list()
for i, vertex in enumerate(verticesEdgePeauFiss):
demis = []
demis = list()
for edge in demiCerclesExternes:
if geompy.MinDistance(vertex, edge) < 0.1:
demis.append(edge)
@ -355,7 +355,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- faces fissure dans le pipe
facesFissinPipe = []
facesFissinPipe = list()
generFissId = getSubshapeIds(pipeFondFiss, generFiss)
logging.debug("generatrice fissure %s", generFissId)
for face in facesPipeOnplan:
@ -376,7 +376,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
# --- edges de fond de fissure
edgesFondFiss = []
edgesFondFiss = list()
for i, edge in enumerate(edgesInside):
anEdge = geompy.GetInPlace(pipeFondFiss, edge)
logging.debug(" edge %s ", anEdge)
@ -395,7 +395,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
aFilterManager = smesh.CreateFilterManager()
nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
criteres = []
criteres = list()
unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
criteres.append(unCritere)
filtre = smesh.GetFilterFromCriteria(criteres)
@ -452,7 +452,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
isDone = meshFondFiss.Compute()
logging.info("meshFondFiss computed")
disks = []
disks = list()
for i, face in enumerate(disques[:4]):
name = "disk%d"%i
disks.append(meshFondFiss.GroupOnGeom(face, name, SMESH.FACE))
@ -464,8 +464,8 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
grp = meshFondFiss.GroupOnGeom(groupFaceFissInPipe, "fisInPi", SMESH.FACE)
group_edgeFondFiss = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "FONDFISS", SMESH.EDGE)
noeudsFondFissure = meshFondFiss.GroupOnGeom(groupEdgeFondFiss, "nfondfis", SMESH.NODE)
groups_demiCercles = []
groupnodes_demiCercles = []
groups_demiCercles = list()
groupnodes_demiCercles = list()
for i, group in enumerate(groupsDemiCerclesPipe):
name = "Cercle%d"%i
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")
idNode0 = grpNode0.GetID(1)
idNode1 = grpNode1.GetID(1)
coordsMesh = []
coordsMesh = list()
coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode0))
coordsMesh.append(meshFondFiss.GetNodeXYZ(idNode1))
coordsGeom = []
coordsGeom = list()
for vertex in verticesEdgePeauFiss:
coord = geompy.PointCoordinates(vertex);
coord = geompy.PointCoordinates(vertex)
if distance2(coord, coordsMesh[0]) < 0.1:
meshFondFiss.MoveNode(idNode0, coord[0], coord[1], coord[2])
if distance2(coord, coordsMesh[1]) < 0.1:
@ -526,7 +526,7 @@ def insereFissureLongue(geometriesSaines, maillagesSains,
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)
algo1d = meshFacePeau.Segment(geom=edgePeauFiss)
hypo1d = algo1d.NumberOfSegments(nbSeg,[],[ ])
hypo1d = algo1d.NumberOfSegments(nbSeg,list(),[ ])
hypo1d.SetDistrType( 2 )
hypo1d.SetConversionMode( 1 )
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)
meshBoiteDefaut = smesh.Concatenate([internalBoundary.GetMesh(),
meshFondFiss.GetMesh(),
meshFacePeau.GetMesh(),
meshFaceFiss.GetMesh()],
1, 1, 1e-05,False)
meshBoiteDefaut = smesh.Concatenate( [internalBoundary.GetMesh(), \
meshFondFiss.GetMesh(), \
meshFacePeau.GetMesh(), \
meshFaceFiss.GetMesh()], \
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
# on designe les faces de peau en quadrangles par le groupe "skinFaces"
group_faceFissOutPipe = None

View File

@ -26,12 +26,13 @@ from salome.smesh import smeshBuilder
import SMESH
from .putName import putName
def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC, \
meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad):
"""maillage faces de fissure"""
logging.info('start')
logging.info("Maillage de {}".format(faceFissureExterne.GetName()))
texte = "Maillage de {}".format(faceFissureExterne.GetName())
logging.info(texte)
meshFaceFiss = smesh.Mesh(faceFissureExterne)
algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
@ -46,7 +47,8 @@ def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFi
putName(algo2d, "algo2d_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)
hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
putName(algo1d.GetSubMesh(), "edgeFissPeau")

View File

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