small optimization

This commit is contained in:
eap 2013-07-24 14:48:32 +00:00
parent 4689443745
commit 8fe58da2fc

View File

@ -332,24 +332,22 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
list<const SMDS_MeshNode*>* Result, list<const SMDS_MeshNode*>* Result,
const double precision) const double precision)
{ {
gp_XYZ p(Node->X(), Node->Y(), Node->Z()); gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
bool isInsideBool = isInside(p, precision); bool isInsideBool = isInside( p1.XYZ(), precision );
if (isInsideBool) if (isInsideBool)
{ {
// I'm only looking in the leaves, since all the nodes are stored there. // I'm only looking in the leaves, since all the nodes are stored there.
if (isLeaf()) if (isLeaf())
{ {
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z()); TIDSortedNodeSet::iterator it = myNodes.begin();
const double tol2 = precision * precision;
TIDSortedNodeSet myNodesCopy = myNodes;
TIDSortedNodeSet::iterator it = myNodesCopy.begin();
double tol2 = precision * precision;
bool squareBool; bool squareBool;
while (it != myNodesCopy.end()) while (it != myNodes.end())
{ {
const SMDS_MeshNode* n2 = *it; const SMDS_MeshNode* n2 = *it;
squareBool = false;
// We're only looking at nodes with a superior Id. // We're only looking at nodes with a superior Id.
// JFA: Why? // JFA: Why?
//if (Node->GetID() < n2->GetID()) //if (Node->GetID() < n2->GetID())
@ -364,14 +362,13 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
{ {
Result->insert(Result->begin(), n2); Result->insert(Result->begin(), n2);
SetOfNodes->erase( n2 ); SetOfNodes->erase( n2 );
myNodes.erase( n2 ); myNodes.erase( *it++ ); // it++ goes forward and returns it's previous position
} }
} }
//myNodesCopy.erase( it ); if ( !squareBool )
//it = myNodesCopy.begin();
it++; it++;
} }
if (Result->size() > 0) if ( !Result->empty() )
myNodes.erase(Node); // JFA: for bug 0020185 myNodes.erase(Node); // JFA: for bug 0020185
} }
else else