Changeset 11716
- Timestamp:
- 03/14/12 17:09:20 (13 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/io/Matlab/FetchMatlabData.cpp
r11695 r11716 286 286 /*Check dataref is not pointing to NaN: */ 287 287 if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetM(dataref)==1) && (mxGetN(dataref)==1) ){ 288 outmatrix= NULL;288 outmatrix=new Matrix(0,0); 289 289 } 290 290 else{ … … 434 434 if(mxIsEmpty(dataref)){ 435 435 /*Nothing to pick up. Just initialize matrix pointer to NULL: */ 436 vector= NULL;436 vector=new Vector(0); 437 437 } 438 438 else if (mxIsClass(dataref,"double") ){ -
issm/trunk-jpl/src/c/io/Matlab/WriteMatlabData.cpp
r11695 r11716 114 114 115 115 if(vector){ 116 117 116 /*call toolkit routine: */ 118 117 dataref=vector->ToMatlabVector(); -
issm/trunk-jpl/src/c/modules/Solverx/Solverx.cpp
r11715 r11716 16 16 void Solverx(Vector** puf, Matrix* Kff, Vector* pf, Vector* uf0,Vector* df, Parameters* parameters){ 17 17 18 /*output: */19 Vector* uf=NULL;20 uf=new Vector();21 22 18 /*Intermediary: */ 23 19 int analysis_type; 20 21 /*output: */ 22 Vector *uf=new Vector(); 23 24 /*In debugging mode, check that stiffness matrix and load vectors are not NULL (they can be empty)*/ 25 _assert_(Kff); 26 _assert_(pf); 24 27 25 28 #ifdef _HAVE_PETSC_ 26 29 Vec uf0_vector = NULL; 27 30 Vec df_vector = NULL; 28 if(uf0) uf0_vector =uf0->vector;29 if(df) df_vector = df->vector;31 if(uf0) uf0_vector = uf0->vector; 32 if(df) df_vector = df->vector; 30 33 31 34 /*In serial mode, the Petsc Options database has not been initialized properly: */ … … 37 40 SolverxPetsc(&uf->vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters); 38 41 if(uf->vector == NULL){ 39 uf->M ;42 uf->M = 0; 40 43 } 41 44 else{ -
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.