Transform exodus data with programmable filter

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