Salome HOME
020697: EDF 1248 SMESH: Sub-mesh on group of face not taken into account
authoreap <eap@opencascade.com>
Thu, 18 Feb 2010 08:29:00 +0000 (08:29 +0000)
committereap <eap@opencascade.com>
Thu, 18 Feb 2010 08:29:00 +0000 (08:29 +0000)
 * Correct adding geom groups into map of ansestors

src/SMESH/SMESH_Mesh.cxx

index ea3beb9f0838ffc28049416ad78b3edb9349c8af..52ac6154be2ad76167ccd7c1e4f5f23cf3b7b524 100644 (file)
@@ -520,7 +520,7 @@ SMESH_Hypothesis::Hypothesis_Status
     if (ret2 > ret)
       ret = ret2;
 
-    // check concurent hypotheses on ansestors
+    // check concurent hypotheses on ancestors
     if (ret < SMESH_Hypothesis::HYP_CONCURENT && !isGlobalHyp )
     {
       SMESH_subMeshIteratorPtr smIt = subMesh->getDependsOnIterator(false,false);
@@ -591,7 +591,7 @@ SMESH_Hypothesis::Hypothesis_Status
     if (ret2 > ret) // more severe
       ret = ret2;
 
-    // check concurent hypotheses on ansestors
+    // check concurent hypotheses on ancestors
     if (ret < SMESH_Hypothesis::HYP_CONCURENT && !IsMainShape( aSubShape ) )
     {
       SMESH_subMeshIteratorPtr smIt = subMesh->getDependsOnIterator(false,false);
@@ -1578,20 +1578,38 @@ const TListOfListOfInt& SMESH_Mesh::GetMeshOrder() const
 
 //=============================================================================
 /*!
- *  \brief fillAncestorsMap
+ *  \brief fill _mapAncestors
  */
 //=============================================================================
 
 void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
 {
-  // fill _mapAncestors
+
   int desType, ancType;
-  for ( desType = TopAbs_VERTEX; desType > TopAbs_COMPOUND; desType-- )
-    for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- )
-      TopExp::MapShapesAndAncestors ( theShape,
-                                      (TopAbs_ShapeEnum) desType,
-                                      (TopAbs_ShapeEnum) ancType,
-                                      _mapAncestors );
+  if ( !theShape.IsSame( GetShapeToMesh()) && theShape.ShapeType() == TopAbs_COMPOUND )
+  {
+    // a geom group is added. Insert it into lists of ancestors before
+    // the first ancestor more complex than group members
+    int memberType = TopoDS_Iterator( theShape ).Value().ShapeType();
+    for ( desType = TopAbs_VERTEX; desType >= memberType; desType-- )
+      for (TopExp_Explorer des( theShape, TopAbs_ShapeEnum( desType )); des.More(); des.Next())
+      {
+        TopTools_ListOfShape& ancList = _mapAncestors.ChangeFromKey( des.Current() );
+        TopTools_ListIteratorOfListOfShape ancIt (ancList);
+        while ( ancIt.More() && ancIt.Value().ShapeType() >= memberType )
+          ancIt.Next();
+        if ( ancIt.More() )
+          ancList.InsertBefore( theShape, ancIt );
+      }
+  }
+  {
+    for ( desType = TopAbs_VERTEX; desType > TopAbs_COMPOUND; desType-- )
+      for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- )
+        TopExp::MapShapesAndAncestors ( theShape,
+                                        (TopAbs_ShapeEnum) desType,
+                                        (TopAbs_ShapeEnum) ancType,
+                                        _mapAncestors );
+  }
 }
 
 //=============================================================================