[vtkusers] AddArray problems

John Platt jcplatt at lineone.net
Thu Feb 17 19:26:57 EST 2005


Hi Raymond,

 

There are 2 approaches you could use to add data arrays to a data set.
The first is to ensure that the output is always up to date by calling
Update() on your append filter. This will force the filter to execute
and you will have a grid to add a data array (functional system).
Alternatively, you can use vtkMergeDataObjectFilter to add an array from
a data object at a time in the future when the pipeline executes in
response to some event.

 

I suspect that the append filter has not executed at the time you write
your XML. Adding vtkExtractUnstructuredGrid probably causes the append
filter to update.

 

If a filter is out of date, most things you do to the current output
will be lost when the filter next updates. A typical operation at the
start of filter execution is to re-initialise the output.

 

HTH

 

John. 

 

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On
Behalf Of Maple Raymond C LtCol AFIT/ENY
Sent: 17 February 2005 16:46
To: vtkusers at vtk.org
Subject: [vtkusers] AddArray problems

 

Hello, 
    We are having some problems adding arrays of scalars to an
unstructured grid.  We are doing the following: 

mygrid = <appendfilter>->GetOutput() 
vtkDoubleArray *data = vtkDoubleArray::New(); 
(set num tuples, components, allocate, fill data, set name, etc) 
mygrid->GetCellData()->AddArray( data ); 
data->Delete() 
... 

At this point, if we write the grid to an xml file, the file contains an
array section with the correct name in the cell data section, but the
data values themselves are missing.  If we run the grid through a
vtkExtractUnstructuredGrid filter before we write the xml file, then all
the data is there as expected.  We have verified that the array
dimensions match the number of cells in the grid.  We have tried with
versions 4.2 and 4.4.2, and get the same results with both.

The one clue I found in the archives was a statement that you can't
change an object in the middle of a pipeline, and that something like a
vtkMergeDataObjectFilter must be used.  If that is the case, why does
everything work correctly if I go though a filter before writing the
grid?  What am I missing?  

Thank you, 

RAYMOND C. MAPLE, Lt Col USAF 
Deputy Head, Department of Aeronautics and Astronautics 
Air Force Institute of Technology 

 

RAYMOND C. MAPLE, Lt Col USAF 
Deputy Head, Department of Aeronautics and Astronautics 
Air Force Institute of Technology 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050218/f2d586a1/attachment.htm>


More information about the vtkusers mailing list