<span>It looks like even if I want to store only a single number I need to use a vtkIntArray, like this?<br></span><br><span> <span class="highlight"> vtkIntArray</span> *intArray = <span class="highlight">vtkIntArray</span>::New();
</span><br><span>  intArray-&gt;SetNumberOfComponents(1);
</span><br><span>  intArray-&gt;InsertNextValue(4);
</span><br><span>  intArray-&gt;SetName(&quot;FileIndex&quot;);
</span><br><span> pdata-&gt;GetFieldData-&gt;AddArray(intArray);
</span><br><span></span><br clear="all">Thanks,<br><br>David<br>
<br><br><div class="gmail_quote">On Fri, Apr 17, 2009 at 1:44 PM, David E DeMarle <span dir="ltr">&lt;<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Yes. That is what the field data is for.<br>
<br>
All DataSets have three independent containers for arrays.<br>
<br>
ds-&gt;GetPointData() returns the container that holds point associated values.<br>
ds-&gt;GetCellData() returns the container that holds cell associated values.<br>
ds-&gt;GetFieldData() returns the general purpose (whole data set<br>
associated) container<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 Fri, Apr 17, 2009 at 1:41 PM, David Doria &lt;<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>&gt; wrote:<br>
&gt; Say I have a vtp file which contains 100 points (and vertices). I know how<br>
&gt; to add a vector of the same length with information about each point, but is<br>
&gt; there a way to add just a single integer or double or something? For<br>
&gt; example, if I want to know this was the 4th file, I would want to store<br>
&gt; FileIndex=4 in the file. If I add a vtkIntArray with only one element,<br>
&gt; paraview gets mad when I open the file because that array is not the same<br>
&gt; length as the point array.<br>
&gt;<br>
&gt; This is what I was doing:<br>
&gt; vtkSmartPointer&lt;vtkIntArray&gt; FileIndex =<br>
&gt; vtkSmartPointer&lt;vtkIntArray&gt;::New();<br>
&gt;     FileIndex-&gt;SetNumberOfComponents(1);<br>
&gt;     FileIndex-&gt;SetName(&quot;FileIndex&quot;);<br>
&gt;     FileIndex-&gt;InsertNextValue(4);<br>
&gt;     pdata-&gt;GetPointData()-&gt;AddArray(FileIndex);<br>
&gt;<br>
&gt; What I want to do would be something like this:<br>
&gt;     pdata-&gt;AddData(&quot;FileIndex&quot;)-&gt;AddValue(4); //this is not valid VTK syntax<br>
&gt;<br>
&gt; Is there any way to do this?<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; David<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>