[vtkusers] Storing an independent piece of information in a VTP file

David E DeMarle dave.demarle at kitware.com
Fri Apr 17 13:44:17 EDT 2009


Yes. That is what the field data is for.

All DataSets have three independent containers for arrays.

ds->GetPointData() returns the container that holds point associated values.
ds->GetCellData() returns the container that holds cell associated values.
ds->GetFieldData() returns the general purpose (whole data set
associated) container

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



On Fri, Apr 17, 2009 at 1:41 PM, David Doria <daviddoria at gmail.com> wrote:
> Say I have a vtp file which contains 100 points (and vertices). I know how
> to add a vector of the same length with information about each point, but is
> there a way to add just a single integer or double or something? For
> example, if I want to know this was the 4th file, I would want to store
> FileIndex=4 in the file. If I add a vtkIntArray with only one element,
> paraview gets mad when I open the file because that array is not the same
> length as the point array.
>
> This is what I was doing:
> vtkSmartPointer<vtkIntArray> FileIndex =
> vtkSmartPointer<vtkIntArray>::New();
>     FileIndex->SetNumberOfComponents(1);
>     FileIndex->SetName("FileIndex");
>     FileIndex->InsertNextValue(4);
>     pdata->GetPointData()->AddArray(FileIndex);
>
> What I want to do would be something like this:
>     pdata->AddData("FileIndex")->AddValue(4); //this is not valid VTK syntax
>
> Is there any way to do this?
>
> Thanks,
>
> 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
>
>



More information about the vtkusers mailing list