Mapping from csv file to cell center of VTK file

Hi,
I think my problem should be relatively easy but I haven’t figured out how to solve it. I have a csv file with data organized as X, Y, Z and a scalar value “Velocity”.

Now I want to open a VTK file and “map” the data from the csv file onto the VTK file. In this case I dont really need an interpolation since I know that the data in the csv file is at the face center of the VTK file.

So far I figured out it to do like this:

  1. Open the VTK file
  2. Open the csv file
  3. TableToPoints
  4. PointDataSetInterpolator

The problem now is however that with this Paraview will interpolate my data onto vertexes on the VTK file and not on the cell center. How can I solve this problem? Is there a way to convert the VTK file to a “cell centered surface” or something similar and then do the same procedure as I described?

Hi Tobias,

Does it make sense to add new points according to the list of x,y,z coordinates and, after that, apply PointDataSetInterpolator?

Edited: that was a wrong comment.

If it is not possible to map data from one point array to the cell faces centers of another cell array by built-in PV filters, it is possible to do it by programmable filter (or plugin).
In case of 2D mesh, for each cell:
based on cell vertices coordinates, find appropriate velocity value from x,y,z,v list and add this velocity value to a new cell data array (‘Velocity’).
There will be a constant color within the bounds of each face.
If I understand the problem correctly, in case of 3D mesh, it needs to add new 2D cells for each of faces of initial 3D mesh cells.

Best Regards,
Pavel

Hi, I don’t think I can do as you suggested, not in a easy way at least. The problem would be to find out the new face center coordinates. Ideally I would like to change the surface so that the points are at the face center instead of vortex center and than I think I could use the “PointDataSetInterpolator” directly on the “new surface”.

Ok. Anyway, if you

you will have another mesh with different topology. What kind of mesh is in your .vtk file? Maybe you can share an example dataset, and we try to use Python calculator filter for starting to solve the problem?