Salome HOME
updated copyright message
[modules/smesh.git] / src / Tools / blocFissure / gmu / insereFissureLongue_c.py
index 9efc7523271cae750d60157090350ec8683ee57e..107c27372d78ea3df3cec3aba6d59a6871b1b619 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (C) 2014-2020  EDF R&D
+# Copyright (C) 2014-2023  EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,6 @@
 import logging
 import math
 
-import salome
 from salome.smesh import smeshBuilder
 import SMESH
 
@@ -37,38 +36,35 @@ def insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCercl
                            VerticesEndPipeFiss, verticesEdgePeauFiss, \
                            groupFaceFissInPipe, groupEdgeFondFiss, groupsDemiCerclesPipe, groupGenerFiss, \
                            profondeur, rayonPipe, \
-                           nro_cas=-1):
+                           nro_cas=None):
   """maillage pipe fond fissure"""
   logging.info('start')
-  logging.info("Maillage pour le cas n°%d", nro_cas)
+  logging.info("Maillage pour le cas n°%s", nro_cas)
 
   meshFondFiss = smesh.Mesh(pipeFondFiss)
   putName(meshFondFiss, "pipeFondFiss", i_pref=nro_cas)
 
-  algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.QUADRANGLE)
   algo3d = meshFondFiss.Prism()
-  putName(algo3d.GetSubMesh(), "pipe", i_pref=nro_cas)
-  putName(algo3d, "algo3d_pipe", i_pref=nro_cas)
-  putName(algo2d, "algo2d_pipe", i_pref=nro_cas)
+
+  algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.QUADRANGLE)
 
   for i_aux, face in enumerate(disques):
+    #print (i_aux)
+    # la commande suivante entraîne addToStudy() failed
     algo2d = meshFondFiss.Quadrangle(algo=smeshBuilder.RADIAL_QUAD,geom=face)
     putName(algo2d.GetSubMesh(), "disque", i_aux, nro_cas)
-    putName(algo2d, "algo2d_disque", i_aux, nro_cas)
 
   for i_aux, edge in enumerate(rayons):
     algo1d = meshFondFiss.Segment(geom=edge)
-    hypo1d = algo1d.NumberOfSegments(4)
     putName(algo1d.GetSubMesh(), "rayon", i_aux, nro_cas)
-    putName(algo1d, "algo1d_rayon", i_aux, nro_cas)
-    putName(hypo1d, "hypo1d_rayon", i_aux, nro_cas)
+    hypo1d = algo1d.NumberOfSegments(4)
+    putName(hypo1d, "rayon={}".format(4), i_aux, nro_cas)
 
   for i_aux, edge in enumerate(demiCercles):
     algo1d = meshFondFiss.Segment(geom=edge)
-    hypo1d = algo1d.NumberOfSegments(6)
     putName(algo1d.GetSubMesh(), "demiCercle", i_aux, nro_cas)
-    putName(algo1d, "algo1d_demiCercle", i_aux, nro_cas)
-    putName(hypo1d, "hypo1d_demiCercle", i_aux, nro_cas)
+    hypo1d = algo1d.NumberOfSegments(6)
+    putName(hypo1d, "demiCercle={}".format(6), 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
@@ -76,13 +72,13 @@ def insereFissureLongue_c (pipeFondFiss, disques, rayons, demiCercles, demiCercl
   logging.info("min %s, max %s, nombre de segments %s, nombre de generatrices %s", minlg, maxlg, nbSegGenLong, len(generSorted))
   for i_aux, edge in enumerate(generSorted):
     algo1d = meshFondFiss.Segment(geom=edge)
+    putName(algo1d.GetSubMesh(), "generatrice", i_aux, nro_cas)
     if i_aux < 6:
-      hypo1d = algo1d.NumberOfSegments(nbSegGenBout)
+      nbSeg = nbSegGenBout
     else:
-      hypo1d = algo1d.NumberOfSegments(nbSegGenLong)
-    putName(algo1d.GetSubMesh(), "generatrice", i_aux, nro_cas)
-    putName(algo1d, "algo1d_generatrice", i_aux, nro_cas)
-    putName(hypo1d, "hypo1d_generatrice", i_aux, nro_cas)
+      nbSeg = nbSegGenLong
+    hypo1d = algo1d.NumberOfSegments(nbSeg)
+    putName(hypo1d, "generatrice={}".format(nbSeg), i_aux, nro_cas)
 
   disks = list()
   for i_aux, face in enumerate(disques[:4]):