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