| 189 | } |
| 190 | |
| 191 | int vtkUnstructuredGridToCellGrid::RequestData( |
| 192 | vtkInformation* vtkNotUsed(request), vtkInformationVector** inInfo, vtkInformationVector* ouInfo) |
| 193 | { |
| 194 | vtkSmartPointer<vtkPartitionedDataSetCollection> inputPDC; |
| 195 | inputPDC = vtkPartitionedDataSetCollection::GetData(inInfo[0]); |
| 196 | if (!inputPDC) |
| 197 | { |
| 198 | auto* input = vtkUnstructuredGrid::GetData(inInfo[0]); |
| 199 | if (input) |
| 200 | { |
| 201 | inputPDC = vtkSmartPointer<vtkPartitionedDataSetCollection>::New(); |
| 202 | inputPDC->SetNumberOfPartitionedDataSets(1); |
| 203 | inputPDC->SetPartition(0, 0, input); |
| 204 | } |
| 205 | } |
| 206 | auto* output = vtkPartitionedDataSetCollection::GetData(ouInfo); |
| 207 | if (!inputPDC) |
| 208 | { |
| 209 | vtkWarningMacro("Empty input or input of wrong type."); |
| 210 | return 1; |
| 211 | } |
| 212 | if (!output) |
| 213 | { |
| 214 | vtkErrorMacro("Empty output."); |
| 215 | return 0; |
| 216 | } |
| 217 | |
| 218 | // Copy the input's hierarchical block arrangement if it exists: |
| 219 | if (inputPDC->GetDataAssembly()) |
| 220 | { |
| 221 | vtkNew<vtkDataAssembly> dataAssembly; |
| 222 | dataAssembly->DeepCopy(inputPDC->GetDataAssembly()); |
| 223 | output->SetDataAssembly(dataAssembly); |
| 224 | } |
| 225 | |
| 226 | // Look for annotations specifying DG cell-attributes. |
| 227 | // this->AddAnnotatedAttributes(inputPDC); |
| 228 | // Reset any annotations from the ustructured grid and re-ingest. |
| 229 | this->Request->Annotations->Reset(); |
| 230 | this->Request->Annotations->FetchAnnotations( |
| 231 | inputPDC->GetFieldData(), inputPDC->GetDataAssembly()); |
| 232 | |
| 233 | // Iterate over partitioned datasets and turn unstructured grids |
| 234 | // into cell grids. |
| 235 | // |
| 236 | // NB: We cannot use vtkPartitionedDataSetCollection::NewIterator() |
| 237 | // to fetch an iterator because there is no mapping between that |
| 238 | // iterator's flat index and the flat index of the parent node ID |
| 239 | // in the vtkDataAssembly. |
| 240 | // For instance, given a data assembly like this: |
| 241 | // + root 1 |
| 242 | // + node 2 : dataset ids 0, 3 |
| 243 | // + node 3 : dataset ids 1 |
| 244 | // + node 4 : dataset ids 2 |
| 245 | // When a composite iterator points to a dataset held inside |
| 246 | // dataset id 1 (itself a partitioned-dataset), there is no |
| 247 | // way to discover the flat index of dataset id 1 from the |
| 248 | // (non-partitioned) child dataset or the iterator. |
nothing calls this directly
no test coverage detected