------------------------------------------------------------------------------
| 49 | |
| 50 | //------------------------------------------------------------------------------ |
| 51 | int vtkDistributedPointCloudFilter::RequestData( |
| 52 | vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 53 | { |
| 54 | vtkPointSet* input = vtkPointSet::GetData(inputVector[0]); |
| 55 | if (!input) |
| 56 | { |
| 57 | vtkErrorMacro("No valid input!"); |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | vtkPolyData* output = vtkPolyData::GetData(outputVector); |
| 62 | if (!output) |
| 63 | { |
| 64 | vtkErrorMacro("No output object!"); |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | vtkMPIController* controller = vtkMPIController::SafeDownCast(this->Controller); |
| 69 | if (!controller) |
| 70 | { |
| 71 | // No MPI controller? Just pass points & point data |
| 72 | output->SetPoints(input->GetPoints()); |
| 73 | output->GetPointData()->ShallowCopy(input->GetPointData()); |
| 74 | return 1; |
| 75 | } |
| 76 | |
| 77 | std::vector<vtkMPIController*> subControllersTree; |
| 78 | if (this->InitializeKdTree(subControllersTree)) |
| 79 | { |
| 80 | double bounds[6]; |
| 81 | this->OptimizeBoundingBox(subControllersTree, input, bounds); |
| 82 | vtkDistributedPointCloudFilter::GetPointsInsideBounds(controller, input, output, bounds); |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | vtkErrorMacro("Sub-communicators are not correctly initialized, no distribution performed"); |
| 87 | return 0; |
| 88 | } |
| 89 | // Destroy the kdtree controllers |
| 90 | for (auto* c : subControllersTree) |
| 91 | { |
| 92 | c->Delete(); |
| 93 | } |
| 94 | |
| 95 | return 1; |
| 96 | } |
| 97 | |
| 98 | //------------------------------------------------------------------------------ |
| 99 | bool vtkDistributedPointCloudFilter::InitializeKdTree(std::vector<vtkMPIController*>& kdTreeRounds) |
nothing calls this directly
no test coverage detected