X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_OctreeNode.cxx;h=772a50f99f1a2504c640beaf9039ed2950a0cbdf;hp=f23cac0cab8bc5e0804e03d2c6c93535e676487a;hb=b22e182dd1a2c30be324b21074158390d00714b3;hpb=5c5fea746ac226dd7c125751c6ebb4dddcbe3ea0 diff --git a/src/SMESHUtils/SMESH_OctreeNode.cxx b/src/SMESHUtils/SMESH_OctreeNode.cxx index f23cac0ca..772a50f99 100644 --- a/src/SMESHUtils/SMESH_OctreeNode.cxx +++ b/src/SMESHUtils/SMESH_OctreeNode.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -275,42 +275,33 @@ void SMESH_OctreeNode::FindCoincidentNodes (TIDSortedNodeSet& theSetOfNodes, * \param theGroupsOfNodes - list of nodes closed to each other returned */ //============================= -void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet* theSetOfNodes, - const double theTolerance, +void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet* theSetOfNodes, + const double theTolerance, list< list< const SMDS_MeshNode*> >* theGroupsOfNodes) { TIDSortedNodeSet::iterator it1 = theSetOfNodes->begin(); list::iterator it2; + list ListOfCoincidentNodes; + TIDCompare idLess; + while (it1 != theSetOfNodes->end()) { const SMDS_MeshNode * n1 = *it1; - list ListOfCoincidentNodes;// Initialize the lists via a declaration, it's enough - - list * groupPtr = 0; - // Searching for Nodes around n1 and put them in ListofCoincidentNodes. // Found nodes are also erased from theSetOfNodes FindCoincidentNodes(n1, theSetOfNodes, &ListOfCoincidentNodes, theTolerance); - // We build a list {n1 + his neigbours} and add this list in theGroupsOfNodes - for (it2 = ListOfCoincidentNodes.begin(); it2 != ListOfCoincidentNodes.end(); it2++) + if ( !ListOfCoincidentNodes.empty() ) { - const SMDS_MeshNode* n2 = *it2; - if ( !groupPtr ) - { - theGroupsOfNodes->push_back( list() ); - groupPtr = & theGroupsOfNodes->back(); - groupPtr->push_back( n1 ); - } - if (groupPtr->front() > n2) - groupPtr->push_front( n2 ); - else - groupPtr->push_back( n2 ); + // We build a list {n1 + his neigbours} and add this list in theGroupsOfNodes + if ( idLess( n1, ListOfCoincidentNodes.front() )) ListOfCoincidentNodes.push_front( n1 ); + else ListOfCoincidentNodes.push_back ( n1 ); + ListOfCoincidentNodes.sort( idLess ); + theGroupsOfNodes->push_back( list() ); + theGroupsOfNodes->back().splice( theGroupsOfNodes->back().end(), ListOfCoincidentNodes ); } - if (groupPtr != 0) - groupPtr->sort(); theSetOfNodes->erase(it1); it1 = theSetOfNodes->begin();