------------------------------------------------------------------------------
| 27 | |
| 28 | //------------------------------------------------------------------------------ |
| 29 | int vtkGenerateProcessIds::RequestData(vtkInformation* vtkNotUsed(request), |
| 30 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 31 | { |
| 32 | // get the info objects |
| 33 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 34 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 35 | if (!inInfo || !outInfo) |
| 36 | { |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | // get the input and output |
| 41 | vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 42 | vtkDataSet* output = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 43 | if (!input || !output) |
| 44 | { |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | vtkIdType piece = |
| 49 | this->Controller ? static_cast<vtkIdType>(this->Controller->GetLocalProcessId()) : 0; |
| 50 | output->ShallowCopy(input); |
| 51 | |
| 52 | if (this->GeneratePointData) |
| 53 | { |
| 54 | vtkIdType numberOfPoints = input->GetNumberOfPoints(); |
| 55 | auto processIds = this->GenerateProcessIds(piece, numberOfPoints); |
| 56 | processIds->SetName("PointProcessIds"); |
| 57 | output->GetPointData()->SetProcessIds(processIds); |
| 58 | } |
| 59 | if (this->GenerateCellData) |
| 60 | { |
| 61 | vtkIdType numberOfCells = input->GetNumberOfCells(); |
| 62 | auto processIds = this->GenerateProcessIds(piece, numberOfCells); |
| 63 | processIds->SetName("CellProcessIds"); |
| 64 | output->GetCellData()->SetProcessIds(processIds); |
| 65 | } |
| 66 | |
| 67 | return 1; |
| 68 | } |
| 69 | |
| 70 | //------------------------------------------------------------------------------ |
| 71 | vtkSmartPointer<vtkConstantArray<vtkIdType>> vtkGenerateProcessIds::GenerateProcessIds( |
nothing calls this directly
no test coverage detected