[vtkusers] AddArray problems

John Platt jcplatt at lineone.net
Fri Feb 18 14:13:37 EST 2005


Hi Ray,

 

You could try AppendFilter->Modified() followed by
AppendFilter->Update() to force the filter to execute. If you are using
the vtkMergeDataObjectFilter, you will probably need to follow this with
vtkAssignFilter to set the attributes. Also, I seem to recall that the
merge filter does not pass any of the input point/cell/field data - only
the data from the data object.

 

HTH

John

 

 

-----Original Message-----
From: Maple Raymond C LtCol AFIT/ENY [mailto:Raymond.Maple at afit.edu] 
Sent: 18 February 2005 12:36
To: John Platt
Subject: RE: [vtkusers] AddArray problems

 

John,

   Thanks for your reply.  We are updating the AppendFilter, as I have
no guarantee that I will get any cells out of it.  I have to update in
order to get a valid cell count to decide whether to proceed with my
pipeline.  (Actually, I am probably calling something like
AppendFilter->GetOutput()->Update().)  I have my student trying the
MergeDataObjectFilter route.

 

BTW, I am having difficulty submitting to the mailing list.  The DNS
tables do not have valid MX (mail) entries for ftp.org.  I got through
yesterday on a manual route our IT shop set up for me, but it was only
temporary.  I'm surprised my initial message got through, since I got a
bounce back reply saying it couldn't be delivered, even with the manual
routing in place.  Unfortunately, the email address to report problems
is also an ftp.org address.  If you could forward my problems on , I
would appreciate it.

 

Thanks,

Ray

 

RAYMOND C. MAPLE, Lt Col USAF

Deputy Head, Department of Aeronautics and Astronautics

Air Force Institute of Technology

 

 

 

  _____  

From: John Platt [mailto:jcplatt at lineone.net] 
Sent: Thursday, February 17, 2005 7:27 PM
To: Maple Raymond C LtCol AFIT/ENY
Cc: vtkusers at vtk.org
Subject: RE: [vtkusers] AddArray problems

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/270c9153/attachment.htm>


More information about the vtkusers mailing list