<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hello,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I am new to Paraview as well as Phython.</div>
<div style="font-family:arial,sans-serif;font-size:13px">Currently I am working on some tensor representation issues.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Right now, I am dealing with a symetric tensor dataset. As the the tensor is symetric only 6 values are stored in the data array.</div><div style="font-family:arial,sans-serif;font-size:13px">Some filters I would like to apply, however, demand input arrays with 9 components.</div>
<div style="font-family:arial,sans-serif;font-size:13px">So my guess was, it would be easiest to use "Phyton Programmabe Filter" and add the missing entries.</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Here is what i tried after viewing some examples on the paraview-wiki:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
//////////////////////////////////////////////////////////////////////////////////</div><div style="font-family:arial,sans-serif;font-size:13px"><div>from paraview import numpy_support as NS</div><div>import numpy as N</div>
<div>pdi = self.GetInputDataObject(0,0)</div><div>pdo = self.GetOutputDataObject(0)</div><div>pdo.ShallowCopy(pdi)</div><div><br></div><div>import math</div><div><br></div><div>m = pdi.GetPointData().GetArray('tensor6_array')</div>
<div>m2 = N.mat([[m.GetValue(0), m.GetValue(1), m.GetValue(2)], [m.GetValue(1), m.GetValue(3), m.GetValue(4)], [m.GetValue(2), m.GetValue(4), m.GetValue(5)]])</div><div><br></div><div><br></div><div>m3 = NS.numpy_to_vtk(m2)</div>
<div>m3.SetName('tensor9_array')</div><div>pdo.GetPointData().AddArray(m3)</div></div><div style="font-family:arial,sans-serif;font-size:13px">//////////////////////////////////////////////////////////////////////////////////<br>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">This however results in a 3 component array, with only zeros in it.</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Its quite clear to me, that there must be some fundamental mistake in it, and would be very gratefull if someone could point it out to me!</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Regards,</div><div style="font-family:arial,sans-serif;font-size:13px">Michael</div></div>