[vtkusers] multiple vtkScalars in one dataset?
christopher moore
aeolus at ocean.washington.edu
Tue Sep 19 20:03:25 EDT 2000
Okay - so I'm enlightened in the use of vtkFieldData now, but for one
problem....
I create a vtkRectilinearGrid dataset and associate a FieldData to it via
the PointData. The FieldData has two variables (arrays) in it (salinity,
and temperature).
I use a FieldDataToAttributeDataFilter to set the Scalars of the dataset
to one of the FieldData arrays (salinity).
But something's wrong: the output of GetScalarRange is (0,1) instead of
(0, 33.5768). The salinity array isn't properly assigned to the Scalars
of the dataset....
If I change the code and simply create a new instance of vtkScalars, and
use the SetData method to access the FieldData array, and then associate
the new vtkScalars with the dataset, it works fine.
Why won't the FieldDataToAttributeDataFilter work?
---------sample code----------------
rg = vtkRectilinearGrid::New();
totalSteps = LoadData(1);
cout << "number of arrays: " << rg->GetPointData()->GetFieldData()->GetNumberOfArrays() << endl;
cout << "first array name: " << rg->GetPointData()->GetFieldData()->GetArrayName(0) << endl;
cout << "second array name: " << rg->GetPointData()->GetFieldData()->GetArrayName(1) << endl;
vtkFieldDataToAttributeDataFilter *fd2ad = vtkFieldDataToAttributeDataFilter::New();
fd2ad->SetInput(rg);
fd2ad->SetOutputAttributeDataToPointData();
fd2ad->SetInputFieldToPointDataField();
fd2ad->SetScalarComponent(0,"salinity",0);
float *something;
something = rg->GetScalarRange();
cout << "scalar range min: " << something[0] << endl;
cout << "scalar range max: " << something[1] << endl;
-----end code------------------------
______________________________________________________________
Christopher Moore tel 206.526.6779
Research Scientist, Oceanography fax 206.526.6744
University of Washington/JISAO/NOAA-PMEL
--------------------------------------------------------------
More information about the vtkusers
mailing list