Salome HOME
Update copyrights
[modules/smesh.git] / src / Tools / blocFissure / gmu / construitFissureGenerale.py
index d4936d0ae5f303e9353a062ca547cc39bdf31616..db28c88c30968cd0a85105e7d5cf020fb9d573cf 100644 (file)
@@ -1,14 +1,36 @@
 # -*- coding: utf-8 -*-
+# Copyright (C) 2014-2019  CEA/DEN, 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
 
 import logging
 import salome
-from geomsmesh import geompy
+from .geomsmesh import geompy
+from .geomsmesh import geomPublish
+from .geomsmesh import geomPublishInFather
+from . import initLog
 import GEOM
-from geomsmesh import smesh
+from .geomsmesh import smesh
 from salome.smesh import smeshBuilder
 import SMESH
 import math
 import bisect
+import traceback
 
 # from extractionOrientee import extractionOrientee
 # from extractionOrienteeMulti import extractionOrienteeMulti
@@ -19,35 +41,36 @@ import bisect
 # from produitMixte import produitMixte
 # from findWireEndVertices import findWireEndVertices
 #from findWireIntermediateVertices import findWireIntermediateVertices
-from orderEdgesFromWire import orderEdgesFromWire
+from .orderEdgesFromWire import orderEdgesFromWire
 # from getSubshapeIds import getSubshapeIds
-from putName import putName
+from .putName import putName
 # from distance2 import distance2
-from enleveDefaut import enleveDefaut
-from shapeSurFissure import shapeSurFissure
-from regroupeSainEtDefaut import RegroupeSainEtDefaut
-from triedreBase import triedreBase
+from .enleveDefaut import enleveDefaut
+from .shapeSurFissure import shapeSurFissure
+from .regroupeSainEtDefaut import RegroupeSainEtDefaut
+from .triedreBase import triedreBase
 # from checkDecoupePartition import checkDecoupePartition
 # from whichSide import whichSide
 # from whichSideMulti import whichSideMulti
 #from whichSideVertex import whichSideVertex
 #from projettePointSurCourbe import projettePointSurCourbe
 # from prolongeWire import prolongeWire
-from restreintFaceFissure import restreintFaceFissure
-from partitionneFissureParPipe import partitionneFissureParPipe
-from construitPartitionsPeauFissure import construitPartitionsPeauFissure
-from compoundFromList import compoundFromList
-from identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
-from identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
-from calculePointsAxiauxPipe import calculePointsAxiauxPipe
-from elimineExtremitesPipe import elimineExtremitesPipe
-from construitEdgesRadialesDebouchantes import construitEdgesRadialesDebouchantes
-from creePointsPipePeau import creePointsPipePeau
-from ajustePointsEdgePipeFissure import ajustePointsEdgePipeFissure
-from construitMaillagePipe import construitMaillagePipe
-from mailleAretesEtJonction import mailleAretesEtJonction
-from mailleFacesFissure import mailleFacesFissure
-from mailleFacesPeau import mailleFacesPeau
+from .restreintFaceFissure import restreintFaceFissure
+from .partitionneFissureParPipe import partitionneFissureParPipe
+from .construitPartitionsPeauFissure import construitPartitionsPeauFissure
+from .compoundFromList import compoundFromList
+from .identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
+from .identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
+from .calculePointsAxiauxPipe import calculePointsAxiauxPipe
+from .elimineExtremitesPipe import elimineExtremitesPipe
+from .construitEdgesRadialesDebouchantes import construitEdgesRadialesDebouchantes
+from .creePointsPipePeau import creePointsPipePeau
+from .ajustePointsEdgePipeFissure import ajustePointsEdgePipeFissure
+from .construitMaillagePipe import construitMaillagePipe
+from .mailleAretesEtJonction import mailleAretesEtJonction
+from .mailleFacesFissure import mailleFacesFissure
+from .mailleFacesPeau import mailleFacesPeau
+from .fissError import fissError
 
 # -----------------------------------------------------------------------------
 # --- procédure complète fissure générale
@@ -64,7 +87,7 @@ def construitFissureGenerale(maillagesSains,
   fondFiss          = shapesFissure[4] # groupe d'edges de fond de fissure
 
   rayonPipe = shapeFissureParams['rayonPipe']
-  if shapeFissureParams.has_key('lenSegPipe'):
+  if 'lenSegPipe' in shapeFissureParams:
     lenSegPipe = shapeFissureParams['lenSegPipe']
   else:
     lenSegPipe = rayonPipe
@@ -76,18 +99,21 @@ def construitFissureGenerale(maillagesSains,
   nbsegRad          = maillageFissureParams['nbsegRad']      # nombre de couches selon un rayon du pipe
   nbsegCercle       = maillageFissureParams['nbsegCercle']   # nombre de secteur dans un cercle du pipe
   areteFaceFissure  = maillageFissureParams['areteFaceFissure']
+  lgAretesVives     = 0
+  if 'aretesVives' in maillageFissureParams:
+    lgAretesVives   = maillageFissureParams['aretesVives']
 
   pointIn_x = 0.0
   pointIn_y = 0.0
   pointIn_z = 0.0
   isPointInterne = False
-  if shapeFissureParams.has_key('pointIn_x'):
+  if 'pointIn_x' in shapeFissureParams:
     pointIn_x = shapeFissureParams['pointIn_x']
     isPointInterne = True
-  if shapeFissureParams.has_key('pointIn_y'):
+  if 'pointIn_y' in shapeFissureParams:
     pointIn_y = shapeFissureParams['pointIn_y']
     isPointInterne = True
-  if shapeFissureParams.has_key('pointIn_z'):
+  if 'pointIn_z' in shapeFissureParams:
     pointIn_z = shapeFissureParams['pointIn_z']
     isPointInterne = True
   if isPointInterne:
@@ -116,6 +142,9 @@ def construitFissureGenerale(maillagesSains,
   #edgeFondExt              = elementsDefaut[14]
   centreFondFiss           = elementsDefaut[15]
   #tgtCentre                = elementsDefaut[16]
+  if lgAretesVives == 0:
+     lgAretesVives = dmoyen
+
 
   O, OX, OY, OZ = triedreBase()
 
@@ -130,7 +159,7 @@ def construitFissureGenerale(maillagesSains,
   (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) = partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe)
   edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
   for i,edge in enumerate(edgesFondFiss):
-    geompy.addToStudyInFather(wireFondFiss, edge, "edgeFondFiss%d"%i)
+    geomPublishInFather(initLog.debug, wireFondFiss, edge, "edgeFondFiss%d"%i)
   
   # --- peau et face de fissure
   #
@@ -195,7 +224,7 @@ def construitFissureGenerale(maillagesSains,
   
   for i, avc in enumerate(aretesVivesCoupees):
     name = "areteViveCoupee%d"%i
-    geompy.addToStudy(avc, name)
+    geomPublish(initLog.debug, avc, name)
   
   # --- identification des faces et edges de fissure externe pour maillage
   
@@ -241,7 +270,7 @@ def construitFissureGenerale(maillagesSains,
   
   # --- edges de bord, faces défaut à respecter
   
-  (internalBoundary, bordsLibres, grpAretesVives) = mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, dmoyen)
+  (internalBoundary, bordsLibres, grpAretesVives) = mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives)
 
   # --- maillage faces de fissure
   
@@ -317,12 +346,12 @@ def construitFissureGenerale(maillagesSains,
   fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
 
   logging.info("export maillage fini")
-  maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 )
+  maillageComplet.ExportMED(fichierMaillageFissure)
   putName(maillageComplet, nomFicFissure)
   logging.info("fichier maillage fissure %s", fichierMaillageFissure)
 
   if salome.sg.hasDesktop():
-    salome.sg.updateObjBrowser(1)
+    salome.sg.updateObjBrowser()
 
   logging.info("maillage fissure fini")