]> SALOME platform Git repositories - plugins/hexoticplugin.git/commitdiff
Salome HOME
0023102: [CEA 1486 ] Add the parameters for defining the boundary layers (edited)
authormpa <mpa@opencascade.com>
Wed, 24 Jun 2015 15:23:35 +0000 (18:23 +0300)
committermpa <mpa@opencascade.com>
Wed, 24 Jun 2015 15:23:35 +0000 (18:23 +0300)
doc/salome/examples/hexoticdemo_vl.py
src/HexoticPlugin/HexoticPLUGINBuilder.py
src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx

index bc2b4a213a3041f51ba42365be756fb7108f70e5..971060d92d58623f05c95b4f4d3fb39364441c3f 100644 (file)
@@ -42,7 +42,7 @@ MEFISTO_2D = Mesh_mghexa_vl.Triangle(algo=smeshBuilder.MEFISTO)
 
 MG_Hexa = Mesh_mghexa_vl.Hexahedron(algo=smeshBuilder.MG_Hexa)
 MG_Hexa_Parameters = MG_Hexa.Parameters()
-MG_Hexa.SetViscousLayers(5,5,3,"Inward",[13,23])
+MG_Hexa.SetViscousLayers(5,5,3,MG_Hexa.Inward,[13,23])
 MG_Hexa_Parameters.SetMinSize( 2 )
 MG_Hexa_Parameters.SetMaxSize( 4 )
 MG_Hexa_Parameters.SetHexesMinLevel( 2 )
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)
         
index ac0285fa3638339e91f83407838b5607db8e1910..3a325707c2c07e799271f80501481da1f7e71369 100644 (file)
@@ -477,7 +477,6 @@ SMESH::long_array* HexoticPlugin_Hypothesis_i::GetFacesWithLayers()
   std::vector<int> idsVec = this->GetImpl()->GetFacesWithLayers();
   SMESH::long_array_var ids = new SMESH::long_array;
   ids->length( idsVec.size() );
-  std::vector<int>::const_iterator anIt;
   for ( unsigned i = 0; i < idsVec.size(); ++i )
     ids[i] = idsVec[i];
   return ids._retn();
@@ -490,7 +489,6 @@ SMESH::long_array* HexoticPlugin_Hypothesis_i::GetImprintedFaces()
   std::vector<int> idsVec = this->GetImpl()->GetImprintedFaces();
   SMESH::long_array_var ids = new SMESH::long_array;
   ids->length( idsVec.size() );
-  std::vector<int>::const_iterator anIt;
   for ( unsigned i = 0; i < idsVec.size(); ++i )
     ids[i] = idsVec[i];
   return ids._retn();