BBTree<SPACEDIM,int> myTree(&bbox[0],0,0,nbNodes,-prec);
double bb[2*SPACEDIM];
double prec2=prec*prec;
+ std::vector<bool> isDone(nbNodes);
for(int i=0;i<nbNodes;i++)
{
- if(std::find(c.begin(),c.end(),i)!=c.end())
- continue;
- for(int j=0;j<SPACEDIM;j++)
+ if(!isDone[i])
{
- bb[2*j]=coordsPtr[SPACEDIM*i+j];
- bb[2*j+1]=coordsPtr[SPACEDIM*i+j];
- }
- std::vector<int> intersectingElems;
- myTree.getIntersectingElems(bb,intersectingElems);
- if(intersectingElems.size()>1)
- {
- std::vector<int> commonNodes;
- for(std::vector<int>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
- if(*it!=i)
- if(*it>=limitNodeId)
- if(INTERP_KERNEL::distance2<SPACEDIM>(coordsPtr+SPACEDIM*i,coordsPtr+SPACEDIM*(*it))<prec2)
- commonNodes.push_back(*it);
- if(!commonNodes.empty())
+ for(int j=0;j<SPACEDIM;j++)
+ {
+ bb[2*j]=coordsPtr[SPACEDIM*i+j];
+ bb[2*j+1]=coordsPtr[SPACEDIM*i+j];
+ }
+ std::vector<int> intersectingElems;
+ myTree.getIntersectingElems(bb,intersectingElems);
+ if(intersectingElems.size()>1)
{
- cI.push_back(cI.back()+commonNodes.size()+1);
- c.push_back(i);
- c.insert(c.end(),commonNodes.begin(),commonNodes.end());
+ std::vector<int> commonNodes;
+ for(std::vector<int>::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++)
+ if(*it!=i)
+ if(*it>=limitNodeId)
+ if(INTERP_KERNEL::distance2<SPACEDIM>(coordsPtr+SPACEDIM*i,coordsPtr+SPACEDIM*(*it))<prec2)
+ {
+ commonNodes.push_back(*it);
+ isDone[*it]=true;
+ }
+ if(!commonNodes.empty())
+ {
+ cI.push_back(cI.back()+commonNodes.size()+1);
+ c.push_back(i);
+ c.insert(c.end(),commonNodes.begin(),commonNodes.end());
+ }
}
}
}