Modify the position (or Coordinate) values of particles to exaggerate the displacements

I am visualizing my simulation results (which contain tones of particles) with ‘Point Gaussian’ in Paraview.

I wrote the Lagacy VTK file in my C/C++ program, with the following structure.

BINARY
DATASET POLYDATA
POINTS n_particles double
... (positions)

POINT_DATA n_particles
FIELD FieldData n_data
...

I have the following set of files, each contains the information of the each time step of the simulation and ‘_initial’ contains the initial condition.

output_initial.vtk
output_00001.vtk
output_00002.vtk

The thing is, the change of the positions of the particles are so small that I need to exaggerate it for clear visualization.

More specifically, say ‘pos[3] = (x,y,z)’ is the positions of the particles from ‘output_N.vtk’, and pos_init[3] = (x_init, y_init, z_init)’ is the initial positions of the particles from ‘output_initial.vtk’.

So I want to modify the ‘pos[:]’ from ‘output_N.vtk’ to ‘pos_init[:] + 100 * (pos[:] - pos_init[:])’ to exaggerate the displacements from the initial condition 100 times, while maintaining other Field quantities the same as ‘output_N.vtk’.

I have been using VTK for years, but mostly I used very basic features such as ‘Calculator’ and so on, and barely used the programmable filters.

Does anyone could give me a comment on how this could be done on the ParaView, and some keywords of the programmable filters, functions, and so on if I have to code it? It would be great if I can do this via some simple filters, though.

I get to achieve what I wanted to do using Python, using features in the Numpy.

For whom interested, I pasted the whole script I used. Any further comments, or possible improvements, as well as the way to achieve this via Paraview Programmable filter would very very appriciated.

The following script was branched from one of the StackOverFlow post(numpy - modifying vtk array in python without copying it - Stack Overflow)

#https://stackoverflow.com/questions/69181589/modifying-vtk-array-in-python-without-copying-it

from os import read
import vtk as vtk
import numpy as np
from vtk.util.numpy_support import vtk_to_numpy

def main():
    # read file from the initial VTK
    sphere0 = vtk.vtkPolyDataReader()
    sphere0.SetFileName('output_initial.vtk')
    sphere0.Update()
    polyData0 = sphere0.GetOutput()

    # get Point data of each particles
    array0_point = vtk_to_numpy(polyData0.GetPoints().GetData())
    # get some additional value which will be used as conditions (see below)
    array0_type  = vtk_to_numpy(polyData0.GetPointData().GetAbstractArray('type'))

    # read target VTK, do the same
    sphere = vtk.vtkPolyDataReader()
    sphere.SetFileName('output_0000004000.vtk')
    sphere.Update()
    polyData = sphere.GetOutput()
    array_point = vtk_to_numpy(polyData.GetPoints().GetData())
    array_type  = vtk_to_numpy(polyData.GetPointData().GetAbstractArray('type'))

    for i in range(len(array0_point)):
        if array0_type[i] < 1.: # this condition is just because I wanted to exaggerate the displacements of 'type == 0.' particle.
            array_point[i,0] = array0_point[i,0] + 100.*(array_point[i,0]-array0_point[i,0])
            array_point[i,1] = array0_point[i,1] + 100.*(array_point[i,1]-array0_point[i,1])
            array_point[i,2] = array0_point[i,2] + 100.*(array_point[i,2]-array0_point[i,2])

    writer = vtk.vtkPolyDataWriter()
    writer.SetFileName('output_0000004000_modi.vtk')
    writer.SetInputData(polyData)
    writer.Write()

main()