[Paraview] Finding the Input Array for A Module

Berk Geveci berk.geveci at gmail.com
Fri Jun 30 09:19:22 EDT 2006


GetInputArrayToProcess() is a bit tricky :-) The first argument (idx) does
not correspond to the index of the array. Here is how it works:

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:

  // by default process active point scalars (temperature)

this->SetInputArrayToProcess(0,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,
                               vtkDataSetAttributes::SCALARS);
  // by default process active point vectors (velocity)

this->SetInputArrayToProcess(1,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS,
                               vtkDataSetAttributes::VECTORS);
in the constructor. In RequestData:

  vtkDataArray *temperature = this->GetInputArrayToProcess(0,inputVector);
  vtkDataArray *velocity = this->GetInputArrayToProcess(1,inputVector);

This is why vtkSurfaceVectors always use idx. It has only 1 array (vectors)
it processes. I hope this answers your question.

-Berk


On 6/28/06, Kent Eschenberg <eschenbe at psc.edu> wrote:
>
> A new filter I've written compiles and runs without error but cannot
> obtain
> the user's choice for the input array. I'd appreciate any suggestions or
> questions.
>
> The test: start ParaView; read a file (1 scalar and 1 vector per cell, no
> point data); then connect the new filter. The name of the scalar is
> displayed on the GUI button as expected. When I click "Accept" my filter
> tries to obtain the selection, fails, and prints a message to that effect.
>
> I've used the XML and source for for the vtkSurfaceVectors (SV) module as
> a
> guide for my module (MM).
>
> SV inherits from vtkDataSetAlgorithm and vtkAlgorithm while MM inherits
> from vtkPolyDataAlgorithm and vtkAlgorithm. The server manager XML for
> both
> use vtkAlgorithm::SetInputArrayToProcess to record the user's selection.
>
> SV uses vtkAlgorithm::GetInputArrayToProcess to retreive this selection
> with idx set to 0. I don't understand - that would seem to always get the
> 0th array no matter what the user selects. What have I missed?
>
> In MM GetInputArrayToProcess returns null. Here is a piece of its server
> manager XMl which is nearly identical to that for SV:
>
>          <StringVectorProperty
>             name="SelectInputScalars"
>             command="SetInputArrayToProcess"
>             number_of_elements="5"
>             element_types="0 0 0 0 2"
>             animateable="0"
>          >
>             <ArrayListDomain name="array_list" attribute_type="Scalars">
>                <RequiredProperties>
>                   <Property name="Input" function="Input"/>
>                </RequiredProperties>
>             </ArrayListDomain>
>          </StringVectorProperty>
>
> The corresponding GUI XML for this parameter is
>
>       <ArrayMenu
>          id="arrMen"
>          input_menu="inpMen"
>          trace_name="Scalars"
>          property="SelectInputScalars"
>          label="Variable"
>          help="Input cell scalar used for point density"
>       />
>
> Help!
>
> Kent
> Pittsburgh Supercomputing Center
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20060630/0810c9c6/attachment.htm


More information about the ParaView mailing list