----------------------------------------------------------------------------
| 342 | |
| 343 | //---------------------------------------------------------------------------- |
| 344 | void vtkIOSSWriter::WriteData() |
| 345 | { |
| 346 | vtkSmartPointer<vtkDataObject> inputDO = this->GetInput(); |
| 347 | if (vtkDataSet::SafeDownCast(inputDO)) |
| 348 | { |
| 349 | vtkNew<vtkPartitionedDataSet> pd; |
| 350 | pd->SetPartition(0, inputDO); |
| 351 | inputDO = pd; |
| 352 | } |
| 353 | |
| 354 | if (auto pd = vtkPartitionedDataSet::SafeDownCast(inputDO)) |
| 355 | { |
| 356 | vtkNew<vtkPartitionedDataSetCollection> pdc; |
| 357 | pdc->SetPartitionedDataSet(0, pd); |
| 358 | inputDO = pdc; |
| 359 | } |
| 360 | |
| 361 | auto inputPDC = vtkPartitionedDataSetCollection::SafeDownCast(inputDO); |
| 362 | if (!inputPDC) |
| 363 | { |
| 364 | vtkErrorMacro("Incorrect input type!"); |
| 365 | return; |
| 366 | } |
| 367 | |
| 368 | auto& internals = (*this->Internals); |
| 369 | auto* controller = this->GetController(); |
| 370 | |
| 371 | const vtkIOSSModel model(inputPDC, this); |
| 372 | const auto md5 = model.MD5(); |
| 373 | vtkLogF(TRACE, "MD5: %s", md5.c_str()); |
| 374 | |
| 375 | int structureChanged = internals.LastMD5 != md5; |
| 376 | // ensure that all processes agree on whether the structure changed |
| 377 | if (controller && controller->GetNumberOfProcesses() > 1) |
| 378 | { |
| 379 | int globalStructureChanged; |
| 380 | controller->AllReduce(&structureChanged, &globalStructureChanged, 1, vtkCommunicator::MAX_OP); |
| 381 | structureChanged = globalStructureChanged; |
| 382 | } |
| 383 | // checks for global ids and element_side warnings |
| 384 | if (model.GlobalIdsCreated() && model.GlobalIdsCreated() != internals.LastGlobalIdsCreated) |
| 385 | { |
| 386 | internals.LastGlobalIdsCreated = model.GlobalIdsCreated(); |
| 387 | vtkWarningMacro("Point or Cell Global IDs were not present. They have been created " |
| 388 | "assuming uniqueness."); |
| 389 | } |
| 390 | else if (model.GlobalIdsModified() && |
| 391 | model.GlobalIdsModified() != internals.LastGlobalIdsModified) |
| 392 | { |
| 393 | internals.LastGlobalIdsModified = model.GlobalIdsModified(); |
| 394 | vtkWarningMacro( |
| 395 | "Point or Cell Global IDs were invalid. They have been re-created assuming uniqueness."); |
| 396 | } |
| 397 | // checks for element_side |
| 398 | if (model.ElementSideCouldNotBeCreated() && |
| 399 | model.ElementSideCouldNotBeCreated() != internals.LastElementSideCouldNotBeCreated) |
| 400 | { |
| 401 | internals.LastElementSideCouldNotBeCreated = model.ElementSideCouldNotBeCreated(); |
no test coverage detected