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

Method CopyDefaultInformation

Common/ExecutionModel/vtkExecutive.cxx:617–712  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

615
616//------------------------------------------------------------------------------
617void vtkExecutive::CopyDefaultInformation(vtkInformation* request, int direction,
618 vtkInformationVector** inInfoVec, vtkInformationVector* outInfoVec)
619{
620 if (direction == vtkExecutive::RequestDownstream)
621 {
622 // Copy information from the first input to all outputs.
623 if (this->GetNumberOfInputPorts() > 0 && inInfoVec[0]->GetNumberOfInformationObjects() > 0)
624 {
625 vtkInformationKey** keys = request->Get(KEYS_TO_COPY());
626 int length = request->Length(KEYS_TO_COPY());
627 vtkInformation* inInfo = inInfoVec[0]->GetInformationObject(0);
628
629 vtkSmartPointer<vtkInformationIterator> infoIter =
630 vtkSmartPointer<vtkInformationIterator>::New();
631 infoIter->SetInformationWeak(inInfo);
632
633 int oiobj = outInfoVec->GetNumberOfInformationObjects();
634 for (int i = 0; i < oiobj; ++i)
635 {
636 vtkInformation* outInfo = outInfoVec->GetInformationObject(i);
637 for (int j = 0; j < length; ++j)
638 {
639 // Copy the entry.
640 outInfo->CopyEntry(inInfo, keys[j]);
641
642 // If the entry is a key vector, copy all the keys listed.
643 if (vtkInformationKeyVectorKey* vkey = vtkInformationKeyVectorKey::SafeDownCast(keys[j]))
644 {
645 outInfo->CopyEntries(inInfo, vkey);
646 }
647 }
648
649 // Give the keys an opportunity to copy themselves.
650 infoIter->InitTraversal();
651 while (!infoIter->IsDoneWithTraversal())
652 {
653 vtkInformationKey* key = infoIter->GetCurrentKey();
654 key->CopyDefaultInformation(request, inInfo, outInfo);
655 infoIter->GoToNextItem();
656 }
657 }
658 }
659 }
660 else
661 {
662 // Get the output port from which the request was made. Use zero
663 // if output port was not specified.
664 int outputPort = 0;
665 if (request->Has(FROM_OUTPUT_PORT()))
666 {
667 outputPort = request->Get(FROM_OUTPUT_PORT());
668 outputPort = outputPort == -1 ? 0 : outputPort;
669 }
670
671 // Copy information from the requesting output to all inputs.
672 if (outputPort >= 0 && outputPort < outInfoVec->GetNumberOfInformationObjects())
673 {
674 vtkInformationKey** keys = request->Get(KEYS_TO_COPY());

Callers 2

CallAlgorithmMethod · 0.95
CallAlgorithmMethod · 0.45

Calls 13

GetNumberOfInputPortsMethod · 0.95
GetInformationObjectMethod · 0.80
SetInformationWeakMethod · 0.80
CopyEntryMethod · 0.80
CopyEntriesMethod · 0.80
GetCurrentKeyMethod · 0.80
NewFunction · 0.50
GetMethod · 0.45
LengthMethod · 0.45
InitTraversalMethod · 0.45
IsDoneWithTraversalMethod · 0.45
GoToNextItemMethod · 0.45

Tested by

no test coverage detected