<span id="mailbox-conversation"> CBC. </span><div class="mailbox_signature">—<br>Sent from <a href="https://www.dropbox.com/mailbox">Mailbox</a>
</div>
<br><br><div class="gmail_quote"><p>On Fri, May 2, 2014 at 8:52 AM, Cory Quammen <span dir="ltr"><<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span> wrote:<br></p><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><p>David,
<br><br>Thanks for your reply :-)
<br><br>As for determining the active scalars (vectors, etc) on the output,
<br>one thing that might make sense would be to set the active scalars to
<br>an output array only if the input arrays being appended are designated
<br>the active scalars in their respective inputs, e.g. if "A" is the
<br>active scalar in input 1 and input 2, set "A" as the active scalar in
<br>the output. If "A" is active in input 1 and "B" is active in input 2,
<br>then don't set an active scalar in the output. How does that sound?
<br><br>Thanks,
<br>Cory
<br><br>On Fri, Apr 25, 2014 at 12:47 PM, David Thompson
<br><david.thompson@kitware.com> wrote:
<br>> Hi Cory,
<br>>
<br>> Congratulations, you've found a bug. :-) I agree that variables should be merged by name, not attribute type. I will be happy to review a patch to fix that.
<br>>
<br>> A little more debatable: which attribute (if any) should be marked as active scalars on the output?
<br>>
<br>> David
<br>>
<br>> On Apr 25, 2014, at 12:35 PM, Cory Quammen <cory.quammen@kitware.com> wrote:
<br>>
<br>>> Hi all,
<br>>>
<br>>> There is some unexpected behavior (to me, anyway) in vtkAppendFilter.
<br>>> Say I have two data sets D1 and D2, each of which has two
<br>>> single-component scalar arrays named "A" and "B". Assume for
<br>>> simplicity that each array has three elements as illustrated below:
<br>>>
<br>>> D1:
<br>>> "A" = [ 1, 1, 1 ]
<br>>> "B" = [ 2, 2, 2 ]
<br>>>
<br>>> D2:
<br>>> "A" = [ 1, 1, 1 ]
<br>>> "B" = [ 2, 2, 2 ]
<br>>>
<br>>> I would expect that if I used vtkAppendFilter to merge these two
<br>>> datasets that the values from the "A" arrays in each data set would be
<br>>> merged into an "A" array in the result, with the same happening for
<br>>> the "B" arrays. That is:
<br>>>
<br>>> Appended result:
<br>>> "A" = [ 1, 1, 1, 1, 1, 1 ]
<br>>> "B" = [ 2, 2, 2, 2, 2, 2 ]
<br>>>
<br>>> If no "active" scalars are set in the two data sets, then everything
<br>>> works as I suspect.
<br>>>
<br>>> "A" = [1, 1, 1, 1, 1, 1]
<br>>> "B" = [2, 2, 2, 2, 2, 2]
<br>>>
<br>>> However, if "A" is set as the active scalar in D1 and "B" is set as
<br>>> the active scalar in D2, the result is that the merged array in the
<br>>> result with the name "A" has the first half of its values from array
<br>>> "A" in D1 and the second half of its values from array "B" in D2. The
<br>>> "B" array in the output is all 2s as I would expect.
<br>>>
<br>>> "A" = [ 1, 1, 1, 2, 2, 2 ]
<br>>> "B" = [ 2, 2, 2, 2, 2, 2 ]
<br>>>
<br>>> If you set "B" to be the active scalar in D1 and "A" as the active
<br>>> scalar in D2, then the resulting merged array is named "B" and has
<br>>> values from D1's "B" array followed by values from D2's "A" array. The
<br>>> "A" array in the output is all 1s as I would expected.
<br>>>
<br>>> "B" = [ 2, 2, 2, 1, 1, 1 ]
<br>>> "A" = [ 1, 1, 1, 1, 1, 1 ]
<br>>>
<br>>> If you set "A" to be the active scalars in both datasets, then "A" in
<br>>> the output is all 1s and "B" is all 2s as I would expect.
<br>>>
<br>>> "A" = [ 1, 1, 1, 1, 1, 1 ]
<br>>> "B" = [ 2, 2, 2, 2, 2, 2 ]
<br>>>
<br>>> What's happening is that the filter is merging the active scalars from
<br>>> all the data sets into an array whose name comes from whichever
<br>>> dataset happens to come first. Non-active arrays are merged by name.
<br>>>
<br>>> Does this seem like sensible behavior? My guess is that most people
<br>>> would expect arrays with the same name to be merged. The concern is
<br>>> that some filter upstream may change which array is active, the user
<br>>> has no idea that this has happened, and unexpected results occur.
<br>>>
<br>>> Sure, you could get merging by name only by setting the active scalar
<br>>> to the same array in each input data set for vtkAppendFilter prior to
<br>>> updating it, but this is not at all obvious or well documented.
<br>>>
<br>>> I've attached a self-contained code sample illustrating the problem.
<br>>>
<br>>> Thanks for your thoughts,
<br>>> Cory
<br>>> <CMakeLists.txt><AppendExample.cxx>_______________________________________________
<br>>> Powered by www.kitware.com
<br>>>
<br>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
<br>>>
<br>>> Follow this link to subscribe/unsubscribe:
<br>>> http://www.vtk.org/mailman/listinfo/vtk-developers
<br>>>
<br>>
<br>_______________________________________________
<br>Powered by www.kitware.com
<br><br>Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
<br><br>Follow this link to subscribe/unsubscribe:
<br>http://www.vtk.org/mailman/listinfo/vtk-developers
<br><br></p></blockquote></div><br>