76 vtkInformation *vtkNotUsed(request),
77 vtkInformationVector **inputVector,
78 vtkInformationVector *outputVector)
80 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
81 vtkInformation *outInfo = outputVector->GetInformationObject(0);
83 vtkPolyData *input = vtkPolyData::SafeDownCast(
84 inInfo->Get(vtkDataObject::DATA_OBJECT()));
85 vtkPolyData *output = vtkPolyData::SafeDownCast(
86 outInfo->Get(vtkDataObject::DATA_OBJECT()));
88 if ( input->GetNumberOfPoints() < 1 )
97 vtkPoints* newPoints = vtkPoints::New();
98 newPoints->DeepCopy(input->GetPoints());
100 vtkCellArray* newPolys = vtkCellArray::New();
101 newPolys->DeepCopy(input->GetPolys());
103 vtkIdTypeArray* cellEntityIdsArray = NULL;
107 cellEntityIdsArray = vtkIdTypeArray::New();
108 cellEntityIdsArray->SetName(this->CellEntityIdsArrayName);
109 if (input->GetCellData()->GetArray(this->CellEntityIdsArrayName))
111 cellEntityIdsArray->DeepCopy(input->GetCellData()->GetArray(this->CellEntityIdsArrayName));
115 cellEntityIdsArray->SetNumberOfTuples(newPolys->GetNumberOfCells());
123 vtkNew<vtkPolyData> boundaries;
124 vtkNew<vtkIdList> boundaryLabels;
128 for (
int i=0; i<boundaries->GetNumberOfCells(); i++)
132 vtkIdType boundaryId = useBoundaryLabels ? boundaryLabels->GetId(i) : i;
140 vtkPolyLine* boundary = vtkPolyLine::SafeDownCast(boundaries->GetCell(i));
141 vtkIdType numberOfBoundaryPoints = boundary->GetNumberOfPoints();
142 vtkIdList* boundaryPointIds = vtkIdList::New();
143 boundaryPointIds->SetNumberOfIds(numberOfBoundaryPoints);
144 for (
int j=0; j<numberOfBoundaryPoints; j++)
146 boundaryPointIds->SetId(j,
static_cast<vtkIdType
>(boundaries->GetPointData()->GetScalars()->GetTuple1(boundary->GetPointId(j))));
148 newPolys->InsertNextCell(boundaryPointIds);
156 vtkIdType capCellEntityId = useBoundaryLabels ? boundaryId : i+1+this->
CellEntityIdOffset;
159 && this->BoundaryCellEntityIds->GetValue(boundaryId) >= 0)
163 cellEntityIdsArray->InsertNextValue(capCellEntityId);
165 boundaryPointIds->Delete();
168 output->SetPoints(newPoints);
169 output->SetPolys(newPolys);
171 output->GetPointData()->PassData(input->GetPointData());
175 output->GetCellData()->AddArray(cellEntityIdsArray);
176 cellEntityIdsArray->Delete();