| 275 | } |
| 276 | |
| 277 | bool vtkUnstructuredGridToCellGrid::ProcessUnstructuredGrid( |
| 278 | vtkUnstructuredGrid* input, vtkCellGrid* output) |
| 279 | { |
| 280 | // Add every type of cell to the output (so the query |
| 281 | // asks each one which input cells it can claim). |
| 282 | output->Initialize(); |
| 283 | output->AddAllCellMetadata(); |
| 284 | |
| 285 | // Now claim cells: |
| 286 | this->Request->Input = input; |
| 287 | this->Request->Output = output; |
| 288 | this->Request->Phase = VTK_TRANSCRIBE_CELLGRID_PHASE_CLAIM; |
| 289 | if (!output->Query(this->Request)) |
| 290 | { |
| 291 | vtkErrorMacro("Cell-grid failed to claim input cells."); |
| 292 | return false; |
| 293 | } |
| 294 | this->Request->Input = input; |
| 295 | this->Request->Output = output; |
| 296 | if (!this->Request->SumOutputCounts()) |
| 297 | { |
| 298 | // TODO: Warn or error or ignore when unhandled input cells exist? Should be configurable. |
| 299 | vtkWarningMacro("One or more unhandled input cells exist."); |
| 300 | } |
| 301 | this->Request->Phase = VTK_TRANSCRIBE_CELLGRID_PHASE_CONVERT; |
| 302 | if (!output->Query(this->Request)) |
| 303 | { |
| 304 | vtkErrorMacro("Cell-grid failed to transcribe some claimed input cells."); |
| 305 | return false; |
| 306 | } |
| 307 | output->RemoveUnusedCellMetadata(); |
| 308 | |
| 309 | // TODO: Will we ever copy schema/content information from the unstructured grid? |
| 310 | output->SetSchema("dg leaf", 1); |
| 311 | output->SetContentVersion(1); |
| 312 | return true; |
| 313 | } |
| 314 | |
| 315 | VTK_ABI_NAMESPACE_END |
no test coverage detected