<div dir="ltr"><div><div><div></div>Hey Andy,<br><br>Does the GradientOfUnstructuredDataSet filter produce a tensor from an input vector field? My testing in ParaView indicates it doesn't , but I'm not super familiar with it.<br><br></div>Thanks,<br></div>Cory<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 18, 2018 at 11:14 AM, Caffagni, Andrea <span dir="ltr"><<a href="mailto:Andrea.Caffagni@ferrari.com" target="_blank">Andrea.Caffagni@ferrari.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div class="m_4082803412342905101WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Dear Cory,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This is the complete message that I have obtained like output:<u></u><u></u></span></p><span class="">
<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:8.5pt;font-family:Courier;color:maroon">Traceback (most recent call last):</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "<string>", line 22, in <module></span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "<string>", line 14, in RequestData</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "C:\Program Files\ParaView 5.3.0-Qt5-OpenGL2-Windows-<wbr>64bit\bin\lib\site-packages\<wbr>numpy\linalg\linalg.py", line 1095, in eig</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">_assertRankAtLeast2(a)</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "C:\Program Files\ParaView 5.3.0-Qt5-OpenGL2-Windows-<wbr>64bit\bin\lib\site-packages\<wbr>numpy\linalg\linalg.py", line 202, in _assertRankAtLeast2</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">'at least two-dimensional' % len(a.shape))</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">numpy.linalg.linalg.<wbr>LinAlgError: 0-dimensional array given. Array must be at least two-dimensional</span><u></u><u></u></p>
</span><p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green">number of points 1</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green">tensors[0:3] [VTKArray([[[ 8.34616375, -23.89611435, 2.00894117],</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green">[ 0.67995167, -23.11237526, 289.07113647],</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green">[ 27.26550674, -231.06710815, 16.90883636]]], dtype=float32)]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green">From this, I have thought about the vtk array.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green">Best regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:green">Andrea</span><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"><u></u> <u></u></span></p>
<p class="MsoNormal"><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""> Cory Quammen [mailto:<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.<wbr>com</a>]
<br>
<b>Sent:</b> Wednesday, April 18, 2018 15:11<br>
<b>To:</b> Caffagni, Andrea<br>
<b>Cc:</b> <a href="mailto:paraview@public.kitware.com" target="_blank">paraview@public.kitware.com</a><br>
<b>Subject:</b> Re: [Paraview] Problem with numpy array<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Hi Andrea,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">Besides the error message, what does your script print?<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Cory<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Wed, Apr 18, 2018 at 2:14 AM, Caffagni, Andrea <<a href="mailto:Andrea.Caffagni@ferrari.com" target="_blank">Andrea.Caffagni@ferrari.com</a>> wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Dear Users,<u></u><u></u></p>
<p class="MsoNormal">I need to solve an eigenproblem in a point of a CFD field.<u></u><u></u></p>
<p class="MsoNormal">Using the GradientOfUnstructuredDataSet I calculate the velocity gradient of my velocity field, than I isolate may point of interest and I have written the following ProgrammableFilter:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal" style="margin-top:9.0pt"><b><span style="font-size:10.0pt;font-family:"Courier New";color:green">import</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<b><span style="color:blue">numpy</span></b> <b><span style="color:green">as</span></b>
<b><span style="color:blue">np</span></b></span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Courier New";color:green">from</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<b><span style="color:blue">numpy</span></b> <b><span style="color:green">import</span></b> linalg
<b><span style="color:green">as</span></b> LA</span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Courier New";color:green">from</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<b><span style="color:blue">paraview</span></b> <b><span style="color:green">import</span></b> numpy_support</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:green">input</span><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#666666">=</span> inputs[<span style="color:#666666">0</span>]</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">numPoints
<span style="color:#666666">=</span> <span style="color:green">input</span><span style="color:#666666">.</span>GetNumberOfPoints()</span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Courier New";color:green">print</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#ba2121">"number of points"</span>,numPoints</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">tensors
<span style="color:#666666">=</span> <span style="color:green">input</span><span style="color:#666666">.</span>PointData[<span style="color:#ba2121">'Gradients'</span>]</span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Courier New";color:green">print</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#ba2121">"tensors[0:3]"</span>,tensors[<span style="color:#666666">0</span>:<span style="color:#666666">3</span>]</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">eigenvalues,eigenvectors
<span style="color:#666666">=</span> LA<span style="color:#666666">.</span>eig(tensors)</span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Courier New";color:green">print</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#ba2121">'eigenvalues'</span>, eigenvalues[<span style="color:#666666">0</span>]</span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Courier New";color:green">print</span></b><span style="font-size:10.0pt;font-family:"Courier New"">
<span style="color:#ba2121">'eigenvectors'</span>,eigenvectors[<span style="color:#666666">0</span>]</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">output<span style="color:#666666">.</span>PointData<span style="color:#666666">.</span>append(<wbr>eigenvalues,<span style="color:#ba2121">'eigenvalues'</span>)</span><u></u><u></u></p>
<p class="MsoNormal">output<span style="color:#666666">.</span>PointData<span style="color:#666666">.</span>append(<wbr>eigenvectors,<span style="color:#ba2121">'eigenvectors'</span>)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I have obtained the following error message:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">Traceback (most recent call last):</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "<string>", line 22, in <module></span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "<string>", line 14, in RequestData</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "C:\Program Files\ParaView 5.3.0-Qt5-OpenGL2-Windows-<wbr>64bit\bin\lib\site-packages\<wbr>numpy\linalg\linalg.py", line
1095, in eig</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">_assertRankAtLeast2(a)</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">File "C:\Program Files\ParaView 5.3.0-Qt5-OpenGL2-Windows-<wbr>64bit\bin\lib\site-packages\<wbr>numpy\linalg\linalg.py", line
202, in _assertRankAtLeast2</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">'at least two-dimensional' % len(a.shape))</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon">numpy.linalg.linalg.<wbr>LinAlgError: 0-dimensional array given. Array must be at least two-dimensional</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier;color:maroon"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier">I imagine that the problem is linked to the vtk array, I need to convert my ‘Gradients’ matrix in a nparray?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier">Someone have the same problem?</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier">Best Regards,</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:8.5pt;font-family:Courier">Andrea</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p>______________________________<wbr>______________________________<wbr>______________________________<wbr>_______________________<u></u><u></u></p>
<p> <u></u><u></u></p>
<p>Questo messaggio è da intendersi esclusivamente ad uso del destinatario e può contenere informazioni che sono di natura privilegiata, confidenziale o non divulgabile secondo le leggi vigenti. Se il lettore del presente messaggio non è il destinatario designato,
o il dipendente/agente responsabile per la consegna del messaggio al destinatario designato, si informa che ogni disseminazione, distribuzione o copiatura di questa comunicazione è vietata anche ai sensi della normativa vigente in materia di protezione dei
dati personali. Se avete ricevuto questo messaggio per errore, vi preghiamo di notificarcelo immediatamente a mezzo e-mail di risposta e successivamente di procedere alla cancellazione di questa e-mail e relativi allegati dal vostro sistema.<u></u><u></u></p>
<p>______________________________<wbr>______________________________<wbr>______________________________<wbr>_______________________<u></u><u></u></p>
<p> <u></u><u></u></p>
<p>This message is intended only for the use of the addressee and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent
responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is prohibited under the applicable data protection law. If you have received this e-mail by mistake,
please notify us immediately by return e-mail and delete this e-mail and all attachments from your system.<u></u><u></u></p>
<p> <u></u><u></u></p>
<p>______________________________<wbr>______________________________<wbr>______________________________<wbr>_______________________ <u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
______________________________<wbr>_________________<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/<wbr>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/<wbr>ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" target="_blank">
http://markmail.org/search/?q=<wbr>ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/paraview" target="_blank">https://public.kitware.com/<wbr>mailman/listinfo/paraview</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal">-- <u></u><u></u></p>
<div>
<p class="MsoNormal">Cory Quammen<br>
Staff R&D Engineer<br>
Kitware, Inc.<u></u><u></u></p>
</div>
</div>
</div></div></div><div><div class="h5">
<p>______________________________<wbr>______________________________<wbr>______________________________<wbr>_______________________</p>
<p> </p>
<p>Questo messaggio è da intendersi esclusivamente ad uso del destinatario e può contenere informazioni che sono di natura privilegiata, confidenziale o non divulgabile secondo le leggi vigenti. Se il lettore del presente messaggio non è il destinatario designato,
o il dipendente/agente responsabile per la consegna del messaggio al destinatario designato, si informa che ogni disseminazione, distribuzione o copiatura di questa comunicazione è vietata anche ai sensi della normativa vigente in materia di protezione dei
dati personali. Se avete ricevuto questo messaggio per errore, vi preghiamo di notificarcelo immediatamente a mezzo e-mail di risposta e successivamente di procedere alla cancellazione di questa e-mail e relativi allegati dal vostro sistema.</p>
<p>______________________________<wbr>______________________________<wbr>______________________________<wbr>_______________________</p>
<p> </p>
<p>This message is intended only for the use of the addressee and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent
responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is prohibited under the applicable data protection law. If you have received this e-mail by mistake,
please notify us immediately by return e-mail and delete this e-mail and all attachments from your system.</p>
<p> </p>
<p>______________________________<wbr>______________________________<wbr>______________________________<wbr>_______________________ </p>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Cory Quammen<br>Staff R&D Engineer<br>Kitware, Inc.</div>
</div>