]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0021530: EDF 2176 SMESH: Projection 1D-2D with compounds
authoreap <eap@opencascade.com>
Wed, 11 Apr 2012 08:19:09 +0000 (08:19 +0000)
committereap <eap@opencascade.com>
Wed, 11 Apr 2012 08:19:09 +0000 (08:19 +0000)
     In GetGroupSubMeshesContaining() preview a case where the main
     shape is a group

src/SMESH/SMESH_Mesh.cxx

index 2e09dcd860c1c5388e310909c346fe1d431008f8..234e64597529a0e97a51425d6cff2e42279df327 100644 (file)
@@ -26,6 +26,7 @@
 //  Module : SMESH
 //
 #include "SMESH_Mesh.hxx"
+#include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 #include "SMESH_Gen.hxx"
 #include "SMESH_Hypothesis.hxx"
@@ -968,17 +969,27 @@ SMESH_Mesh::GetGroupSubMeshesContaining(const TopoDS_Shape & aSubShape) const
   for ( i_sm = _mapSubMesh.rbegin(); i_sm != _mapSubMesh.rend(); ++i_sm) {
     SMESHDS_SubMesh * ds = i_sm->second->GetSubMeshDS();
     if ( ds && ds->IsComplexSubmesh() ) {
-      TopExp_Explorer exp( i_sm->second->GetSubShape(), aSubShape.ShapeType() );
-      for ( ; exp.More(); exp.Next() ) {
-        if ( aSubShape.IsSame( exp.Current() )) {
-          found.push_back( i_sm->second );
-          break;
-        }
+      if ( SMESH_MesherHelper::IsSubShape( aSubShape, i_sm->second->GetSubShape() ))
+      {
+        found.push_back( i_sm->second );
+        break;
       }
     } else {
-      break;
+      break; // the rest sub-meshes are not those of groups
     }
   }
+
+  if ( found.empty() ) // maybe the main shape is a COMPOUND (issue 0021530)
+  {
+    if ( SMESH_subMesh * mainSM = GetSubMeshContaining(1))
+      if ( mainSM->GetSubShape().ShapeType() == TopAbs_COMPOUND )
+      {
+        TopoDS_Iterator it( mainSM->GetSubShape() );
+        if ( it.Value().ShapeType() == aSubShape.ShapeType() &&
+             SMESH_MesherHelper::IsSubShape( aSubShape, mainSM->GetSubShape() ))
+          found.push_back( mainSM );
+      }
+  }
   return found;
 }
 //=======================================================================