------------------------------------------------------------------------------
| 102 | |
| 103 | //------------------------------------------------------------------------------ |
| 104 | int vtkDIYAggregateDataSetFilter::RequestData( |
| 105 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 106 | { |
| 107 | vtkDataSet* input = nullptr; |
| 108 | vtkDataSet* output = vtkDataSet::GetData(outputVector, 0); |
| 109 | |
| 110 | if (inputVector[0]->GetNumberOfInformationObjects() > 0) |
| 111 | { |
| 112 | input = vtkDataSet::GetData(inputVector[0], 0); |
| 113 | } |
| 114 | |
| 115 | vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController(); |
| 116 | |
| 117 | int numberOfProcesses = controller->GetNumberOfProcesses(); |
| 118 | int myRank = controller->GetLocalProcessId(); |
| 119 | if (numberOfProcesses == this->NumberOfTargetProcesses) |
| 120 | { |
| 121 | if (input) |
| 122 | { |
| 123 | output->ShallowCopy(input); |
| 124 | } |
| 125 | return 1; |
| 126 | } |
| 127 | |
| 128 | if (input->IsA("vtkUnstructuredGrid") || input->IsA("vtkPolyData")) |
| 129 | { |
| 130 | // the superclass handles unstructured grids and polydata |
| 131 | return this->Superclass::RequestData(request, inputVector, outputVector); |
| 132 | } |
| 133 | // mark that the output grid hasn't been touched yet |
| 134 | this->OutputInitialized = false; |
| 135 | // DIY bounds are really just based on extents |
| 136 | vtkInformation* outputInfo = outputVector->GetInformationObject(0); |
| 137 | int wholeExtent[6] = { 0, -1, 0, -1, 0, -1 }; // empty by default |
| 138 | outputInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wholeExtent); |
| 139 | int outputExtent[6] = { 0, -1, 0, -1, 0, -1 }; // empty by default |
| 140 | |
| 141 | vtkNew<vtkExtentTranslator> extentTranslator; |
| 142 | int targetProcessId = this->GetTargetProcessId(myRank, numberOfProcesses); |
| 143 | if (targetProcessId != -1) |
| 144 | { |
| 145 | extentTranslator->PieceToExtentThreadSafe(targetProcessId, this->GetNumberOfTargetProcesses(), |
| 146 | 0, wholeExtent, outputExtent, vtkExtentTranslator::BLOCK_MODE, 0); |
| 147 | } |
| 148 | |
| 149 | if (vtkImageData* idOutput = vtkImageData::SafeDownCast(output)) |
| 150 | { |
| 151 | idOutput->SetExtent(outputExtent); |
| 152 | } |
| 153 | else if (vtkRectilinearGrid* rgOutput = vtkRectilinearGrid::SafeDownCast(output)) |
| 154 | { |
| 155 | rgOutput->SetExtent(outputExtent); |
| 156 | } |
| 157 | else if (vtkStructuredGrid* sgOutput = vtkStructuredGrid::SafeDownCast(output)) |
| 158 | { |
| 159 | sgOutput->SetExtent(outputExtent); |
| 160 | } |
| 161 |
nothing calls this directly
no test coverage detected