MCPcopy Create free account
hub / github.com/Kitware/VTK / WriteData

Method WriteData

IO/IOSS/vtkIOSSWriter.cxx:344–493  ·  view source on GitHub ↗

----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

342
343//----------------------------------------------------------------------------
344void 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();

Callers 1

RequestDataMethod · 0.95

Calls 15

createFunction · 0.85
GetVTKVersionFunction · 0.85
SetPartitionedDataSetMethod · 0.80
MD5Method · 0.80
GetNumberOfProcessesMethod · 0.80
GlobalIdsCreatedMethod · 0.80
GlobalIdsModifiedMethod · 0.80
ElementSideModifiedMethod · 0.80
property_addMethod · 0.80
PropertyClass · 0.50

Tested by

no test coverage detected