iterate over surface points directly in the relaxation
This commit is contained in:
parent
ffe5a68504
commit
dacb2ffa04
@ -25,16 +25,18 @@ vtkTypeBool RelaxationFilter::RequestData(
|
||||
newPoints->DeepCopy(output->GetPoints());
|
||||
vtkNew<vtkIdList> neighborCells;
|
||||
vtkNew<vtkIdList> cellPoints;
|
||||
vtkIdTypeArray *surfacePoints = vtkIdTypeArray::SafeDownCast(
|
||||
output->GetFieldData()->GetArray("surface_points"));
|
||||
vtkIntArray *isSurface = vtkIntArray::SafeDownCast(
|
||||
output->GetPointData()->GetArray("isSurface"));
|
||||
std::set<vtkIdType> neighbors;
|
||||
output->BuildLinks();
|
||||
double avg[3];
|
||||
|
||||
for (vtkIdType i = 0; i < output->GetNumberOfPoints(); i++) {
|
||||
if (!isSurface->GetValue(i)) continue;
|
||||
for (vtkIdType i = 0; i < surfacePoints->GetNumberOfValues(); i++) {
|
||||
vtkIdType id = surfacePoints->GetValue(i);
|
||||
|
||||
output->GetPointCells(i, neighborCells);
|
||||
output->GetPointCells(id, neighborCells);
|
||||
|
||||
if (neighborCells->GetNumberOfIds() != 0) {
|
||||
|
||||
@ -52,10 +54,7 @@ vtkTypeBool RelaxationFilter::RequestData(
|
||||
}
|
||||
cellPoints->Reset();
|
||||
}
|
||||
|
||||
if (neighbors.find(i) != neighbors.end()) {
|
||||
neighbors.erase(neighbors.find(i));
|
||||
}
|
||||
neighbors.erase(neighbors.find(id));
|
||||
if (neighbors.size() != 0) {
|
||||
avg[0] = 0; avg[1] = 0; avg[2] = 0;
|
||||
for (const vtkIdType &j : neighbors) {
|
||||
@ -64,7 +63,7 @@ vtkTypeBool RelaxationFilter::RequestData(
|
||||
vtkMath::Add(point, avg, avg);
|
||||
}
|
||||
vtkMath::MultiplyScalar(avg, 1. / neighbors.size());
|
||||
newPoints->SetPoint(i, avg);
|
||||
newPoints->SetPoint(id, avg);
|
||||
}
|
||||
}
|
||||
neighborCells->Reset();
|
||||
|
Loading…
Reference in New Issue
Block a user