<div dir="ltr"><div><div><div>Hello,<br><br><br></div> 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<br>
<br><a href="http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets" target="_blank">http://www.paraview.org/Wiki/Python_Programmable_Filter#Dealing_with_Composite_Datasets</a><br><br></div>
This also works on the slice.. but not on the whole dataset.<br>
<br><br></div>#Programmable filter code below <br><br>import numpy as np<br>from paraview import vtk<br>from paraview.vtk.dataset_adapter import numpyTovtkDataArray<br>from scipy.interpolate import interp1d<br>
<br>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, \<br>61.633, 62.9, 300.0])<br>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, \<br>
0.863, 0.37, 0.106, 0, 0.0])<br>pitch = 8.7<br>aeroTwistInterp = interp1d(initrLoc, initaeroTwist+pitch)<br><br><br>uxym = np.loadtxt('uxym')<br>umeanInterp = interp1d(uxym[:,2], uxym[:,0]*cos(21.6*np.pi/180.<div>
0) + uxym[:,1]*sin(21.6*np.pi/180.0))<br>
vmeanInterp = interp1d(uxym[:,2], -uxym[:,0]*sin(21.6*np.pi/180.0) + uxym[:,1]*cos(21.6*np.pi/180.0))<br><br>input = self.GetInput()<br>output = self.GetOutput()<br>output.ShallowCopy(input)<br>points = inputs[0].Points[:,:]<br>
nPoints = np.size(points,0)<br>vel = inputs[0].PointData['U']<br>uPrime = np.empty(np.shape(vel))<br>AoACyl = np.empty(np.size(vel,0))<br>omega = (12.0 * 2 * np.pi / 60.0) * array([1,0,0])<br>for i in range(nPoints):<br>
uPrime[i] = array([umeanInterp(points[i,2]),vmeanInterp(points[i,2]), 0.0])<br> r = array([0, 15, 0])<br> localTwist = aeroTwistInterp(15)<br> newVel = vel[i] - np.cross(omega, r)<br> AoACyl[i] = arctan2(newVel[0,1],-newVel[0,2])*180/np.pi - localTwist<br>
<br>uPrimeVTK = numpyTovtkDataArray(uPrime)<br>uPrimeVTK.SetName('uPrime')<br>output.GetPointData().AddArray(uPrimeVTK)<br><br>AoACylVTK = numpyTovtkDataArray(AoACyl)<br>AoACylVTK.SetName('AoACyl')<br>output.GetPointData().AddArray(AoACylVTK)</div>
<br clear="all"><br>-- <br>ganesh<br>
</div>