Salome HOME
0020206: EDF SMESH 987: Netgen1D2D3D +submesh
authoreap <eap@opencascade.com>
Wed, 11 Mar 2009 15:13:38 +0000 (15:13 +0000)
committereap <eap@opencascade.com>
Wed, 11 Mar 2009 15:13:38 +0000 (15:13 +0000)
   in GetSubMesh(), fix detection of SMESHDS_SubMesh'es of geom groups

src/SMESH/SMESH_Mesh.cxx

index 1b2f06bc5a11ba47f2e726d56c9061fa795f204d..ce4f8fa57ac1fd251be2f547fdbcb5be12256d34 100644 (file)
@@ -86,7 +86,7 @@ SMESH_Mesh::SMESH_Mesh(int               theLocalId,
                       SMESH_Gen*        theGen,
                       bool              theIsEmbeddedMode,
                       SMESHDS_Document* theDocument):
-  _groupId( 0 )
+  _groupId( 0 ), _nbSubShapes( 0 )
 {
   MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
   _id            = theLocalId;
@@ -164,6 +164,7 @@ void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape)
   {
     _myMeshDS->ShapeToMesh(aShape);
     _isShapeToMesh = true;
+    _nbSubShapes = _myMeshDS->MaxShapeIndex();
 
     // fill _mapAncestors
     int desType, ancType;
@@ -764,7 +765,7 @@ SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
   int index = _myMeshDS->ShapeToIndex(aSubShape);
 
   // for submeshes on GEOM Group
-  if ( !index && aSubShape.ShapeType() == TopAbs_COMPOUND ) {
+  if (( !index || index > _nbSubShapes ) && aSubShape.ShapeType() == TopAbs_COMPOUND ) {
     TopoDS_Iterator it( aSubShape );
     if ( it.More() )
       index = _myMeshDS->AddCompoundSubmesh( aSubShape, it.Value().ShapeType() );