source: issm/branches/trunk-jpl-damage/src/mex/TriaSearch/TriaSearch.cpp@ 11427

Last change on this file since 11427 was 8910, checked in by Eric.Larour, 14 years ago

Reorganized io/ directory quite a bit.
Separated Matlab io from the other Disk related io.
Renamed WriteData to WriteMatlabData and FetchData to FetchMatlabData.
Folded WriteParams and FetchParams into FetchMatlabData and WriteMatlabData.

File size: 1.6 KB
Line 
1/*\file TriaSearch.c
2 *\brief: TriaSearch module. See TriaSearchx for more details.
3 */
4#include "./TriaSearch.h"
5
6void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
7
8 int i;
9
10 /*input: */
11 double* index=NULL;
12 int nel;
13 int dummy;
14
15 double* x=NULL;
16 double* y=NULL;
17 int nods;
18
19 double* x0=NULL;
20 double* y0=NULL;
21 int numberofnodes;
22
23 /* output: */
24 double* tria=NULL;
25
26 /*Boot module: */
27 MODULEBOOT();
28
29 /*checks on arguments on the matlab side: */
30 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&TriaSearchUsage);
31
32 /*Input datasets: */
33 FetchMatlabData(&index,&nel,&dummy,INDEXHANDLE);
34 FetchMatlabData(&x,&nods,XHANDLE);
35 FetchMatlabData(&y,&nods,YHANDLE);
36 FetchMatlabData(&x0,&numberofnodes,X0HANDLE);
37 FetchMatlabData(&y0,&numberofnodes,Y0HANDLE);
38
39 /* Echo: {{{1*/
40 //printf("(x0,y0)=(%g,%g)\n",x0,y0);
41 /*}}}*/
42
43 /* Run core computations: */
44 TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes);
45
46 /* c to matlab: */
47 for(i=0;i<numberofnodes;i++)tria[i]++;
48
49 /*Write data: */
50 WriteMatlabData(TRIA,tria,numberofnodes);
51
52 /*end module: */
53 MODULEEND();
54}
55
56void TriaSearchUsage(void)
57{
58 _printf_(true,"TriaSearch- find triangle holding a point (x0,y0) in a mesh\n");
59 _printf_(true,"\n");
60 _printf_(true," Usage:\n");
61 _printf_(true," tria=TriaSearch(index,x,y,x0,y0);\n");
62 _printf_(true," index,x,y: mesh triangulatrion\n");
63 _printf_(true," x0,y0: coordinates of the point for which we are trying to find a triangle\n");
64 _printf_(true," x0,y0 can be an array of points\n");
65 _printf_(true,"\n");
66}
Note: See TracBrowser for help on using the repository browser.