<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Pat,<br>
<br>
Thank you for the advice.<br>
Is it therefore not possible to run the calculator filter inside a for
loop? Or do I need to create an intermediate array (say ResultTemp) by
deep copying the original Result array?<br>
<br>
Thank you,<br>
George<br>
<br>
On 2010/11/28 10:09 PM, pat marion wrote:
<blockquote
cite="mid:AANLkTinNaO2WQM+4pw+swb3_aSza7RFAvHssnDfHk2WC@mail.gmail.com"
type="cite">Hi George,<br>
<br>
To execute a filter from python you can call UpdatePipeline(). This is
just like clicking the Apply button. So for your code it would be
CalculatorX.UpdatePipeline(). But your loop isn't going to do what you
want. Filters operate on their input data and output new data, they do
not modify their input data in place. If you call the calculator
filter 10 times, it's going to produce the same output each time unless
its input has changed.<br>
<br>
Pat<br>
<br>
<div class="gmail_quote">On Sun, Nov 28, 2010 at 2:33 PM, George <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:george.gerber@gmail.com">george.gerber@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
paraviewers,<br>
<br>
I am trying to write a python script where I call the Calculator filter
repeatedly inside a for-loop.<br>
However, I am not quite sure how to write this for paraview. At the
moment my code looks like this:<br>
~~~~~~~~~~~~<br>
try: paraview.simple<br>
except: from paraview.simple import *<br>
paraview.simple._DisableFirstRenderCameraReset()<br>
<br>
# Data Processing<br>
Coarse = OpenFOAMReader( FileName='C:\\Users\\Public\\Mesh.OpenFOAM' )<br>
Coarse.CellArrays = ['U', 'U_0', 'p']<br>
Coarse.MeshRegions = ['internalMesh']<br>
SetActiveSource(Coarse)<br>
CalculatorX = Calculator()<br>
CalculatorX.AttributeMode = 'point_data'<br>
CalculatorX.Function = 'p'<br>
CalculatorX.ResultArrayName = 'Result'<br>
<br>
# A hypothetical for-loop where I repeatedly add the array 'p' to the
array 'Result'<br>
for i in range(10):<br>
CalculatorX.Function = 'Result+p' #( Result = Result + p)<br>
~~~~~~~~~~~~<br>
The above script will not work in paraview as is.<br>
Can anyone tell me the proper way of writing this in Python?<br>
<br>
Thank you very much,<br>
George<br>
_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com"
target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
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
moz-do-not-send="true" href="http://paraview.org/Wiki/ParaView"
target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a moz-do-not-send="true"
href="http://www.paraview.org/mailman/listinfo/paraview"
target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote>
</div>
<br>
</blockquote>
<br>
</body>
</html>