remove dupes from surfacePoints list
This commit is contained in:
parent
1782687e9a
commit
226ef2dc0a
@ -10,6 +10,8 @@
|
|||||||
#include <vtkStaticCellLinks.h>
|
#include <vtkStaticCellLinks.h>
|
||||||
#include <vtkIntArray.h>
|
#include <vtkIntArray.h>
|
||||||
|
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vtkStandardNewMacro(SurfacePointsFilter);
|
vtkStandardNewMacro(SurfacePointsFilter);
|
||||||
@ -46,6 +48,7 @@ vtkTypeBool SurfacePointsFilter::RequestData(
|
|||||||
|
|
||||||
vtkNew<vtkIdList> neighborCells;
|
vtkNew<vtkIdList> neighborCells;
|
||||||
vtkNew<vtkIdList> facePoints;
|
vtkNew<vtkIdList> facePoints;
|
||||||
|
std::set<vtkIdType> surfacePointsSet;
|
||||||
auto *it = input->NewCellIterator();
|
auto *it = input->NewCellIterator();
|
||||||
for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell()) {
|
for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell()) {
|
||||||
vtkIdList *cellPointIds = it->GetPointIds();
|
vtkIdList *cellPointIds = it->GetPointIds();
|
||||||
@ -60,15 +63,19 @@ vtkTypeBool SurfacePointsFilter::RequestData(
|
|||||||
neighborCells);
|
neighborCells);
|
||||||
facePoints->Reset();
|
facePoints->Reset();
|
||||||
if (neighborCells->GetNumberOfIds() == 0) {
|
if (neighborCells->GetNumberOfIds() == 0) {
|
||||||
surfacePoints->InsertNextValue(idA);
|
surfacePointsSet.insert(idA);
|
||||||
surfacePoints->InsertNextValue(idB);
|
surfacePointsSet.insert(idB);
|
||||||
surfacePoints->InsertNextValue(idC);
|
surfacePointsSet.insert(idC);
|
||||||
isSurface->SetValue(idA, 1);
|
isSurface->SetValue(idA, 1);
|
||||||
isSurface->SetValue(idB, 1);
|
isSurface->SetValue(idB, 1);
|
||||||
isSurface->SetValue(idC, 1);
|
isSurface->SetValue(idC, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
surfacePoints->Allocate(surfacePointsSet.size());
|
||||||
|
for (const vtkIdType &id : surfacePointsSet) {
|
||||||
|
surfacePoints->InsertNextValue(id);
|
||||||
|
}
|
||||||
|
|
||||||
output->GetPointData()->SetScalars(isSurface);
|
output->GetPointData()->SetScalars(isSurface);
|
||||||
output->GetFieldData()->AddArray(surfacePoints);
|
output->GetFieldData()->AddArray(surfacePoints);
|
||||||
|
Loading…
Reference in New Issue
Block a user