Changeset 13586
- Timestamp:
- 10/10/12 13:46:23 (12 years ago)
- Location:
- issm/trunk-jpl/src/modules
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/modules/BamgMesher/BamgMesher.h
r13236 r13586 1 1 /* 2 BamgMesher Usage.h2 BamgMesher.h 3 3 */ 4 4 -
issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp
r13236 r13586 35 35 mwSize dimensions[2] = {1,1}; 36 36 double* pair=NULL; 37 38 37 39 38 /* input: */ 40 double *tindex_in = NULL;41 39 double *index_in = NULL; 42 40 int nel; 43 double *x_inm = NULL; //matlab vector44 41 double *x_in = NULL; //copy of matlab vector 45 42 int nods; 46 double *y_inm = NULL; //matlab vector47 43 double *y_in = NULL; //copy of matlab vector 48 double *tsegments_in = NULL;49 44 double *segments_in = NULL; 50 double *tsegmentmarkers_in = NULL;51 45 double *segmentmarkers_in = NULL; 52 46 … … 59 53 int numrifts; 60 54 61 /* verify correct usage: */ 62 if (nlhs==0 && nrhs==0){ 63 /* special case: */ 64 TriMeshProcessRiftsUsage(); 65 return; 66 } 67 68 if (!( (nlhs==6) || (nrhs==5))){ 69 mexPrintf(" %s format error.\n", __FUNCT__); 70 TriMeshProcessRiftsUsage(); 71 _error_("bad usage"); 72 } 55 /*Boot module*/ 56 MODULEBOOT(); 73 57 74 /*Fetch index_in: */ 75 if(mxIsDouble(prhs[0])){ 76 nel=mxGetM(prhs[0]); 77 tindex_in=mxGetPr(prhs[0]); 78 index_in=xNew<double>(nel*3); 79 for (i=0;i<nel;i++){ 80 for (j=0;j<3;j++){ 81 *(index_in+3*i+j)=*(tindex_in+nel*j+i); 82 } 83 } 84 } 85 else{ 86 _error_("first argument should be the element list"); 87 } 58 /*checks on arguments on the matlab side: */ 59 CHECKARGUMENTS(NLHS,NRHS,&TriMeshProcessRiftsUsage); 88 60 89 /*Fetch x_in: */ 90 if(mxIsDouble(prhs[1])){ 91 nods=mxGetM(prhs[1]); 92 x_inm=mxGetPr(prhs[1]); 93 x_in=xNew<double>(nods); 94 for (i=0;i<nods;i++){ 95 x_in[i]=x_inm[i]; 96 } 97 } 98 else{ 99 _error_("second argument should be the x corrdinate list"); 100 } 101 102 /*Fetch y_in: */ 103 if(mxIsDouble(prhs[2])){ 104 y_inm=mxGetPr(prhs[2]); 105 y_in=xNew<double>(nods); 106 for (i=0;i<nods;i++){ 107 y_in[i]=y_inm[i]; 108 } 109 } 110 else{ 111 _error_("third argument should be the y corrdinate list"); 112 } 113 114 /*Fetch segments_in: */ 115 if(mxIsDouble(prhs[3])){ 116 num_seg=mxGetM(prhs[3]); 117 tsegments_in=mxGetPr(prhs[3]); 118 segments_in=xNew<double>(num_seg*3); 119 for (i=0;i<num_seg;i++){ 120 for (j=0;j<3;j++){ 121 *(segments_in+3*i+j)=*(tsegments_in+num_seg*j+i); 122 } 123 } 124 } 125 else{ 126 _error_("fourth argument should be the segments list"); 127 } 128 129 /*Fetch segment markers: */ 130 if(mxIsDouble(prhs[4])){ 131 tsegmentmarkers_in=mxGetPr(prhs[4]); 132 segmentmarkers_in=xNew<double>(num_seg); 133 for (i=0;i<num_seg;i++){ 134 segmentmarkers_in[i]=tsegmentmarkers_in[i]; 135 } 136 } 137 else{ 138 _error_("fourth argument should be the segmentmarkers list"); 139 } 61 /*Fetch data */ 62 FetchData(&index_in,&nel,NULL,INDEXIN); 63 FetchData(&x_in,&nods,XIN); 64 FetchData(&y_in,NULL,YIN); 65 FetchData(&segments_in,&num_seg,NULL,SEGMENTSIN); 66 FetchData(&segmentmarkers_in,NULL,SEGMENTMARKERSIN); 140 67 141 68 /*First, do some fixing on the existing mesh: we do not want any element belonging entirely to the segment list (ie: … … 171 98 172 99 /*Output : */ 173 WriteData( &plhs[0],index_in,nel,3);174 WriteData( &plhs[1],x_in,nods,1);175 WriteData( &plhs[2],y_in,nods,1);176 WriteData( &plhs[3],segments_in,num_seg,3);177 WriteData( &plhs[4],segmentmarkers_in,num_seg,1);100 WriteData(INDEXOUT,index_in,nel,3); 101 WriteData(XOUT,x_in,nods,1); 102 WriteData(YOUT,y_in,nods,1); 103 WriteData(SEGMENTSOUT,segments_in,num_seg,3); 104 WriteData(SEGMENTMARKERSOUT,segmentmarkers_in,num_seg,1); 178 105 179 106 if(riftflag){ … … 191 118 192 119 dimensions[0]=out_numrifts; 193 194 120 pmxa_array=mxCreateStructArray( ndim,dimensions,10,fnames); 195 121 … … 249 175 plhs[5]=pmxa_array; 250 176 251 return; 177 /*end module: */ 178 MODULEEND(); 252 179 } -
issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.h
r13236 r13586 1 /* !\file: TriMeshProcessRifts.h2 * \brief header prototype1 /* 2 * TriMeshProcessRifts.h 3 3 */ 4 4 … … 6 6 #define _TRIMESH_PROCESSRIFTS_H_ 7 7 8 #include "mex.h" 9 #include "triangle.h" 10 #include "string.h" 8 #ifdef HAVE_CONFIG_H 9 #include <config.h> 10 #else 11 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 12 #endif 13 14 /*For python modules: needs to come before header files inclusion*/ 15 #ifdef _HAVE_PYTHON_ 16 #define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol 17 #endif 18 11 19 #include "../../c/include/globals.h" 12 20 #include "../../c/modules/modules.h" … … 14 22 #include "../../c/shared/shared.h" 15 23 #include "../../c/issm-binding.h" 16 #include "../../c/EnumDefinitions/EnumDefinitions.h"17 24 18 25 #undef __FUNCT__ 19 #define __FUNCT__ "TriMeshProcessRifts" 26 #define __FUNCT__ "TriMeshProcessRifts" 27 28 #ifdef _HAVE_MATLAB_MODULES_ 29 /* serial input macros: */ 30 #define INDEXIN prhs[0] 31 #define XIN prhs[1] 32 #define YIN prhs[2] 33 #define SEGMENTSIN prhs[3] 34 #define SEGMENTMARKERSIN prhs[4] 35 /* serial output macros: */ 36 #define INDEXOUT (mxArray**)&plhs[0] 37 #define XOUT (mxArray**)&plhs[1] 38 #define YOUT (mxArray**)&plhs[2] 39 #define SEGMENTSOUT (mxArray**)&plhs[3] 40 #define SEGMENTMARKERSOUT (mxArray**)&plhs[4] 41 #define RIFTSTRUCTOUT (mxArray**)&plhs[5] 42 #endif 43 44 #ifdef _HAVE_PYTHON_MODULES_ 45 /* serial input macros: */ 46 #define INDEXIN PyTuple_GetItem(args,0) 47 #define XIN PyTuple_GetItem(args,1) 48 #define YIN PyTuple_GetItem(args,2) 49 #define SEGMENTSIN PyTuple_GetItem(args,3) 50 #define SEGMENTSMARKERSIN PyTuple_GetItem(args,4) 51 /* serial output macros: */ 52 #define INDEXOUT output,0 53 #define XOUT output,1 54 #define YOUT output,2 55 #define SEGMENTSOUT output,3 56 #define SEGMENTMARKERSOUT output,4 57 #define RIFTSTRUCTOUT output,5 58 #endif 59 60 /* serial arg counts: */ 61 #undef NLHS 62 #define NLHS 6 63 #undef NRHS 64 #define NRHS 5 20 65 21 66 #endif
Note:
See TracChangeset
for help on using the changeset viewer.