----------------------------------------------------------------------------
| 954 | |
| 955 | //---------------------------------------------------------------------------- |
| 956 | int vtkMarkBoundaryFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 957 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 958 | { |
| 959 | // get the info objects |
| 960 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 961 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 962 | |
| 963 | // get the input and output |
| 964 | vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 965 | vtkDataSet* output = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 966 | |
| 967 | // The output structure is the same as the input. Input point and cell data is |
| 968 | // copied through as well. |
| 969 | output->CopyStructure(input); |
| 970 | output->GetPointData()->PassData(input->GetPointData()); |
| 971 | output->GetCellData()->PassData(input->GetCellData()); |
| 972 | |
| 973 | // Create the required output arrays indicating boundary points, cells, |
| 974 | // mand optional faces. |
| 975 | vtkIdType numPts = input->GetNumberOfPoints(); |
| 976 | vtkIdType numCells = input->GetNumberOfCells(); |
| 977 | |
| 978 | vtkNew<vtkUnsignedCharArray> bPoints; |
| 979 | bPoints->SetNumberOfTuples(numPts); |
| 980 | bPoints->SetName(this->BoundaryPointsName); |
| 981 | output->GetPointData()->AddArray(bPoints); |
| 982 | |
| 983 | vtkNew<vtkUnsignedCharArray> bCells; |
| 984 | bCells->SetNumberOfTuples(numCells); |
| 985 | bCells->SetName(this->BoundaryCellsName); |
| 986 | output->GetCellData()->AddArray(bCells); |
| 987 | |
| 988 | vtkSmartPointer<vtkIdTypeArray> bFaces; |
| 989 | if (this->GenerateBoundaryFaces) |
| 990 | { |
| 991 | bFaces.TakeReference(vtkIdTypeArray::New()); |
| 992 | bFaces->SetNumberOfTuples(numCells); |
| 993 | bFaces->SetName(this->BoundaryFacesName); |
| 994 | output->GetCellData()->AddArray(bFaces); |
| 995 | } |
| 996 | |
| 997 | // Initially, nothing is marked on the boundary |
| 998 | InitializeBoundaryArrays(bPoints, bCells, bFaces); |
| 999 | unsigned char* bPtsPtr = bPoints->GetPointer(0); |
| 1000 | unsigned char* bCellsPtr = bCells->GetPointer(0); |
| 1001 | vtkIdType* bFacesPtr = (bFaces.Get() != nullptr ? bFaces->GetPointer(0) : nullptr); |
| 1002 | |
| 1003 | if (numCells == 0) |
| 1004 | { |
| 1005 | return 1; |
| 1006 | } |
| 1007 | |
| 1008 | // Grab ghost levels if needed |
| 1009 | unsigned char* cellGhosts = nullptr; |
| 1010 | vtkDataArray* temp = nullptr; |
| 1011 | temp = input->GetCellData()->GetArray(vtkDataSetAttributes::GhostArrayName()); |
| 1012 | if ((!temp) || (temp->GetDataType() != VTK_UNSIGNED_CHAR) || (temp->GetNumberOfComponents() != 1)) |
| 1013 | { |
nothing calls this directly
no test coverage detected