source: issm/trunk/src/modules/BamgTriangulate/BamgTriangulate.cpp@ 13395

Last change on this file since 13395 was 13395, checked in by Mathieu Morlighem, 12 years ago

merged trunk-jpl and trunk for revision 13393

File size: 1.4 KB
Line 
1/*\file BamgTriangulate.c
2 *\brief: bamg module.
3 */
4#include "./BamgTriangulate.h"
5
6void BamgTriangulateUsage(void){/*{{{*/
7 _pprintString_("BAMGTRIANGULATE - Delaunay Triangulation of a list of points");
8 _pprintLine_("");
9 _pprintLine_(" Usage:");
10 _pprintLine_(" index=BamgTriangulate(x,y);");
11 _pprintLine_(" index: index of the triangulation");
12 _pprintLine_(" x,y: coordinates of the nodes");
13 _pprintLine_("");
14}/*}}}*/
15WRAPPER(BamgTriangulate){
16
17 /*input: */
18 double* x=NULL;
19 double* y=NULL;
20 int x_cols;
21 int y_rows,y_cols;
22 int nods;
23
24 /*Output*/
25 int* index=NULL;
26 int nels;
27
28 /*Intermediary*/
29 int verbose=0;
30
31 /*Boot module: */
32 MODULEBOOT();
33
34 /*checks on arguments on the matlab side: */
35 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&BamgTriangulateUsage);
36
37 /*Input datasets: */
38 if (verbose) _printLine_("Fetching inputs");
39 FetchData(&x,&nods,&x_cols,XHANDLE);
40 FetchData(&y,&y_rows,&y_cols,YHANDLE);
41
42 /*Check inputs*/
43 if(y_rows!=nods) _error_("x and y do not have the same length");
44 if(x_cols>1 || y_cols>1) _error_("x and y should have only one column");
45 if(nods<3) _error_("At least 3 points are required");
46
47 /* Run core computations: */
48 if (verbose) _printLine_("Call core");
49 BamgTriangulatex(&index,&nels,x,y,nods);
50
51 /*Write output*/
52 WriteData(INDEX,index,nels,3);
53
54 /*end module: */
55 MODULEEND();
56}
Note: See TracBrowser for help on using the repository browser.