# Transfert PointData from mesh to another

**URL:** https://discourse.paraview.org/t/transfert-pointdata-from-mesh-to-another/14835
**Category:** ParaView Support
**Created:** [June 12, 2024, 4:16pm UTC](https://discourse.paraview.org/t/transfert-pointdata-from-mesh-to-another/14835 "2024-06-12T16:16:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Uraeus](https://discourse.paraview.org/user_avatar/discourse.paraview.org/uraeus/32/14584_2.png) [@Uraeus](https://discourse.paraview.org/u/Uraeus)
#### Post date: [June 12, 2024, 4:16pm UTC](https://discourse.paraview.org/t/transfert-pointdata-from-mesh-to-another/14835/1 "2024-06-12T16:16:07Z")

</div>

Hello Everybody,

I need some help please. I have two similar meshes A and B with a temperature PointData TA (define on A) and TB (define on B).

I need to calculate (TA-TB) and show it on A mesh for example. I tried with the ResampleWithDataSet, but even if the mesh A and B are very closed (same cells, but Cell\_id are not the same), but some little differences in points coordinates cause bad values in the result.

So i tried to build a Programmable Filter with my limited skills. It makes the job, but it is not really optimized, and the execution time could be very prohibitif. I loop on each point of A to find the equivalent point of B with a second loop 🙄.

Did someone could help me to optimize my probleme please ?

Here my code:

```auto
# Code for 'Script
import numpy as np
from paraview.vtk.numpy_interface import algorithms as algs
# Get the two inputs
A = inputs[0]
B = inputs[1]
TA = A.PointData["TK"]
TB = B.PointData["Temperature"]
n1 = A.GetNumberOfPoints()
TBOnA = np.empty(n1, dtype=np.float64)
TA_B = np.empty(n1, dtype=np.float64)
bxMax =algs.max(B.Points[:,0])
byMax =algs.max(B.Points[:,1])
#test = 0
for i in range(n1):
    a1x = A.Points.Arrays[0][i][0]
    a1y = A.Points.Arrays[0][i][1]
    for j in range(n1):
        b1x = B.Points.Arrays[0][j][0]
        b1y = B.Points.Arrays[0][j][1]
        EcX = abs((a1x-b1x)/bxMax)
        EcY = abs((a1y-b1y)/byMax)
        Test1 = (EcX < 1.e-5) and (EcY < 1.e-5)
        if Test1:
            TBOnA[i]=TB.Arrays[0][j]
            TA_B[i]=abs(TA.Arrays[0][i]-TBOnA[i])
# test += 1
            break
#print('controle : nbre Point à trouver:', n1, '<=> nbre trouvé:', test)
output.PointData.append(TA, "TA")
output.PointData.append(TBOnA, "TBonA")
output.PointData.append(TA_B, "TA_B")

```

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 13, 2024, 11:38am UTC](https://discourse.paraview.org/t/transfert-pointdata-from-mesh-to-another/14835/2 "2024-06-13T11:38:43Z")

</div>

> [@Uraeus](#):
>
> ResampleWithDataSet

This should work, please share your data.
