<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Thank you for the clarification!<br>
Indeed I tried the Modified call on the graph object during my
testing. Still no rebuild of lookup. I now just tried Modified
calls on VertexData and directly on the PedigreeID Array after
adding the vertices. Still no rebuild of lookup. The DataChanged()
call did the job. (In 5.10.1)<br>
In any case, I think it would be preferable if the graph method
AddVertex(pedId) would trigger the lookup rebuild. Or at least the
graph->Modified() call. An update of the corresponding API docs
should be considered also. Otherwise migration to newer vtk
versions might give some people serious headaches. It took me half
a day to track the strange behaviour of my graphs down to this
change. ;)<br>
<br>
Best,<br>
Adrian.<br>
<br>
<br>
Am 28.08.2014 02:19, schrieb Berk Geveci:<br>
</div>
<blockquote
cite="mid:CAE32kpUd5AdfWz4rp9XjL+y_H1HDKuFuokYWkw4=kxmOpNKW5Q@mail.gmail.com"
type="cite">
<div dir="ltr">Ah interesting. Note that I plan to remove <span
style="font-family:arial,sans-serif;font-size:13px">DataChanged()
in the future. It is a serious performance bottleneck when
multiple threads are setting different parts of an array
because it causes all threads to write to the same memory
location where that flag is stored. The right way of doing
this is to call Modified() after doing a set of changes to
notify whatever may depend on an array.</span>
<div>
<span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">Best,</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">-berk</span></div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Aug 27, 2014 at 5:30 PM, Jeff
Baumes <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jeff.baumes@kitware.com" target="_blank">jeff.baumes@kitware.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">It is unclear what changed exactly, but the
current behavior is that for numeric arrays, setting data
with SetValue() (which is what AddVertex ultimately does
to the pedigree ID array), does not in fact invoke
DataChanged() on the array which would signal the lookup
to rebuild on the next LookupValue() call (which is what
FindVertex() performs). This was done for performance
reasons, and perhaps this change was made between 5.8 and
5.10.
<div>
<br>
</div>
<div>If you call pedigreeIds->DataChanged() just before
the call to FindVertex(), the issue should be resolved.</div>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
On Wed, Aug 27, 2014 at 9:28 AM, Adrian Friebel <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:friebel@izbi.uni-leipzig.de"
target="_blank">friebel@izbi.uni-leipzig.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hey,<br>
so far I compiled my software against vtk 5.8.
Recently I tried to compile it against 5.10.1 and
noticed unexpected behaviour while adding vertices
to a graph while passing pedigree ids.<br>
Below a minimal example and its output:<br>
<br>
#include <stdio.h><br>
#include <iostream><br>
<br>
#include <vtkDataSetAttributes.h><br>
#include <vtkMutableUndirectedGraph.h><br>
#include <vtkSmartPointer.h><br>
#include <vtkUnsignedLongArray.h><br>
<br>
int main(int argc, char **argv)<br>
{<br>
vtkSmartPointer<vtkMutableUndirectedGraph>
graph = vtkSmartPointer<vtkMutableUndirectedGraph>::New();<br>
<br>
vtkSmartPointer<vtkUnsignedLongArray>
pedigreeIds = vtkSmartPointer<vtkUnsignedLongArray>::New();<br>
pedigreeIds->Initialize();<br>
pedigreeIds->SetName("Pedigree IDs");<br>
<br>
graph->GetVertexData()->SetPedigreeIds(pedigreeIds);<br>
<br>
for(unsigned int i=0; i<10; ++i) {<br>
vtkIdType v = graph->AddVertex(i*100);<br>
std::cout << "i = " << i
<< ": v = " << v <<<br>
", graph->GetVertex[..]->GetVariantValue(
" << v << ") = " <<
graph->GetVertexData()->GetPedigreeIds()->GetVariantValue(v)
<<<br>
", graph->FindVertex(" <<
i << "*100) = " <<
graph->FindVertex(i*100) << std::endl;<br>
}<br>
return 0;<br>
}<br>
<br>
VTK-5.8:<br>
i = 0: v = 0, graph->GetVertex[..]->GetVariantValue(
0) = 0, graph->FindVertex(0*100) = 0<br>
i = 1: v = 1, graph->GetVertex[..]->GetVariantValue(
1) = 100, graph->FindVertex(1*100) = 1<br>
i = 2: v = 2, graph->GetVertex[..]->GetVariantValue(
2) = 200, graph->FindVertex(2*100) = 2<br>
i = 3: v = 3, graph->GetVertex[..]->GetVariantValue(
3) = 300, graph->FindVertex(3*100) = 3<br>
i = 4: v = 4, graph->GetVertex[..]->GetVariantValue(
4) = 400, graph->FindVertex(4*100) = 4<br>
i = 5: v = 5, graph->GetVertex[..]->GetVariantValue(
5) = 500, graph->FindVertex(5*100) = 5<br>
i = 6: v = 6, graph->GetVertex[..]->GetVariantValue(
6) = 600, graph->FindVertex(6*100) = 6<br>
i = 7: v = 7, graph->GetVertex[..]->GetVariantValue(
7) = 700, graph->FindVertex(7*100) = 7<br>
i = 8: v = 8, graph->GetVertex[..]->GetVariantValue(
8) = 800, graph->FindVertex(8*100) = 8<br>
i = 9: v = 9, graph->GetVertex[..]->GetVariantValue(
9) = 900, graph->FindVertex(9*100) = 9<br>
<br>
VTK-5.10.1:<br>
i = 0: v = 0, graph->GetVertex[..]->GetVariantValue(
0) = 0, graph->FindVertex(0*100) = 0<br>
i = 1: v = 1, graph->GetVertex[..]->GetVariantValue(
1) = 100, graph->FindVertex(1*100) = 1<br>
i = 2: v = 2, graph->GetVertex[..]->GetVariantValue(
2) = 200, graph->FindVertex(2*100) = -1<br>
i = 3: v = 3, graph->GetVertex[..]->GetVariantValue(
3) = 300, graph->FindVertex(3*100) = 3<br>
i = 4: v = 4, graph->GetVertex[..]->GetVariantValue(
4) = 400, graph->FindVertex(4*100) = -1<br>
i = 5: v = 5, graph->GetVertex[..]->GetVariantValue(
5) = 500, graph->FindVertex(5*100) = -1<br>
i = 6: v = 6, graph->GetVertex[..]->GetVariantValue(
6) = 600, graph->FindVertex(6*100) = -1<br>
i = 7: v = 7, graph->GetVertex[..]->GetVariantValue(
7) = 700, graph->FindVertex(7*100) = 7<br>
i = 8: v = 8, graph->GetVertex[..]->GetVariantValue(
8) = 800, graph->FindVertex(8*100) = -1<br>
i = 9: v = 9, graph->GetVertex[..]->GetVariantValue(
9) = 900, graph->FindVertex(9*100) = -1<br>
<br>
<br>
It seems that there is something wrong with the
AbstractArray::LookupValue in 5.10.1, since the
array entries value->pedId are made.<br>
I am aware that 6.1 was released some time ago.
Maybe the issue was solved already, but since I
couldn't find any reports on this I thought I
might inform you guys.<br>
Or am I just missing some newly introduced update
call?<br>
<br>
Best,<br>
Adrian.<br>
<br>
-- <br>
Dipl.-Inform. Adrian Friebel<br>
Research Group for Multicellular Systems Biology<br>
Interdisciplinary Centre for BioInformatics<br>
University of Leipzig<br>
Haertelstrasse 16-18<br>
04107 Leipzig<br>
Germany<br>
Tel.: <a moz-do-not-send="true"
href="tel:%2B49%20341%2097-16627"
value="+493419716627" target="_blank">+49 341
97-16627</a><br>
email: <a moz-do-not-send="true"
href="mailto:adrian.friebel@uni-leipzig.de"
target="_blank">adrian.friebel@uni-leipzig.de</a><br>
<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK
FAQ at: <a moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK_FAQ"
target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
href="http://www.kitware.com/opensource/opensource.html"
target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a
moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://public.kitware.com/mailman/listinfo/vtkusers"
target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>