------------------------------------------------------------------------------
| 511 | |
| 512 | //------------------------------------------------------------------------------ |
| 513 | int vtkHDFReader::RequestDataObject(vtkInformation*, vtkInformationVector** vtkNotUsed(inputVector), |
| 514 | vtkInformationVector* outputVector) |
| 515 | { |
| 516 | std::map<int, std::string> typeNameMap = { { VTK_IMAGE_DATA, "vtkImageData" }, |
| 517 | { VTK_UNSTRUCTURED_GRID, "vtkUnstructuredGrid" }, { VTK_POLY_DATA, "vtkPolyData" }, |
| 518 | { VTK_OVERLAPPING_AMR, "vtkOverlappingAMR" }, { VTK_HYPER_TREE_GRID, "vtkHyperTreeGrid" }, |
| 519 | { VTK_PARTITIONED_DATA_SET_COLLECTION, "vtkPartitionedDataSetCollection" }, |
| 520 | { VTK_MULTIBLOCK_DATA_SET, "vtkMultiBlockDataSet" } }; |
| 521 | |
| 522 | vtkInformation* info = outputVector->GetInformationObject(0); |
| 523 | vtkDataObject* output = info->Get(vtkDataObject::DATA_OBJECT()); |
| 524 | |
| 525 | if (!this->FileName && !this->Stream) |
| 526 | { |
| 527 | vtkErrorMacro("Requires valid input file name or stream"); |
| 528 | return 0; |
| 529 | } |
| 530 | |
| 531 | if (this->Stream) |
| 532 | { |
| 533 | this->Stream->Seek(0, vtkResourceStream::SeekDirection::Begin); |
| 534 | if (!this->Impl->Open(this->Stream)) |
| 535 | { |
| 536 | return 0; |
| 537 | } |
| 538 | } |
| 539 | else if (!this->Impl->Open(this->FileName)) |
| 540 | { |
| 541 | return 0; |
| 542 | } |
| 543 | |
| 544 | auto version = this->Impl->GetVersion(); |
| 545 | if (!CanReadFileVersion(version[0], version[1])) |
| 546 | { |
| 547 | vtkWarningMacro("File version: " << version[0] << "." << version[1] |
| 548 | << " is higher than " |
| 549 | "this reader supports " |
| 550 | << vtkHDFMajorVersion << "." << vtkHDFMinorVersion); |
| 551 | } |
| 552 | |
| 553 | if (this->MergeParts) |
| 554 | { |
| 555 | vtkWarningMacro("MergeParts option will be ignored. Please use vtkMergeBlocks instead."); |
| 556 | } |
| 557 | |
| 558 | this->NumberOfSteps = this->Impl->GetNumberOfSteps(); |
| 559 | const int numPieces = this->Impl->GetNumberOfPieces(this->Step); |
| 560 | this->SetHasTemporalData(this->NumberOfSteps > 1); |
| 561 | const int dataSetType = this->Impl->GetDataSetType(); |
| 562 | if (!output || !output->IsA(typeNameMap[dataSetType].c_str())) |
| 563 | { |
| 564 | this->Assembly = vtkSmartPointer<vtkDataAssembly>::New(); |
| 565 | info->Set(vtkDataObject::DATA_OBJECT(), this->Impl->GetNewDataSet(dataSetType, numPieces)); |
| 566 | for (int i = 0; i < vtkHDFUtilities::GetNumberOfAttributeTypes(); ++i) |
| 567 | { |
| 568 | const std::vector<std::string> arrayNames = this->Impl->GetArrayNames(i); |
| 569 | // Remove obsolete arrays from selection |
| 570 | vtkIdType arrId = 0; |
nothing calls this directly
no test coverage detected