From ec62e23cb04b3f6699150a19fec591e8d94a1601 Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 30 Nov 2010 07:40:21 +0000 Subject: [PATCH] Acceleration of algorithm. --- src/MEDCoupling/MEDCouplingPointSet.cxx | 39 +++++++++++-------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 4b8a17cc0..e587b2978 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -277,33 +277,28 @@ DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayInt *ret=DataArrayInt::New(); int nbNodesOld=getNumberOfNodes(); ret->alloc(nbNodesOld,1); - std::fill(ret->getPointer(),ret->getPointer()+nbNodesOld,-1); - int *retPtr=ret->getPointer(); - std::vector commRemain(comm->getConstPointer(),comm->getConstPointer()+comm->getNumberOfTuples()); - std::vector commIRemain(commIndex->getConstPointer(),commIndex->getConstPointer()+commIndex->getNumberOfTuples()); + int *pt=ret->getPointer(); + std::fill(pt,pt+nbNodesOld,-1); + int nbOfGrps=commIndex->getNumberOfTuples()-1; + const int *cIPtr=commIndex->getPointer(); + const int *cPtr=comm->getPointer(); + for(int i=0;i::const_iterator iNode2=commRemain.begin(); - iNode2!=commRemain.begin()+commIRemain[1];iNode2++) - retPtr[*iNode2]=newNb; - int delta=commIRemain[1]; - commRemain.erase(commRemain.begin(),commRemain.begin()+commIRemain[1]); - commIRemain.erase(commIRemain.begin()); - std::transform(commIRemain.begin(),commIRemain.end(),commIRemain.begin(),std::bind2nd(std::minus(),delta)); + if(pt[iNode]==-1) + pt[iNode]=newNb++; + else + { + int grpId=-(pt[iNode]+2); + for(int j=cIPtr[grpId];j