<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Hi Utkarsh,</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Using the script you wrote with the Programmable Filter does the job nicely! Thanks so much for going above and beyond to help me assemble the arrays into a tensor. Programmable Filter never occurred to me and I am now looking forward to exploring Chapter 13 of the Paraview Guide to see what else I can do with it.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Many thanks,</div><div class="gmail_default" style="font-family:monospace,monospace">Nick Richmond</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 29, 2017 at 9:56 PM, Utkarsh Ayachit <span dir="ltr"><<a href="mailto:utkarsh.ayachit@kitware.com" target="_blank">utkarsh.ayachit@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">Nick,<div><br></div><div>You can use the <b>Programmable Filter</b> instead with something like the following script as the <b>Script</b>:</div><div><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)"><br></span></div><div><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)"><br></span></div><div><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)">from</span><span style="font-family:monospace"> </span><span style="font-family:monospace;font-weight:600;color:rgb(0,0,255)">paraview.vtk.numpy_interface</span><span style="font-family:monospace"> </span><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)">import</span><span style="font-family:monospace"> dataset_adapter </span><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)">as</span><span style="font-family:monospace"> dsa</span><br></div><div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)">import</span><span style="font-family:monospace"> </span><span style="font-family:monospace;font-weight:600;color:rgb(0,0,255)">numpy</span><span style="font-family:monospace"> </span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)">def</span><span style="font-family:monospace"> </span><span style="font-family:monospace;color:rgb(0,0,255)">make_tensor</span><span style="font-family:monospace">(xx,yy,zz, xy, yz, xz):</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace"> t </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> numpy</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">vstack([xx,yy,zz,xy, yz, xz])</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">transpose()</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">view(dsa</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">VTKA<wbr>rray)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace"> t</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">DataSet </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> xx</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">DataSet</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace"> t</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">Association </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> xx</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">Association</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace"> </span><span style="font-family:monospace;font-weight:600;color:rgb(0,128,0)">return</span><span style="font-family:monospace"> t</span></pre>
<pre style="margin-top:0px;margin-bottom:0px;font-family:monospace"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace">xx </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> inputs[</span><span style="font-family:monospace;color:rgb(102,102,102)">0</span><span style="font-family:monospace">]</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">PointData[</span><span style="font-family:monospace;color:rgb(186,33,33)">"sigma_xx"</span><span style="font-family:monospace"><wbr>]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace">yy </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> inputs[</span><span style="font-family:monospace;color:rgb(102,102,102)">0</span><span style="font-family:monospace">]</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">PointData[</span><span style="font-family:monospace;color:rgb(186,33,33)">"sigma_yy"</span><span style="font-family:monospace"><wbr>]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace">zz </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> inputs[</span><span style="font-family:monospace;color:rgb(102,102,102)">0</span><span style="font-family:monospace">]</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">PointData[</span><span style="font-family:monospace;color:rgb(186,33,33)">"sigma_zz"</span><span style="font-family:monospace"><wbr>]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace">xy </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> inputs[</span><span style="font-family:monospace;color:rgb(102,102,102)">0</span><span style="font-family:monospace">]</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">PointData[</span><span style="font-family:monospace;color:rgb(186,33,33)">"sigma_xy"</span><span style="font-family:monospace"><wbr>]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace">yz </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> inputs[</span><span style="font-family:monospace;color:rgb(102,102,102)">0</span><span style="font-family:monospace">]</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">PointData[</span><span style="font-family:monospace;color:rgb(186,33,33)">"sigma_yz"</span><span style="font-family:monospace"><wbr>]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace">xz </span><span style="font-family:monospace;color:rgb(102,102,102)">=</span><span style="font-family:monospace"> inputs[</span><span style="font-family:monospace;color:rgb(102,102,102)">0</span><span style="font-family:monospace">]</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">PointData[</span><span style="font-family:monospace;color:rgb(186,33,33)">"sigma_xz"</span><span style="font-family:monospace"><wbr>]</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:monospace">output</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">PointData</span><span style="font-family:monospace;color:rgb(102,102,102)">.</span><span style="font-family:monospace">append(make_<wbr>tensor(xx,yy,zz,xy,yz,xz), </span><span style="font-family:monospace;color:rgb(186,33,33)">"tensor"</span><span style="font-family:monospace">)</span></pre>
<pre style="margin-top:0px;margin-bottom:12px;font-family:monospace"><br></pre>Utkarsh</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Nov 29, 2017 at 5:01 PM, Nicholas Richmond <span dir="ltr"><<a href="mailto:nicholas.richmond@maine.edu" target="_blank">nicholas.richmond@maine.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Greetings,</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">I have a vtk Polygonal Mesh with six separate arrays (sigma_xx, sigma_yy, sigma_zz, sigma_xy, sigma_yz, sigma_xz). I'd like to assemble these into a tensor so that I may apply the Tensor Glyph filter.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">After reading that the <a href="https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.TensorGlyph.html" target="_blank">paraview.simple.TensorGlyph</a> ex<wbr>pects a symmetric tensor with the order XX, YY, ZZ, XY, YZ, XZ, I tried to assemble the six separate arrays into a single array with the Python Calculator, but have been unsuccessful.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">I've tried a variety of approaches, including:</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"><span style="background-color:rgb(204,204,204)"><b>Expression:</b> np.array([sigma_xx<wbr>, sigma_yy, sigma_zz, sigma_xy, sigma_yz, sigma_xz])</span></div><div class="gmail_default" style="font-family:monospace,monospace"><span style="background-color:rgb(204,204,204)"><b>Array Association:</b> Point Data</span></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">I can make a vector of the normal stresses using the "make_vector" function from paraview.vtk.numpy_interface.a<wbr>lgorithms, but there is no "make_tensor" function to assemble both normal and shear stresses into a single symmetric tensor.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Any guidance would be most appreciated.</div><div class="gmail_default" style="font-family:monospace,monospace">Many thanks,</div><div class="gmail_default" style="font-family:monospace,monospace">Nick Richmond</div></div>
<br></div></div>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensou<wbr>rce/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaV<wbr>iew</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mail<wbr>man/listinfo/paraview</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>