<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 10 (filtered)">
<title>AddArray problems</title>

<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.emailstyle18
        {font-family:Arial;
        color:navy;}
span.emailstyle19
        {font-family:Arial;
        color:navy;}
span.EmailStyle20
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><!-- Converted from text/rtf format -->Hi
Raymond,</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>There are 2 approaches you could use to
add data arrays to a data set. &nbsp;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.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>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.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>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.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>HTH</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>John. </span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> vtkusers-bounces@vtk.org
[mailto:vtkusers-bounces@vtk.org] <b><span style='font-weight:bold'>On Behalf
Of </span></b>Maple Raymond C LtCol AFIT/ENY<br>
<b><span style='font-weight:bold'>Sent:</span></b> 17 February 2005 16:46<br>
<b><span style='font-weight:bold'>To:</span></b> vtkusers@vtk.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> [vtkusers] AddArray problems</span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Hello,</span></font> <br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>&nbsp;&nbsp;&nbsp;
We are having some problems adding arrays of scalars to an unstructured
grid.&nbsp; We are doing the following:</span></font> </p>

<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>mygrid = &lt;appendfilter&gt;-&gt;GetOutput()</span></font>
<br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>vtkDoubleArray
*data = vtkDoubleArray::New();</span></font> <br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>(set num
tuples, components, allocate, fill data, set name, etc)</span></font> <br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>mygrid-&gt;GetCellData()-&gt;AddArray(
data );</span></font> <br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>data-&gt;Delete()</span></font>
<br>
<font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>...</span></font>
</p>

<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>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.&nbsp; If we run the grid
through a vtkExtractUnstructuredGrid filter before we write the xml file, then
all the data is there as expected.&nbsp; We have verified that the array
dimensions match the number of cells in the grid.&nbsp; We have tried with
versions 4.2 and 4.4.2, and get the same results with both.</span></font></p>

<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>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.&nbsp; If that is the case, why
does everything work correctly if I go though a filter before writing the
grid?&nbsp; What am I missing?&nbsp; </span></font></p>

<p style='margin-left:36.0pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Thank you,</span></font> </p>

<p style='margin-left:36.0pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>RAYMOND C. MAPLE, Lt Col USAF <br>
Deputy Head, Department of Aeronautics and Astronautics <br>
Air Force Institute of Technology </span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

<p style='margin-left:36.0pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>RAYMOND C. MAPLE, Lt Col USAF <br>
Deputy Head, Department of Aeronautics and Astronautics <br>
Air Force Institute of Technology </span></font></p>

<p class=MsoNormal style='margin-left:36.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;</span></font></p>

</div>

</body>

</html>