1 | /*
|
---|
2 | * TriMesh: mesh a domain using an .exp file
|
---|
3 | */
|
---|
4 |
|
---|
5 | #include "./TriMesh.h"
|
---|
6 |
|
---|
7 | void TriMeshUsage(void){/*{{{*/
|
---|
8 | _printf_("\n");
|
---|
9 | _printf_(" usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,rifts,area) \n");
|
---|
10 | _printf_(" where: index,x,y defines a triangulation, segments is an array made \n");
|
---|
11 | _printf_(" of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, \n");
|
---|
12 | _printf_(" outlinefilename an Argus domain outline file, \n");
|
---|
13 | _printf_(" area is the maximum area desired for any element of the resulting mesh, \n");
|
---|
14 | _printf_("\n");
|
---|
15 | }/*}}}*/
|
---|
16 | WRAPPER(TriMesh,double** pindex, double** px, double** py, int* pnel, int* pnods, double* domainx, double* domainy, int domainnods, double areain){
|
---|
17 |
|
---|
18 |
|
---|
19 | /*intermediary: */
|
---|
20 | double area;
|
---|
21 | Contours *domain = NULL;
|
---|
22 | Contours *rifts = NULL;
|
---|
23 |
|
---|
24 | /* output: */
|
---|
25 | int *index = NULL;
|
---|
26 | double *x = NULL;
|
---|
27 | double *y = NULL;
|
---|
28 | int *segments = NULL;
|
---|
29 | int *segmentmarkerlist = NULL;
|
---|
30 | int nel,nods,nsegs;
|
---|
31 |
|
---|
32 | /*Boot module: */
|
---|
33 | MODULEBOOT();
|
---|
34 |
|
---|
35 | /*checks on arguments: */
|
---|
36 | CHECKARGUMENTS(NLHS,NRHS,&TriMeshUsage);
|
---|
37 |
|
---|
38 | /*Fetch data needed for meshing: */
|
---|
39 | FetchData(&domain,DOMAINOUTLINE);
|
---|
40 | FetchData(&rifts,RIFTSOUTLINE);
|
---|
41 | FetchData(&area,AREA);
|
---|
42 |
|
---|
43 | /*call x core: */
|
---|
44 | TriMeshx(&index,&x,&y,&segments,&segmentmarkerlist,&nel,&nods,&nsegs,domain,rifts,area);
|
---|
45 |
|
---|
46 | /*write outputs: */
|
---|
47 | WriteData(INDEX,index,nel,3);
|
---|
48 | WriteData(X,x,nods);
|
---|
49 | WriteData(Y,y,nods);
|
---|
50 | WriteData(SEGMENTS,segments,nsegs,3);
|
---|
51 | WriteData(SEGMENTMARKERLIST,segmentmarkerlist,nsegs);
|
---|
52 |
|
---|
53 | /*free ressources: */
|
---|
54 | delete domain;
|
---|
55 | delete rifts;
|
---|
56 | xDelete<int>(index);
|
---|
57 | xDelete<double>(x);
|
---|
58 | xDelete<double>(y);
|
---|
59 | xDelete<int>(segments);
|
---|
60 | xDelete<int>(segmentmarkerlist);
|
---|
61 |
|
---|
62 | /*end module: */
|
---|
63 | MODULEEND();
|
---|
64 | }
|
---|