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

Method SetNumberOfOutputPorts

Common/ExecutionModel/vtkAlgorithm.cxx:1021–1056  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1019
1020//------------------------------------------------------------------------------
1021void vtkAlgorithm::SetNumberOfOutputPorts(int n)
1022{
1023 // Sanity check.
1024 if (n < 0)
1025 {
1026 vtkErrorMacro("Attempt to set number of output ports to " << n);
1027 n = 0;
1028 }
1029
1030 // We must remove all connections from ports that are removed.
1031 for (int i = n; i < this->GetNumberOfOutputPorts(); ++i)
1032 {
1033 // Get the producer and its output information for this port.
1034 vtkExecutive* producer = this->GetExecutive();
1035 vtkInformation* info = producer->GetOutputInformation(i);
1036
1037 // Remove all consumers' references to this producer on this port.
1038 vtkExecutive** consumers = vtkExecutive::CONSUMERS()->GetExecutives(info);
1039 int* consumerPorts = vtkExecutive::CONSUMERS()->GetPorts(info);
1040 int consumerCount = vtkExecutive::CONSUMERS()->Length(info);
1041 for (int j = 0; j < consumerCount; ++j)
1042 {
1043 vtkInformationVector* inputs = consumers[j]->GetInputInformation(consumerPorts[j]);
1044 inputs->Remove(info);
1045 }
1046
1047 // Remove this producer's references to all consumers on this port.
1048 vtkExecutive::CONSUMERS()->Remove(info);
1049 }
1050
1051 // Set the number of output port information objects.
1052 this->OutputPortInformation->SetNumberOfInformationObjects(n);
1053
1054 // Set the number of connection proxy objects.
1055 this->AlgorithmInternal->Outputs.resize(n);
1056}
1057
1058//------------------------------------------------------------------------------
1059vtkInformation* vtkAlgorithm::GetInputPortInformation(int port)

Calls 10

GetExecutiveMethod · 0.95
GetExecutivesMethod · 0.80
GetPortsMethod · 0.80
GetOutputInformationMethod · 0.45
LengthMethod · 0.45
GetInputInformationMethod · 0.45
RemoveMethod · 0.45
resizeMethod · 0.45

Tested by 8

TestTimeSourceMethod · 0.36
TestTimeFilterMethod · 0.36
TestMultiTsAlgoMethod · 0.36
TestTemporalAlgorithmMethod · 0.36
MySourceMethod · 0.36
vtkTestAlgorithmMethod · 0.36
TestTimeSourceMethod · 0.36
TestTimeFilterMethod · 0.36