[Paraview] Programmable filter works on Slice but not on original data set

Ganesh Vijayakumar ganesh.iitm at gmail.com
Thu Aug 28 11:53:00 EDT 2014


Hello,


  My original dataset is an xdmf file that points to some hdf5 files. I
have this piece of code in a programmable filter. It seems to work on a
Slice of the original dataset, but won't work on the dataset as a whole.
The original dataset is cell centered and I then pass it through a
"CellDataToPointData" filter. Could anyone tell me why? I'm running
Paraview 4.1 - 64 bit on a server-client mode with the server using 16
cores. I thought it might be related to the dataset being multiblock or
something (I don't understand this very well). So I tried the piece of code
here

http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets

This also works on the slice.. but not on the whole dataset.


#Programmable filter code below

import numpy as np
from paraview import vtk
from  paraview.vtk.dataset_adapter import numpyTovtkDataArray
from scipy.interpolate import interp1d

initrLoc = array([0, 2.8667, 5.6, 8.3333, 11.75, 15.85, 19.95, 24.05,
28.15, 32.25, 36.35, 40.45, 44.55, 48.65, 52.75, 56.1667, 58.9, \
61.633, 62.9, 300.0])
initaeroTwist = array([13.308, 13.308, 13.308, 13.308, 13.308, 11.48,
10.162, 9.011, 7.795, 6.544, 5.361, 4.188, 3.125, 2.319, 1.526, \
0.863, 0.37, 0.106, 0, 0.0])
pitch = 8.7
aeroTwistInterp = interp1d(initrLoc, initaeroTwist+pitch)


uxym = np.loadtxt('uxym')
umeanInterp = interp1d(uxym[:,2], uxym[:,0]*cos(21.6*np.pi/180.
0) + uxym[:,1]*sin(21.6*np.pi/180.0))
vmeanInterp = interp1d(uxym[:,2], -uxym[:,0]*sin(21.6*np.pi/180.0) +
uxym[:,1]*cos(21.6*np.pi/180.0))

input = self.GetInput()
output = self.GetOutput()
output.ShallowCopy(input)
points = inputs[0].Points[:,:]
nPoints = np.size(points,0)
vel = inputs[0].PointData['U']
uPrime = np.empty(np.shape(vel))
AoACyl = np.empty(np.size(vel,0))
omega = (12.0 * 2 * np.pi / 60.0) * array([1,0,0])
for i in range(nPoints):
    uPrime[i] = array([umeanInterp(points[i,2]),vmeanInterp(points[i,2]),
0.0])
    r = array([0, 15, 0])
    localTwist = aeroTwistInterp(15)
    newVel = vel[i] - np.cross(omega, r)
    AoACyl[i] = arctan2(newVel[0,1],-newVel[0,2])*180/np.pi - localTwist

uPrimeVTK = numpyTovtkDataArray(uPrime)
uPrimeVTK.SetName('uPrime')
output.GetPointData().AddArray(uPrimeVTK)

AoACylVTK = numpyTovtkDataArray(AoACyl)
AoACylVTK.SetName('AoACyl')
output.GetPointData().AddArray(AoACylVTK)


-- 
ganesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140828/10f084e6/attachment.html>


More information about the ParaView mailing list