From: mpa Date: Wed, 24 Jun 2015 15:23:35 +0000 (+0300) Subject: 0023102: [CEA 1486 ] Add the parameters for defining the boundary layers (edited) X-Git-Tag: V7_7_0a1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c7892b5528b9aa2b683268eb39666935c35e74a;p=plugins%2Fhexoticplugin.git 0023102: [CEA 1486 ] Add the parameters for defining the boundary layers (edited) --- diff --git a/doc/salome/examples/hexoticdemo_vl.py b/doc/salome/examples/hexoticdemo_vl.py index bc2b4a2..971060d 100644 --- a/doc/salome/examples/hexoticdemo_vl.py +++ b/doc/salome/examples/hexoticdemo_vl.py @@ -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 ) diff --git a/src/HexoticPlugin/HexoticPLUGINBuilder.py b/src/HexoticPlugin/HexoticPLUGINBuilder.py index d8e034a..bd59371 100644 --- a/src/HexoticPlugin/HexoticPLUGINBuilder.py +++ b/src/HexoticPlugin/HexoticPLUGINBuilder.py @@ -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) diff --git a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx index ac0285f..3a32570 100644 --- a/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx +++ b/src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx @@ -477,7 +477,6 @@ SMESH::long_array* HexoticPlugin_Hypothesis_i::GetFacesWithLayers() std::vector idsVec = this->GetImpl()->GetFacesWithLayers(); SMESH::long_array_var ids = new SMESH::long_array; ids->length( idsVec.size() ); - std::vector::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 idsVec = this->GetImpl()->GetImprintedFaces(); SMESH::long_array_var ids = new SMESH::long_array; ids->length( idsVec.size() ); - std::vector::const_iterator anIt; for ( unsigned i = 0; i < idsVec.size(); ++i ) ids[i] = idsVec[i]; return ids._retn();