Thanks for the answer.<br>For the moment I convert my structured grid to unstructured but I will try with GetFieldData().<br><br>Didier <br><br><div class="gmail_quote">2009/11/30 David E DeMarle <span dir="ltr">&lt;<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You can&#39;t easily.<br>
<br>
vtkDataSet::GetCellData() will return the cell associated arrays, but<br>
those are defined to have values for every cell. There are some new<br>
sparse array types in vtk, but I haven&#39;t personally tried them. I<br>
suspect they are not allowed in the Cell/Point Data containers.<br>
<br>
An alternative is to use vtkDataSet::GetFieldData(), which returns<br>
general purpose (ie not cell or point associated arrays), and make up<br>
your own indexing scheme there.<br>
<br>
David E DeMarle<br>
Kitware, Inc.<br>
R&amp;D Engineer<br>
28 Corporate Drive<br>
Clifton Park, NY 12065-8662<br>
Phone: 518-371-3971 x109<br>
<div><div></div><div class="h5"><br>
<br>
<br>
On Tue, Nov 24, 2009 at 8:17 AM, Didier Roissé &lt;<a href="mailto:didier.roisse@gmail.com">didier.roisse@gmail.com</a>&gt; wrote:<br>
&gt; Hello,<br>
&gt; I have a structured grid , and I want to put data on the different cells<br>
&gt; inside the structured grid. I know how to do for unstructured grid, but for<br>
&gt; structured grid I don&#39;t know.<br>
&gt;<br>
&gt; For example i define my structured grid like this:<br>
&gt;     vtkStructuredGrid *sgrid = vtkStructuredGrid::New();<br>
&gt;     sgrid-&gt;SetDimensions(x.nbnodes,y.nbnodes,z.nbnodes);<br>
&gt;     vtkPoints *points = vtkPoints::New();<br>
&gt;     for(int k=0;k&lt;z.nbnodes;k++)<br>
&gt;         for(int j=0;j&lt;y.nbnodes;j++)<br>
&gt;             for(int i=0;i&lt;x.nbnodes;i++)<br>
&gt;                 points-&gt;InsertNextPoint(x.nodes[i],y.nodes[j],z.nodes[k]);<br>
&gt;<br>
&gt;     sgrid-&gt;SetPoints(points);<br>
&gt;<br>
&gt;     vtkCell *cell3D = sgrid-&gt;GetCell(10);<br>
&gt;<br>
&gt; cell3D is a vtkHexaedron cell. So my problem is : How can I put a data value<br>
&gt; only on one of the quad cell which define cell3D ?<br>
&gt;<br>
&gt; Thanks in advance for your help<br>
&gt;<br>
&gt; Regards,<br>
&gt; Didier<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
</blockquote></div><br>