----------------------------------------------------------------------------
| 156 | |
| 157 | //---------------------------------------------------------------------------- |
| 158 | int vtkGroupDataSetsFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 159 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 160 | { |
| 161 | const auto& internals = (*this->Internals); |
| 162 | std::vector<std::pair<std::string, vtkSmartPointer<vtkDataObject>>> inputs; |
| 163 | |
| 164 | const int numInputs = inputVector[0]->GetNumberOfInformationObjects(); |
| 165 | const int precision = numInputs > 0 ? static_cast<int>(std::log10(numInputs) + 1) : 1; |
| 166 | for (int cc = 0; cc < numInputs; ++cc) |
| 167 | { |
| 168 | auto dObject = vtkDataObject::GetData(inputVector[0], cc); |
| 169 | auto name = internals.GetName(cc, this->OutputType, precision); |
| 170 | inputs.emplace_back(name, dObject); |
| 171 | } |
| 172 | |
| 173 | if (this->OutputType == VTK_PARTITIONED_DATA_SET) |
| 174 | { |
| 175 | unsigned int next = 0; |
| 176 | auto output = vtkPartitionedDataSet::GetData(outputVector, 0); |
| 177 | for (auto& input : inputs) |
| 178 | { |
| 179 | if (this->CheckAbort()) |
| 180 | { |
| 181 | break; |
| 182 | } |
| 183 | const auto datasets = vtkCompositeDataSet::GetDataSets<vtkDataObject>(input.second); |
| 184 | for (auto& ds : datasets) |
| 185 | { |
| 186 | output->SetPartition(next++, ds); |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | else if (this->OutputType == VTK_MULTIBLOCK_DATA_SET) |
| 191 | { |
| 192 | unsigned int next = 0; |
| 193 | auto output = vtkMultiBlockDataSet::GetData(outputVector, 0); |
| 194 | for (auto& input : inputs) |
| 195 | { |
| 196 | if (this->CheckAbort()) |
| 197 | { |
| 198 | break; |
| 199 | } |
| 200 | const auto idx = next++; |
| 201 | vtkSmartPointer<vtkDataObject> inputDO; |
| 202 | auto inputMB = vtkMultiBlockDataSet::SafeDownCast(input.second); |
| 203 | if (vtkPartitionedDataSetCollection::SafeDownCast(input.second)) |
| 204 | { |
| 205 | vtkNew<vtkConvertToMultiBlockDataSet> converter; |
| 206 | converter->SetInputDataObject(input.second); |
| 207 | converter->Update(); |
| 208 | inputDO = converter->GetOutput(); |
| 209 | } |
| 210 | else if (auto inputPD = vtkPartitionedDataSet::SafeDownCast(input.second)) |
| 211 | { |
| 212 | vtkNew<vtkMultiPieceDataSet> data; |
| 213 | data->ShallowCopy(inputPD); |
| 214 | inputDO = data; |
| 215 | } |
nothing calls this directly
no test coverage detected