[vtkusers] Using vtkFieldData
Berk Geveci
berk.geveci at gmail.com
Tue Oct 11 15:25:18 EDT 2005
Not currently. I have been thinking of doing a few different ways of
doing this but unfortunately I am swamped with the ParaView release to
implement any right now. Ping me in a few weeks :-)
On 10/11/05, John Norris <jnorris at mcs.anl.gov> wrote:
> Hi,
>
> I've using a vtkHierarchicalDataSet to represent my multi-block data.
> I'd like to preserve certain block-specific information (e.g. the
> block's text label), but haven't figured out a good way to do this yet.
> I tried adding a vtkCharArray to the vtkFieldData of each of the
> component datasets, but this doesn't appear to be passed down the pipe.
> I've tried a simple example using a regular vtkStructuredPoints, and
> it doesn't seem to pass along its vtkFieldData either. A code snippet
> follows.
>
> Is there any way, other than converting the string to cell or point
> data, to get this data passed through filters?
>
> Thanks,
> John
>
> vtkStructuredGrid* pStrGrid = vtkStructuredGrid::New();
> <set the grid's points and point data>
>
> // Create the array to add to the field data.
> char* charData = new char[16];
> strcpy(charData, "Hello!");
> vtkCharArray* pText = vtkCharArray::New();
> pText->SetArray(charData, strlen(charData) + 1, 0);
> pText->SetName("Text Test");
>
> // Add to the field data.
> pStrGrid->GetFieldData()->AddArray(pText);
> pText->Delete();
> pStrGrid->GetFieldData()->CopyAllOn();
>
> // Pass the data through a filter.
> vtkContourFilter* pContour = vtkContourFilter::New();
> pContour->UseScalarTreeOn();
> pContour->GenerateValues(5, 0.1, 1.0);
> pContour->SetInput(pStrGrid);
>
> // Force an update.
> pContour->GetOutput()->Update();
>
> // Print info on the original grid.
> // Its Field Data will contain one array named 'Text Test'.
> std::cout << "Original Grid:\n";
> pStrGrid->Print(std::cout);
>
> // Print info on the contours.
> // Its Field Data will not contain any arrays.
> std::cout << "\nContours:\n";
> pContour->GetOutput()->Print(std::cout);
>
> --
> John Norris
> Research Programmer
> Center for Simulation of Advanced Rockets
> http://www.uiuc.edu/ph/www/jnorris
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the 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