Nick, You can use the *Programmable Filter* instead with something like the following script as the *Script*:
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") Utkarsh On Wed, Nov 29, 2017 at 5:01 PM, Nicholas Richmond < nicholas.richm...@maine.edu> wrote: > Greetings, > > I have a vtk Polygonal Mesh with six separate arrays (sigma_xx, sigma_yy, > sigma_zz, sigma_xy, sigma_yz, sigma_xz). I'd like to assemble these into a > tensor so that I may apply the Tensor Glyph filter. > > After reading that the paraview.simple.TensorGlyph > <https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.TensorGlyph.html> > expects a symmetric tensor with the order XX, YY, ZZ, XY, YZ, XZ, I > tried to assemble the six separate arrays into a single array with the > Python Calculator, but have been unsuccessful. > > I've tried a variety of approaches, including: > > *Expression:* np.array([sigma_xx, sigma_yy, sigma_zz, sigma_xy, sigma_yz, > sigma_xz]) > *Array Association:* Point Data > > I can make a vector of the normal stresses using the "make_vector" > function from paraview.vtk.numpy_interface.algorithms, but there is no > "make_tensor" function to assemble both normal and shear stresses into a > single symmetric tensor. > > Any guidance would be most appreciated. > Many thanks, > Nick Richmond > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=ParaView > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/paraview > >
_______________________________________________ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview