[vtkusers] Re: Writing multiple fields with vtkWriter
clyne at ncar.ucar.edu
clyne at ncar.ucar.edu
Fri Oct 10 17:33:44 EDT 2003
The multifield bug/problem I've run into seems to be in the
vtkDataReader, not the writer as I originally posted. Maybe it's just
operator error, but there does not appear to be a way to get a
vtkDataReader to read in more than one data attribute of any given type
(e.g. scalar, vector, etc). By using the SetScalarsName method one can
select which field is read in, but there doesn't appear to be a way to
have the reader read *all* the fields of a given type. Furthermore, it
doesn't look like there is a way to probe a vtk file to determine which
fields exist. The implications are that if, for example, I wanted to
write a simple utility to convert any ASCII vtk file to a binary file I
would need to 1) know and explictly identify each field of a given type
that existed in the file, and 2) reread the *entire* file once for each
field.
Am I correct about this or totally out to lunch (again)?
many thanks - jc
> 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