[Paraview] use of self.GetOutPut.SetCells() and vtkSphereSource() in a programmable source
David E DeMarle
dave.demarle at kitware.com
Wed Feb 25 09:40:42 EST 2009
On Wed, Feb 25, 2009 at 4:40 AM, Felipe Bordeu Weldt
<bordeu at lmt.ens-cachan.fr> wrote:
> I'm using the programmmable source to generate a simple mesh.
> Until now, I was using vtk.vtkUnstructuredGrid.SetCells(int, vtkCellArray)
> to set the generated mesh to the output. It work fine for meshes of only one
> type.
>
> now I am trying to generate a mesh with different elements types. but I
> wasn't able to add meshes with different types to the output.
> I am trying with the function:
>
> V.SetCells(vtkUnsignedCharArray *cellTypes, vtkIdTypeArray *cellLocations,
> vtkCellArray *Cells);
>
> but I don't understand the cellLocations input variable.
It is strange that the first signature doesn't work. What happens when
you call it? vtkUnstructuredGrid should build the Locations array for
you.
The Locations array is a set of pointers into the UnstructuredGrid's
internal pointid array. Because the cell types are not homogeneous,
they have different numbers of points, so this array is needed to give
random access to the cells.
The pointidarray looks like this:
0[cell0=VTK_VERTEX ]
1[cell0's first point id=somewhere in point array]
2[cell1=VTK_QUAD]
3[cell1's first point id...]
4[cell1's second point id...]
5[cell1's third point id...]
6[cell1's fourth point id...]
7[cell2=something]
...
the Locations array gives you random access because each cell in it is
the same size. It looks like this:
0[cell0 starts at 0]
1[cell1 starts at 2]
2[cell2 starts at 7]
...
> -------------
> How can I correctly use the vtkSphereSource in the programmable Source?.
> Once the instance is correctly created, How do I extract the mesh of the
> sphere to put it in the output?
You have to update the SphereSource, then get is PolyData output, then
copy each vertex and cell into the filter's output.
>
> Thanks
> Felipe
>
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>
--
David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109
More information about the ParaView
mailing list