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

Last change on this file since 12004 was 12004, checked in by cborstad, 13 years ago

merged trunk-jpl into trunk-jpl-damage through revision 11990

File size: 1.5 KB
RevLine 
[5354]1/*\file TriaSearch.c
2 *\brief: TriaSearch module. See TriaSearchx for more details.
[3128]3 */
[5354]4#include "./TriaSearch.h"
[1172]5
[3128]6void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
[1172]7
[5032]8 int i;
9
[1172]10 /*input: */
[3128]11 double* index=NULL;
[5354]12 int nel;
13 int dummy;
[1172]14
[5354]15 double* x=NULL;
[5357]16 double* y=NULL;
[5354]17 int nods;
[3128]18
[5357]19 double* x0=NULL;
20 double* y0=NULL;
[8306]21 int numberofnodes;
[1172]22
23 /* output: */
[5357]24 double* tria=NULL;
[1172]25
26 /*Boot module: */
27 MODULEBOOT();
28
29 /*checks on arguments on the matlab side: */
[5354]30 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&TriaSearchUsage);
[1172]31
32 /*Input datasets: */
[12004]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);
[1172]38
[5354]39 /* Echo: {{{1*/
40 //printf("(x0,y0)=(%g,%g)\n",x0,y0);
41 /*}}}*/
[5032]42
[5354]43 /* Run core computations: */
[8306]44 TriaSearchx(&tria,index,nel,x,y,nods,x0,y0,numberofnodes);
[5032]45
[5354]46 /* c to matlab: */
[8306]47 for(i=0;i<numberofnodes;i++)tria[i]++;
[5032]48
[1172]49 /*Write data: */
[12004]50 WriteData(TRIA,tria,numberofnodes);
[1172]51
52 /*end module: */
53 MODULEEND();
54}
55
[5354]56void TriaSearchUsage(void)
[1172]57{
[6412]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");
[1172]66}
Note: See TracBrowser for help on using the repository browser.