[Paraview] Assistance with programmable filter

Peter A. Gustafson peter.gustafson at wmich.edu
Fri Nov 29 13:32:13 EST 2013


Hi all,

I'm working with an exodus file which has stress (S) as a 6 component 
array (obviously a symmetric rank 2 tensor in reality).  I want to find 
the principal stresses and directions and think a programmable filter is 
the best way to do it.

I have tried many variations on the code below without success. Could 
someone point me to a similar example?

Thanks,
Pete


My code is:
-----
def process_block(input_block, output_block):
  S = input_block.PointData['S']
  #SP = 
eigenvalue(array([[S[:,0],S[:,3],S[:,5],S[:,3],S[:,1],S[:,4],S[:,5],S[:,4],S[:,2]]]))
  #SP = 
eigenvalue(array([S[:,0],S[:,3],S[:,5],S[:,3],S[:,1],S[:,4],S[:,5],S[:,4],S[:,2]]))
  SP = 
eigenvalue(array([[S[:,0],S[:,3],S[:,5]],[S[:,3],S[:,1],S[:,4]],[S[:,5],S[:,4],S[:,2]]]))
  output_block.PointData.append(SP, "SP")

from paraview.vtk.dataset_adapter import MultiCompositeDataIterator
iter = MultiCompositeDataIterator([inputs[0], output])

for input_block, output_block in iter:
     process_block(input_block, output_block)


------
The error message is:
------

Traceback (most recent call last):
   File "<string>", line 21, in <module>
   File "<string>", line 16, in RequestData
   File "<string>", line 8, in process_block
   File 
"/usr/lib64/paraview-4.0/site-packages/paraview/vtk/algorithms.py", line 
293, in eigenvalue
     return _matrix_math_filter(narray, "Eigenvalue")
   File 
"/usr/lib64/paraview-4.0/site-packages/paraview/vtk/algorithms.py", line 
129, in _matrix_math_filter
     dataset = narray.DataSet()
AttributeError: 'numpy.ndarray' object has no attribute 'DataSet'





More information about the ParaView mailing list