- Timestamp:
- 10/31/19 12:37:11 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/wrappers/javascript/io/FetchJavascriptData.cpp
r24301 r24304 15 15 /*FUNCTION FetchData(char** pstring, char* string){{{*/ 16 16 void FetchData(char** pstring, char* stringin){ 17 18 char* string=xNew<char>(strlen(stringin)+1); 19 xMemCpy<char>(string,stringin,strlen(stringin)+1);17 char* string=NULL; 18 19 string=xNew<char>(strlen(stringin)+1); xMemCpy<char>(string,stringin,strlen(stringin)+1); 20 20 21 21 *pstring=string; 22 22 } 23 23 /*}}}*/ 24 /*FUNCTION FetchData(int* pinteger,int integer){{{*/ 25 void FetchData(int* pinteger,int integer){ 26 27 *pinteger = integer; 28 } 29 /*}}}*/ 30 /*FUNCTION FetchData(double* pscalar,double scalar){{{*/ 31 void FetchData(double* pscalar,double scalar){ 32 33 *pscalar = scalar; 24 /*FUNCTION FetchData(int* pinteger, int integer){{{*/ 25 void FetchData(int* pinteger, int integer){ 26 *pinteger=integer; 27 } 28 /*}}}*/ 29 /*FUNCTION FetchData(double* pscalar, double scalar){{{*/ 30 void FetchData(double* pscalar, double scalar){ 31 *pscalar=scalar; 34 32 } 35 33 /*}}}*/ 36 34 /*FUNCTION FetchData(double **pvector, double* vectorin, int nods){{{*/ 37 35 void FetchData(double** pvector, double* vectorin, int nods){ 38 39 36 double* vector=NULL; 40 37 … … 46 43 /*FUNCTION FetchData(double **pvector, int* pnods, double* vectorin, int nods){{{*/ 47 44 void FetchData(double** pvector, int* pnods, double* vectorin, int nods){ 48 49 45 double* vector=NULL; 50 46 … … 57 53 /*FUNCTION FetchData(double **pmatrix, int* pM, int* pN, int* matrix, int M, int N){{{*/ 58 54 void FetchData(double **pmatrix, int* pM, int* pN, int* matrixin, int M, int N){ 59 60 55 double* outmatrix=NULL; 61 int outmatrix_rows, outmatrix_cols;56 int outmatrix_rows, outmatrix_cols; 62 57 63 58 if(M == 0 || N == 0){ … … 71 66 outmatrix_cols=N; 72 67 outmatrix=xNew<IssmPDouble>(M*N); 73 for(int i=0;i<M*N;i++) outmatrix[i]=(IssmPDouble)matrixin[i];68 for(int i=0;i<M*N;i++){outmatrix[i]=(IssmPDouble)matrixin[i];} 74 69 } 75 70 76 71 /*Assign output pointers:*/ 77 72 *pmatrix=outmatrix; 78 if (pM) *pM=outmatrix_rows;79 if (pN) *pN=outmatrix_cols;73 if (pM){*pM=outmatrix_rows;} 74 if (pN){*pN=outmatrix_cols;} 80 75 } 81 76 /*}}}*/ 82 77 /*FUNCTION FetchData(double **pmatrix, int* pM, int* pN, double* matrix, int M, int N){{{*/ 83 78 void FetchData(double **pmatrix, int* pM, int* pN, double* matrixin, int M, int N){ 84 85 79 double* outmatrix=NULL; 86 int outmatrix_rows, outmatrix_cols;80 int outmatrix_rows, outmatrix_cols; 87 81 88 82 if(M == 0 || N == 0){ … … 100 94 /*Assign output pointers:*/ 101 95 *pmatrix=outmatrix; 102 if (pM) *pM=outmatrix_rows;103 if (pN) *pN=outmatrix_cols;96 if (pM){*pM=outmatrix_rows;} 97 if (pN){*pN=outmatrix_cols;} 104 98 } 105 99 /*}}}*/ 106 100 /*FUNCTION FetchData(int **pmatrix, int* pM, int* pN, int* matrix, int M, int N){{{*/ 107 101 void FetchData(int **pmatrix, int* pM, int* pN, int* matrixin, int M, int N){ 108 109 102 int* outmatrix=NULL; 110 int outmatrix_rows, outmatrix_cols;103 int outmatrix_rows, outmatrix_cols; 111 104 112 105 if(M == 0 || N == 0){ … … 124 117 /*Assign output pointers:*/ 125 118 *pmatrix=outmatrix; 126 if (pM) *pM=outmatrix_rows;127 if (pN) *pN=outmatrix_cols;119 if (pM){*pM=outmatrix_rows;} 120 if (pN){*pN=outmatrix_cols;} 128 121 } 129 122 /*}}}*/ 130 123 /*ISSM objects*/ 131 /*FUNCTION FetchData(Contours** pcontours,double* x, double* y, int nods){{{*/ 132 void FetchData(Contours** pcontours,double* x, double* y, int nods){ 133 134 int numcontours,index,test1,test2; 124 /*FUNCTION FetchData(Contours** pcontours, double* x, double* y, int nods){{{*/ 125 void FetchData(Contours** pcontours, double* x, double* y, int nods){ 126 int numcontours, index, test1, test2; 135 127 char *contourname = NULL; 136 128 Contours *contours = NULL; … … 141 133 142 134 if (nods){ 143 144 135 contouri=new Contour<double>(); 145 136 contouri->nods=nods; 146 137 contouri->x=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(contouri->x,x,nods); 147 138 contouri->y=xNew<IssmPDouble>(nods); xMemCpy<IssmPDouble>(contouri->y,y,nods); 148 149 139 contours->AddObject(contouri); 150 140 } … … 157 147 158 148 /*Initialize output*/ 159 BamgGeom* bamggeom =new BamgGeom();149 BamgGeom* bamggeom=new BamgGeom(); 160 150 161 151 /*Fetch all fields*/ … … 169 159 170 160 /*Assign output pointers:*/ 171 *pbamggeom =bamggeom;161 *pbamggeom=bamggeom; 172 162 } 173 163 /*}}}*/ … … 176 166 177 167 /*Initialize output*/ 178 BamgMesh* bamgmesh =new BamgMesh();168 BamgMesh* bamgmesh=new BamgMesh(); 179 169 180 170 /*Fetch all fields*/ … … 189 179 190 180 /*Assign output pointers:*/ 191 *pbamgmesh =bamgmesh;181 *pbamgmesh=bamgmesh; 192 182 } 193 183 /*}}}*/ … … 232 222 233 223 /*Assign output pointers:*/ 234 *pbamgopts =bamgopts;235 } 236 /*}}}*/ 237 /*FUNCTION FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){{{*/238 void FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){224 *pbamgopts=bamgopts; 225 } 226 /*}}}*/ 227 /*FUNCTION FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){{{*/ 228 void FetchData(Options** poptions, int NRHS, int nrhs, const char* optionname, double optionvalue){ 239 229 240 230 /*Initialize output*/ … … 242 232 243 233 /*check and parse the name */ 244 GenericOption<double> *odouble =new GenericOption<double>();234 GenericOption<double> *odouble=new GenericOption<double>(); 245 235 odouble=new GenericOption<double>(); 246 odouble->name 236 odouble->name=xNew<char>(strlen(optionname)+1); 247 237 memcpy(odouble->name,optionname,(strlen(optionname)+1)*sizeof(char)); 248 238 odouble->value=optionvalue;
Note:
See TracChangeset
for help on using the changeset viewer.