[Paraview] Calling the calculator filter repeatedly inside a for-loop
George
george.gerber at gmail.com
Sun Nov 28 14:33:54 EST 2010
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
More information about the ParaView
mailing list