Salome HOME
0022098: EDF 2036 SMESH: Create groups from none conected parts of a mesh
[modules/smesh.git] / src / StdMeshers / StdMeshers_ProjectionUtils.cxx
index 5cfccaa1c32772818a34befd55be5dcb257a828b..129e8ae48966bdde67a091a77a5f7311a2b20f92 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -41,6 +41,7 @@
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 #include "SMESH_subMeshEventListener.hxx"
+#include "SMESH_MeshAlgos.hxx"
 
 #include "utilities.h"
 
@@ -1000,7 +1001,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       // get outer edge of theShape1
       TopoDS_Shape wire = OuterShape( face1, TopAbs_WIRE );
       //edge1 = TopoDS::Edge( OuterShape( face1, TopAbs_EDGE ));
-      map<int,TopoDS_Edge> propag_edges; // use map to find the closest propagation edge
+      // use map to find the closest propagation edge
+      map<int, pair< TopoDS_Edge, TopoDS_Edge > > propag_edges;
       for ( TopoDS_Iterator edgeIt( wire ); edgeIt.More(); edgeIt.Next() )
       {
         edge1 = TopoDS::Edge( edgeIt.Value() );
@@ -1009,7 +1011,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
           edge2 = TopoDS::Edge( exp.Current() );
           pair<int,TopoDS_Edge> step_edge = GetPropagationEdge( theMesh1, edge2, edge1 );
           if ( !step_edge.second.IsNull() ) { // propagation found
-            propag_edges.insert( step_edge );
+            propag_edges.insert( make_pair( step_edge.first,
+                                            ( make_pair( edge1, step_edge.second ))));
             if ( step_edge.first == 1 ) break; // most close found
           }
         }
@@ -1017,7 +1020,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       }
       if ( !propag_edges.empty() ) // propagation found
       {
-        edge2 = propag_edges.begin()->second;
+        edge1 = propag_edges.begin()->second.first;
+        edge2 = propag_edges.begin()->second.second;
         TopoDS_Vertex VV1[2], VV2[2];
         TopExp::Vertices( edge1, VV1[0], VV1[1], true );
         TopExp::Vertices( edge2, VV2[0], VV2[1], true );
@@ -1873,12 +1877,12 @@ FindMatchingNodesOnFaces( const TopoDS_Face&     face1,
       TIDSortedElemSet inSet, notInSet;
 
       const SMDS_MeshElement* f1 =
-        SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
+        SMESH_MeshAlgos::FindFaceInSet( vNode, eNode, inSet, notInSet );
       if ( !f1 ) RETURN_BAD_RESULT("The first face on seam not found");
       notInSet.insert( f1 );
 
       const SMDS_MeshElement* f2 =
-        SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
+        SMESH_MeshAlgos::FindFaceInSet( vNode, eNode, inSet, notInSet );
       if ( !f2 ) RETURN_BAD_RESULT("The second face on seam not found");
 
       // select a face with less UV of vNode
@@ -1921,7 +1925,7 @@ FindMatchingNodesOnFaces( const TopoDS_Face&     face1,
       for ( int i = 0; i < nbNodes; ++i ) {
         const SMDS_MeshNode* n1 = faceToKeep->GetNode( i );
         const SMDS_MeshNode* n2 = faceToKeep->GetNode(( i+1 ) % nbNodes );
-        f1 = SMESH_MeshEditor::FindFaceInSet( n1, n2, inSet, notInSet );
+        f1 = SMESH_MeshAlgos::FindFaceInSet( n1, n2, inSet, notInSet );
         if ( f1 )
           elems.insert( f1 );
       }