Question about unstructured grids

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about unstructured grids

Eric R
Hi all,

I have a raw data set of X,Y,Z coordinates as well as a set of scalars (lets call them A, B, C) which are stored at the aforementioned coordinates. I use vtkUnstructuredGrid to create the domain, but when I go to open the .vtu file in Paraview I see that there aren't any cells to visualize. 

My question is- how do I go about providing 'cells' which use these points as cell-centers?

_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Question about unstructured grids

Martin Genet-3
Hi Eric,

Paraview only displays cells, not points.

There are at least two solutions:
 - When you write the ugrid file, you can add vertices, which are cells containing a single point, using something like:
cell = vtk.vtkVertex()
cell_array = vtk.vtkCellArray()
for k_point in xrange(ugrid.GetPoints().GetNumberOfPoints()):
    cell.GetPointIds().SetId(0, k_point)
    cell_array.InsertNextCell(cell)
ugrid.SetCells(vtk.VTK_VERTEX, cell_array)
for k_array in xrange(ugrid.GetPointData().GetNumberOfArrays()):
    ugrid.GetCellData().AddArray(ugrid.GetPointData().GetArray(k_array))
- Otherwise, if you have only points in your ugrid, you can glyph them in paraview, using for instance a sphere with fixed small diameter.

Martin

On 01/02/2016 05:07, Eric Robertson wrote:
Hi all,

I have a raw data set of X,Y,Z coordinates as well as a set of scalars (lets call them A, B, C) which are stored at the aforementioned coordinates. I use vtkUnstructuredGrid to create the domain, but when I go to open the .vtu file in Paraview I see that there aren't any cells to visualize. 

My question is- how do I go about providing 'cells' which use these points as cell-centers?


_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers


_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: Question about unstructured grids

Martin Genet-3
Glad that helped, Eric.

Well, if you have the connectivity you can just write the surface cells (triangles, quadrangles) like you did with the vertexes. If you don't have the connectivity then I do not know, but I'm sure someone on the ML will be able to help.

Martin

On 01/02/2016 16:32, Eric Robertson wrote:
Thanks Martin. That works pretty well.

I might add that I am scripting in C++ but I was quickly able to translate.

I see the output shows up in Paraview as a ton of points. How may I proceed to make it a 'surface' which connects these points? (the data set is a wing).

On Mon, Feb 1, 2016 at 4:22 AM, Martin Genet <[hidden email]> wrote:
Hi Eric,

Paraview only displays cells, not points.

There are at least two solutions:
 - When you write the ugrid file, you can add vertices, which are cells containing a single point, using something like:
cell = vtk.vtkVertex()
cell_array = vtk.vtkCellArray()
for k_point in xrange(ugrid.GetPoints().GetNumberOfPoints()):
    cell.GetPointIds().SetId(0, k_point)
    cell_array.InsertNextCell(cell)
ugrid.SetCells(vtk.VTK_VERTEX, cell_array)
for k_array in xrange(ugrid.GetPointData().GetNumberOfArrays()):
    ugrid.GetCellData().AddArray(ugrid.GetPointData().GetArray(k_array))
- Otherwise, if you have only points in your ugrid, you can glyph them in paraview, using for instance a sphere with fixed small diameter.

Martin


On 01/02/2016 05:07, Eric Robertson wrote:
Hi all,

I have a raw data set of X,Y,Z coordinates as well as a set of scalars (lets call them A, B, C) which are stored at the aforementioned coordinates. I use vtkUnstructuredGrid to create the domain, but when I go to open the .vtu file in Paraview I see that there aren't any cells to visualize. 

My question is- how do I go about providing 'cells' which use these points as cell-centers?


_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers




_______________________________________________
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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers