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

Method CopyCacheToDataObject

Filters/Temporal/vtkDataObjectMeshCache.cxx:442–492  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

440
441//------------------------------------------------------------------------------
442void vtkDataObjectMeshCache::CopyCacheToDataObject(vtkDataObject* output)
443{
444 if (!output)
445 {
446 vtkWarningMacro("Cannot copy to nullptr");
447 return;
448 }
449 if (!this->Cache)
450 {
451 vtkWarningMacro("Cannot copy from nullptr");
452 return;
453 }
454
455 if (!this->IsSupportedData(output))
456 {
457 vtkWarningMacro("Cannot copy to unsupported data type: " << output->GetClassName());
458 return;
459 }
460 vtkSmartPointer<vtkDataObject> input = nullptr;
461 if (this->HasConsumerNoInputPort())
462 {
463 input = vtkSmartPointer<vtkDataObject>::Take(output->NewInstance());
464 input->ShallowCopy(output);
465 }
466 else if (this->OriginalDataSet)
467 {
468 input = this->OriginalDataSet.Get();
469 }
470 else if (this->OriginalCompositeDataSet)
471 {
472 input = this->OriginalCompositeDataSet.Get();
473 }
474
475 vtkCacheLog(INFO, " Copy Cache to data object");
476 output->ShallowCopy(this->Cache);
477 this->ClearAttributes(output);
478
479 auto outputDataSet = vtkDataSet::SafeDownCast(output);
480 auto outputComposite = vtkCompositeDataSet::SafeDownCast(output);
481 if (outputDataSet)
482 {
483 auto cacheDataSet = vtkDataSet::SafeDownCast(this->Cache);
484 auto inputDataSet = vtkDataSet::SafeDownCast(input);
485 this->ForwardAttributesToDataSet(inputDataSet, cacheDataSet, outputDataSet);
486 }
487 else if (outputComposite)
488 {
489 auto inputComposite = vtkCompositeDataSet::SafeDownCast(input);
490 this->ForwardAttributesToComposite(inputComposite, outputComposite);
491 }
492}
493
494//------------------------------------------------------------------------------
495void vtkDataObjectMeshCache::ForwardAttributesToDataSet(

Callers 8

ReadGeometryMethod · 0.80
UpdateGeometryIfRequiredFunction · 0.80
UseCacheIfPossibleMethod · 0.80
TestUseCacheFunction · 0.80
TestMeshOnlyFunction · 0.80
TestGhostCellsFunction · 0.80
TestUseCompositeCacheFunction · 0.80
TestUnsupportedCallsFunction · 0.80

Calls 10

IsSupportedDataMethod · 0.95
ClearAttributesMethod · 0.95
TakeFunction · 0.85
GetClassNameMethod · 0.45
NewInstanceMethod · 0.45
ShallowCopyMethod · 0.45
GetMethod · 0.45

Tested by 5

TestUseCacheFunction · 0.64
TestMeshOnlyFunction · 0.64
TestGhostCellsFunction · 0.64
TestUseCompositeCacheFunction · 0.64
TestUnsupportedCallsFunction · 0.64