Changeset 13372
- Timestamp:
- 09/14/12 11:16:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/python/io/FetchPythonData.cpp
r13368 r13372 63 63 64 64 /*output: */ 65 double* dmatrix=NULL; 65 66 double* matrix=NULL; 66 67 int M,N; 67 int ndim;68 int i,ndim; 68 69 npy_intp* dims=NULL; 69 70 … … 75 76 76 77 /*retrieve internal value: */ 77 matrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 78 dmatrix=(double*)PyArray_DATA((PyArrayObject*)py_matrix); 79 80 /*copy matrix: */ 81 matrix=xNew<double>(M*N); 82 for(i=0;i<M*N;i++)matrix[i]=dmatrix[i]; 78 83 79 84 /*output: */ … … 119 124 120 125 /*output: */ 126 double* dvector=NULL; 121 127 double* vector=NULL; 122 128 int M; 123 int ndim;129 int i,ndim; 124 130 npy_intp* dims=NULL; 125 131 … … 131 137 132 138 /*retrieve internal value: */ 133 vector=(double*)PyArray_DATA((PyArrayObject*)py_vector); 139 dvector=(double*)PyArray_DATA((PyArrayObject*)py_vector); 140 141 /*copy vector: */ 142 vector=xNew<double>(M); 143 for(i=0;i<M;i++)vector[i]=dvector[i]; 134 144 135 145 /*output: */ … … 282 292 283 293 /*clean-up and assign output pointer*/ 294 xDelete<char>(contourname); 284 295 *pcontours=contours; 285 296 } … … 294 305 char* string=NULL; 295 306 296 297 307 /*convert to bytes format: */ 298 308 PyUnicode_FSConverter(py_unicode,&py_bytes); … … 312 322 /*extract internal string: */ 313 323 string=PyString_AsString(py_string); 314 315 *pstring=string; 324 325 /*copy string (note strlen does not include trailing NULL): */ 326 *pstring=xNew<char>(strlen(string)+1); 327 memcpy(*pstring,string,(strlen(string)+1)*sizeof(char)); 316 328 } 317 329 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.