From b07ad0d79cc8e79896cc853193fd0afe4185e30d Mon Sep 17 00:00:00 2001 From: GERALD NICOLAS Date: Fri, 2 Apr 2021 15:18:46 +0200 Subject: [PATCH] Nommage des objets pour une fissure longue --- .../blocFissure/CasTests/fissure_Coude.py | 2 +- .../blocFissure/gmu/insereFissureLongue.py | 18 +++--- .../blocFissure/gmu/insereFissureLongue_a.py | 18 +++--- .../blocFissure/gmu/insereFissureLongue_c.py | 55 ++++++++++--------- .../blocFissure/gmu/insereFissureLongue_d.py | 32 +++++------ .../blocFissure/gmu/insereFissureLongue_e.py | 20 +++---- .../blocFissure/gmu/insereFissureLongue_f.py | 10 ++-- .../blocFissure/gmu/insereFissureLongue_g.py | 5 +- 8 files changed, 82 insertions(+), 78 deletions(-) diff --git a/src/Tools/blocFissure/CasTests/fissure_Coude.py b/src/Tools/blocFissure/CasTests/fissure_Coude.py index e5705002a..a9c868baa 100644 --- a/src/Tools/blocFissure/CasTests/fissure_Coude.py +++ b/src/Tools/blocFissure/CasTests/fissure_Coude.py @@ -510,7 +510,7 @@ class fissure_Coude(fissureGenerique): maillageFissure = insereFissureLongue(geometriesSaines, \ shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue.py b/src/Tools/blocFissure/gmu/insereFissureLongue.py index 62bf50258..20c510332 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue.py @@ -42,10 +42,10 @@ from .insereFissureLongue_g import insereFissureLongue_g def insereFissureLongue(geometriesSaines, \ shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step=-1, mailleur="MeshGems"): + step=-1, mailleur="MeshGems", nro_cas=-1): """procedure complete fissure longue""" logging.info('start') - logging.info("Usage du mailleur %s", mailleur) + logging.info("Usage du mailleur %s pour le cas n° %d", mailleur, nro_cas) #geometrieSaine = geometriesSaines[0] shapeDefaut = shapesFissure[0] # face de fissure, debordant @@ -114,7 +114,7 @@ def insereFissureLongue(geometriesSaines, \ planfiss, planBord1, planBord2, \ facePeau, verticesOutCercles, verticesEdgePeauFiss, \ fillingFaceExterne, rayonPipe, \ - internalBoundary) + internalBoundary) # --- maillage pipe fond fissure @@ -122,7 +122,8 @@ def insereFissureLongue(geometriesSaines, \ insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCerclesPeau, generatrices, \ VerticesEndPipeFiss, verticesEdgePeauFiss, \ groupFaceFissInPipe, groupEdgeFondFiss, groupsDemiCerclesPipe, groupGenerFiss, \ - profondeur, rayonPipe) + profondeur, rayonPipe, \ + nro_cas) # --- maillage face de peau @@ -130,20 +131,20 @@ def insereFissureLongue(geometriesSaines, \ insereFissureLongue_d ( facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibres, \ groupsDemiCerclesPeau, groups_demiCercles, verticesOutCercles, \ nbSegGenLong, nbSegGenBout, profondeur, \ - mailleur ) + mailleur, nro_cas ) # --- maillage face de fissure meshFaceFiss = \ insereFissureLongue_e ( faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_generFiss, groupEdgesFaceFissPipe, \ profondeur, rayonPipe, \ - mailleur ) + mailleur, nro_cas ) # --- maillage meshBoiteDefaut meshBoiteDefaut, group_faceFissInPipe, group_faceFissOutPipe = \ insereFissureLongue_f ( internalBoundary, meshFondFiss, meshFacePeau, meshFaceFiss, \ - mailleur ) + mailleur, nro_cas ) # --- maillage complet @@ -151,7 +152,8 @@ def insereFissureLongue(geometriesSaines, \ insereFissureLongue_g (nomFicFissure, fichierMaillageFissure, nomFicSain, maillageSain, \ meshBoiteDefaut, facePorteFissure, \ group_faceFissInPipe, group_faceFissOutPipe, \ - zoneDefaut, zoneDefaut_skin, zoneDefaut_internalEdges, zoneDefaut_internalFaces) + zoneDefaut, zoneDefaut_skin, zoneDefaut_internalEdges, zoneDefaut_internalFaces, \ + nro_cas) if salome.sg.hasDesktop(): diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_a.py b/src/Tools/blocFissure/gmu/insereFissureLongue_a.py index 5b31e0b6e..1816d9e49 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_a.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_a.py @@ -128,29 +128,29 @@ def insereFissureLongue_a(facePorteFissure, WirePorteFondFissure, \ edgesFacePeauSorted, _, _ = sortEdges(edgesFacePeau) demiCerclesPeau = edgesFacePeauSorted[0:4] verticesDemiCerclesPeau = list() - for i, edge in enumerate(demiCerclesPeau): - name = "demiCerclePeau_%d"%i + for i_aux, edge in enumerate(demiCerclesPeau): + name = "demiCerclePeau_{}".format(i_aux) geomPublishInFather(initLog.debug,facePeau, edge, name) verticesDemiCerclesPeau += geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False) verticesDemiCerclesPeau = eliminateDoubles(facePeau, verticesDemiCerclesPeau) - for i, vertex in enumerate(verticesDemiCerclesPeau): - name = "verticesDemiCerclesPeau_%d"%i + for i_aux, vertex in enumerate(verticesDemiCerclesPeau): + name = "verticesDemiCerclesPeau_{}".format(i_aux) geomPublishInFather(initLog.debug,facePeau, vertex, name) verticesOutCercles = substractSubShapes(facePeau, verticesDemiCerclesPeau, verticesEdgePeauFiss) - for i, vertex in enumerate(verticesOutCercles): - name = "verticesOutCercles_%d"%i + for i_aux, vertex in enumerate(verticesOutCercles): + name = "verticesOutCercles_{}".format(i_aux) geomPublishInFather(initLog.debug,facePeau, vertex, name) # --- demi cercles regroupés groupsDemiCerclesPeau = list() - for i, vertex in enumerate(verticesEdgePeauFiss): + for i_aux, vertex in enumerate(verticesEdgePeauFiss): demis = list() for edge in demiCerclesPeau: - if geompy.MinDistance(vertex, edge) < 1.e-5: + if ( geompy.MinDistance(vertex, edge) < 1.e-5 ): demis.append(edge) group = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"]) geompy.UnionList(group, demis) - name = "Cercle%d"%i + name = "Cercle{}".format(i_aux) geomPublishInFather(initLog.debug,facePeau, group , name) groupsDemiCerclesPeau.append(group) diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_c.py b/src/Tools/blocFissure/gmu/insereFissureLongue_c.py index ce6d0b25b..cd090999b 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_c.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_c.py @@ -36,53 +36,54 @@ from .distance2 import distance2 def insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCerclesPeau, generatrices, \ VerticesEndPipeFiss, verticesEdgePeauFiss, \ groupFaceFissInPipe, groupEdgeFondFiss, groupsDemiCerclesPipe, groupGenerFiss, \ - profondeur, rayonPipe): + profondeur, rayonPipe, \ + nro_cas=-1): """maillage pipe fond fissure""" logging.info('start') meshFondFiss = smesh.Mesh(pipeFondFiss) algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.QUADRANGLE) algo3d = meshFondFiss.Prism() - putName(algo3d.GetSubMesh(), "pipe") - putName(algo3d, "algo3d_pipe") - putName(algo2d, "algo2d_pipe") + putName(algo3d.GetSubMesh(), "pipe", i_pref=nro_cas) + putName(algo3d, "algo3d_pipe", i_pref=nro_cas) + putName(algo2d, "algo2d_pipe", i_pref=nro_cas) - for i, face in enumerate(disques): + for i_aux, face in enumerate(disques): algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.RADIAL_QUAD,geom=face) - putName(algo2d.GetSubMesh(), "disque", i) - putName(algo2d, "algo2d_disque", i) + putName(algo2d.GetSubMesh(), "disque", i_aux, nro_cas) + putName(algo2d, "algo2d_disque", i_aux, nro_cas) - for i, edge in enumerate(rayons): + for i_aux, edge in enumerate(rayons): algo1d = meshFondFiss.Segment(geom=edge) hypo1d = algo1d.NumberOfSegments(4) - putName(algo1d.GetSubMesh(), "rayon", i) - putName(algo1d, "algo1d_rayon", i) - putName(hypo1d, "hypo1d_rayon", i) + putName(algo1d.GetSubMesh(), "rayon", i_aux, nro_cas) + putName(algo1d, "algo1d_rayon", i_aux, nro_cas) + putName(hypo1d, "hypo1d_rayon", i_aux, nro_cas) - for i, edge in enumerate(demiCercles): + for i_aux, edge in enumerate(demiCercles): algo1d = meshFondFiss.Segment(geom=edge) hypo1d = algo1d.NumberOfSegments(6) - putName(algo1d.GetSubMesh(), "demiCercle", i) - putName(algo1d, "algo1d_demiCercle", i) - putName(hypo1d, "hypo1d_demiCercle", i) + putName(algo1d.GetSubMesh(), "demiCercle", i_aux, nro_cas) + putName(algo1d, "algo1d_demiCercle", i_aux, nro_cas) + putName(hypo1d, "hypo1d_demiCercle", i_aux, nro_cas) generSorted, minlg, maxlg = sortEdges(generatrices) nbSegGenLong = int(math.sqrt(3.0)*maxlg/(profondeur - rayonPipe)) # on veut 2 triangles equilateraux dans la largeur de la face nbSegGenBout = 6 logging.info("min %s, max %s, nombre de segments %s, nombre de generatrices %s", minlg, maxlg, nbSegGenLong, len(generSorted)) - for i, edge in enumerate(generSorted): + for i_aux, edge in enumerate(generSorted): algo1d = meshFondFiss.Segment(geom=edge) - if i < 6: + if i_aux < 6: hypo1d = algo1d.NumberOfSegments(nbSegGenBout) else: hypo1d = algo1d.NumberOfSegments(nbSegGenLong) - putName(algo1d.GetSubMesh(), "generatrice", i) - putName(algo1d, "algo1d_generatrice", i) - putName(hypo1d, "hypo1d_generatrice", i) + putName(algo1d.GetSubMesh(), "generatrice", i_aux, nro_cas) + putName(algo1d, "algo1d_generatrice", i_aux, nro_cas) + putName(hypo1d, "hypo1d_generatrice", i_aux, nro_cas) disks = list() - for i, face in enumerate(disques[:4]): - name = "disk%d"%i + for i_aux, face in enumerate(disques[:4]): + name = "disk{}".format(i_aux) disks.append(meshFondFiss.GroupOnGeom(face, name, SMESH.FACE)) _ = meshFondFiss.GetMesh().UnionListOfGroups( disks, 'PEAUEXT' ) @@ -95,10 +96,10 @@ def insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCercl groups_demiCercles = list() groupnodes_demiCercles = list() - for i, group in enumerate(groupsDemiCerclesPipe): - name = "Cercle%d"%i + for i_aux, group in enumerate(groupsDemiCerclesPipe): + name = "Cercle{}".format(i_aux) groups_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.EDGE)) - name = "nCercle%d"%i + name = "nCercle{}".format(i_aux) groupnodes_demiCercles.append(meshFondFiss.GroupOnGeom(group, name, SMESH.NODE)) group_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.EDGE) groupnode_generFiss = meshFondFiss.GroupOnGeom(groupGenerFiss, "GenFiss", SMESH.NODE) @@ -134,12 +135,12 @@ def insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCercl minDist = 100000 minCoord = None imin = -1 - for i, edge in enumerate(demiCerclesPeau): + for i_aux, edge in enumerate(demiCerclesPeau): discoord = geompy.MinDistanceComponents(vertex, edge) if discoord[0] = 0 and minDist > 1.E-6: logging.debug("node id moved : %s distance=%s", idNode, minDist) meshFondFiss.MoveNode(idNode, coordMesh[0] + minCoord[0], coordMesh[1] + minCoord[1], coordMesh[2] + minCoord[2]) diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_d.py b/src/Tools/blocFissure/gmu/insereFissureLongue_d.py index 35a63dd72..a6eb1c479 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_d.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_d.py @@ -33,7 +33,7 @@ from .putName import putName def insereFissureLongue_d (facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibres, \ groupsDemiCerclesPeau, groups_demiCercles, verticesOutCercles, \ nbSegGenLong, nbSegGenBout, profondeur, \ - mailleur="MeshGems"): + mailleur="MeshGems", nro_cas=-1): """maillage face de peau""" logging.info('start') @@ -55,9 +55,9 @@ def insereFissureLongue_d (facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibr hypo2d.SetFineness( 2 ) hypo2d.SetMinSize( 2 ) hypo2d.SetQuadAllowed( 0 ) - putName(algo2d.GetSubMesh(), "facePeau") - putName(algo2d, "algo2d_facePeau") - putName(hypo2d, "hypo2d_facePeau") + putName(algo2d.GetSubMesh(), "facePeau", i_pref=nro_cas) + putName(algo2d, "algo2d_facePeau", i_pref=nro_cas) + putName(hypo2d, "hypo2d_facePeau", i_pref=nro_cas) # lenEdgePeauFiss = geompy.BasicProperties(edgePeauFiss)[0] frac = profondeur/lenEdgePeauFiss @@ -70,22 +70,22 @@ def insereFissureLongue_d (facePeau, edgePeauFiss, groupEdgesBordPeau, bordsLibr hypo1d.SetDistrType( 2 ) hypo1d.SetConversionMode( 1 ) hypo1d.SetTableFunction( [ 0, ratio, frac, 1, (1.-frac), 1, 1, ratio ] ) - putName(algo1d.GetSubMesh(), "edgePeauFiss") - putName(algo1d, "algo1d_edgePeauFiss") - putName(hypo1d, "hypo1d_edgePeauFiss") + putName(algo1d.GetSubMesh(), "edgePeauFiss", i_pref=nro_cas) + putName(algo1d, "algo1d_edgePeauFiss", i_pref=nro_cas) + putName(hypo1d, "hypo1d_edgePeauFiss", i_pref=nro_cas) # algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) - putName(algo1d.GetSubMesh(), "bordsLibres") - putName(algo1d, "algo1d_bordsLibres") - putName(hypo1d, "hypo1d_bordsLibres") + putName(algo1d.GetSubMesh(), "bordsLibres", i_pref=nro_cas) + putName(algo1d, "algo1d_bordsLibres", i_pref=nro_cas) + putName(hypo1d, "hypo1d_bordsLibres", i_pref=nro_cas) # - for i in range(2): - algo1d = meshFacePeau.UseExisting1DElements(geom=groupsDemiCerclesPeau[i]) - hypo1d = algo1d.SourceEdges([ groups_demiCercles[i] ],0,0) - putName(algo1d.GetSubMesh(), "DemiCercles", i) - putName(algo1d, "algo1d_groupDemiCercles", i) - putName(hypo1d, "hypo1d_groupDemiCercles", i) + for i_aux in range(2): + algo1d = meshFacePeau.UseExisting1DElements(geom=groupsDemiCerclesPeau[i_aux]) + hypo1d = algo1d.SourceEdges([ groups_demiCercles[i_aux] ],0,0) + putName(algo1d.GetSubMesh(), "DemiCercles", i_aux, nro_cas) + putName(algo1d, "algo1d_groupDemiCercles", i_aux, nro_cas) + putName(hypo1d, "hypo1d_groupDemiCercles", i_aux, nro_cas) _ = meshFacePeau.GroupOnGeom(verticesOutCercles[0], "THOR", SMESH.NODE) _ = meshFacePeau.GroupOnGeom(verticesOutCercles[1], "THEX", SMESH.NODE) diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_e.py b/src/Tools/blocFissure/gmu/insereFissureLongue_e.py index b0e81dba7..efad610b5 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_e.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_e.py @@ -32,7 +32,7 @@ from .putName import putName def insereFissureLongue_e (faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_generFiss, groupEdgesFaceFissPipe, \ profondeur, rayonPipe, \ - mailleur="MeshGems"): + mailleur="MeshGems", nro_cas=-1): """maillage face de fissure""" logging.info('start') @@ -55,21 +55,21 @@ def insereFissureLongue_e (faceFiss, edgePeauFiss, groupEdgesPeauFiss, group_gen hypo2d.SetFineness( 2 ) hypo2d.SetMinSize( 2 ) hypo2d.SetQuadAllowed( 0 ) - putName(algo2d.GetSubMesh(), "faceFiss") - putName(algo2d, "algo2d_faceFiss") - putName(hypo2d, "hypo2d_faceFiss") + putName(algo2d.GetSubMesh(), "faceFiss", i_pref=nro_cas) + putName(algo2d, "algo2d_faceFiss", i_pref=nro_cas) + putName(hypo2d, "hypo2d_faceFiss", i_pref=nro_cas) # algo1d = meshFaceFiss.UseExisting1DElements(geom=edgePeauFiss) hypo1d = algo1d.SourceEdges([ groupEdgesPeauFiss ],0,0) - putName(algo1d.GetSubMesh(), "edgeFissPeau") - putName(algo1d, "algo1d_edgeFissPeau") - putName(hypo1d, "hypo1d_edgeFissPeau") + putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas) + putName(algo1d, "algo1d_edgeFissPeau", i_pref=nro_cas) + putName(hypo1d, "hypo1d_edgeFissPeau", i_pref=nro_cas) # algo1d = meshFaceFiss.UseExisting1DElements(geom=groupEdgesFaceFissPipe) hypo1d = algo1d.SourceEdges([ group_generFiss ],0,0) - putName(algo1d.GetSubMesh(), "edgeFissPeau") - putName(algo1d, "algo1d_edgeFissPeau") - putName(hypo1d, "hypo1d_edgeFissPeau") + putName(algo1d.GetSubMesh(), "edgeFissPeau", i_pref=nro_cas) + putName(algo1d, "algo1d_edgeFissPeau", i_pref=nro_cas) + putName(hypo1d, "hypo1d_edgeFissPeau", i_pref=nro_cas) _ = meshFaceFiss.GroupOnGeom(faceFiss, "fisOutPi", SMESH.FACE) diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_f.py b/src/Tools/blocFissure/gmu/insereFissureLongue_f.py index 8804e9ca3..24891a032 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_f.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_f.py @@ -30,7 +30,7 @@ from .geomsmesh import smesh from .putName import putName def insereFissureLongue_f (internalBoundary, meshFondFiss, meshFacePeau, meshFaceFiss, \ - mailleur="MeshGems"): + mailleur="MeshGems", nro_cas=-1): """maillage meshBoiteDefaut""" logging.info('start') logging.info("insereFissureLongue_f (%s)", mailleur) @@ -39,7 +39,7 @@ def insereFissureLongue_f (internalBoundary, meshFondFiss, meshFacePeau, meshFac meshFondFiss.GetMesh(), \ meshFacePeau.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 # on designe les faces de peau en quadrangles par le groupe "skinFaces" group_faceFissOutPipe = None @@ -65,9 +65,9 @@ def insereFissureLongue_f (internalBoundary, meshFondFiss, meshFacePeau, meshFac hypo3d.SetVerboseLevel( 0 ) hypo3d.SetStandardOutputLog( 0 ) hypo3d.SetRemoveLogOnSuccess( 1 ) - putName(algo3d.GetSubMesh(), "boiteDefaut") - putName(algo3d, "algo3d_boiteDefaut") - putName(meshBoiteDefaut, "boiteDefaut") + putName(algo3d.GetSubMesh(), "boiteDefaut", i_pref=nro_cas) + putName(algo3d, "algo3d_boiteDefaut", i_pref=nro_cas) + putName(meshBoiteDefaut, "boiteDefaut", i_pref=nro_cas) is_done = meshBoiteDefaut.Compute() text = "meshBoiteDefaut.Compute" diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue_g.py b/src/Tools/blocFissure/gmu/insereFissureLongue_g.py index dfd98627f..7e9aabdf9 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue_g.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue_g.py @@ -37,7 +37,8 @@ from .triedreBase import triedreBase def insereFissureLongue_g(nomFicFissure, fichierMaillageFissure, nomFicSain, maillageSain, \ meshBoiteDefaut, facePorteFissure, \ group_faceFissInPipe, group_faceFissOutPipe, \ - zoneDefaut, zoneDefaut_skin, zoneDefaut_internalEdges, zoneDefaut_internalFaces): + zoneDefaut, zoneDefaut_skin, zoneDefaut_internalEdges, zoneDefaut_internalFaces, \ + nro_cas=-1): """Les groupes de la fissure longue""" logging.info('start') @@ -52,7 +53,7 @@ def insereFissureLongue_g(nomFicFissure, fichierMaillageFissure, nomFicSain, mai _ = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' ) maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges) - putName(maillageSain, nomFicSain+"_coupe") + putName(maillageSain, nomFicSain+"_coupe", i_pref=nro_cas) extrusionFaceFissure, normfiss = shapeSurFissure(facePorteFissure) maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut, extrusionFaceFissure, facePorteFissure, 'COUDE')