8 _printf0_(
"INTERPFROMGRIDTOMESH - interpolation from a grid onto a list of points\n");
10 _printf0_(
" This function is a multi-threaded mex file that interpolates a field\n");
11 _printf0_(
" defined on a grid onto a list of points based on a bilinear interpolation\n");
14 _printf0_(
" data_mesh=InterpFromGridToMesh(x,y,data,x_mesh,y_mesh,default_value);\n");
16 _printf0_(
" data: matrix holding the data to be interpolated onto the mesh.\n");
17 _printf0_(
" x,y: coordinates of matrix data. (x and y must be in increasing order)\n");
18 _printf0_(
" x_mesh,y_mesh: coordinates of the points onto which we interpolate.\n");
19 _printf0_(
" default_value: default value if no data is found (holes).\n");
20 _printf0_(
" data_mesh: vector of mesh interpolated data.\n");
24 _printf0_(
" md.inversion.vx_obs=InterpFromGridToMesh(x_n,y_m,vx,md.mesh.x,md.mesh.y,0);\n");
36 int data_rows,data_cols;
37 double *x_mesh = NULL;
38 double *y_mesh = NULL;
39 int x_mesh_rows,y_mesh_rows;
41 char* interpolationtype = NULL;
50 if(nrhs!=6 && nrhs!=7){
52 _error_(
"Wrong usage. See above");
58 FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
59 FetchData(&x_mesh,&x_mesh_rows,NULL,XMESHHANDLE);
60 FetchData(&y_mesh,&y_mesh_rows,NULL,YMESHHANDLE);
66 InterpFromGridToMeshx(&data_mesh, x, x_rows, y, y_rows, data, data_rows,data_cols, x_mesh, y_mesh, x_mesh_rows,default_value,interpolationtype);
67 xDelete<char>(interpolationtype);
70 InterpFromGridToMeshx(&data_mesh, x, x_rows, y, y_rows, data, data_rows,data_cols, x_mesh, y_mesh, x_mesh_rows,default_value,
"bilinear");
79 xDelete<double>(data);
80 xDelete<double>(x_mesh);
81 xDelete<double>(y_mesh);