Hi Pat,
Thank you for the advice.
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?
Thank you,
George
On 2010/11/28 10:09 PM, pat marion wrote:
Hi George,
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.
Pat
On Sun, Nov 28, 2010 at 2:33 PM, George <[email protected]
<mailto:[email protected]>> wrote:
Hi paraviewers,
I am trying to write a python script where I call the Calculator
filter repeatedly inside a for-loop.
However, I am not quite sure how to write this for paraview. At
the moment my code looks like this:
~~~~~~~~~~~~
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
# Data Processing
Coarse = OpenFOAMReader( FileName='C:\\Users\\Public\\Mesh.OpenFOAM' )
Coarse.CellArrays = ['U', 'U_0', 'p']
Coarse.MeshRegions = ['internalMesh']
SetActiveSource(Coarse)
CalculatorX = Calculator()
CalculatorX.AttributeMode = 'point_data'
CalculatorX.Function = 'p'
CalculatorX.ResultArrayName = 'Result'
# A hypothetical for-loop where I repeatedly add the array 'p' to
the array 'Result'
for i in range(10):
CalculatorX.Function = 'Result+p' #( Result = Result + p)
~~~~~~~~~~~~
The above script will not work in paraview as is.
Can anyone tell me the proper way of writing this in Python?
Thank you very much,
George
_______________________________________________
Powered by www.kitware.com <http://www.kitware.com>
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview