[vtk-developers] vtkProcessObject: cannot disconnect inputs

Brad King brad.king at kitware.com
Mon Nov 22 09:38:55 EST 2004


Charl P. Botha wrote:
> Looking at +- line 154 of vtkProcessObject.cxx in method SetNthInput
> (CVS VTK), we find the following:
> 
>   else if(!input && num < this->GetNumberOfInputConnections(0)-1)
>     {
>     vtkErrorMacro("SetNthInput cannot set input index " << num
>                   << " to NULL because there are "
>                   << this->GetNumberOfInputConnections(0)
>                   << " connections and NULL connections are not allowed.");
>     }
> 
> I find this new behaviour a bit strange, because it prevents me from
> arbitrarily disconnecting inputs from multi-input filters, for example
> a vtkProbeFilter.  Is the idea really that all outputs should always
> be disconnected from "back to front"?

The new pipeline design organizes inputs in a different way.  Inputs are 
now treated more like a 2-D array.  There are zero or more input "ports" 
each of which can have zero or more connections.  Each port serves one 
purpose.  For example, an append filter would have one input port and 
all data sets to be appended would be connected to this one port.  For a 
glyph filter, there would be two input ports.  One would be the data 
providing the points, and the other would be the source providing the 
glyph (sphere, arrow, etc).

This design accounts for filters that have one special input and then 
allow arbitrary other inputs.  For example, I came across one filter 
that treats inputs 0, 2..infinity as the same and input 1 is special.

For backward compatibility vtkProcessObject defines only one input port 
whose purpose is to store all old-style connections.  Connection 0 is 
treated as input 0, connection 1 as input 1, etc.  However, the 
implementation of connection storage in vtkAlgorithm does not allow for 
NULL connections.  We wanted to avoid requiring every filter writer to 
check the inputs.  Therefore vtkProcessObject could not originally 
represent a NULL connection between two non-NULL connections.  Later I 
added a way to do it by storing a dummy data object of a special type 
that is used to identify NULL connections.  Part of vtkProcessObject has 
been updated to use it but the lines you discovered have not.

Please submit a bug report to remind me to fix those lines too.

Thanks,
-Brad



More information about the vtk-developers mailing list