------------------------------------------------------------------------------
| 247 | |
| 248 | //------------------------------------------------------------------------------ |
| 249 | int vtkExtractBlockUsingDataAssembly::RequestData( |
| 250 | vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 251 | { |
| 252 | const auto& internals = (*this->Internals); |
| 253 | |
| 254 | if (this->AssemblyName == nullptr) |
| 255 | { |
| 256 | vtkErrorMacro("AssemblyName must be specified."); |
| 257 | return 0; |
| 258 | } |
| 259 | |
| 260 | auto inputCD = vtkCompositeDataSet::GetData(inputVector[0], 0); |
| 261 | assert(inputCD != nullptr); |
| 262 | |
| 263 | auto outputCD = vtkCompositeDataSet::GetData(outputVector, 0); |
| 264 | |
| 265 | // Ensure field data from input is copied to output when this method returns. |
| 266 | vtkScopedFieldDataCopier copier(inputCD, outputCD); |
| 267 | |
| 268 | // if the input is a vtkPartitionedDataSet, we have nothing to do but copy it over. |
| 269 | if (auto pd = vtkPartitionedDataSet::SafeDownCast(inputCD)) |
| 270 | { |
| 271 | outputCD->ShallowCopy(pd); |
| 272 | return 1; |
| 273 | } |
| 274 | |
| 275 | auto assembly = vtkDataAssemblyUtilities::GetDataAssembly(this->AssemblyName, inputCD); |
| 276 | if (!assembly) |
| 277 | { |
| 278 | vtkErrorMacro("Invalid assembly name '" << this->AssemblyName |
| 279 | << "' for input " |
| 280 | "of type " |
| 281 | << inputCD->GetClassName()); |
| 282 | return 0; |
| 283 | } |
| 284 | |
| 285 | const bool useHierarchy = |
| 286 | (strcmp(this->AssemblyName, vtkDataAssemblyUtilities::HierarchyName()) == 0); |
| 287 | |
| 288 | if (useHierarchy) |
| 289 | { |
| 290 | vtkNew<vtkPartitionedDataSetCollection> xformedInput; |
| 291 | vtkNew<vtkDataAssembly> tmpHierarchy; |
| 292 | if (!vtkDataAssemblyUtilities::GenerateHierarchy(inputCD, tmpHierarchy, xformedInput)) |
| 293 | { |
| 294 | vtkErrorMacro("Failed to generate hierarchy for input of type " << inputCD->GetClassName()); |
| 295 | return 0; |
| 296 | } |
| 297 | |
| 298 | auto hierarchy = xformedInput->GetDataAssembly(); |
| 299 | assert(hierarchy != nullptr); |
| 300 | |
| 301 | if (auto outputPDC = vtkPartitionedDataSetCollection::GetData(outputVector, 0)) |
| 302 | { |
| 303 | std::vector<vtkSmartPointer<vtkDataAssembly>> input_assemblies, output_assemblies; |
| 304 | if (auto inputPDC = vtkPartitionedDataSetCollection::SafeDownCast(inputCD)) |
| 305 | { |
| 306 | if (inputPDC->GetDataAssembly() != nullptr) |
nothing calls this directly
no test coverage detected