| 670 | } |
| 671 | |
| 672 | int vtkGenerateStatistics::RequestLocalDataDispatch( |
| 673 | vtkDataObject* dataObject, vtkPartitionedDataSetCollection* modelTree) |
| 674 | { |
| 675 | // Either we have a composite input dataset or a single data object of interest. |
| 676 | vtkCompositeDataSet* compDataObjIn = vtkCompositeDataSet::SafeDownCast(dataObject); |
| 677 | if (compDataObjIn) |
| 678 | { |
| 679 | // We handle two cases for now: vtkStatisticalModel and vtkPartitionedData. |
| 680 | // |
| 681 | // For the case of vtkStatisticalModel, we require either a |
| 682 | // vtkDataAssembly or (for vtkUniformGridAMR) vtkAMRMetaData. |
| 683 | // In either case, we construct either a single model from all matching leaf data |
| 684 | // or a model per entry of the vtkDataAssembly/vtkAMRMetaData tree; the difference is |
| 685 | // that when SingleModel is false, we key models for AMR data based on their (level, block) |
| 686 | // index while for other PDCs, we key models to match vtkDataAssembly nodes. |
| 687 | if (auto* amr = vtkUniformGridAMR::SafeDownCast(compDataObjIn)) |
| 688 | { |
| 689 | return this->RequestDataAMR(amr, modelTree); |
| 690 | } |
| 691 | else if (auto* pd = vtkPartitionedDataSet::SafeDownCast(compDataObjIn)) |
| 692 | { |
| 693 | // Unlike other composite data, a partitioned dataset will always result in a |
| 694 | // single model. |
| 695 | vtkNew<vtkStatisticalModel> model; |
| 696 | if (this->RequestDataPD(pd, model) == 1) |
| 697 | { |
| 698 | modelTree->SetPartition(0, 0, model); |
| 699 | vtkNew<vtkDataAssembly> tree; |
| 700 | int node = tree->AddNode("Statistics", 0); |
| 701 | tree->AddDataSetIndex(node, 0); |
| 702 | modelTree->SetDataAssembly(tree); |
| 703 | return 1; |
| 704 | } |
| 705 | return 0; |
| 706 | } |
| 707 | // If given a multi-block dataset, this will error out: |
| 708 | return this->RequestDataPDC( |
| 709 | vtkPartitionedDataSetCollection::SafeDownCast(compDataObjIn), modelTree); |
| 710 | } |
| 711 | |
| 712 | // The remaining data types we handle always result in a single model rather |
| 713 | // than possibly a hierarchy of models. |
| 714 | vtkNew<vtkStatisticalModel> model; |
| 715 | vtkNew<vtkDataAssembly> tree; |
| 716 | modelTree->SetPartition(0, 0, model); |
| 717 | int node = tree->AddNode("Statistics", 0); |
| 718 | tree->AddDataSetIndex(node, 0); |
| 719 | modelTree->SetDataAssembly(tree); |
| 720 | |
| 721 | return this->RequestDataNonComposite(dataObject, model); |
| 722 | } |
| 723 | |
| 724 | int vtkGenerateStatistics::RequestDataNonComposite( |
| 725 | vtkDataObject* dataObject, vtkStatisticalModel* model) |
no test coverage detected