[vtkusers] Re: Writing multiple fields with vtkWriter

Steve Kirstukas sjk60 at iastate.edu
Fri Oct 10 10:54:34 EDT 2003


You can add multiple scalars to the point data (or cell data) field...

vtkFloatArray *dataArray;

//attach data to mesh...
yourGrid->GetPointData()->AddArray( dataArray );

//for displaying the i-th scalar, you need to activate it...
yourGrid->GetPointData()->SetActiveScalars( 
                      yourGrid->GetPointData()->GetArray(i)->GetName() );

You can store multiple vectors this way too, but I believe that it is a bit of a
trick to send grids with vector data stored in the point data field through
things like the transform filters -- they properly rotate vectors but leave
3-component point data fields untouched.

-steve

> Message: 4
> From: "John Clyne" <clyne at ncar.ucar.edu>
> To: <vtkusers at vtk.org>
> Date: Thu, 9 Oct 2003 16:37:24 -0600
> Organization: NCAR
> Subject: [vtkusers] Writing multiple fields with vtkWriter
> 
> Hi,
> 
> How does one go about writting multiple fields with vtkWriter
> (vtkUnstrucutedGridWriter)? For example, If I have multiple scalar fields
> defined the default behaviour of the writer is to only output the
> first/current field. I'd like to output *all* the fields.
> 
> thanks  - jc
> 
> John Clyne (clyne at ncar.ucar.edu)
> National Center for Atmospheric Research
> 1850 Table Mesa Dr. Boulder, CO 80303 USA
> 1.303.497.1236
> 
> 







More information about the vtkusers mailing list