mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 18:20:34 +05:00
Cosmétique python3
This commit is contained in:
parent
ee8255184a
commit
4203b2933f
@ -17,6 +17,7 @@
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
"""Cas standard"""
|
||||
|
||||
import os
|
||||
from .geomsmesh import geompy, smesh
|
||||
@ -48,6 +49,7 @@ class casStandard(fissureGenerique):
|
||||
- les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
|
||||
- les paramètres de maillage de la fissure
|
||||
"""
|
||||
referencesMaillageFissure = None
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
def __init__ (self, dicoParams, references = None, numeroCas = 0):
|
||||
|
@ -17,21 +17,20 @@
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
"""Construit les arêtes débouchantes"""
|
||||
|
||||
import logging
|
||||
|
||||
from .geomsmesh import geompy
|
||||
from .geomsmesh import geomPublish
|
||||
from .geomsmesh import geomPublishInFather
|
||||
#from .geomsmesh import geomPublishInFather
|
||||
from . import initLog
|
||||
import GEOM
|
||||
from .sortEdges import sortEdges
|
||||
|
||||
def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
|
||||
facesPipePeau, edgeRadFacePipePeau, nbsegCercle):
|
||||
"""
|
||||
construction des listes d'edges radiales sur chaque extrémité débouchante
|
||||
"""
|
||||
"""construction des listes d'edges radiales sur chaque extrémité débouchante"""
|
||||
logging.info('start')
|
||||
|
||||
# --- listes de nappes radiales en filling à chaque extrémité débouchante
|
||||
@ -95,7 +94,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
|
||||
vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
|
||||
if len(vs) > 2:
|
||||
eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
|
||||
[edsorted, minl,maxl] = sortEdges(eds)
|
||||
[edsorted, _, maxl] = sortEdges(eds)
|
||||
edge = edsorted[-1]
|
||||
else:
|
||||
maxl = geompy.BasicProperties(edge)[0]
|
||||
@ -118,7 +117,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
|
||||
logging.debug(" edges issues de la partition: %s", ednouv)
|
||||
for ii, ed in enumerate(ednouv):
|
||||
geomPublish(initLog.debug, ed, "ednouv%d"%ii)
|
||||
[edsorted, minl,maxl] = sortEdges(ednouv)
|
||||
[edsorted, _, maxl] = sortEdges(ednouv)
|
||||
logging.debug(" longueur edge trouvée: %s", maxl)
|
||||
edge = edsorted[-1]
|
||||
else:
|
||||
@ -134,7 +133,7 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
|
||||
logging.debug("nombre vertex candidats %s", len(vxnouv))
|
||||
if len(vxnouv) >= 2:
|
||||
eds = [geompy.MakeEdge(vxnouv[j],vxnouv[(j+1)%len(vxnouv)]) for j in range(len(vxnouv))]
|
||||
[edsorted2, minl,maxl] = sortEdges(eds)
|
||||
[edsorted2, _, maxl] = sortEdges(eds)
|
||||
edge = edsorted2[-1]
|
||||
logging.debug("lg edge: %s", maxl)
|
||||
else:
|
||||
@ -144,4 +143,4 @@ def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
|
||||
geomPublish(initLog.debug, edge, name)
|
||||
listEdges.append(edges)
|
||||
|
||||
return (listEdges, idFacesDebouchantes)
|
||||
return (listEdges, idFacesDebouchantes)
|
||||
|
@ -144,7 +144,7 @@ def construitFissureGenerale(maillagesSains,
|
||||
centreFondFiss = elementsDefaut[15]
|
||||
#tgtCentre = elementsDefaut[16]
|
||||
if lgAretesVives == 0:
|
||||
lgAretesVives = dmoyen
|
||||
lgAretesVives = dmoyen
|
||||
|
||||
|
||||
O, OX, OY, OZ = triedreBase()
|
||||
@ -183,7 +183,8 @@ def construitFissureGenerale(maillagesSains,
|
||||
# 0, 1 ou plus edges de la face de fissure externe au pipe
|
||||
|
||||
nbFacesFilling = len(partitionsPeauFissFond)
|
||||
logging.info("nbFacesFilling : {} ".format(nbFacesFilling))
|
||||
texte = "nbFacesFilling : {} ".format(nbFacesFilling)
|
||||
logging.info(texte)
|
||||
|
||||
ptEdgeFond = [ list() for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
|
||||
fsPipePeau = [ list() for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
|
||||
@ -231,9 +232,8 @@ def construitFissureGenerale(maillagesSains,
|
||||
|
||||
# --- identification des faces et edges de fissure externe pour maillage
|
||||
|
||||
(faceFissureExterne, edgesPipeFissureExterneC,
|
||||
wirePipeFissureExterne, edgesPeauFissureExterneC) = identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe,
|
||||
edFisExtPi, edgesPipeFiss)
|
||||
(faceFissureExterne, edgesPipeFissureExterneC, wirePipeFissureExterne, edgesPeauFissureExterneC) = \
|
||||
identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss)
|
||||
|
||||
# --- preparation maillage du pipe :
|
||||
# - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
|
||||
@ -322,12 +322,13 @@ def construitFissureGenerale(maillagesSains,
|
||||
putName(meshBoiteDefaut, "boiteDefaut")
|
||||
logging.info("meshBoiteDefaut fini")
|
||||
|
||||
faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' )
|
||||
faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], \
|
||||
'FACE1' )
|
||||
maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
|
||||
zoneDefaut_internalFaces, zoneDefaut_internalEdges)
|
||||
putName(maillageSain, nomFicSain+"_coupe")
|
||||
extrusionFaceFissure, normfiss = shapeSurFissure(facesPortFissure)
|
||||
maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut,
|
||||
_, normfiss = shapeSurFissure(facesPortFissure)
|
||||
maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut, \
|
||||
None, None, 'COMPLET', normfiss)
|
||||
|
||||
logging.info("conversion quadratique")
|
||||
|
@ -17,6 +17,7 @@
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
"""Maillage du pipe"""
|
||||
|
||||
import logging
|
||||
|
||||
@ -25,9 +26,7 @@ from .geomsmesh import smesh
|
||||
import SMESH
|
||||
|
||||
def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
|
||||
"""
|
||||
maillage effectif du pipe
|
||||
"""
|
||||
"""maillage effectif du pipe"""
|
||||
logging.info('start')
|
||||
meshPipe = smesh.Mesh(None, "meshPipe")
|
||||
fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
|
||||
@ -38,26 +37,26 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
|
||||
edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1")
|
||||
faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0")
|
||||
faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1")
|
||||
|
||||
mptsdisks = [] # vertices maillage de tous les disques
|
||||
mEdges = [] # identifiants edges maillage fond de fissure
|
||||
mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe
|
||||
mFaces = [] # identifiants faces maillage fissure
|
||||
mVols = [] # identifiants volumes maillage pipe
|
||||
|
||||
mptdsk = None
|
||||
mptsdisks = list() # vertices maillage de tous les disques
|
||||
mEdges = list() # identifiants edges maillage fond de fissure
|
||||
mEdgeFaces = list() # identifiants edges maillage edge face de fissure externe
|
||||
mFaces = list() # identifiants faces maillage fissure
|
||||
mVols = list() # identifiants volumes maillage pipe
|
||||
|
||||
mptdsk = list()
|
||||
for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# --- points
|
||||
|
||||
|
||||
gptdsk = gptsdisks[idisk]
|
||||
if idisk > idisklim[0]:
|
||||
oldmpts = mptdsk
|
||||
mptdsk = [] # vertices maillage d'un disque
|
||||
mptdsk = list() # vertices maillage d'un disque
|
||||
for k in range(nbsegCercle):
|
||||
points = gptdsk[k]
|
||||
mptids = []
|
||||
mptids = list()
|
||||
for j, pt in enumerate(points):
|
||||
if j == 0 and k > 0:
|
||||
id = mptdsk[0][0]
|
||||
@ -67,37 +66,39 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
|
||||
mptids.append(id)
|
||||
mptdsk.append(mptids)
|
||||
mptsdisks.append(mptdsk)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# --- groupes edges cercles debouchants
|
||||
|
||||
|
||||
if idisk == idisklim[0]:
|
||||
pts = []
|
||||
pts = list()
|
||||
for k in range(nbsegCercle):
|
||||
pts.append(mptdsk[k][-1])
|
||||
edges = []
|
||||
for k in range(len(pts)):
|
||||
k1 = (k+1)%len(pts)
|
||||
edges = list()
|
||||
nb_pts = len(pts)
|
||||
for k in range(nb_pts):
|
||||
k1 = (k+1)%nb_pts
|
||||
idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
|
||||
edges.append(idEdge)
|
||||
edgeCircPipe0Group.Add(edges)
|
||||
|
||||
|
||||
if idisk == idisklim[1]:
|
||||
pts = []
|
||||
pts = list()
|
||||
for k in range(nbsegCercle):
|
||||
pts.append(mptdsk[k][-1])
|
||||
edges = []
|
||||
for k in range(len(pts)):
|
||||
k1 = (k+1)%len(pts)
|
||||
edges = list()
|
||||
nb_pts = len(pts)
|
||||
for k in range(nb_pts):
|
||||
k1 = (k+1)%nb_pts
|
||||
idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
|
||||
edges.append(idEdge)
|
||||
edgeCircPipe1Group.Add(edges)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# --- groupes faces debouchantes
|
||||
|
||||
|
||||
if idisk == idisklim[0]:
|
||||
faces = []
|
||||
faces = list()
|
||||
for j in range(nbsegRad):
|
||||
for k in range(nbsegCercle):
|
||||
k1 = k+1
|
||||
@ -111,7 +112,7 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
|
||||
faceCircPipe0Group.Add(faces)
|
||||
|
||||
if idisk == idisklim[1]:
|
||||
faces = []
|
||||
faces = list()
|
||||
for j in range(nbsegRad):
|
||||
for k in range(nbsegCercle):
|
||||
k1 = k+1
|
||||
@ -123,10 +124,10 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
|
||||
idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
|
||||
faces.append(idf)
|
||||
faceCircPipe1Group.Add(faces)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
|
||||
|
||||
|
||||
if idisk == idisklim[0]:
|
||||
mEdges.append(0)
|
||||
mEdgeFaces.append(0)
|
||||
@ -141,28 +142,28 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
|
||||
ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]])
|
||||
mEdgeFaces.append(ide2)
|
||||
edgeFaceFissGroup.Add([ide2])
|
||||
idFaces = []
|
||||
idVols = []
|
||||
|
||||
idFaces = list()
|
||||
idVols = list()
|
||||
|
||||
for j in range(nbsegRad):
|
||||
idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]])
|
||||
faceFissGroup.Add([idf])
|
||||
idFaces.append(idf)
|
||||
|
||||
idVolCercle = []
|
||||
|
||||
idVolCercle = list()
|
||||
for k in range(nbsegCercle):
|
||||
k1 = k+1
|
||||
if k == nbsegCercle-1:
|
||||
k1 = 0
|
||||
if j == 0:
|
||||
idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1],
|
||||
idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], \
|
||||
oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1]])
|
||||
else:
|
||||
idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j],
|
||||
idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j], \
|
||||
oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]])
|
||||
idVolCercle.append(idv)
|
||||
idVols.append(idVolCercle)
|
||||
|
||||
idVols.append(idVolCercle)
|
||||
|
||||
mFaces.append(idFaces)
|
||||
mVols.append(idVols)
|
||||
|
||||
@ -172,16 +173,16 @@ def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
|
||||
nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
|
||||
edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
|
||||
|
||||
meshPipeGroups = dict(fondFissGroup = fondFissGroup,
|
||||
nodesFondFissGroup = nodesFondFissGroup,
|
||||
faceFissGroup = faceFissGroup,
|
||||
edgeFaceFissGroup = edgeFaceFissGroup,
|
||||
edgeCircPipe0Group = edgeCircPipe0Group,
|
||||
edgeCircPipe1Group = edgeCircPipe1Group,
|
||||
faceCircPipe0Group = faceCircPipe0Group,
|
||||
faceCircPipe1Group = faceCircPipe1Group,
|
||||
pipeFissGroup = pipeFissGroup,
|
||||
edgesCircPipeGroup = edgesCircPipeGroup
|
||||
meshPipeGroups = dict(fondFissGroup = fondFissGroup, \
|
||||
nodesFondFissGroup = nodesFondFissGroup, \
|
||||
faceFissGroup = faceFissGroup, \
|
||||
edgeFaceFissGroup = edgeFaceFissGroup, \
|
||||
edgeCircPipe0Group = edgeCircPipe0Group, \
|
||||
edgeCircPipe1Group = edgeCircPipe1Group, \
|
||||
faceCircPipe0Group = faceCircPipe0Group, \
|
||||
faceCircPipe1Group = faceCircPipe1Group, \
|
||||
pipeFissGroup = pipeFissGroup, \
|
||||
edgesCircPipeGroup = edgesCircPipeGroup \
|
||||
)
|
||||
|
||||
return (meshPipe, meshPipeGroups, edgesCircPipeGroup)
|
||||
|
||||
return (meshPipe, meshPipeGroups, edgesCircPipeGroup)
|
||||
|
@ -34,27 +34,27 @@ from .checkDecoupePartition import checkDecoupePartition
|
||||
# liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
|
||||
|
||||
def construitPartitionsPeauFissure(facesDefaut, fissPipe):
|
||||
"""
|
||||
partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
|
||||
"""partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
|
||||
|
||||
Il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure.
|
||||
@param facesDefaut liste de faces externes
|
||||
@param fissPipe partition face de fissure etendue par pipe prolongé
|
||||
@return partitionsPeauFissFond : liste de partitions face externe - fissure (None quand pas d'intersection)
|
||||
"""
|
||||
|
||||
|
||||
logging.info('start')
|
||||
partitionsPeauFissFond = []
|
||||
partitionsPeauFissFond = list()
|
||||
ipart = 0
|
||||
for filling in facesDefaut:
|
||||
part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
||||
for filling in facesDefaut:
|
||||
part = geompy.MakePartition([fissPipe, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
||||
isPart = checkDecoupePartition([fissPipe, filling], part)
|
||||
if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
|
||||
otherFD = [fd for fd in facesDefaut if fd != filling]
|
||||
if otherFD:
|
||||
fissPipePart = geompy.MakePartition([fissPipe], otherFD, [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
||||
fissPipePart = geompy.MakePartition([fissPipe], otherFD, list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
||||
else:
|
||||
fissPipePart = fissPipe
|
||||
part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
|
||||
part = geompy.MakePartition([fissPipePart, filling], list(), list(), list(), geompy.ShapeType["FACE"], 0, list(), 0)
|
||||
partitionsPeauFissFond.append(part)
|
||||
geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
|
||||
else:
|
||||
|
@ -29,9 +29,7 @@ from .putName import putName
|
||||
|
||||
def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
|
||||
meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad):
|
||||
"""
|
||||
maillage faces de fissure
|
||||
"""
|
||||
"""maillage faces de fissure"""
|
||||
logging.info('start')
|
||||
logging.info("Maillage de {}".format(faceFissureExterne.GetName()))
|
||||
|
||||
@ -48,7 +46,7 @@ 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()))
|
||||
logging.info("Récupération des arêtes de '{}'".format(edgesPipeFissureExterneC.GetName()))
|
||||
algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
|
||||
hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
|
||||
putName(algo1d.GetSubMesh(), "edgeFissPeau")
|
||||
|
Loading…
Reference in New Issue
Block a user