Salome HOME
[bos #40653][CEA] New mesh import export formats with meshio.
[modules/smesh.git] / src / SMESH_SWIG / smesh_algorithm.py
index 768900eb095d40505b18f372283278b85b1a6556..934b1235cbdb3813cc495dbe9e1bba226d9d0a57 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -350,7 +350,10 @@ class Mesh_Algorithm:
                   from SHAPERSTUDY_utils import getEngine
                   gen = getEngine()
                   if gen:
-                    faceIDs = gen.GetIShapesOperations().GetAllSubShapesIDs(shape, self.mesh.geompyD.ShapeType["FACE"], False)
+                    aShapeOp = gen.GetIShapesOperations()
+                    ff = aShapeOp.ExtractSubShapes( shape, self.mesh.geompyD.ShapeType["FACE"], False)
+                    for f in ff:
+                      faceIDs.append( aShapeOp.GetSubShapeIndex( self.mesh.geom, f ))
             faces = faceIDs
         hyp = self.Hypothesis("ViscousLayers",
                               [thickness, numberOfLayers, stretchFactor, faces, isFacesToIgnore],
@@ -369,7 +372,7 @@ class Mesh_Algorithm:
         """
         Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral
         elements to build near mesh boundary. This hypothesis can be used by several 2D algorithms:
-        NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MEFISTO, MG-CADSurf
+        NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MG-CADSurf
 
         Parameters:
                 thickness: total thickness of layers of quadrilaterals
@@ -410,7 +413,10 @@ class Mesh_Algorithm:
                 from SHAPERSTUDY_utils import getEngine
                 gen = getEngine()
                 if gen:
-                  edgeIDs = gen.GetIShapesOperations().GetAllSubShapesIDs(shape, self.mesh.geompyD.ShapeType["EDGE"], False)
+                  aShapeOp = gen.GetIShapesOperations()
+                  ee = aShapeOp.ExtractSubShapes( shape, self.mesh.geompyD.ShapeType["EDGE"], False)
+                  for e in ee:
+                    edgeIDs.append( aShapeOp.GetSubShapeIndex( self.mesh.geom, e ))
             edges = edgeIDs
         hyp = self.Hypothesis("ViscousLayers2D",
                               [thickness, numberOfLayers, stretchFactor, edges, isEdgesToIgnore],
@@ -434,6 +440,18 @@ class Mesh_Algorithm:
         for i in reverseList:
             if isinstance( i, int ):
                 s = geompy.GetSubShape(self.mesh.geom, [i])
+
+                #bos #20082 begin:
+                if s is None and type(self.geom) != geomBuilder.GEOM._objref_GEOM_Object:
+                    # try to get the SHAPERSTUDY engine directly, as GetGen does not work because of
+                    # simplification of access in geomBuilder: omniORB.registerObjref
+                    from SHAPERSTUDY_utils import getEngine
+                    gen = getEngine()
+                    if gen:
+                        aShapeOp = gen.GetIShapesOperations()
+                        s = aShapeOp.GetSubShape(self.mesh.geom, i)
+                #bos #20082 end
+
                 if s.GetShapeType() != geomBuilder.GEOM.EDGE:
                     raise TypeError("Not EDGE index given")
                 resList.append( i )