| 134 | } |
| 135 | |
| 136 | int vtkExtractStatisticalModelTables::RequestData(vtkInformation* vtkNotUsed(request), |
| 137 | vtkInformationVector** inInfoVec, vtkInformationVector* outInfoVec) |
| 138 | { |
| 139 | auto* model = vtkStatisticalModel::GetData(inInfoVec[0]); |
| 140 | auto* pdc = vtkPartitionedDataSetCollection::GetData(inInfoVec[0]); |
| 141 | auto* out = vtkPartitionedDataSetCollection::GetData(outInfoVec); |
| 142 | |
| 143 | if (pdc && (pdc->GetNumberOfPartitionedDataSets() == 0 || !pdc->GetDataAssembly())) |
| 144 | { |
| 145 | // Empty input ⇒ empty output |
| 146 | out->Initialize(); |
| 147 | return 1; |
| 148 | } |
| 149 | |
| 150 | vtkNew<vtkDataAssembly> resultAssy; |
| 151 | |
| 152 | if (model) |
| 153 | { |
| 154 | AddModelToAssembly(out, model, resultAssy, /*root node of model*/ 0); |
| 155 | } |
| 156 | else if (pdc) |
| 157 | { |
| 158 | // Copy the input's structure so all node IDs match, but remove dataset references: |
| 159 | auto* assemblyIn = pdc->GetDataAssembly(); |
| 160 | resultAssy->DeepCopy(assemblyIn); |
| 161 | resultAssy->RemoveAllDataSetIndices(0, /*traverse_subtree*/ true); |
| 162 | // Create a visitor for the input collection. |
| 163 | vtkNew<ModelExtractor> extractor; |
| 164 | extractor->Initialize(pdc, out, resultAssy); |
| 165 | // Add new node IDs for statistical models by traversing the input: |
| 166 | assemblyIn->Visit(extractor); |
| 167 | } |
| 168 | else |
| 169 | { |
| 170 | auto* data = vtkDataObject::GetData(inInfoVec[0]); |
| 171 | vtkErrorMacro("Unhandled input type \"" << (data ? data->GetClassName() : "null") << "\"."); |
| 172 | return 0; |
| 173 | } |
| 174 | out->SetDataAssembly(resultAssy); |
| 175 | |
| 176 | return 1; |
| 177 | } |
| 178 | |
| 179 | VTK_ABI_NAMESPACE_END |
nothing calls this directly
no test coverage detected