<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-CA">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I am trying to improve paraview loading times of many vtk files (on disk). I wrote a plugin that connects to a database (locally – for now) and extracts a potentially long list (100s – 1000s) of files locations which
I want to load into paraview fast. Most of the vtk files are only 1 kb, and feel it should be much much faster. Am I doing something wrong in my code? :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue">void</span><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">pqDatabaseConnection</span>::<span style="color:#880000">setupPipeline</span>(
<span style="color:blue">const</span> <span style="color:blue">QStringList</span>&
<b><span style="color:navy">file_list</span></b> )<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">pqApplicationCore</span> *<b><span style="color:navy">core</span></b> =
<span style="color:blue">pqApplicationCore</span>::<span style="color:#880000">instance</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">pqObjectBuilder</span> *<b><span style="color:navy">builder</span></b> =
<b><span style="color:navy">core</span></b>-><span style="color:#880000">getObjectBuilder</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">pqUndoStack</span> *<b><span style="color:navy">stack</span></b> =
<b><span style="color:navy">core</span></b>-><span style="color:#880000">getUndoStack</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">pqDisplayPolicy</span> *<b><span style="color:navy">displayPolicy</span></b> =
<b><span style="color:navy">core</span></b>-><span style="color:#880000">getDisplayPolicy</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">pqView</span> *<b><span style="color:navy">view</span></b> =
<span style="color:blue">pqActiveObjects</span>::<span style="color:#880000">instance</span>().<span style="color:#880000">activeView</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">int</span> <b><span style="color:navy">nfiles</span></b> = (<span style="color:blue">int</span>)<b><span style="color:navy">file_list</span></b>.<span style="color:#880000">size</span>(); // (e.g. file_list[0] = “C:/file1.vtk”, file_list[1]
= “C:/file2.vtk”, …) <o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">for</span> (<span style="color:blue">int</span> <b><span style="color:navy">j</span></b> = 0;
<b><span style="color:navy">j</span></b> < <b><span style="color:navy">nfiles</span></b>;
<b><span style="color:navy">j</span></b>++ ){<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">QStringList</span> <b><span style="color:navy">filej</span></b>;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<b><span style="color:navy">filej</span></b>.<span style="color:#880000">push_back</span>(<b><span style="color:navy">file_list</span></b>[<b><span style="color:navy">j</span></b>]);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">pqPipelineSource</span>* <b><span style="color:navy">reader</span></b> =
<b><span style="color:navy">builder</span></b>-><span style="color:#880000">createReader</span>(<span style="color:#A31515">"sources"</span>,<span style="color:#A31515">"LegacyVTKFileReader"</span>,<b><span style="color:navy">filej</span></b>,<span style="color:blue">this</span>-><span style="color:navy">Server</span>);
// </span><span style="font-size:9.5pt;font-family:Wingdings">ß</span><span style="font-size:9.5pt;font-family:Consolas"> this function is culprit<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<span style="color:blue">vtkSMProxy</span> *<b><span style="color:navy">readerProxy</span></b> =
<b><span style="color:navy">reader</span></b>-><span style="color:#880000">getProxy</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<b><span style="color:navy">readerProxy</span></b>-><span style="color:#880000">UpdateVTKObjects</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">
<b><span style="color:navy">displayPolicy</span></b>-><span style="color:#880000">setRepresentationVisibility</span>(<b><span style="color:navy">reader</span></b>-><span style="color:#880000">getOutputPort</span>(0),<b><span style="color:navy">view</span></b>,<span style="color:blue">false</span>);<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">When looking at the task manager (this is windows) all my cpu cores (16) are barely doing anything; 1 core is doing some work (maybe 20% utilized). Can you parallelize the above? Is the issue with the storage (legacy
.vtk asci); is there a more appropriate format or method at reading the large amount of files?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Thanks !<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Michael Hillier <o:p></o:p></span></p>
</div>
</body>
</html>