From a710674f8336f2863fcb169aa59d0cc1917113ae Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 18 Feb 2010 08:29:00 +0000 Subject: [PATCH] 020697: EDF 1248 SMESH: Sub-mesh on group of face not taken into account * Correct adding geom groups into map of ansestors --- src/SMESH/SMESH_Mesh.cxx | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index ea3beb9f0..52ac6154b 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -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 ); + } } //============================================================================= -- 2.39.2