]> SALOME platform Git repositories - plugins/hexoticplugin.git/blobdiff - src/HexoticPlugin/HexoticPLUGINBuilder.py
Salome HOME
0023102: [CEA 1486 ] Add the parameters for defining the boundary layers (edited)
[plugins/hexoticplugin.git] / src / HexoticPlugin / HexoticPLUGINBuilder.py
index d8e034a7f921ec5b4d51f5ee83426af0696d1f93..bd59371a7d378723ea82c7ddd38b2ee57d87fa5b 100644 (file)
@@ -23,6 +23,7 @@
 
 from salome.smesh.smesh_algorithm import Mesh_Algorithm
 from salome.smesh.smeshBuilder import AssureGeomPublished
+from salome.geom import geomBuilder
 
 # import HexoticPlugin module if possible
 noHexoticPlugin = 0
@@ -59,6 +60,11 @@ class Hexotic_Algorithm(Mesh_Algorithm):
     #  @internal
     docHelper  = "Creates hexahedron 3D algorithm for volumes"
 
+    ## Direction of viscous layers
+    #  @internal
+    Inward = True
+    Outward = False
+
     ## Private constructor.
     #  @param mesh parent mesh object algorithm is assigned to
     #  @param geom geometry (shape/sub-shape) algorithm is assigned to;
@@ -130,14 +136,30 @@ class Hexotic_Algorithm(Mesh_Algorithm):
     #         boundary layers
     #  @return hypothesis object
     def SetViscousLayers(self, numberOfLayers, firstLayerSize, growth, 
-                          direction="Inward", facesWithLayers=[], imprintedFaces=[]): 
+                          direction=Inward, facesWithLayers=[], imprintedFaces=[]): 
         self.Parameters().SetNbLayers(numberOfLayers)
         self.Parameters().SetFirstLayerSize(firstLayerSize)
         self.Parameters().SetGrowth(growth)
-        if direction == "Inward":
-          self.Parameters().SetDirection(True)
-        elif direction == "Outward":
-          self.Parameters().SetDirection(False)
+        self.Parameters().SetDirection(direction)
+        if facesWithLayers and isinstance( facesWithLayers[0], geomBuilder.GEOM._objref_GEOM_Object ):
+          import GEOM
+          facesWithLayersIDs = []
+          for f in facesWithLayers:
+            if self.mesh.geompyD.ShapeIdToType( f.GetType() ) == "GROUP":
+              facesWithLayersIDs += f.GetSubShapeIndices()
+            else:
+              facesWithLayersIDs += [self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f)]
+          facesWithLayers = facesWithLayersIDs
+          
+        if imprintedFaces and isinstance( imprintedFaces[0], geomBuilder.GEOM._objref_GEOM_Object ):
+          import GEOM
+          imprintedFacesIDs = []
+          for f in imprintedFaces:
+            if self.mesh.geompyD.ShapeIdToType( f.GetType() ) == "GROUP":
+              imprintedFacesIDs += f.GetSubShapeIndices()
+            else:
+              imprintedFacesIDs += [self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f)]
+          imprintedFaces = imprintedFacesIDs
         self.Parameters().SetFacesWithLayers(facesWithLayers)
         self.Parameters().SetImprintedFaces(imprintedFaces)