Christian,<div><br></div><div>Thanks for getting me started. And sorry it took me so long to respond. I've been moving pretty slow on this project.</div><div><br></div><div>Anyway, I've done the following with my script:</div>
<div><br></div><div><p style="margin:0px"><font size="1">import math</font></p>
<p style="margin:0px"><font size="1">input = self.GetInputDataObject(0,0)</font></p>
<p style="margin:0px"><font size="1">output = self.GetOutputDataObject(0)</font></p>
<p style="margin:0px"><font size="1">numPoints = input.GetNumberOfPoints()</font></p>
<p style="margin:0px"><font size="1">points = input.GetPointData()</font></p>
<p style="margin:0px"></p>
<p style="margin:0px"><font size="1"><br></font></p><p style="margin:0px"><font size="1">SurfCvg = 0</font></p>
<p style="margin:0px"><font size="1">for i in xrange(numPoints):</font></p>
<p style="margin:0px"><font size="1"> d = points.GetArray('d').GetValue(i)</font></p>
<p style="margin:0px"><font size="1"> coords = input.GetPoint(i)</font></p>
<p style="margin:0px"><font size="1"> z = coords[3]</font></p>
<p style="margin:0px"><font size="1"> h = 0.00015 - abs(z - 0.00015) - 0.5*d</font></p>
<p style="margin:0px"><font size="1"> H0 = 2*h/d</font></p>
<p style="margin:0px"><font size="1"> if (H0 < 0.002)</font></p>
<p style="margin:0px"><font size="1"> SurfCvg = SurfCvg + 0.25*math.pi*d*d</font></p>
<p style="margin:0px"></p>
<p style="margin:0px"><font size="1"><br></font></p><p style="margin:0px"><font size="1">Theta = SurfCvg/(0.01*0.001)</font></p>
<p style="margin:0px"></p>
<p style="margin:0px"><font size="1">outputarray = vtk.vtkStringArray()</font></p>
<p style="margin:0px"><font size="1">outputarray.SetName("Surface Coverage")</font></p>
<p style="margin:0px"><font size="1">outputarray.SetNumberOfTuples(1)</font></p>
<p style="margin:0px"><font size="1">outputarray.SetValue(0, "%d" % (Theta))</font></p>
<p style="margin:0px"><font size="1">output.GetRowData().AddArray(outputarray)</font></p><p style="margin:0px"><font size="1"><br></font></p><p style="margin:0px">First of all, am I getting the z coordinate correctly? I haven't been able to find an answer to that in my searching. Secondly, my end goal is to plot the value of Theta over time for my dataset. Do I have the output stuff done right, and where do I go from there?</p>
<p style="margin:0px"><br></p><p style="margin:0px">Thanks in advance.</p><p style="margin:0px"><br></p><p style="margin:0px">-Scott</p></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 3, 2012 at 3:53 AM, Christian Richter <span dir="ltr"><<a href="mailto:christian.richter@ovgu.de" target="_blank">christian.richter@ovgu.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Hi,<br>
<br>
in a programmable Filter do something like this:<br>
<br>
<tt> import math<br>
input = self.GetInputDataObject(0, 0)<br>
output = self.GetOutputDataObject(0)<br>
COUNT=input.GetNumberOfPoints()<br>
pd=input.GetPointData()<br>
m=0<br>
v=0<br>
for i in xrange(COUNT):<br>
r=pd.GetArray('radius').GetValue(i)<br>
v=v+((4.0/3.0)*math.pi*r*r*r)<br>
m=m+pd.GetArray('Mass').GetValue(i)<br>
outputarray = vtk.vtkStringArray()<br>
outputarray.SetName("Text")<br>
outputarray.SetNumberOfTuples(1)<br>
outputarray.SetValue(0,"N=%d\nV=%1.6f m³\nm=%1.6f kg" %
(COUNT,v,m))<br>
output.GetRowData().AddArray(outputarray)</tt><br>
<br>
Attention: if you save this to a state-file change the ³ to 3
because it will not be escaped and you can not load the state
anymore.<br>
<br>
best wishes,<br>
Christian<br>
<br>
Am 02.11.2012 21:49, schrieb Scott Ripplinger:<br>
</div>
<blockquote type="cite"><div class="im">I need to sum all the values in a vector of a scalar
property. I've struggled understanding the documentation for the
python calculator and programmable filter, mainly in how to access
the point data that I want to use. Any tips will be appreciated.
<br>
<fieldset></fieldset>
<br>
</div><pre>_______________________________________________
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a>
Follow this link to subscribe/unsubscribe:
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a>
</pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div>