------------------------------------------------------------------------------
| 194 | |
| 195 | //------------------------------------------------------------------------------ |
| 196 | int vtkPDistributedDataFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 197 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 198 | { |
| 199 | TimeLog timer("D3::RequestData", this->Timing, true); |
| 200 | (void)timer; |
| 201 | |
| 202 | // get the info objects |
| 203 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 204 | |
| 205 | this->GhostLevel = |
| 206 | outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS()); |
| 207 | this->GhostLevel = std::max(this->GhostLevel, this->MinimumGhostLevel); |
| 208 | |
| 209 | // get the input and output |
| 210 | vtkDataSet* inputDS = vtkDataSet::GetData(inputVector[0], 0); |
| 211 | vtkUnstructuredGrid* outputUG = vtkUnstructuredGrid::GetData(outInfo); |
| 212 | if (inputDS && outputUG) |
| 213 | { |
| 214 | return this->RequestDataInternal(inputDS, outputUG); |
| 215 | } |
| 216 | |
| 217 | vtkCompositeDataSet* inputCD = vtkCompositeDataSet::GetData(inputVector[0], 0); |
| 218 | vtkMultiBlockDataSet* outputMB = vtkMultiBlockDataSet::GetData(outputVector, 0); |
| 219 | if (!inputCD || !outputMB) |
| 220 | { |
| 221 | vtkErrorMacro("Input must either be a composite dataset or a vtkDataSet."); |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | outputMB->CopyStructure(inputCD); |
| 226 | |
| 227 | TimeLog::StartEvent("Classify leaves", this->Timing); |
| 228 | vtkSmartPointer<vtkCompositeDataIterator> iter; |
| 229 | iter.TakeReference(inputCD->NewIterator()); |
| 230 | // We want to traverse over empty nodes as well. This ensures that this |
| 231 | // algorithm will work correctly in parallel. |
| 232 | iter->SkipEmptyNodesOff(); |
| 233 | |
| 234 | // Collect information about datatypes all the processes have at all the leaf |
| 235 | // nodes. Ideally all processes will either have the same type or an empty |
| 236 | // dataset. This assumes that all processes have the same composite structure. |
| 237 | std::vector<int> leafTypes; |
| 238 | for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem()) |
| 239 | { |
| 240 | vtkDataObject* dObj = iter->GetCurrentDataObject(); |
| 241 | if (dObj) |
| 242 | { |
| 243 | leafTypes.push_back(dObj->GetDataObjectType()); |
| 244 | } |
| 245 | else |
| 246 | { |
| 247 | leafTypes.push_back(-1); |
| 248 | } |
| 249 | } |
| 250 | unsigned int numLeaves = static_cast<unsigned int>(leafTypes.size()); |
| 251 | |
| 252 | int myId = this->Controller->GetLocalProcessId(); |
| 253 | int numProcs = this->Controller->GetNumberOfProcesses(); |
nothing calls this directly
no test coverage detected