From 045cedf24f735d1f8ce34c0c88c7cbb54969d02a Mon Sep 17 00:00:00 2001 From: GERALD NICOLAS Date: Mon, 29 Mar 2021 18:13:22 +0200 Subject: [PATCH] =?utf8?q?Ajout=20d'un=20pr=C3=A9fix=20aux=20noms=20des=20?= =?utf8?q?objets=20SMESH=20-=20d=C3=A9but?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/Tools/blocFissure/CasTests/cubeAngle.py | 2 +- src/Tools/blocFissure/CasTests/cylindre.py | 2 +- src/Tools/blocFissure/CasTests/ellipse_1.py | 2 +- .../blocFissure/CasTests/eprouvetteCourbe.py | 2 +- .../blocFissure/CasTests/eprouvetteDroite.py | 2 +- src/Tools/blocFissure/CasTests/faceGauche.py | 2 +- .../blocFissure/CasTests/faceGauche_2.py | 2 +- src/Tools/blocFissure/CasTests/tube.py | 2 +- src/Tools/blocFissure/CasTests/vis_1.py | 2 +- .../gmu/construitFissureGenerale.py | 5 ++- src/Tools/blocFissure/gmu/fissureCoude.py | 2 +- src/Tools/blocFissure/gmu/mailleFacesPeau.py | 40 +++++++++---------- src/Tools/blocFissure/gmu/putName.py | 16 ++++++-- 13 files changed, 45 insertions(+), 36 deletions(-) diff --git a/src/Tools/blocFissure/CasTests/cubeAngle.py b/src/Tools/blocFissure/CasTests/cubeAngle.py index 236b7ea46..ba5392e5a 100644 --- a/src/Tools/blocFissure/CasTests/cubeAngle.py +++ b/src/Tools/blocFissure/CasTests/cubeAngle.py @@ -113,7 +113,7 @@ class cubeAngle(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/cylindre.py b/src/Tools/blocFissure/CasTests/cylindre.py index 4da916166..2e01fb91b 100644 --- a/src/Tools/blocFissure/CasTests/cylindre.py +++ b/src/Tools/blocFissure/CasTests/cylindre.py @@ -108,7 +108,7 @@ class cylindre(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/ellipse_1.py b/src/Tools/blocFissure/CasTests/ellipse_1.py index 7ca10b8c1..08c8187db 100644 --- a/src/Tools/blocFissure/CasTests/ellipse_1.py +++ b/src/Tools/blocFissure/CasTests/ellipse_1.py @@ -122,7 +122,7 @@ class ellipse_1(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py b/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py index d3110d863..30e0a2ac7 100644 --- a/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py +++ b/src/Tools/blocFissure/CasTests/eprouvetteCourbe.py @@ -116,7 +116,7 @@ class eprouvetteCourbe(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/eprouvetteDroite.py b/src/Tools/blocFissure/CasTests/eprouvetteDroite.py index 8122f01a9..150dc5c62 100644 --- a/src/Tools/blocFissure/CasTests/eprouvetteDroite.py +++ b/src/Tools/blocFissure/CasTests/eprouvetteDroite.py @@ -113,7 +113,7 @@ class eprouvetteDroite(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/faceGauche.py b/src/Tools/blocFissure/CasTests/faceGauche.py index 1427d943c..739f74eb1 100644 --- a/src/Tools/blocFissure/CasTests/faceGauche.py +++ b/src/Tools/blocFissure/CasTests/faceGauche.py @@ -111,7 +111,7 @@ class faceGauche(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/faceGauche_2.py b/src/Tools/blocFissure/CasTests/faceGauche_2.py index e3863efc5..f624f8764 100644 --- a/src/Tools/blocFissure/CasTests/faceGauche_2.py +++ b/src/Tools/blocFissure/CasTests/faceGauche_2.py @@ -113,7 +113,7 @@ class faceGauche_2(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/tube.py b/src/Tools/blocFissure/CasTests/tube.py index 3653c9ac3..c579b384d 100644 --- a/src/Tools/blocFissure/CasTests/tube.py +++ b/src/Tools/blocFissure/CasTests/tube.py @@ -118,7 +118,7 @@ class tube(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/CasTests/vis_1.py b/src/Tools/blocFissure/CasTests/vis_1.py index f7b07a0b5..b1f2dde7c 100644 --- a/src/Tools/blocFissure/CasTests/vis_1.py +++ b/src/Tools/blocFissure/CasTests/vis_1.py @@ -119,7 +119,7 @@ class vis_1(fissureGenerique): mailleur = self.mailleur2d3d() maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/gmu/construitFissureGenerale.py b/src/Tools/blocFissure/gmu/construitFissureGenerale.py index c1f46c8fd..feed23ef9 100644 --- a/src/Tools/blocFissure/gmu/construitFissureGenerale.py +++ b/src/Tools/blocFissure/gmu/construitFissureGenerale.py @@ -53,10 +53,11 @@ from .construitFissureGenerale_c import construitFissureGenerale_c def construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step=-1, mailleur="MeshGems"): + step=-1, mailleur="MeshGems", nro_cas=-1): """procédure complète fissure générale""" logging.info('start') logging.info("Usage du mailleur %s", mailleur) + logging.info("pour le cas %d", nro_cas) shapeDefaut = shapesFissure[0] # faces de fissure, débordant @@ -195,7 +196,7 @@ def construitFissureGenerale(shapesFissure, shapeFissureParams, \ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives, \ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad, \ - mailleur) + mailleur, nro_cas) # --- regroupement des maillages du défaut diff --git a/src/Tools/blocFissure/gmu/fissureCoude.py b/src/Tools/blocFissure/gmu/fissureCoude.py index ac6d17b68..1eed55827 100644 --- a/src/Tools/blocFissure/gmu/fissureCoude.py +++ b/src/Tools/blocFissure/gmu/fissureCoude.py @@ -684,7 +684,7 @@ class fissureCoude(fissureGenerique): mailleur="MeshGems"): maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \ maillageFissureParams, elementsDefaut, \ - step, mailleur) + step, mailleur, self.numeroCas) return maillageFissure # --------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/gmu/mailleFacesPeau.py b/src/Tools/blocFissure/gmu/mailleFacesPeau.py index 949218f07..0839e3573 100644 --- a/src/Tools/blocFissure/gmu/mailleFacesPeau.py +++ b/src/Tools/blocFissure/gmu/mailleFacesPeau.py @@ -36,10 +36,10 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, \ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives, \ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad, \ - mailleur="MeshGems"): + mailleur="MeshGems", nro_cas=-1): """maillage faces de peau""" logging.info('start') - logging.info(mailleur) + logging.info(mailleur+" pour le cas n° %d"%nro_cas) nbFacesFilling = len(partitionsPeauFissFond) boutFromIfil = [None for i in range(nbFacesFilling)] if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes @@ -65,9 +65,9 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) - putName(algo1d.GetSubMesh(), "bordsLibres", ifil) - putName(algo1d, "algo1d_bordsLibres", ifil) - putName(hypo1d, "hypo1d_bordsLibres", ifil) + putName(algo1d.GetSubMesh(), "bordsLibres", ifil, nro_cas) + putName(algo1d, "algo1d_bordsLibres", ifil, nro_cas) + putName(hypo1d, "hypo1d_bordsLibres", ifil, nro_cas) else: @@ -84,23 +84,23 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau) hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0) - putName(algo1d.GetSubMesh(), "bordsLibres", ifil) - putName(algo1d, "algo1d_bordsLibres", ifil) - putName(hypo1d, "hypo1d_bordsLibres", ifil) + putName(algo1d.GetSubMesh(), "bordsLibres", ifil, nro_cas) + putName(algo1d, "algo1d_bordsLibres", ifil, nro_cas) + putName(hypo1d, "hypo1d_bordsLibres", ifil, nro_cas) logging.info("b") algo1d = meshFacePeau.UseExisting1DElements(geom=geompy.MakeCompound(edgesFissurePeau)) hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0) - putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil) - putName(algo1d, "algo1d_edgePeauFiss", ifil) - putName(hypo1d, "hypo1d_edgePeauFiss", ifil) + putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil, nro_cas) + putName(algo1d, "algo1d_edgePeauFiss", ifil, nro_cas) + putName(hypo1d, "hypo1d_edgePeauFiss", ifil, nro_cas) if bordsVifs is not None: algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs) hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0) - putName(algo1d.GetSubMesh(), "bordsVifs", ifil) - putName(algo1d, "algo1d_bordsVifs", ifil) - putName(hypo1d, "hypo1d_bordsVifs", ifil) + putName(algo1d.GetSubMesh(), "bordsVifs", ifil, nro_cas) + putName(algo1d, "algo1d_bordsVifs", ifil, nro_cas) + putName(hypo1d, "hypo1d_bordsVifs", ifil, nro_cas) for i, edgeCirc in enumerate(edgesCircPeau): logging.info("i = {}".format(i)) @@ -111,9 +111,9 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ else: hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0) name = "cercle%d"%i - putName(algo1d.GetSubMesh(), name, ifil) - putName(algo1d, "algo1d_" + name, ifil) - putName(hypo1d, "hypo1d_" + name, ifil) + putName(algo1d.GetSubMesh(), name, ifil, nro_cas) + putName(algo1d, "algo1d_" + name, ifil, nro_cas) + putName(hypo1d, "hypo1d_" + name, ifil, nro_cas) logging.info("c") logging.info("Maillage avec %s", mailleur) @@ -134,9 +134,9 @@ def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, \ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) ) hypo2d.SetQuadAllowed( 0 ) logging.info("d") - putName(algo2d.GetSubMesh(), "facePeau", ifil) - putName(algo2d, "algo2d_facePeau", ifil) - putName(hypo2d, "hypo2d_facePeau", ifil) + putName(algo2d.GetSubMesh(), "facePeau", ifil, nro_cas) + putName(algo2d, "algo2d_facePeau", ifil, nro_cas) + putName(hypo2d, "hypo2d_facePeau", ifil, nro_cas) is_done = meshFacePeau.Compute() text = "meshFacePeau {} .Compute".format(ifil) diff --git a/src/Tools/blocFissure/gmu/putName.py b/src/Tools/blocFissure/gmu/putName.py index ccc0a35b0..c7480fb8f 100644 --- a/src/Tools/blocFissure/gmu/putName.py +++ b/src/Tools/blocFissure/gmu/putName.py @@ -23,9 +23,17 @@ from .geomsmesh import smesh # ----------------------------------------------------------------------------- # --- nommage des objets mesh (algorithme, hypothèse, subMesh) -def putName(objmesh,name, i=-1): - if i >= 0: - suffix = "_%d"%i - name += suffix +def putName (objmesh, name, i_suff=-1, i_pref=-1): + + # suffixe éventuel : + if i_suff >= 0: + suffixe = "_{}".format(i_suff) + name += suffixe + + # préfixe éventuel : + if i_pref >= 0: + prefixe = "Cas{:02d}_".format(i_pref) + name = prefixe + name + smesh.SetName(objmesh, name) -- 2.39.2