#include <vector>
#include <map>
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+// TTimerLog
+#include "VISU_ConvertorUtils.hxx"
+
namespace
{
typedef std::vector<int> TSortedArray;
vtkIntArray* inputPointIds,
TSortedArray& outputSortedArray)
{
+ VISU::TTimerLog aTimerLog(MYDEBUG,"GetIdsForCopy");
if(inputUGrid){
TSortedArray aSortedPointIds;
TSortedArray aOutputCellIds;
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;i<nbPointsInCell;i++){
+ TSortedArray::iterator aResult = find(aSortedPointIds.begin(),aSortedPointIds.end(),ptIds->GetId(i));
+ if(aResult == aSortedPointIds.end()){
+ aGoodCell = false;
+ break;
+ }
+ }
+ if(aGoodCell)
aOutputCellIds.push_back(idCell);
+ else
+ continue;
+
}
outputSortedArray.swap(aOutputCellIds);