Changeset 5019
- Timestamp:
- 08/06/10 11:41:13 (15 years ago)
- Location:
- issm/trunk/src/mex
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/mex/ContourToMesh/ContourToMesh.cpp
r3755 r5019 44 44 45 45 //contours 46 mxArray* matlabstructure=NULL; 46 47 int numcontours; 47 48 Contour** contours=NULL; … … 58 59 } 59 60 61 /*First, call expread on filename to build a contour array in the matlab workspace: */ 62 mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread"); 63 60 64 /*Fetch inputs: */ 61 65 FetchData(&index,&nel,NULL,INDEXHANDLE); … … 64 68 FetchData(&edgevalue,EDGEVALUEHANDLE); 65 69 66 /*Recover list of contours from the 'contours' structure: */ 67 //number of contours; 68 numcontours=mxGetNumberOfElements(CONTOURSHANDLE); 69 //allocate array: 70 //Fetch contours 71 numcontours=mxGetNumberOfElements(matlabstructure); 70 72 contours=(Contour**)xmalloc(numcontours*sizeof(Contour*)); 71 72 //go through contours, and populate xcontours and ycontours accordingly.73 73 for(i=0;i<numcontours;i++){ 74 74 //allocate 75 75 contouri=(Contour*)xmalloc(sizeof(Contour)); 76 76 //retrieve dimension of this contour. 77 contouri->nods=(int)mxGetScalar(mxGetField( CONTOURSHANDLE,i,"nods"));77 contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods")); 78 78 //set pointers. 79 contouri->x=mxGetPr(mxGetField( CONTOURSHANDLE,i,"x"));80 contouri->y=mxGetPr(mxGetField( CONTOURSHANDLE,i,"y"));79 contouri->x=mxGetPr(mxGetField(matlabstructure,i,"x")); 80 contouri->y=mxGetPr(mxGetField(matlabstructure,i,"y")); 81 81 *(contours+i)=contouri; 82 82 } 83 83 84 /* 85 for(i=0;i<numcontours;i++){ 84 /*Fetch interptype: */ 85 FetchData(&interptype,INTERPTYPEHANDLE); 86 87 /* Debugging of contours :{{{1*/ 88 /*for(i=0;i<numcontours;i++){ 86 89 printf("\nContour echo: contour number %i / %i\n",i+1,numcontours); 87 90 contouri=*(contours+i); … … 90 93 printf(" %lf %lf\n",*(contouri->x+j),*(contouri->y+j)); 91 94 } 92 } 93 */ 94 95 /*Recover interptype: */ 96 FetchData(&interptype,INTERPTYPEHANDLE); 95 }*/ 96 /*}}}*/ 97 97 98 98 /*Run interpolation routine: */ … … 122 122 printf("\n"); 123 123 printf(" Usage: \n"); 124 printf(" [in_nod,in_elem]=ContourToMesh(index,x,y,contour s,interptype,edgevalue)\n\n");124 printf(" [in_nod,in_elem]=ContourToMesh(index,x,y,contourname,interptype,edgevalue)\n\n"); 125 125 printf("\n"); 126 126 printf(" index,x,y: mesh triangulation.\n"); 127 printf(" contour s: structure holding sets of vertices making opencontours.\n");127 printf(" contourname: name of .exp file containing the contours.\n"); 128 128 printf(" interptype: string definining type of interpolation ('element', or 'node').\n"); 129 129 printf(" edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.\n"); -
issm/trunk/src/mex/ContourToMesh/ContourToMesh.h
r4236 r5019 27 27 #define XHANDLE prhs[1] 28 28 #define YHANDLE prhs[2] 29 #define CONTOURSHANDLE prhs[3]29 #define FILENAME prhs[3] 30 30 #define INTERPTYPEHANDLE prhs[4] 31 31 #define EDGEVALUEHANDLE prhs[5] -
issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp
r3249 r5019 39 39 40 40 //contours 41 mxArray* matlabstructure=NULL; 41 42 int numcontours; 42 43 Contour** contours=NULL; … … 49 50 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ContourToNodesUsage); 50 51 52 /*First, call expread on filename to build a contour array in the matlab workspace: */ 53 mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread"); 54 51 55 /*Fetch inputs: */ 52 56 FetchData(&x,&nods,NULL,XHANDLE); … … 54 58 FetchData(&edgevalue,EDGEVALUEHANDLE); 55 59 56 /*Recover list of contours from the 'contours' structure: */ 57 //number of contours; 58 numcontours=mxGetNumberOfElements(CONTOURSHANDLE); 59 //allocate array: 60 //Fetch contours 61 numcontours=mxGetNumberOfElements(matlabstructure); 60 62 contours=(Contour**)xmalloc(numcontours*sizeof(Contour*)); 61 62 //go through contours, and populate xcontours and ycontours accordingly.63 63 for(i=0;i<numcontours;i++){ 64 64 //allocate 65 65 contouri=(Contour*)xmalloc(sizeof(Contour)); 66 66 //retrieve dimension of this contour. 67 contouri->nods=(int)mxGetScalar(mxGetField( CONTOURSHANDLE,i,"nods"));67 contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods")); 68 68 //set pointers. 69 contouri->x=mxGetPr(mxGetField( CONTOURSHANDLE,i,"x"));70 contouri->y=mxGetPr(mxGetField( CONTOURSHANDLE,i,"y"));69 contouri->x=mxGetPr(mxGetField(matlabstructure,i,"x")); 70 contouri->y=mxGetPr(mxGetField(matlabstructure,i,"y")); 71 71 *(contours+i)=contouri; 72 72 } 73 74 /* Debugging of contours :{{{1*/ 75 /*for(i=0;i<numcontours;i++){ 76 printf("\nContour echo: contour number %i / %i\n",i+1,numcontours); 77 contouri=*(contours+i); 78 printf(" Number of grids %i\n",contouri->nods); 79 for (j=0;j<contouri->nods;j++){ 80 printf(" %lf %lf\n",*(contouri->x+j),*(contouri->y+j)); 81 } 82 }*/ 83 /*}}}*/ 73 84 74 85 /*Run interpolation routine: */ … … 85 96 void ContourToNodesUsage(void){ 86 97 printf(" usage:\n"); 87 printf(" [flags]=ContourToNodes(x,y,contour s,edgevalue);\n\n");98 printf(" [flags]=ContourToNodes(x,y,contourname,edgevalue);\n\n"); 88 99 printf(" where:\n"); 89 100 printf(" x,y: list of nodes.\n"); 90 printf(" contour s: structure holding sets of vertices making opencontours.\n");101 printf(" contourname: name of .exp file containing the contours.\n"); 91 102 printf(" interptype: string definining type of interpolation ('element', or 'node').\n"); 92 103 printf(" edgevalue: integer (0, 1 or 2) defining the value associated to the nodes on the edges of the polygons.\n"); -
issm/trunk/src/mex/ContourToNodes/ContourToNodes.h
r4236 r5019 26 26 #define XHANDLE prhs[0] 27 27 #define YHANDLE prhs[1] 28 #define CONTOURSHANDLE prhs[2]28 #define FILENAME prhs[2] 29 29 #define EDGEVALUEHANDLE prhs[3] 30 30 -
issm/trunk/src/mex/InputToResult/InputToResult.cpp
r4573 r5019 21 21 22 22 /*checks on arguments on the matlab side: */ 23 //CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,& ContourToMeshUsage); Cant' use it here, as we have variable inputs.23 //CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InputToResultUsage); Cant' use it here, as we have variable inputs. 24 24 if((nlhs!=NLHS) || (nrhs!=7 && nrhs!=9)){ 25 25 InputToResultUsage();
Note:
See TracChangeset
for help on using the changeset viewer.