- Timestamp:
- 03/14/12 17:09:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/toolkits/petsc/patches/PetscVectorToMatlabVector.cpp
r9320 r11716 27 27 int PetscVectorToMatlabVector(mxArray** pdataref,Vec vector){ 28 28 29 30 int i; 31 int rows; 32 int* idxm=NULL; 33 double* values=NULL; 29 int i; 30 int rows; 31 int *idxm = NULL; 32 double *values = NULL; 34 33 35 34 /*output: */ … … 37 36 38 37 /*Get size of vector: */ 39 VecGetSize(vector,&rows); 38 if(vector){ 39 VecGetSize(vector,&rows); 40 if(rows){ 41 idxm=(int*)xmalloc(rows*sizeof(int)); 42 values=(double*)xmalloc(rows*sizeof(double)); 43 for(i=0;i<rows;i++)idxm[i]=i; 40 44 41 if(rows){ 42 idxm=(int*)xmalloc(rows*sizeof(int)); 43 values=(double*)xmalloc(rows*sizeof(double)); 44 for(i=0;i<rows;i++)idxm[i]=i; 45 46 VecGetValues(vector,rows,idxm,values); 45 VecGetValues(vector,rows,idxm,values); 46 } 47 } 48 else{ 49 rows=0; 47 50 } 48 51 … … 61 64 } 62 65 63 64 66 #endif //#ifdef _SERIAL_ 65
Note:
See TracChangeset
for help on using the changeset viewer.