Salome HOME
Amélioration du ptyhon
[modules/smesh.git] / src / Tools / blocFissure / gmu / casStandard.py
index 2b9ef26e842598702c01cff2164889612222eaf7..ecce716728f4998384ee8e3719830b0cf2a71e84 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (C) 2014-2020  EDF R&D
+# Copyright (C) 2014-2021  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 """Cas standard"""
 
 import os
-from .geomsmesh import geompy, smesh
-from .geomsmesh import geomPublish
-from .geomsmesh import geomPublishInFather
-from . import initLog
+import logging
 
-import math
 import GEOM
 import SALOMEDS
 import SMESH
-import logging
+
+from .geomsmesh import geompy, smesh
+from .geomsmesh import geomPublish
+from .geomsmesh import geomPublishInFather
+
+from . import initLog
 
 from .fissureGenerique import fissureGenerique
 
@@ -88,7 +89,7 @@ class casStandard(fissureGenerique):
   def genereMaillageSain(self, geometriesSaines, meshParams):
     logging.info("genereMaillageSain %s", self.nomCas)
 
-    ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
+    ([objetSain], _) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
     smesh.SetName(objetSain.GetMesh(), 'objetSain')
 
     return [objetSain, True] # True : maillage hexa
@@ -116,32 +117,39 @@ class casStandard(fissureGenerique):
                                      lenSegPipe  = self.lenSegPipe)
 
   # ---------------------------------------------------------------------------
-  def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
-    logging.info("genereShapeFissure %s", self.nomCas)
+  def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams, \
+                                mailleur="MeshGems"):
 
     lgInfluence = shapeFissureParams['lgInfluence']
 
-    cao_file = self.dicoParams['brepFaceFissure']
+#   Contrôle de 'brepFaceFissure' pour les anciennes versions
+    if ( 'brepFaceFissure' in self.dicoParams ):
+      self.dicoParams['CAOFaceFissure'] = self.dicoParams['brepFaceFissure']
+    cao_file = self.dicoParams['CAOFaceFissure']
     suffix = os.path.basename(cao_file).split(".")[-1]
     if ( suffix.upper() == "BREP" ):
       shellFiss = geompy.ImportBREP(cao_file)
     elif ( suffix.upper() == "XAO" ):
       (_, shellFiss, _, l_groups, _) = geompy.ImportXAO(cao_file)
     fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
-    if isinstance(self.dicoParams['edgeFissIds'][0],int):
-      geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
+#   Contrôle de 'edgeFissIds' pour les anciennes versions
+    if ( 'edgeFissIds' in self.dicoParams ):
+      self.dicoParams['edgeFiss'] = self.dicoParams['edgeFissIds']
+    if isinstance(self.dicoParams['edgeFiss'][0],int):
+      geompy.UnionIDs(fondFiss, self.dicoParams['edgeFiss'] )
     else:
       l_groups = geompy.GetGroups(shellFiss)
       l_aux = list()
       for group in l_groups:
-        if ( group.GetName() in self.dicoParams['edgeFissIds'] ):
+        if ( group.GetName() in self.dicoParams['edgeFiss'] ):
           l_aux.append(group)
       geompy.UnionList(fondFiss, l_aux )
     geomPublish(initLog.debug, shellFiss, 'shellFiss' )
     geomPublishInFather(initLog.debug, shellFiss, fondFiss, 'fondFiss' )
 
 
-    coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
+    coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1], \
+                                                     mailleur)
 
     centre = None
     return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
@@ -162,12 +170,13 @@ class casStandard(fissureGenerique):
     return elementsDefaut
 
   # ---------------------------------------------------------------------------
-  def genereMaillageFissure(self, geometriesSaines, maillagesSains,
-                            shapesFissure, shapeFissureParams,
-                            maillageFissureParams, elementsDefaut, step):
-    maillageFissure = construitFissureGenerale(maillagesSains, \
-                                              shapesFissure, shapeFissureParams, \
-                                              maillageFissureParams, elementsDefaut, step)
+  def genereMaillageFissure(self, geometriesSaines, maillagesSains, \
+                                  shapesFissure, shapeFissureParams, \
+                                  maillageFissureParams, elementsDefaut, step, \
+                                  mailleur="MeshGems"):
+    maillageFissure = construitFissureGenerale(shapesFissure, shapeFissureParams, \
+                                               maillageFissureParams, elementsDefaut, \
+                                               step, mailleur, self.numeroCas)
     return maillageFissure
 
   # ---------------------------------------------------------------------------