Dear ParaView Community,
I have the components of a tensor as scalar variables, and I would like to combine them into a single tensor variable so I can use the Tensor Glyph filter. The ParaView Wiki indicates that this can be done using a Programmable Filter, but when I use the suggested script, I get the following error: “TypeError: Could not find a suitable VTK type for object.” Could someone please explain how to fix the error? Here is the script from the Wiki:
from paraview.vtk.numpy_interface import dataset_adapter as dsa
import numpy
def make_tensor(xx,yy,zz, xy, yz, xz):
t = numpy.vstack([xx,yy,zz,xy, yz, xz]).transpose().view(dsa.VTKArray)
t.DataSet = xx.DataSet
t.Association = xx.Association
return t
xx = inputs[0].PointData["sigma_xx"]
yy = inputs[0].PointData["sigma_yy"]
zz = inputs[0].PointData["sigma_zz"]
xy = inputs[0].PointData["sigma_xy"]
yz = inputs[0].PointData["sigma_yz"]
xz = inputs[0].PointData["sigma_xz"]
output.PointData.append(make_tensor(xx,yy,zz,xy,yz,xz), "tensor")
Best regards,
Mike