- if ( !onBnd )
- elems.insert( f );
- }
- // add also faces adjacent to faceToKeep
- int nbNodes = faceToKeep->NbNodes();
- if ( faceToKeep->IsQuadratic() ) nbNodes /= 2;
- notInSet.insert( f1 );
- notInSet.insert( f2 );
- 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_MeshAlgos::FindFaceInSet( n1, n2, inSet, notInSet );
- if ( f1 )
- elems.insert( f1 );
- }
- } // case on a sphere
- } // loop on 2 faces
-
- // int quadFactor = (*Elems1.begin())->IsQuadratic() ? 2 : 1;
-
- node1To2Map.clear();
- int res = SMESH_MeshEditor::FindMatchingNodes( Elems1, Elems2,
- vNode1, vNode2,
- eNode1[0], eNode2[0],
- node1To2Map);
- if ( res != SMESH_MeshEditor::SEW_OK )
- RETURN_BAD_RESULT("FindMatchingNodes() result " << res );
+ gp_Pnt2d uv1 = helper->GetNodeUV( face, vNode, notSeamNode[0] );
+ gp_Pnt2d uv2 = helper->GetNodeUV( face, vNode, notSeamNode[1] );
+ if ( uv1.X() + uv1.Y() > uv2.X() + uv2.Y() )
+ faceToKeep = f2;
+ else
+ faceToKeep = f1;
+
+ // fill elem set
+ elems.insert( faceToKeep );
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* f = eIt->next();
+ int nbNodes = f->NbNodes();
+ if ( f->IsQuadratic() )
+ nbNodes /= 2;
+ bool onBnd = false;
+ for ( int i = 0; !onBnd && i < nbNodes; ++i ) {
+ const SMDS_MeshNode* node = f->GetNode( i );
+ onBnd = ( node->GetPosition()->GetTypeOfPosition() != SMDS_TOP_FACE);
+ }
+ if ( !onBnd )
+ elems.insert( f );
+ }
+ // add also faces adjacent to faceToKeep
+ int nbNodes = faceToKeep->NbNodes();
+ if ( faceToKeep->IsQuadratic() ) nbNodes /= 2;
+ notInSet.insert( f1 );
+ notInSet.insert( f2 );
+ 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_MeshAlgos::FindFaceInSet( n1, n2, inSet, notInSet );
+ if ( f1 )
+ elems.insert( f1 );
+ }
+ } // case on a sphere
+ } // loop on 2 faces
+
+ node1To2Map.clear();
+ assocRes = SMESH_MeshEditor::FindMatchingNodes( Elems1, Elems2,
+ vNode1, vNode2,
+ eNode1[0], eNode2[0],
+ node1To2Map);
+ if (( assocRes != SMESH_MeshEditor::SEW_OK ) &&
+ ( eNode1[1] || eNode2[1] )) // there is another node to try (on a closed EDGE)
+ {
+ node1To2Map.clear();
+ if ( eNode1[1] ) std::swap( eNode1[0], eNode1[1] );
+ else std::swap( eNode2[0], eNode2[1] );
+ continue; // one more attempt
+ }
+
+ break;
+ }
+ if ( assocRes != SMESH_MeshEditor::SEW_OK )
+ RETURN_BAD_RESULT("FindMatchingNodes() result " << assocRes );