GetInputArrayToProcess() is a bit tricky :-) The first argument (idx) does not correspond to the index of the array. Here is how it works:<br><br>Let's say your algorithm need to input arrays: temperature and velocity. You want these to correspond to scalars and vectors by default. The algorithm then says something like "temperature is the first array I process, the velocity second". Note, these indices have nothing to do with indices the arrays are stored with. They are rather a convention the algorithm uses to note what it does with which array. Maybe string keys would have been a better choice. Anyway, the algorithm then has something like:
<br><br> // by default process active point scalars (temperature)<br> this->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,<br> vtkDataSetAttributes::SCALARS);<br> // by default process active point vectors (velocity)
<br>
this->SetInputArrayToProcess(1,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,<br>
vtkDataSetAttributes::VECTORS);<br>
in the constructor. In RequestData:<br><br> vtkDataArray *temperature = this->GetInputArrayToProcess(0,inputVector);<br>
vtkDataArray *velocity = this->GetInputArrayToProcess(1,inputVector);<br><br>This is why vtkSurfaceVectors always use idx. It has only 1 array (vectors) it processes. I hope this answers your question.<br><br>-Berk<br>
<br><br><div><span class="gmail_quote">On 6/28/06, <b class="gmail_sendername">Kent Eschenberg</b> <<a href="mailto:eschenbe@psc.edu">eschenbe@psc.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
A new filter I've written compiles and runs without error but cannot obtain<br>the user's choice for the input array. I'd appreciate any suggestions or<br>questions.<br><br>The test: start ParaView; read a file (1 scalar and 1 vector per cell, no
<br>point data); then connect the new filter. The name of the scalar is<br>displayed on the GUI button as expected. When I click "Accept" my filter<br>tries to obtain the selection, fails, and prints a message to that effect.
<br><br>I've used the XML and source for for the vtkSurfaceVectors (SV) module as a<br>guide for my module (MM).<br><br>SV inherits from vtkDataSetAlgorithm and vtkAlgorithm while MM inherits<br>from vtkPolyDataAlgorithm and vtkAlgorithm. The server manager XML for both
<br>use vtkAlgorithm::SetInputArrayToProcess to record the user's selection.<br><br>SV uses vtkAlgorithm::GetInputArrayToProcess to retreive this selection<br>with idx set to 0. I don't understand - that would seem to always get the
<br>0th array no matter what the user selects. What have I missed?<br><br>In MM GetInputArrayToProcess returns null. Here is a piece of its server<br>manager XMl which is nearly identical to that for SV:<br><br> <StringVectorProperty
<br> name="SelectInputScalars"<br> command="SetInputArrayToProcess"<br> number_of_elements="5"<br> element_types="0 0 0 0 2"<br> animateable="0"
<br> ><br> <ArrayListDomain name="array_list" attribute_type="Scalars"><br> <RequiredProperties><br> <Property name="Input" function="Input"/>
<br> </RequiredProperties><br> </ArrayListDomain><br> </StringVectorProperty><br><br>The corresponding GUI XML for this parameter is<br><br> <ArrayMenu<br> id="arrMen"
<br> input_menu="inpMen"<br> trace_name="Scalars"<br> property="SelectInputScalars"<br> label="Variable"<br> help="Input cell scalar used for point density"
<br> /><br><br>Help!<br><br>Kent<br>Pittsburgh Supercomputing Center<br><br>_______________________________________________<br>ParaView mailing list<br><a href="mailto:ParaView@paraview.org">ParaView@paraview.org</a>
<br><a href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a><br></blockquote></div><br>