1 | /*\file TriaSearch.c
|
---|
2 | *\brief: TriaSearch module. See TriaSearchx for more details.
|
---|
3 | */
|
---|
4 | #include "./TriaSearch.h"
|
---|
5 |
|
---|
6 | void 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 | FetchData(&index,&nel,&dummy,INDEXHANDLE);
|
---|
34 | FetchData(&x,&nods,XHANDLE);
|
---|
35 | FetchData(&y,&nods,YHANDLE);
|
---|
36 | FetchData(&x0,&numberofnodes,X0HANDLE);
|
---|
37 | FetchData(&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 | WriteData(TRIA,tria,numberofnodes);
|
---|
51 |
|
---|
52 | /*end module: */
|
---|
53 | MODULEEND();
|
---|
54 | }
|
---|
55 |
|
---|
56 | void 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 | }
|
---|