[vtkusers] Assigning cell values on structured grid

Sebastian Gatzka sebastian.gatzka at stud.tu-darmstadt.de
Wed Feb 24 04:49:16 EST 2010


Dear Users.

Does your work on this topic include the information of the 
cell-coordinates as well?
Or is there allready a way of accessing the cell centers coordinate with 
the current VTK version?

Sebastian

Am 19.02.2010 14:01, schrieb David Doria:
> On Fri, Feb 19, 2010 at 6:30 AM, Sebastian Gatzka 
> <sebastian.gatzka at stud.tu-darmstadt.de 
> <mailto:sebastian.gatzka at stud.tu-darmstadt.de>> wrote:
>
>     Hello.
>
>     This time I'm trying to set cell (centroid) values (scalar and
>     vector) to a structured grid.
>     All the examples I have found set values to the grid points - not
>     the cell-centroids.
>
>     This should lead to a classical CFD / finite-volume representation
>     of field data like temperature, density or velocities.
>     So beside the actual assignment to the field I need to know how to
>     display the field data, and maybe how to switch between them.
>
>     Have a nice day.
>     Sebastian
>
>
> Sebastian,
>
> You can access cells via their (i,j,k) coordinates using this function:
> vtkCell* GetCell(vtkStructuredGrid* grid, int i, int j, int k)
> {
>   int dims[3];
>   grid->GetDimensions(dims);
>
>   if(i < 0 || i > dims[0] - 1 ||
>      j < 0 || j > dims[1] - 1 ||
>      k < 0 || k > dims[2] - 1 )
>     {
>     return NULL; // out of bounds!
>     }
>   int pos[3];
>   pos[0] = i;
>   pos[1] = j;
>   pos[2] = k;
>
>   vtkIdType id;
>   id = vtkStructuredData::ComputeCellId(dims, pos);
>   return grid->GetCell(id);
> }
>
> I'm working on adding it to vtk so you can directly call
>
> grid->GetCell(i,j,k)
>
> Hope this helps,
>
> David
>
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100224/33cb19a2/attachment.htm>


More information about the vtkusers mailing list