<div dir="ltr"><div>Hi Dennis,</div><div><br></div>Here is an example that works in 4.3:<div><br></div><div><div>from vtk.numpy_interface import dataset_adapter as dsa</div><div>iterator = dsa.MultiCompositeDataIterator([inputs[0], output])</div><div>for iblock, oblock in iterator:</div><div>    oblock.PointData.append(iblock.PointData['DISPL'], "DISPL")</div></div><div><br></div><div>A few points:</div><div>* MultiCompositeDataIterator() allows you to traverse the input and output datasets together so you get matching datasets</div><div>* iblock and oblock correspond to input and output blocks</div><div>* For the API for the iblock and oblock objects, see the User's Guide or numerous blogs that I wrote on the topic under <a href="http://www.kitware.com/blog">www.kitware.com/blog</a></div><div>* vtkDataSet API is also available through those objects so you can call things like GetNumberOfCells(), GetNumberOfPoints() etc.</div><div><br></div><div>Best,</div><div>-berk</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 29, 2015 at 11:01 AM, Dennis Conklin <span dir="ltr"><<a href="mailto:dennis_conklin@goodyear.com" target="_blank">dennis_conklin@goodyear.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Berk,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks for your reply.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I am using Paraview 4.3, so hopefully that has the improvements you mentioned.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I guess if I could figure out what objects are used for Blocks in side the Programmable filter I could do more on my own, but it’s clear they are different from
 in a python script, but still not clear what they are.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">So a typical application would be a special version of point data to cell data.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">I have some node variables.     I want to find all the nodes attached to each element, do some calculations on those node variables to generate a new element
 variable.   So basically like<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Loop over blocks<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">     Loop over elements in block<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">                Find all nodes connected to element<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">                Perform calculations based on node variables<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">                Assign new element variable(s) based on calculations<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Thanks for any insight – Alan at Sandia has suggested I check the latest user guide, and I will, but I haven’t seen a good element example for the Programmable
 filter yet – I don’t have any problem doing nodal manipulations, but I have a good example of that.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Dennis<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Berk Geveci [mailto:<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>]
<br>
<b>Sent:</b> Wednesday, April 29, 2015 10:29 AM<br>
<b>To:</b> Scott, W Alan<br>
<b>Cc:</b> Dennis Conklin; <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview] [EXTERNAL] Idiot's Guide to Programmable Filter<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hey Dennis,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Which version of ParaView are you using? We have made some significant improvements to the way we handle multi-block datasets (which Exodus produces) in the latest version.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The interface in the Programmable Filter is somewhat different than what you would have in a ParaView Python script. This is because you actually have access to the full data and the objects in there are of different types.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">If you give me some examples of what you are trying to do in the programmable filter, I can provide code that demonstrates the use of the API in the programmable filter.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Best,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">-berk<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, Apr 28, 2015 at 10:32 PM, Scott, W Alan <<a href="mailto:wascott@sandia.gov" target="_blank">wascott@sandia.gov</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal"><span style="color:#1f497d">Dennis,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d">The Python/ Programmable filter is a black box to me (i.e., I won’t be much additional help).  However, the place i would start would be the new, super-duper
 ParaView Guide.  Kitware – and especially Utkarsh – have done a great job on it.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d">Rather than giving the link, here is how to find it.  It is sold in paper form on Amazon, and also is available as a .pdf for free (lacking 3 chapters,
 not related to the python filter).  </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"><a href="http://paraview.org/" target="_blank">paraview.org/</a> Resources/ ParaView Guide.  This includes the link to the .pdf.  You are interested
 in (at least) chapter 13.  It is listed under master section II, Reference Manual.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d">Alan</span><u></u><u></u></p>
<p class="MsoNormal"><span style="color:#1f497d"> </span><u></u><u></u></p>
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in">
<b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif"> ParaView [mailto:<a href="mailto:paraview-bounces@paraview.org" target="_blank">paraview-bounces@paraview.org</a>]
<b>On Behalf Of </b>Dennis Conklin<br>
<b>Sent:</b> Tuesday, April 28, 2015 11:11 AM<br>
<b>To:</b> <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> [EXTERNAL] [Paraview] Idiot's Guide to Programmable Filter</span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
All,<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
I’m a little confused by what objects are inside a programmable filter.    I have a multi-block EXODUS dataset.    When I read this in it is a Exodus2Reader object (sp?) and I can access the blocks, pointdata, celldata, etc in a python script.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Once I get inside the Programmable filter, the  blocks of the input[] seem to have different member functions than they did in a Python script.   So I can’t figure out  how to get connectivity,   number of cells in a block, generate new cell variables, etc.   
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
So, if I’m in a Programmable Filter, what object do I look at in either the Paraview or VTK class libraries to understand what the properties of the block are?<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Thanks very much for any insight you can give.<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
 <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Dennis<u></u><u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a 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 ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">
http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" target="_blank">
http://markmail.org/search/?q=ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>