<HTML>
<HEAD>
<TITLE>Re: [Paraview] Filter Plugin w/ multiple connections</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>There are two parts to making this work. The first part is supporting multiple ports and/or connections in the filter itself. To set the number of input ports, you call this->SetNumberOfInputPorts() in the filter’s constructor. To set the number of connections allowed on each port, you override the FillInputPortInformation method and add the appropriate flags to the information object. The specifics are documented at the beginning of Chapter 13 (How to Write an Algorithm for VTK) in the latest <I>VTK User’s Guide</I> book.<BR>
<BR>
The second part is to announce the input ports and/or connections in the server manager XML. To set multiple ports, provide multiple InputProperty elements, one for each input. These are easiest to set up if you provide convenience methods for each port in your filter that call SetInputConnection with the appropriate port number. The arguments for the InputProperty tag provide information about ports that support multiple connections and optional ports. <I>The ParaView Guide</I> book provides some documentation on the XML structure and the ParaView3/Servers/ServerManager/Resources/filters.xml source file provides plenty of examples. The ArbitrarySourceStreamTracer, labeled “Stream Tracer (Custom Source)”, provides good examples of both multiple ports and ports that support multiple connections.<BR>
<BR>
-Ken<BR>
<BR>
<BR>
On 5/5/09 5:08 PM, "David Fuentes" <<a href="fuentesdt@gmail.com">fuentesdt@gmail.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hello,<BR>
<BR>
<BR>
What is the proper way to write a filter plugin for paraview w/ multiple<BR>
connections and access the data from each connection?<BR>
<BR>
<BR>
I have been trying to use the vtkProgrammableFilter,<BR>
vtkPythonProgrammableFilter, vtkMultiBlockDataGroupFilter, and<BR>
vtkTemporalStaticsFilter as examples.<BR>
<BR>
<BR>
int vtkMyFilterPlugin::RequestData(<BR>
vtkInformation *vtkNotUsed(request),<BR>
vtkInformationVector **inputVector,<BR>
vtkInformationVector *outputVector)<BR>
{<BR>
<BR>
int numInputs = inputVector[0]->GetNumberOfInformationObjects();<BR>
for (int idx = 0; idx < numInputs; ++idx)<BR>
{<BR>
vtkInformation *inInfo = inputVector[0]->GetInformationObject(idx);<BR>
<BR>
vtkDataObject *input = vtkDataObject::GetData(inInfo);<BR>
<BR>
vtkDataSet *inputDataSet = vtkDataSet::SafeDownCast( input) ;<BR>
<BR>
.<BR>
.<BR>
.<BR>
}<BR>
<BR>
where numInputs = the number of connections to my Filter.<BR>
vtkDataSet::SafeDownCast(input) returns a NULL pointer when I have<BR>
multiple connections to the filter but works for ONE connection.<BR>
How do I get the pointer(s) that will let me access the vtkDataArray<BR>
for each connection to my filter? ie<BR>
<BR>
vtkPointData *pd=inputDataSet->GetPointData();<BR>
int numArrays = pd->GetNumberOfArrays();<BR>
for (int i = 0; i < numArrays; i++)<BR>
{<BR>
vtkDataArray *array = pd->GetArray(i);<BR>
}<BR>
<BR>
<BR>
thanks,<BR>
df<BR>
_______________________________________________<BR>
Powered by www.kitware.com<BR>
<BR>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
<BR>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView">http://paraview.org/Wiki/ParaView</a><BR>
<BR>
Follow this link to subscribe/unsubscribe:<BR>
<a href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a><BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
**** Kenneth Moreland<BR>
*** Sandia National Laboratories<BR>
*********** <BR>
*** *** *** email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
** *** ** phone: (505) 844-8919<BR>
*** web: <a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a><BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>