[Paraview] Re : How to add vector/scalar field as attributes to a vtkPointSet (vtkPolyData, ...)?

R M mlokida at yahoo.fr
Wed Oct 13 09:47:48 EDT 2010

Here's what I have done:

//output is a vtkPolyData

int nbComponents = 2;

vtkSmartPointer<vtkFloatArray> dataToAdd = 

vtkIdType nbElems = output->GetNumberOfCells(); 
int size = nbElems * nbComponents;

int cpt = 0;
for(unsigned int i = 0; i < values.size(); i += 2)
    dataToAdd->InsertTuple2(cpt, values[i], values[i+1]);            


Everything is ok and I can see elements that are colored corresponding to the 
magnitude, x and y components.

But now, If I want to display gliph of these velocities I can't. Only attibutes 
attached to the points are presents.  So, What is the way to display gliphs of 
attributes that are attached to some elements.

Thank you.

De : Andy Bauer <andy.bauer at kitware.com>
À : R M <mlokida at yahoo.fr>
Cc : paraview at paraview.org
Envoyé le : Mar 12 octobre 2010, 19h 13min 16s
Objet : Re: [Paraview] How to add vector/scalar field as attributes to a 
vtkPointSet (vtkPolyData, ...)?

For the velocity array you'll need to set the number of components.  You 
probably want to set the number of components to 3 for both 2D and 3D so that 
ParaView can manipulate the vector quantities (for 2D just set the last 
component to 0).

Using the glyph filter will give you arrows for showing the velocity magnitude 
and direction.

On Tue, Oct 12, 2010 at 12:08 PM, R M <mlokida at yahoo.fr> wrote:

>Like the title say, I would to like to add some attributes to a vtkPointSet 
>(vtkPolyData and vtkUnstructuredGrid).
>The attributes are vector(2D, 3D,...) field or scalar field. 
>For a scalar Field, If I want to add an attribute to the cells , I do: 
>output->GetCellData()->AddArray( data) and 
>output->GetPointData()->AddArray(donnees);  for the points
>For the moment it is ok, because I can select them in Paraview.
>But now, I have a 2D (or 3D) vector field (velocity) and I would to add the 
>velocity field for the points or the cells.  How can I do that ?
>Moreover, if I want to show somme arrow (to show the direction of the vectors) 
>should I use the glyph filter ?
>Thank you.
>Powered by www.kitware.com
>Visit other Kitware open-source projects at 
>Please keep messages on-topic and check the ParaView Wiki at: 
>Follow this link to subscribe/unsubscribe:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20101013/21d6b6bc/attachment.htm>

More information about the ParaView mailing list