<div dir="ltr"><div>The Programmable Filter can handle time but it has to be done explicitly. You'll need to do the proper calls in RequestUpdateExtentScript, RequestInformationScript and Script. (i.e. RequestData). You can use inInfo and outInfo to set the required information objections like UPDATE_TIME_STEP, TIME_STEPS, etc.<br><br></div>Andy<br><div><br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 11:23 AM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com" target="_blank">sebastien.jourdain@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Josh,<div><br></div><div>I've noticed that the default programmable filters does not advertise that it handle time. To properly do that you can use the attached XML plugin.</div><div><br></div><div>Let us know if that fix the problem.</div><div><br></div><div>Seb</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 28, 2014 at 8:48 PM, Joshua Murphy <span dir="ltr"><<a href="mailto:Joshua.Murphy@lasp.colorado.edu" target="_blank">Joshua.Murphy@lasp.colorado.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I am working with a scientist who is attempting to run a complex programmable filter that uses two inputs and produces one output. The script generates a result for the first time step is applied on, but if you advance paraview to the next time step, the new result is NOT generated. (no streamline update, no recalculation, nothing..) I am not seeing why this is the case. If you advance the time step, then force a re-apply of the filter, it will run, but that doesn't help for automated image generation. I am sure the problem has to do with updating the pipeline, but I don't have enough experience with the programmable filter to say for sure what needs to be done. If someone could take a look and let me know if there is a simple solution, I would be grateful.<br>
<br>
I have tried this with the same result on PV4.0.1 and PV4.1.0. I have not tried on PV4.2 as our reader plugin has not yet been compiled against 4.2.<br>
<br>
Thanks,<br>
<br>
Josh<br>
<br>
The programmable filter script follows:<br>
<br>
from paraview.vtk import dataset_adapter as DA<br>
from paraview import vtk<br>
from numpy import *<br>
<br>
# get inputs and define output<br>
# first input needs to define the grid used to provide the seed points to the stream tracer<br>
# the second are the resulting stream lines<br>
# the output is a modified version of the first input<br>
<br>
in1 = self.GetInputDataObject(0,0)<br>
in2 = self.GetInputDataObject(0,1)<br>
pdo = self.GetOutputDataObject(0)<br>
<br>
# get number of lines and total number of pts on the lines<br>
# note: paraview does the filed line integration first forward for all seed<br>
# points, then backward in the same order<br>
# ncells is twice the total number of field lines<br>
<br>
ncells = inputs[1].GetNumberOfCells()<br>
npts = inputs[1].GetNumberOfPoints()<br>
nc2 = ncells/2<br>
<br>
# figure out the location and and number of points in each line<br>
<br>
numpts = zeros(ncells,dtype=int)<br>
cellpointer = zeros(ncells,dtype=int)<br>
for i in range(0,ncells):<br>
numpts[i] = in2.GetCell(i).GetNumberOfPoints()<br>
print numpts<br>
for i in range(1,ncells):<br>
cellpointer[i] = cellpointer[i-1] + numpts[i-1]<br>
<br>
#for i in range(0,ncells):<br>
# print cellpointer[i],numpts[i],r2[cellpointer[i],:]<br>
<br>
#<br>
# put points into numpy arrays<br>
#<br>
r = inputs[0].Points<br>
r2 = inputs[1].Points<br>
rmag = mag(r2)<br>
dR = r2[1:npts,:] - r2[0:npts-1,:]<br>
dr = mag(dR)<br>
<br>
#<br>
# get variables needed for integration<br>
#<br>
<br>
B = inputs[1].PointData['Magnetic Field Vector']<br>
den = inputs[1].PointData['Plasma Density']<br>
csound = inputs[1].PointData['Sound Speed']<br>
pressure = den*csound**2<br>
b = mag(B)<br>
binv = 1./b<br>
<br>
#<br>
# get midpoint values<br>
#<br>
<br>
bav = 0.5*(b[1:npts]+b[:npts-1])<br>
denav = 0.5*(den[1:npts]+den[0:npts-1])<br>
pav = 0.5*(pressure[1:npts]+pressure[0:npts-1])<br>
print 'DR',dR.shape,r.shape<br>
print numpts<br>
print cellpointer<br>
<br>
#<br>
# integrate along field lines<br>
#<br>
FTvolume = zeros(ncells)<br>
FTden = zeros(ncells)<br>
FTP = zeros(ncells)<br>
print FTvolume<br>
for i in range(ncells):<br>
for j in range(cellpointer[i],cellpointer[i]+numpts[i]-1):<br>
FTvolume[i] = FTvolume[i] + binv[j]*dr[j]<br>
FTden[i] = FTden[i] + binv[j]*dr[j]*denav[j]<br>
FTP[i] = FTP[i] + binv[j]*dr[j]*pav[j]**0.6<br>
for i in range(nc2):<br>
FTvolume[i] = FTvolume[i] + FTvolume[i+nc2]<br>
FTden[i] = FTden[i] + FTden[i+nc2]<br>
FTP[i] = FTP[i] + FTP[i+nc2]<br>
print FTvolume<br>
print FTden<br>
print FTP<br>
#<br>
# don't really need to reset the positions<br>
# but can be useful if we modify to plot in min B surface, say<br>
#<br>
<br>
newPoints = vtk.vtkPoints()<br>
denout = zeros(ncells)<br>
for i in range(0,nc2):<br>
xi = r2[cellpointer[i],0]<br>
yi = r2[cellpointer[i],1]<br>
zi = r2[cellpointer[i],2]<br>
denout[i] = b[cellpointer[i]]<br>
print i,xi,yi,zi,denout[i]<br>
newPoints.InsertPoint(i,xi,yi,zi)<br>
<br>
print newPoints<br>
<br>
<br>
pdo.SetPoints(newPoints)<br>
<br>
#<br>
# add computed arrays<br>
#<br>
<br>
arrFTV = DA.numpyTovtkDataArray(FTvolume[0:nc2],'Flux Tube Volume')<br>
pdo.GetPointData().AddArray(arrFTV)<br>
print 'added stuff'<br>
arrFTden = DA.numpyTovtkDataArray(FTden[0:nc2],'Flux Tube Mass')<br>
pdo.GetPointData().AddArray(arrFTden)<br>
<br>
arrFTP = DA.numpyTovtkDataArray(FTP[0:nc2],'Flux Tube Entropy')<br>
pdo.GetPointData().AddArray(arrFTP)<br>
_______________________________________________<br>
Paraview-developers mailing list<br>
<a href="mailto:Paraview-developers@paraview.org" target="_blank">Paraview-developers@paraview.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><br>
</blockquote></div><br></div>
<br>_______________________________________________<br>
Paraview-developers mailing list<br>
<a href="mailto:Paraview-developers@paraview.org">Paraview-developers@paraview.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/paraview-developers" target="_blank">http://public.kitware.com/mailman/listinfo/paraview-developers</a><br>
<br></blockquote></div><br></div>