<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->SetNumberOfComponents(1);
</span><br><span> intArray->InsertNextValue(4);
</span><br><span> intArray->SetName("FileIndex");
</span><br><span> pdata->GetFieldData->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"><<a href="mailto:dave.demarle@kitware.com">dave.demarle@kitware.com</a>></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->GetPointData() returns the container that holds point associated values.<br>
ds->GetCellData() returns the container that holds cell associated values.<br>
ds->GetFieldData() returns the general purpose (whole data set<br>
associated) container<br>
<br>
David E DeMarle<br>
Kitware, Inc.<br>
R&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 <<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>> wrote:<br>
> Say I have a vtp file which contains 100 points (and vertices). I know how<br>
> to add a vector of the same length with information about each point, but is<br>
> there a way to add just a single integer or double or something? For<br>
> example, if I want to know this was the 4th file, I would want to store<br>
> FileIndex=4 in the file. If I add a vtkIntArray with only one element,<br>
> paraview gets mad when I open the file because that array is not the same<br>
> length as the point array.<br>
><br>
> This is what I was doing:<br>
> vtkSmartPointer<vtkIntArray> FileIndex =<br>
> vtkSmartPointer<vtkIntArray>::New();<br>
> FileIndex->SetNumberOfComponents(1);<br>
> FileIndex->SetName("FileIndex");<br>
> FileIndex->InsertNextValue(4);<br>
> pdata->GetPointData()->AddArray(FileIndex);<br>
><br>
> What I want to do would be something like this:<br>
> pdata->AddData("FileIndex")->AddValue(4); //this is not valid VTK syntax<br>
><br>
> Is there any way to do this?<br>
><br>
> Thanks,<br>
><br>
> David<br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</blockquote></div><br>