diff --git a/src/remove_external_cells_filter.cc b/src/remove_external_cells_filter.cc index c16f2e0..f3a2455 100644 --- a/src/remove_external_cells_filter.cc +++ b/src/remove_external_cells_filter.cc @@ -126,7 +126,7 @@ vtkTypeBool RemoveExternalCellsFilter::RequestData( vtkNew outPoints; vtkNew outPointIds; vtkIdType outPointId = 0; - outPointIds->Allocate(3); + outPointIds->SetNumberOfIds(4); output->Allocate(); auto it = tetMesh->NewCellIterator(); for (it->InitTraversal(); @@ -140,12 +140,14 @@ vtkTypeBool RemoveExternalCellsFilter::RequestData( outPointIds->SetId(0, outPointId + 0); outPointIds->SetId(1, outPointId + 1); outPointIds->SetId(2, outPointId + 2); - outPointId += 3; + outPointIds->SetId(3, outPointId + 3); + outPointId += 4; outPoints->InsertPoints(outPointIds, pointIds, tetMesh->GetPoints()); output->InsertNextCell(it->GetCellType(), outPointIds); } } + outPoints->SetNumberOfPoints(outPointId + 3); output->SetPoints(outPoints); return true;