From: enk Date: Mon, 16 Apr 2007 10:24:14 +0000 (+0000) Subject: performance improvement X-Git-Tag: V3_2_6~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b15f05e9bae336ca871a152c78519a1b71c89973;p=modules%2Fvisu.git performance improvement --- diff --git a/src/CONVERTOR/VISU_CommonCellsFilter.cxx b/src/CONVERTOR/VISU_CommonCellsFilter.cxx index 6ca42755..fb040b8f 100644 --- a/src/CONVERTOR/VISU_CommonCellsFilter.cxx +++ b/src/CONVERTOR/VISU_CommonCellsFilter.cxx @@ -22,6 +22,15 @@ #include #include +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + +// TTimerLog +#include "VISU_ConvertorUtils.hxx" + namespace { typedef std::vector TSortedArray; @@ -46,6 +55,7 @@ namespace vtkIntArray* inputPointIds, TSortedArray& outputSortedArray) { + VISU::TTimerLog aTimerLog(MYDEBUG,"GetIdsForCopy"); if(inputUGrid){ TSortedArray aSortedPointIds; TSortedArray aOutputCellIds; @@ -59,22 +69,20 @@ namespace vtkCell* aCell = inputUGrid->GetCell(idCell); vtkIdList* ptIds = aCell->GetPointIds(); int aMaxId = ptIds->GetNumberOfIds(); - int* aPointer = ptIds->GetPointer(0); - int* anEndPointer = ptIds->GetPointer(aMaxId + 1); - TSortedArray aSortedArray(aPointer, anEndPointer); - std::sort(aSortedArray.begin(), aSortedArray.end()); - - int aMaxLength = std::max(aSortedArray.size(), aSortedPointIds.size()); - TSortedArray anIntersectionArray(aMaxLength); - TSortedArray::iterator anArrayIter = anIntersectionArray.begin(); - anArrayIter = std::set_intersection(aSortedArray.begin(), - aSortedArray.end(), - aSortedPointIds.begin(), - aSortedPointIds.end(), - anArrayIter); - anIntersectionArray.erase(anArrayIter, anIntersectionArray.end()); - if(anIntersectionArray.size() == aSortedArray.size()) + int nbPointsInCell = ptIds->GetNumberOfIds(); + bool aGoodCell = true; + for(int i=0;iGetId(i)); + if(aResult == aSortedPointIds.end()){ + aGoodCell = false; + break; + } + } + if(aGoodCell) aOutputCellIds.push_back(idCell); + else + continue; + } outputSortedArray.swap(aOutputCellIds);