Note that ParaView does not really use the active scalars, so there is a
good chance that you will be unpleasantly surprised when you don't get the
array you expect.

ParaView uses a newer convention of vtkAlgorithm to specify input arrays:
the vtkAlgorithm::SelectInputScalars() method.  The SelectInputScalars
method has a 5 argument signature which I won't get into, but can be set
through the server manager with a StringVectorProperty that has an
ArrayListDomain assigned to it.  The XML for defining this property looks
something like this.

     <StringVectorProperty
        name="SelectInputScalars"
        command="SetInputArrayToProcess"
        number_of_elements="5"
        element_types="0 0 0 0 2"
        animateable="0"
        label="Contour By">
          <ArrayListDomain name="array_list" attribute_type="Scalars">
            <RequiredProperties>
               <Property name="Input" function="Input"/>
            </RequiredProperties>
          </ArrayListDomain>
          <Documentation>
            Doing something with this array...
          </Documentation>
     </StringVectorProperty>

See the ParaView guide for more information on these tags.

>From within your filter, you can use the
vtkAlgorithm::GetInputArrayToProcess method to get the selected array from
the input.

  vtkDataArary *input_array = this->GetInputArrayToProcess(0, input);

By the way, I notice that you are using the old-style filter convention of
overriding Execute and calling GetInput and GetOutput on yourself.  New
filters should really override RequestData and get the inputs and outputs
from the inputVector and outputVector arguments, respectively.  The data
objects have convenience methods to get the data objects from the
information vectors.

  vtkStructuredGrid *input = vtkStructuredGrid::GetData(inputVector[0]);
  vtkStructuredGrid *output = vtkStructuredGrid::GetData(outputVector);

-Ken


On 9/4/08 6:57 AM, "David E DeMarle" <[EMAIL PROTECTED]> wrote:

> vtkPointData is a collection of arrays (for example temperature,
> density, velocity), each of which may have multiple components (for
> example VEL_X, VEL_Y, VEL_Z) and multiple tuples (the temperature at
> the first point, the temperature at the second point, ..., the
> temperature at the millionth point). vtkPointData::GetScalars() will
> give you access to the currently active scalar array. You will then
> have to get access to the raw pointer or use element indexing (both of
> which are descibed in the vtkDataArray documentation) to do element
> wise arithmetic. Lastly, you may want to look at the calculator
> filter.
>
> cheers,
> Dave DeMarle
>
>
> On Thu, Sep 4, 2008 at 3:23 AM, Natalie Happenhofer
> <[EMAIL PROTECTED]> wrote:
>> Hi!
>> I´m writing a filter and I want to perform arithmetic operations, i.e. "+="
>> with the scalar data associated to each point of my grid. So I get the Point
>> Data from the input file:
>>
>> void vtkHorizontalAverage::Execute()
>> {vtkStructuredGrid *input = this->GetInput();
>> vtkStructuredGrid *output = this->GetOutput();
>>
>>  vtkPointData *inPtr = input->GetPointData();
>>  vtkPointData *outPtr = output->GetPointData();
>> ...
>>
>> here and now I want to apply the += operator, but I have no idea how to cast
>> my vtkPointData - object, since I do not really know where to fit the cast
>> operator in, to the vtkPointData class or to the vtkDataArray..
>>
>> I could also use a reinterpretcast, but I´m not sure if the format of the
>> data in vtkPointData is double or float..
>>
>> So, any help would be apreciated!
>> thx,
>> NH
>>
>>
>>
>> ________________________________
>> Express yourself instantly with MSN Messenger! MSN Messenger
>> _______________________________________________
>> ParaView mailing list
>> ParaView@paraview.org
>> http://www.paraview.org/mailman/listinfo/paraview
>>
>>
> _______________________________________________
> ParaView mailing list
> ParaView@paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>


_______________________________________________
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to