mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-01 11:05:37 +05:00
PAL 14158 : substitute the old algo (n²) to the Octree one (n) in the FindCoincidentNode method.
This commit is contained in:
parent
9944389aa9
commit
a5ee60b544
@ -42,6 +42,7 @@
|
||||
#include "SMESH_subMesh.hxx"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
#include "SMESH_MesherHelper.hxx"
|
||||
#include "SMESH_OctreeNode.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
@ -4194,7 +4195,8 @@ void SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
||||
//=======================================================================
|
||||
//function : FindCoincidentNodes
|
||||
//purpose : Return list of group of nodes close to each other within theTolerance
|
||||
// Search among theNodes or in the whole mesh if theNodes is empty.
|
||||
// Search among theNodes or in the whole mesh if theNodes is empty using
|
||||
// an Octree algorithm
|
||||
//=======================================================================
|
||||
|
||||
void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes,
|
||||
@ -4204,48 +4206,17 @@ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes
|
||||
myLastCreatedElems.Clear();
|
||||
myLastCreatedNodes.Clear();
|
||||
|
||||
double tol2 = theTolerance * theTolerance;
|
||||
|
||||
list<const SMDS_MeshNode*> nodes;
|
||||
set<const SMDS_MeshNode*> nodes;
|
||||
if ( theNodes.empty() )
|
||||
{ // get all nodes in the mesh
|
||||
SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator();
|
||||
while ( nIt->more() )
|
||||
nodes.push_back( nIt->next() );
|
||||
nodes.insert( nodes.end(),nIt->next());
|
||||
}
|
||||
else
|
||||
{
|
||||
nodes.insert( nodes.end(), theNodes.begin(), theNodes.end() );
|
||||
}
|
||||
nodes=theNodes;
|
||||
SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance);
|
||||
|
||||
list<const SMDS_MeshNode*>::iterator it2, it1 = nodes.begin();
|
||||
for ( ; it1 != nodes.end(); it1++ )
|
||||
{
|
||||
const SMDS_MeshNode* n1 = *it1;
|
||||
gp_Pnt p1( n1->X(), n1->Y(), n1->Z() );
|
||||
|
||||
list<const SMDS_MeshNode*> * groupPtr = 0;
|
||||
it2 = it1;
|
||||
for ( it2++; it2 != nodes.end(); it2++ )
|
||||
{
|
||||
const SMDS_MeshNode* n2 = *it2;
|
||||
gp_Pnt p2( n2->X(), n2->Y(), n2->Z() );
|
||||
if ( p1.SquareDistance( p2 ) <= tol2 )
|
||||
{
|
||||
if ( !groupPtr ) {
|
||||
theGroupsOfNodes.push_back( list<const SMDS_MeshNode*>() );
|
||||
groupPtr = & theGroupsOfNodes.back();
|
||||
groupPtr->push_back( n1 );
|
||||
}
|
||||
if(groupPtr->front()>n2)
|
||||
groupPtr->push_front( n2 );
|
||||
else
|
||||
groupPtr->push_back( n2 );
|
||||
it2 = nodes.erase( it2 );
|
||||
it2--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user