Hello,

I am new to Paraview as well as Phython.
Currently I am working on some tensor representation issues.

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.
Some filters I would like to apply, however, demand input arrays with 9
components.
So my guess was, it would be easiest to use "Phyton Programmabe Filter" and
add the missing entries.

Here is what i tried after viewing some examples on the paraview-wiki:

//////////////////////////////////////////////////////////////////////////////////
from paraview import numpy_support as NS
import numpy as N
pdi = self.GetInputDataObject(0,0)
pdo = self.GetOutputDataObject(0)
pdo.ShallowCopy(pdi)

import math

m = pdi.GetPointData().GetArray('tensor6_array')
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)]])


m3 = NS.numpy_to_vtk(m2)
m3.SetName('tensor9_array')
pdo.GetPointData().AddArray(m3)
//////////////////////////////////////////////////////////////////////////////////

This however results in a 3 component array, with only zeros in it.

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!

Regards,
Michael
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to