source: issm/trunk-jpl/src/mex/TriMesh/TriMesh.cpp.bak@ 11881

Last change on this file since 11881 was 11881, checked in by Eric.Larour, 13 years ago

new TriMesh module

File size: 2.0 KB
Line 
1/*
2 * TriMesh: mesh a domain using an .exp file
3 */
4
5#include "./TriMesh.h"
6
7void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[] ){
8
9 /* input: */
10 char* domainname=NULL;
11 double area;
12 bool order;
13
14 /*intermediary: */
15 DataSet* domain=NULL;
16
17 /* output: */
18 Matrix* index=NULL;
19 Vector* x=NULL;
20 Vector* y=NULL;
21 Matrix* segments=NULL;
22 Vector* segmentmarkerlist=NULL;
23
24 /*Boot module: */
25 MODULEBOOT();
26printf("ok1\n");
27
28 /*checks on arguments on the matlab side: */
29 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&TriMeshUsage);
30printf("ok2\n");
31
32 /*Fetch data needed for meshing: */
33
34 FetchMatlabData(&domainname,DOMAINOUTLINE);
35 FetchMatlabData(&area,AREA);
36 FetchMatlabData(&order,ORDER);
37printf("ok3 %g %s\n",area,domainname);
38
39 /*Read domain outline: */
40 domain=DomainOutlineRead(domainname,false);
41printf("ok4\n");
42
43 /*call x core: */
44 TriMeshx(&index,&x,&y,&segments,&segmentmarkerlist,domain,area,order);
45printf("ok5\n");
46
47 /*write outputs: */
48 /*WriteMatlabData(INDEX,index);
49 WriteMatlabData(X,x);
50 WriteMatlabData(Y,y);
51 WriteMatlabData(SEGMENTS,segments);
52 WriteMatlabData(SEGMENTMARKERLIST,segmentmarkerlist);*/
53
54 /*free ressources: */
55 delete domain;
56 /*
57 xdelete(&index);
58 xdelete(&x);
59 xdelete(&y);
60 xdelete(&segments);
61 xdelete(&segmentmarkerlist);*/
62
63 /*end module: */
64 MODULEEND();
65}
66
67void TriMeshUsage(void)
68{
69 printf("\n");
70 printf(" usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,area,ordered) \n");
71 printf(" where: index,x,y defines a triangulation, segments is an array made \n");
72 printf(" of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, \n");
73 printf(" outlinefilename an Argus domain outline file, \n");
74 printf(" area is the maximum area desired for any element of the resulting mesh, \n");
75 printf(" and ordered is a bool that determines whether segments are output in the \n");
76 printf(" order they are made by Triangle (ie none), or ordered counter clockwise around the domain outline.\n");
77 printf("\n");
78}
Note: See TracBrowser for help on using the repository browser.