Changeset 12049
- Timestamp:
- 04/18/12 15:16:17 (13 years ago)
- Location:
- issm/trunk-jpl/src/modules
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/modules/BamgMesher/BamgMesher.cpp ¶
r12045 r12049 32 32 FetchData(&bamgmesh_in,BAMGGEOMIN); 33 33 34 /* !Generate internal degree of freedom numbers:*/34 /*Call x layer*/ 35 35 Bamgx(bamgmesh_out,bamggeom_out,bamgmesh_in,bamggeom_in,bamgopts); 36 36 -
TabularUnified issm/trunk-jpl/src/modules/Exp2Kml/Exp2Kml.cpp ¶
r11933 r12049 25 25 /*checks on arguments on the matlab side: */ 26 26 if (nlhs > NLHS) { 27 Exp2KmlUsage(); 28 _error_("Exp2Kml usage error"); 27 Exp2KmlUsage(); _error_("Exp2Kml usage error"); 29 28 } 30 29 if (nrhs < NRHS) { 31 Exp2KmlUsage(); 32 _error_("Exp2Kml usage error"); 30 Exp2KmlUsage(); _error_("Exp2Kml usage error"); 33 31 } 34 32 35 33 /*Input datasets: */ 36 if (verbose) printf("Fetching inputs:\n");37 34 FetchData(&filexp,EXP_IN); 38 if (verbose) printf(" filexp=\"%s\"\n",filexp);39 35 FetchData(&filkml,KML_IN); 40 if (verbose) printf(" filkml=\"%s\"\n",filkml);41 36 FetchData(&sgn,SGN_IN); 42 if (verbose) printf(" sgn=%d\n",sgn);37 FetchData(&options,NRHS,nrhs,prhs); 43 38 44 if (verbose) printf("Parsing options:\n");45 options=new Options(NRHS,nrhs,prhs);46 if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();47 39 options->Get(&choles,"holes","no"); 48 if (!strncmp(choles,"y",1) || !strncmp(choles,"on",2)) 49 holes=true; 40 if (!strncmp(choles,"y",1) || !strncmp(choles,"on",2)) holes=true; 41 50 42 /* defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified */ 51 43 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { … … 57 49 58 50 /*some checks*/ 59 if (verbose) printf("Checking inputs:\n"); 60 61 if (sgn != +1 && sgn != -1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn); 51 if (sgn !=+1 && sgn !=-1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn); 62 52 if (fabs(cm) > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm); 63 53 if (sp < 0. || sp > 90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp); 64 54 65 55 /* Run core computations: */ 66 if (verbose) printf("Calling core:\n");67 56 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 68 iret=Exp2Kmlx(filexp,filkml, 69 sgn,cm,sp, 70 holes); 57 iret=Exp2Kmlx(filexp,filkml,sgn,cm,sp,holes); 71 58 else 72 iret=Exp2Kmlx(filexp,filkml, 73 sgn, 74 holes); 75 if (verbose) printf(" iret=%d\n",iret); 59 iret=Exp2Kmlx(filexp,filkml,sgn,holes); 76 60 77 61 /*Write data: */ … … 88 72 } 89 73 90 void Exp2KmlUsage(void) 91 { 74 void Exp2KmlUsage(void){ 92 75 _printf_(true,"Exp2Kml - exp to kml file conversion module:\n"); 93 76 _printf_(true,"\n"); -
TabularUnified issm/trunk-jpl/src/modules/KMLFileRead/KMLFileRead.cpp ¶
r11933 r12049 11 11 /*input: */ 12 12 char* name=NULL; 13 14 13 char* notes=NULL; 15 14 const mxArray* notesi; 16 15 mwIndex nindex; 17 18 16 int* elem=NULL; 19 17 int melem=0,nelem=0; 20 21 18 int* nodecon=NULL; 22 19 int mncon=0,nncon=0; 23 24 20 double* lat=NULL; 25 21 int mlat=0,nlat=0,llat=0; 26 27 22 double* lng=NULL; 28 23 int mlng=0,nlng=0,llng=0; 29 30 24 int nparts=0; 31 32 25 int* part=NULL; 33 26 int mprt=0,nprt=0,lprt=0; 34 35 27 double* data=NULL; 36 28 int mdata=0,ndata=0; 37 38 29 double* cmap=NULL; 39 30 int mcmap=0,ncmap=0; 40 41 31 char* filnam=NULL; 42 43 32 FILE* fidi=NULL; 44 33 FILE* fido=NULL; 45 46 34 Options* options=NULL; 47 35 char* echo =NULL; … … 57 45 /*checks on arguments on the matlab side: */ 58 46 if (nlhs > NLHS) { 59 KMLFileReadUsage(); 60 _error_("KMLFileRead usage error"); 47 KMLFileReadUsage(); _error_("KMLFileRead usage error"); 61 48 } 62 49 if (nrhs < NRHS) { 63 KMLFileReadUsage(); 64 _error_("KMLFileRead usage error"); 50 KMLFileReadUsage(); _error_("KMLFileRead usage error"); 65 51 } 66 52 67 53 /*Input datasets: */ 68 if (verbose) printf("Fetching inputs:\n");69 54 FetchData(&filnam,FILENAME); 70 if (verbose) printf(" filnam =\"%s\"\n",filnam); 55 FetchData(&options,NRHS,nrhs,prhs); 56 FetchData(&options,NRHS,nrhs,prhs); 71 57 72 if (verbose) printf("Parsing options:\n");73 options=new Options(NRHS,nrhs,prhs);74 if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();75 58 options->Get(&echo ,"echo" ,"off"); 76 59 options->Get(&deepecho,"deepecho","off"); … … 78 61 79 62 /*some checks*/ 80 if (verbose) printf("Checking inputs:\n"); 81 82 if (!strlen(filnam)) 83 strcpy(filnam,"stdout"); 63 if (!strlen(filnam)) strcpy(filnam,"stdout"); 84 64 85 65 if (verbose) printf("Opening file \"%s\".\n",filnam); … … 93 73 fclose(fidi); 94 74 95 if (kobj) 75 if (kobj){ 96 76 if (!strncmp(echo ,"on",2) || !strncmp(echo ,"y",1)) 97 77 kobj->Echo(); … … 110 90 } 111 91 } 112 113 92 delete kobj; 114 93 } … … 127 106 } 128 107 129 void KMLFileReadUsage(void) 130 { 108 void KMLFileReadUsage(void){ 131 109 _printf_(true,"KMLFileRead - KML file reader module:\n"); 132 110 _printf_(true,"\n"); -
TabularUnified issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp ¶
r11933 r12049 10 10 /*input: */ 11 11 char* name=NULL; 12 13 12 char* notes=NULL; 14 13 const mxArray* notesi; 15 14 mwIndex nindex; 16 17 15 int* elem=NULL; 18 16 int melem=0,nelem=0; 19 20 17 int* nodecon=NULL; 21 18 int mncon=0,nncon=0; 22 23 19 double* lat=NULL; 24 20 int mlat=0,nlat=0,llat=0; 25 26 21 double* lng=NULL; 27 22 int mlng=0,nlng=0,llng=0; 28 29 23 int nparts=0; 30 31 24 int* part=NULL; 32 25 int mprt=0,nprt=0,lprt=0; 33 34 26 double* data=NULL; 35 27 int mdata=0,ndata=0; 36 37 28 double* cmap=NULL; 38 29 int mcmap=0,ncmap=0; 39 40 30 char* filnam=NULL; 41 42 31 FILE* fid=NULL; 43 44 32 Options* options=NULL; 45 33 … … 52 40 /*checks on arguments on the matlab side: */ 53 41 if (nlhs > NLHS) { 54 KMLMeshWriteUsage(); 55 _error_("KMLMeshWrite usage error"); 42 KMLMeshWriteUsage(); _error_("KMLMeshWrite usage error"); 56 43 } 57 44 if (nrhs < NRHS) { 58 KMLMeshWriteUsage(); 59 _error_("KMLMeshWrite usage error"); 45 KMLMeshWriteUsage(); _error_("KMLMeshWrite usage error"); 60 46 } 61 47 62 48 /*Input datasets: */ 63 if (verbose) printf("Fetching inputs:\n");64 49 FetchData(&name,NAME); 65 if (verbose) printf(" name =\"%s\"\n",name);66 50 67 51 /* notes is typically a cell array of character strings */ … … 85 69 else 86 70 FetchData(¬es,NOTES); 87 if (verbose) printf(" notes =\"%s\"\n",notes);88 89 71 FetchData(&elem,&melem,&nelem,ELEMHANDLE); 90 if (verbose) printf(" elem =size [%d x %d]\n",melem,nelem);91 72 FetchData(&nodecon,&mncon,&nncon,NODECONHANDLE); 92 if (verbose) printf(" nodecon=size [%d x %d]\n",mncon,nncon);93 73 FetchData(&lat,&mlat,&nlat,LATHANDLE); 94 74 llat=mlat*nlat; 95 if (verbose) printf(" lat =length [%d]\n",llat);96 75 FetchData(&lng,&mlng,&nlng,LNGHANDLE); 97 76 llng=mlng*nlng; 98 if (verbose) printf(" lng =length [%d]\n",llng);99 77 FetchData(&part,&mprt,&nprt,PARTHANDLE); 100 78 lprt=mprt*nprt; 101 if (verbose) printf(" part =length [%d]\n",lprt);102 79 FetchData(&data,&mdata,&ndata,DATAHANDLE); 103 if (verbose) printf(" data =size [%d x %d]\n",mdata,ndata);104 80 FetchData(&cmap,&mcmap,&ncmap,CMAPHANDLE); 105 if (verbose) printf(" cmap =size [%d x %d]\n",mcmap,ncmap);106 81 FetchData(&filnam,FILENAME); 107 if (verbose) printf(" filnam =\"%s\"\n",filnam); 108 109 if (verbose) printf("Parsing options:\n"); 110 options=new Options(NRHS,nrhs,prhs); 111 // if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho(); 82 FetchData(&options,NRHS,nrhs,prhs); 112 83 113 84 /*some checks*/ 114 if (verbose) printf("Checking inputs:\n"); 85 for (i=0; i<melem*nelem; i++) if(elem[i]>nnodes) nnodes=elem[i]; 86 if(part) for (i=0; i<lprt; i++) if (part[i]+1 > nparts) nparts=part[i]+1; 115 87 116 for (i=0; i<melem*nelem; i++) 117 if (elem[i] > nnodes) 118 nnodes=elem[i]; 119 if (verbose) printf(" nnodes =%d\n",nnodes); 120 if (part) 121 for (i=0; i<lprt; i++) 122 if (part[i]+1 > nparts) 123 nparts=part[i]+1; 124 if (verbose) printf(" nparts =%d\n",nparts); 125 126 if (nodecon && (mncon != nnodes)) 88 if (nodecon && (mncon != nnodes)) 127 89 _error_("Nodal connectivity table, if supplied, must be supplied for all nodes."); 128 90 else if (!nodecon) … … 136 98 if (cmap && (ncmap != 3)) 137 99 _error_("Colormap matrix, if supplied, must have three columns for rgb."); 138 139 100 if (!strlen(filnam)) 140 101 strcpy(filnam,"stdout"); 141 102 142 if (verbose) printf("Opening file \"%s\".\n",filnam);103 /* Run core computations: */ 143 104 fid=fopen(filnam,"w"); 144 145 /* Run core computations: */ 146 if (verbose) printf("Calling core:\n"); 147 KMLMeshWritex(&ierror, 148 name, 149 notes, 150 elem,melem,nelem, 151 nodecon,mncon,nncon, 152 lat,lng, 153 part, 154 data,mdata,ndata, 155 cmap,mcmap,ncmap, 156 fid); 157 158 if (verbose) printf("Closing file \"%s\".\n",filnam); 105 KMLMeshWritex(&ierror,name,notes,elem,melem,nelem,nodecon,mncon,nncon,lat,lng,part,data,mdata,ndata,cmap,mcmap,ncmap,fid); 159 106 fclose(fid); 160 107 … … 170 117 } 171 118 172 void KMLMeshWriteUsage(void) 173 { 119 void KMLMeshWriteUsage(void){ 174 120 _printf_(true,"KMLMeshWrite - KML mesh writer module:\n"); 175 121 _printf_(true,"\n"); … … 196 142 _printf_(true,"\n"); 197 143 } 198 -
TabularUnified issm/trunk-jpl/src/modules/KMLOverlay/KMLOverlay.cpp ¶
r11933 r12049 30 30 31 31 /*checks on arguments on the matlab side: */ 32 if (nlhs > NLHS) { 33 KMLOverlayUsage(); 34 _error_("KMLOverlay usage error"); 32 if(nlhs>NLHS){ 33 KMLOverlayUsage(); _error_("KMLOverlay usage error"); 35 34 } 36 if (nrhs < NRHS) { 37 KMLOverlayUsage(); 38 _error_("KMLOverlay usage error"); 35 if(nrhs<NRHS){ 36 KMLOverlayUsage(); _error_("KMLOverlay usage error"); 39 37 } 40 38 41 39 /*Input datasets: */ 42 if (verbose) printf("Fetching inputs:\n");43 40 FetchData(&filkml,FILENAME); 44 if (verbose) printf(" filkml=\"%s\"\n",filkml);41 FetchData(&options,NRHS,nrhs,prhs); 45 42 46 if (verbose) printf("Parsing options:\n");47 options=new Options(NRHS,nrhs,prhs);48 // if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();49 43 options->Get(&lataxis ,&nlat ,"lataxis" ); 50 44 if (verbose && lataxis) for (i=0; i<nlat; i++) printf(" lataxis [%d]=%g\n",i,lataxis[i]); 51 45 options->Get(&longaxis,&nlong,"longaxis"); 52 46 if (verbose && longaxis) for (i=0; i<nlong; i++) printf(" longaxis[%d]=%g\n",i,longaxis[i]); 53 // ((Option*)options->GetOption("images"))->DeepEcho();54 47 options->Get(&pimages,&nimages,"images"); 55 48 if (verbose && pimages) for (i=0; i<nimages; i++) printf(" pimages[%d]=\"%s\"\n",i,pimages[i]); … … 58 51 59 52 /*some checks*/ 60 if (verbose) printf("Checking inputs:\n"); 61 62 if (nlat != 2) _error_("Latitudinal axes \"lataxis\" require two double values, not %d.",nlat); 63 if (nlong != 2) _error_("Longitudinal axes \"longaxis\" require two double values, not %d.",nlong); 53 if (nlat !=2) _error_("Latitudinal axes \"lataxis\" require two double values, not %d.",nlat); 54 if (nlong!=2) _error_("Longitudinal axes \"longaxis\" require two double values, not %d.",nlong); 64 55 if (!nimages) _error_("No image files provided."); 65 56 66 if ((int)dzip) 57 if ((int)dzip){ 67 58 filkmz=filkml; 68 filkml=(char *) xmalloc(8*sizeof(char));59 filkml=(char*)mxMalloc(8*sizeof(char)); 69 60 strcpy(filkml,"doc.kml"); 70 61 } 71 62 72 if (!strlen(filkml)) 73 strcpy(filkml,"stdout"); 63 if(!strlen(filkml)) strcpy(filkml,"stdout"); 74 64 75 if 65 if(verbose) printf("Opening kml overlay file \"%s\".\n",filkml); 76 66 fid=fopen(filkml,"w"); 77 67 78 68 /* Run core computations: */ 79 69 if (verbose) printf("Calling core:\n"); 80 KMLOverlayx(&ierror, 81 lataxis,longaxis, 82 nimages,pimages, 83 fid); 70 KMLOverlayx(&ierror,lataxis,longaxis,nimages,pimages,fid); 84 71 85 72 if (verbose) printf("Closing file \"%s\".\n",filkml); … … 88 75 /* Create kmz file, if specified: */ 89 76 if ((int)dzip) { 90 czip=(char *) xmalloc((5+strlen(filkmz)+1+strlen(filkml)+1)*sizeof(char));77 czip=(char*)mxMalloc((5+strlen(filkmz)+1+strlen(filkml)+1)*sizeof(char)); 91 78 czip[0]='\0'; 92 79 strcat(czip,"!zip "); … … 96 83 for (i=0; i<nimages; i++) 97 84 if (strlen(pimages[i]) && strncmp(pimages[i],"http",4)) { 98 czip=(char *) xrealloc(czip,(strlen(czip)+1+strlen(pimages[i])+1)*sizeof(char));85 czip=(char*)mxRealloc(czip,(strlen(czip)+1+strlen(pimages[i])+1)*sizeof(char)); 99 86 strcat(czip," "); 100 87 strcat(czip,pimages[i]); … … 125 112 } 126 113 127 void KMLOverlayUsage(void) 128 { 114 void KMLOverlayUsage(void){ 129 115 _printf_(true,"KMLOverlay - KML file overlay module:\n"); 130 116 _printf_(true,"\n"); … … 147 133 _printf_(true,"\n"); 148 134 } 149 -
TabularUnified issm/trunk-jpl/src/modules/Kml2Exp/Kml2Exp.cpp ¶
r11933 r12049 11 11 char *filkml=NULL,*filexp=NULL; 12 12 int sgn; 13 14 13 Options* options=NULL; 15 14 double cm=0.,sp=0.; … … 23 22 /*checks on arguments on the matlab side: */ 24 23 if (nlhs > NLHS) { 25 Kml2ExpUsage(); 26 _error_("Kml2Exp usage error"); 24 Kml2ExpUsage(); _error_("Kml2Exp usage error"); 27 25 } 28 26 if (nrhs < NRHS) { 29 Kml2ExpUsage(); 30 _error_("Kml2Exp usage error"); 27 Kml2ExpUsage(); _error_("Kml2Exp usage error"); 31 28 } 32 29 33 30 /*Input datasets: */ 34 if (verbose) printf("Fetching inputs:\n");35 31 FetchData(&filkml,KML_IN); 36 if (verbose) printf(" filkml=\"%s\"\n",filkml);37 32 FetchData(&filexp,EXP_IN); 38 if (verbose) printf(" filexp=\"%s\"\n",filexp);39 33 FetchData(&sgn,SGN_IN); 40 if (verbose) printf(" sgn=%d\n",sgn);34 FetchData(&options,NRHS,nrhs,prhs); 41 35 42 if (verbose) printf("Parsing options:\n");43 options=new Options(NRHS,nrhs,prhs);44 if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();45 36 /* defaults are in Ll2xydef, so don't duplicate them here, and only use user values if both have been specified */ 46 37 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { … … 52 43 53 44 /*some checks*/ 54 if (verbose) printf("Checking inputs:\n"); 55 56 if (sgn != +1 && sgn != -1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn); 45 if (sgn !=+1 && sgn!= -1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn); 57 46 if (fabs(cm) > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm); 58 47 if (sp < 0. || sp > 90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp); 59 48 60 49 /* Run core computations: */ 61 if (verbose) printf("Calling core:\n");62 50 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 63 iret=Kml2Expx(filkml,filexp, 64 sgn,cm,sp); 51 iret=Kml2Expx(filkml,filexp,sgn,cm,sp); 65 52 else 66 iret=Kml2Expx(filkml,filexp, 67 sgn); 68 if (verbose) printf(" iret=%d\n",iret); 53 iret=Kml2Expx(filkml,filexp,sgn); 69 54 70 55 /*Write data: */ … … 80 65 } 81 66 82 void Kml2ExpUsage(void) 83 { 67 void Kml2ExpUsage(void){ 84 68 _printf_(true,"Kml2Exp - kml to exp file conversion module:\n"); 85 69 _printf_(true,"\n"); -
TabularUnified issm/trunk-jpl/src/modules/Ll2xy/Ll2xy.cpp ¶
r11933 r12049 25 25 /*checks on arguments on the matlab side: */ 26 26 if (nlhs > NLHS) { 27 Ll2xyUsage(); 28 _error_("Ll2xy usage error"); 27 Ll2xyUsage(); _error_("Ll2xy usage error"); 29 28 } 30 29 if (nrhs < NRHS) { 31 Ll2xyUsage(); 32 _error_("Ll2xy usage error"); 30 Ll2xyUsage(); _error_("Ll2xy usage error"); 33 31 } 34 32 35 33 /*Input datasets: */ 36 if (verbose) printf("Fetching inputs:\n");37 34 FetchData(&lat,&nlat,LAT_IN); 38 if (verbose)39 if (nlat == 1) printf(" lat=%g\n",lat[0]);40 else printf(" lat=[%d values]\n",nlat);41 // for (i=0; i<nlat; i++) printf(" lat[%d]=%g\n",i,lat[i]);42 35 FetchData(&lon,&nlon,LON_IN); 43 if (verbose)44 if (nlon == 1) printf(" lon=%g\n",lon[0]);45 else printf(" lon=[%d values]\n",nlon);46 // for (i=0; i<nlon; i++) printf(" lon[%d]=%g\n",i,lon[i]);47 36 FetchData(&sgn,SGN_IN); 48 if (verbose) printf(" sgn=%d\n",sgn);37 FetchData(&options,NRHS,nrhs,prhs); 49 38 50 if (verbose) printf("Parsing options:\n");51 options=new Options(NRHS,nrhs,prhs);52 if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();53 39 /* defaults are in Ll2xydef, so don't duplicate them here, and only use user values if both have been specified */ 54 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")){40 if(options->GetOption("central_meridian") || options->GetOption("standard_parallel")){ 55 41 options->Get(&cm,"central_meridian"); 56 42 if (verbose) printf(" cm=%g\n",cm); … … 61 47 /*some checks*/ 62 48 if (verbose) printf("Checking inputs:\n"); 63 64 if (nlat != nlon) _error_("Must have same number of lat[%d] and lon[%d] coordinates.",nlat,nlon); 49 if (nlat != nlon) _error_("Must have same number of lat[%d] and lon[%d] coordinates.",nlat,nlon); 65 50 else ncoord=nlat; 66 51 if (sgn != +1 && sgn != -1) _error_("Hemisphere sgn=%d must be +1 (north) or -1 (south).",sgn); … … 68 53 if (sp < 0. || sp > 90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp); 69 54 70 x=(double *)xmalloc(ncoord*sizeof(double));71 y=(double *)xmalloc(ncoord*sizeof(double));55 x=(double*)mxMalloc(ncoord*sizeof(double)); 56 y=(double*)mxMalloc(ncoord*sizeof(double)); 72 57 73 58 /* Run core computations: */ 74 if (verbose) printf("Calling core:\n");75 59 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 76 iret=Ll2xyx(x,y, 77 lat,lon,ncoord, 78 sgn,cm,sp); 60 iret=Ll2xyx(x,y,lat,lon,ncoord,sgn,cm,sp); 79 61 else 80 iret=Ll2xyx(x,y, 81 lat,lon,ncoord, 82 sgn); 83 if (verbose) printf(" iret=%d\n",iret); 62 iret=Ll2xyx(x,y,lat,lon,ncoord,sgn); 84 63 85 64 /*Write data: */ … … 94 73 } 95 74 96 void Ll2xyUsage(void) 97 { 75 void Ll2xyUsage(void){ 98 76 _printf_(true,"Ll2xy - lat/long to x/y coordinate transformation module:\n"); 99 77 _printf_(true,"\n"); … … 119 97 _printf_(true,"\n"); 120 98 } 121 -
TabularUnified issm/trunk-jpl/src/modules/Shp2Kml/Shp2Kml.cpp ¶
r11933 r12049 18 18 char *filshp=NULL,*filkml=NULL; 19 19 int sgn; 20 21 20 Options* options=NULL; 22 21 double cm=0.,sp=0.; … … 34 33 /*checks on arguments on the matlab side: */ 35 34 if (nlhs > NLHS) { 36 Shp2KmlUsage(); 37 _error_("Shp2Kml usage error"); 35 Shp2KmlUsage(); _error_("Shp2Kml usage error"); 38 36 } 39 37 if (nrhs < NRHS) { 40 Shp2KmlUsage(); 41 _error_("Shp2Kml usage error"); 38 Shp2KmlUsage(); _error_("Shp2Kml usage error"); 42 39 } 43 40 44 41 /*Input datasets: */ 45 if (verbose) printf("Fetching inputs:\n");46 42 FetchData(&filshp,SHP_IN); 47 if (verbose) printf(" filshp=\"%s\"\n",filshp);48 43 FetchData(&filkml,KML_IN); 49 if (verbose) printf(" filkml=\"%s\"\n",filkml);50 44 FetchData(&sgn,SGN_IN); 51 if (verbose) printf(" sgn=%d\n",sgn);45 FetchData(&options,NRHS,nrhs,prhs); 52 46 53 if (verbose) printf("Parsing options:\n");54 options=new Options(NRHS,nrhs,prhs);55 if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();56 47 /* defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified */ 57 48 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { … … 63 54 64 55 /*some checks*/ 65 if (verbose) printf("Checking inputs:\n");66 67 56 if (sgn < -1 || sgn > +1) _error_("Hemisphere sgn=%d must be +1 (north), -1 (south), or 0 (no translation).",sgn); 68 57 if (fabs(cm) > 180.) _error_("Central meridian cm=%g must be between -180 (west) and +180 (east) degrees.",cm); … … 70 59 71 60 /* Run core computations: */ 72 if (verbose) printf("Calling core:\n");73 61 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 74 iret=Shp2Kmlx(filshp,filkml, 75 sgn,cm,sp); 62 iret=Shp2Kmlx(filshp,filkml,sgn,cm,sp); 76 63 else 77 iret=Shp2Kmlx(filshp,filkml, 78 sgn); 79 if (verbose) printf(" iret=%d\n",iret); 64 iret=Shp2Kmlx(filshp,filkml,sgn); 80 65 81 66 /*Write data: */ … … 91 76 } 92 77 93 void Shp2KmlUsage(void) 94 { 78 void Shp2KmlUsage(void){ 95 79 _printf_(true,"Shp2Kml - shp to kml file conversion module:\n"); 96 80 _printf_(true,"\n"); … … 115 99 _printf_(true,"\n"); 116 100 } 117 -
TabularUnified issm/trunk-jpl/src/modules/Xy2ll/Xy2ll.cpp ¶
r11933 r12049 12 12 int nx,ny,ncoord; 13 13 int sgn; 14 15 14 Options* options=NULL; 16 15 double cm=0.,sp=0.; … … 25 24 /*checks on arguments on the matlab side: */ 26 25 if (nlhs > NLHS) { 27 Xy2llUsage(); 28 _error_("Xy2ll usage error"); 26 Xy2llUsage(); _error_("Xy2ll usage error"); 29 27 } 30 28 if (nrhs < NRHS) { 31 Xy2llUsage(); 32 _error_("Xy2ll usage error"); 29 Xy2llUsage(); _error_("Xy2ll usage error"); 33 30 } 34 31 35 32 /*Input datasets: */ 36 if (verbose) printf("Fetching inputs:\n");37 33 FetchData(&x,&nx,X_IN); 38 if (verbose)39 if (nx == 1) printf(" x=%g\n",x[0]);40 else printf(" x=[%d values]\n",nx);41 // for (i=0; i<nx; i++) printf(" x[%d]=%g\n",i,x[i]);42 34 FetchData(&y,&ny,Y_IN); 43 if (verbose)44 if (ny == 1) printf(" y=%g\n",y[0]);45 else printf(" y=[%d values]\n",ny);46 // for (i=0; i<ny; i++) printf(" y[%d]=%g\n",i,y[i]);47 35 FetchData(&sgn,SGN_IN); 48 if (verbose) printf(" sgn=%d\n",sgn);36 FetchData(&options,NRHS,nrhs,prhs); 49 37 50 if (verbose) printf("Parsing options:\n");51 options=new Options(NRHS,nrhs,prhs);52 if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();53 38 /* defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified */ 54 39 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { … … 60 45 61 46 /*some checks*/ 62 if (verbose) printf("Checking inputs:\n");63 64 47 if (nx != ny) _error_("Must have same number of x[%d] and y[%d] coordinates.",nx,ny); 65 48 else ncoord=nx; … … 68 51 if (sp < 0. || sp > 90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp); 69 52 70 lat=(double *)xmalloc(ncoord*sizeof(double));71 lon=(double *)xmalloc(ncoord*sizeof(double));53 lat=(double*)mxMalloc(ncoord*sizeof(double)); 54 lon=(double*)mxMalloc(ncoord*sizeof(double)); 72 55 73 56 /* Run core computations: */ 74 57 if (verbose) printf("Calling core:\n"); 75 58 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 76 iret=Xy2llx(lat,lon, 77 x,y,ncoord, 78 sgn,cm,sp); 59 iret=Xy2llx(lat,lon,x,y,ncoord,sgn,cm,sp); 79 60 else 80 iret=Xy2llx(lat,lon, 81 x,y,ncoord, 82 sgn); 83 if (verbose) printf(" iret=%d\n",iret); 61 iret=Xy2llx(lat,lon,x,y,ncoord,sgn); 84 62 85 63 /*Write data: */ … … 94 72 } 95 73 96 void Xy2llUsage(void) 97 { 74 void Xy2llUsage(void){ 98 75 _printf_(true,"Xy2ll - x/y to lat/long coordinate transformation module:\n"); 99 76 _printf_(true,"\n");
Note:
See TracChangeset
for help on using the changeset viewer.