Changeset 9242
- Timestamp:
- 08/10/11 08:24:22 (14 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
r9074 r9242 7 7 #include "../../include/include.h" 8 8 9 void InterpFromMeshToGridx(double** px_m,double** py_m,double** pgriddata,double* index_mesh, double* x_mesh, double* y_mesh, int nods,int nels, double* data_mesh, int data_length, double cornereast,double cornernorth,double xposting,double yposting,int nlines,int ncols,double default_value) {9 void InterpFromMeshToGridx(double** px_m,double** py_m,double** pgriddata,double* index_mesh, double* x_mesh, double* y_mesh, int nods,int nels, double* data_mesh, int data_length, double xmin,double ymax,double xposting,double yposting,int nlines,int ncols,double default_value) { 10 10 11 11 /*Output*/ … … 20 20 bool debug; 21 21 int xflip,yflip; 22 double area ;22 double area,ymin; 23 23 double area_1,area_2,area_3; 24 24 double x_tria_min,y_tria_min; … … 27 27 double x_grid_max,y_grid_max; 28 28 double data_value; 29 double cornersouth;30 29 31 30 /*some checks*/ … … 60 59 61 60 /*Compute coordinates lists*/ 62 // EAST = ACTUAL WEST !!!!!!!!!!!!!!! 63 cornersouth=cornernorth-(nlines-1)*yposting; 64 for(i=0;i<nlines;i++) y_grid[i]= cornersouth + yposting*i; 65 for(i=0;i<ncols; i++) x_grid[i]= cornereast + xposting*i; 61 ymin=ymax-(nlines-1)*yposting; 62 for(i=0;i<nlines;i++) y_grid[i]= ymin + yposting*i; 63 for(i=0;i<ncols; i++) x_grid[i]= xmin + xposting*i; 66 64 67 65 /*Initialize coordintes and griddata*/ -
issm/trunk/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.h
r3913 r9242 8 8 #include "../../toolkits/toolkits.h" 9 9 10 void InterpFromMeshToGridx(double** px_m,double** py_m,double** pgriddata,double* index_mesh, double* x_mesh, double* y_mesh, int nods,int nels, double* data_mesh, int data_length, double cornereast,double cornernorth,double xposting,double yposting,int nlines,int ncols,double default_value);10 void InterpFromMeshToGridx(double** px_m,double** py_m,double** pgriddata,double* index_mesh, double* x_mesh, double* y_mesh, int nods,int nels, double* data_mesh, int data_length, double xmin,double ymax,double xposting,double yposting,int nlines,int ncols,double default_value); 11 11 12 12 #endif /* _INTERPFROMMESHTOGRIDX_H */ -
issm/trunk/src/m/model/plot/plot_overlay.m
r9241 r9242 43 43 44 44 %InterpFromMeshToGrid 45 cornereast=min(md.sarxm); cornernorth=max(md.sarym); 45 xmin=min(md.sarxm); 46 ymax=max(md.sarym); 46 47 xspacing=(max(md.sarxm)-min(md.sarxm))/(length(md.sarxm)); 47 48 yspacing=(max(md.sarym)-min(md.sarym))/(length(md.sarym)); … … 49 50 ncols =length(md.sarxm); 50 51 disp('Interpolating data on grid...'); 51 [x_m y_m data_grid]=InterpFromMeshToGrid(elements,x,y,data, cornereast,cornernorth,xspacing,yspacing,nlines,ncols,NaN);52 [x_m y_m data_grid]=InterpFromMeshToGrid(elements,x,y,data,xmin,ymax,xspacing,yspacing,nlines,ncols,NaN); 52 53 53 54 %Process data_grid -
issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
r9074 r9242 15 15 double* meshdata=NULL; 16 16 int meshdata_length; 17 double cornereast;18 double cornernorth;17 double xmin; 18 double ymax; 19 19 double xposting; 20 20 double yposting; … … 39 39 FetchMatlabData(&y,NULL,NULL,Y); 40 40 FetchMatlabData(&meshdata,&meshdata_length,NULL,MESHDATA); 41 FetchMatlabData(& cornereast,CORNEREAST);42 FetchMatlabData(& cornernorth,CORNERNORTH);41 FetchMatlabData(&xmin,XMIN); 42 FetchMatlabData(&ymax,YMAX); 43 43 FetchMatlabData(&xposting,XPOSTING); 44 44 FetchMatlabData(&yposting,YPOSTING); … … 48 48 49 49 /*Call core of computation: */ 50 InterpFromMeshToGridx(&x_m,&y_m,&griddata,index,x,y,nods,nel,meshdata,meshdata_length, cornereast,cornernorth,xposting,yposting,nlines,ncols,default_value);50 InterpFromMeshToGridx(&x_m,&y_m,&griddata,index,x,y,nods,nel,meshdata,meshdata_length,xmin,ymax,xposting,yposting,nlines,ncols,default_value); 51 51 52 52 /*Write results: */ … … 70 70 _printf_(true,"\n"); 71 71 _printf_(true," Usage:\n"); 72 _printf_(true," [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data, cornereast,cornernorth,xposting,yposting,nlines,ncols,default_value)\n");72 _printf_(true," [x_m,y_m,griddata]=InterpFromMeshToGrid(index,x,y,data,xmin,ymax,xposting,yposting,nlines,ncols,default_value)\n"); 73 73 _printf_(true,"\n"); 74 74 _printf_(true," index,x,y: delaunay triangulation defining the mesh.\n"); 75 75 _printf_(true," meshdata: vertex values of data to be interpolated.\n"); 76 _printf_(true," cornereast,cornernorth,posting,nlines,ncols: parameters that define the grid\n");76 _printf_(true," xmin,ymax,posting,nlines,ncols: parameters that define the grid\n"); 77 77 _printf_(true," default_value: value of points located out of the mesh.\n"); 78 78 _printf_(true,"\n"); -
issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.h
r4236 r9242 23 23 #define Y (mxArray*)prhs[2] 24 24 #define MESHDATA (mxArray*)prhs[3] 25 #define CORNEREAST(mxArray*)prhs[4]26 #define CORNERNORTH(mxArray*)prhs[5]25 #define XMIN (mxArray*)prhs[4] 26 #define YMAX (mxArray*)prhs[5] 27 27 #define XPOSTING (mxArray*)prhs[6] 28 28 #define YPOSTING (mxArray*)prhs[7]
Note:
See TracChangeset
for help on using the changeset viewer.