# Transform exodus data with programmable filter

**URL:** https://discourse.paraview.org/t/transform-exodus-data-with-programmable-filter/4107
**Category:** ParaView Support
**Tags:** exodus, python
**Created:** [April 18, 2020, 3:59pm UTC](https://discourse.paraview.org/t/transform-exodus-data-with-programmable-filter/4107 "2020-04-18T15:59:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nikhil\_Vaidya](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nikhil_vaidya/32/3481_2.png) [@Nikhil\_Vaidya](https://discourse.paraview.org/u/Nikhil_Vaidya)
#### Post date: [April 18, 2020, 3:59pm UTC](https://discourse.paraview.org/t/transform-exodus-data-with-programmable-filter/4107/1 "2020-04-18T15:59:32Z")

</div>

Hello,

I am new to paraview programmable filters. I have exodus data with multiple blocks. I would like to write a programmable filter which loops over the various blocks in the exodus dataset and transforms the nodes in a way unique to that particular block. The transformations involve multiplying the coordinates with a 3x3 matrix and translating the product by a vector. I saw the following example on the paraview website:

def flatten(input, output):  
# Copy the cells etc.  
output.ShallowCopy(input)  
newPoints = vtk.vtkPoints()  
numPoints = input.GetNumberOfPoints()  
for i in range(0, numPoints):  
coord = input.GetPoint(i)  
x, y, z = coord[:3]  
x = x \* 1  
y = y \* 1  
z = 10 + 0.1\*z  
newPoints.InsertPoint(i, x, y, z)  
output.SetPoints(newPoints)

```
 input = self.GetInputDataObject(0, 0)
 output = self.GetOutputDataObject(0)

 if input.IsA("vtkMultiBlockDataSet"):
   output.CopyStructure(input)
   iter = input.NewIterator()
   iter.UnRegister(None)
   iter.InitTraversal()
   while not iter.IsDoneWithTraversal():
     curInput = iter.GetCurrentDataObject()
     curOutput = curInput.NewInstance()
     curOutput.UnRegister(None)
     output.SetDataSet(iter, curOutput)
     flatten(curInput, curOutput)
     iter.GoToNextItem();
 else:
   flatten(input, output)

```

The code above does pretty much what I want to do except for the loop over the blocks. I found a code snippet in the paraview guide which does the loop over blocks:

input0 = inputs [0]  
if input0 . IsA (" vtkCompositeDataSet "):  
# iterate over all non-empty blocks in the input  
# composite dataset, including multiblock and AMR datasets.  
for block in input0 :  
processBlock ( block )  
else:  
processBlock ( input0 )

This code snippet is somehow not compatible with the transformation code snippet from earlier. I notice the different ways the input dataset is being obtained:  
input = self.GetInputDataObject(0, 0)  
vs  
input0 = inputs [0]

Could someone please guide me? I tried to find something like a doxygen page for the programmable filter but I didn’t get anywhere.

Best,  
Nikhil
