I attempted some custom scripts to see the include structure of VTK.<div><br></div><div>python depends.py > vtkdepends.txt</div><div>vtkpython dependsview.py vtkdepends.txt</div><div><br></div><div>The first will create a two-column list of all includes from one class to another in VTK and must be called from the root of VTK source. The second visualizes the data with VTK itself and prints out the classes with the highest number of connections. Since the network makes a so-called "hairball", the second script optionally takes a maximum linkage cutoff to simplify the graph, e.g.</div>
<div><br></div><div>vtkpython dependsview.py vtkdepends.txt 10</div><div><br></div><div>will remove any classes with more than 10 links. Nodes are colored by number of connections.</div><div><br></div><div>Jeff<br><br><div class="gmail_quote">
On Wed, Aug 18, 2010 at 10:31 PM, Andrew Maclean <span dir="ltr"><<a href="mailto:a.maclean@cas.edu.au" target="_blank">a.maclean@cas.edu.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey Bill, need some python practice?<br>
<br>
This could be useful in looking at the examples.<br>
<br>
I attach a python script taken from<br>
<a href="http://furius.ca/pubcode/pub/conf/common/bin/depends-dot.html" target="_blank">http://furius.ca/pubcode/pub/conf/common/bin/depends-dot.html</a><br>
And modified so that just the executable and the VTK nodes of the graph<br>
are traversed.<br>
<br>
Run it as:<br>
python depends-dot ./Executable_File > depends.dot<br>
Then:<br>
neato -Tps -O depends.dot<br>
Or:<br>
dot -Tps -O depends.dot<br>
<br>
As you know you can also run:<br>
cmake --graphviz=g.dot ..<br>
Assuming the source is in ..<br>
Then:<br>
neato -Tps -O g.dot<br>
Or:<br>
dot -Tps -O g.dot<br>
<br>
However the python script (as modified) displays a lot more information.<br>
My modifications are:<br>
# Eliminate /usr or /lib libraries and keep the first level<br>
VTK links.<br>
#if fn.find('/usr') == -1 and fn.find('/lib') == -1 and<br>
dfn.find('VTK') != -1:<br>
# Just the executable and the VTK nodes of the graph are<br>
traversed.<br>
if dfn.find('VTK') != -1:<br>
print '"%s" -> "%s";' % (fn, dfn)<br>
<br>
Just uncomment the first if statement to just get the first-level<br>
linkages to libraries.<br>
<br>
This might be a good start in visualising dependencies.<br>
<br>
I also found perl script called cinclude2dot that produces an include<br>
dependency graph see: <a href="http://www.flourish.org/cinclude2dot/" target="_blank">http://www.flourish.org/cinclude2dot/</a> . The<br>
problem with this one is that it cannot follow links to includes in<br>
other directories. My perl is not good enough but it may be possible to<br>
parse CMakeCache.txt to pick up the include paths and traverse those<br>
directories too.<br>
I ran this on the vtk directory and the output is ... well ...<br>
spectacular and unreadable.<br>
Try:<br>
./cinclude2dot --merge module > source.dot<br>
<br>
<br>
The python script focuses on libraries and the perl one focuses on<br>
includes. So the approaches are different. However I feel the perl one<br>
could be more useful with the --merge module option since in general vtk<br>
include names reflect class names.<br>
<br>
Regards<br>
Andrew<br>
<br>
<br>
--<br>
___________________________________________<br>
Andrew J. P. Maclean<br>
Centre for Autonomous Systems<br>
The Rose Street Building J04<br>
The University of Sydney 2006 NSW<br>
AUSTRALIA<br>
Ph: +61 2 9351 3283<br>
Fax: +61 2 9351 7474<br>
URL: <a href="http://www.acfr.usyd.edu.au/" target="_blank">http://www.acfr.usyd.edu.au/</a><br>
___________________________________________<br>
<br>_______________________________________________<br>
Arb mailing list<br>
<a href="mailto:Arb@vtk.org" target="_blank">Arb@vtk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/arb" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/arb</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jeff Baumes, Ph.D.<br>Technical Lead, Kitware Inc.<br>(518) 881-4932<br>
</div>