<div dir="ltr">Hello,<div><br></div><div>I am new to Paraview as well as Phython.</div><div>Currently I am working on some tensor representation issues.</div><div><br></div><div>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>Some filters I would like to apply, however, demand input arrays with 9 components.</div><div>So my guess was, it would be easiest to use "Phyton Programmabe Filter" and add the missing entries.</div><div><br>
</div><div>Here is what i tried after viewing some examples on the paraview-wiki:</div><div><br></div><div>//////////////////////////////////////////////////////////////////////////////////</div><div><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>//////////////////////////////////////////////////////////////////////////////////<br></div><div><br></div><div>This however results in a 3 component array, with only zeros in it.</div>
<div><br></div><div>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><br></div><div>Regards,</div><div>Michael</div></div>