]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL21718: Composite Side Discretisation 1D Algorithm works incorrently with attached...
authoreap <eap@opencascade.com>
Tue, 27 Apr 2010 09:25:36 +0000 (09:25 +0000)
committereap <eap@opencascade.com>
Tue, 27 Apr 2010 09:25:36 +0000 (09:25 +0000)
 * Avoid pb with internal edges

src/StdMeshers/StdMeshers_CompositeSegment_1D.cxx

index b21833666eea72b5b3d675208b0fda176a2f379c..17161d9ef503dce7b6cff25aaa2f0ae3c137848a 100644 (file)
@@ -74,24 +74,16 @@ namespace {
    */
   //================================================================================
 
-  TopoDS_Edge nextC1Edge(const TopoDS_Edge&  edge,
-                         SMESH_Mesh &        aMesh,
-                         const bool          forward)
+  TopoDS_Edge nextC1Edge(TopoDS_Edge  edge,
+                         SMESH_Mesh & aMesh,
+                         const bool   forward)
   {
+    if (edge.Orientation() > TopAbs_REVERSED) // INTERNAL
+      edge.Orientation( TopAbs_FORWARD );
     TopoDS_Edge eNext;
     TopTools_MapOfShape edgeCounter;
     edgeCounter.Add( edge );
-    TopoDS_Vertex v;
-    if (edge.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
-      v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
-    else {
-      TopoDS_Iterator vIt (edge);
-      if (forward)
-        for (; vIt.More(); vIt.Next())
-          v = TopoDS::Vertex(vIt.Value()); // last
-      else if (vIt.More())
-        v = TopoDS::Vertex(vIt.Value()); // first
-    }
+    TopoDS_Vertex v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
     TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v );
     for ( ; ancestIt.More(); ancestIt.Next() )
     {
@@ -102,18 +94,10 @@ namespace {
     if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) {
       if ( SMESH_Algo::IsContinuous( edge, eNext )) {
         // care of orientation
-        TopoDS_Vertex vn;
-        if (eNext.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
-          vn = forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
-        else {
-          TopoDS_Iterator vIt (eNext);
-          if (forward)
-            vn = TopoDS::Vertex(vIt.Value()); // first
-          else if (vIt.More())
-            for (; vIt.More(); vIt.Next())
-              vn = TopoDS::Vertex(vIt.Value()); // last
-        }
-
+        if (eNext.Orientation() > TopAbs_REVERSED) // INTERNAL
+          eNext.Orientation( TopAbs_FORWARD );
+        TopoDS_Vertex vn =
+          forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
         bool reverse = (!v.IsSame(vn));
         if ( reverse )
           eNext.Reverse();
@@ -315,14 +299,17 @@ StdMeshers_CompositeSegment_1D::GetFaceSide(SMESH_Mesh&        aMesh,
                                             const bool         ignoreMeshed)
 {
   list< TopoDS_Edge > edges;
-  edges.push_back( anEdge );
+  if ( anEdge.Orientation() <= TopAbs_REVERSED )
+    edges.push_back( anEdge );
+  else
+    edges.push_back( TopoDS::Edge( anEdge.Oriented( TopAbs_FORWARD ))); // PAL21718
 
   list <const SMESHDS_Hypothesis *> hypList;
   SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge );
   if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false);
   for ( int forward = 0; forward < 2; ++forward )
   {
-    TopoDS_Edge eNext = nextC1Edge( anEdge, aMesh, forward );
+    TopoDS_Edge eNext = nextC1Edge( edges.back(), aMesh, forward );
     while ( !eNext.IsNull() ) {
       if ( ignoreMeshed ) {
         // eNext must not have computed mesh