Changeset 7188


Ignore:
Timestamp:
01/26/11 14:57:01 (14 years ago)
Author:
Mathieu Morlighem
Message:

Changed philosophy here: if a matlab empty matlab sparse matrix is to be converted to a petsc Mat, Create an empty Mat object instead of returning a NULL pointer

Location:
issm/trunk/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/io/FetchData.cpp

    r6412 r7188  
    9595        int dummy=0;
    9696
    97         if(mxIsEmpty(dataref) ){
    98                 /*Nothing to pick up. Just initialize matrix pointer to NULL: */
    99                 outmatrix=NULL;
    100         }
    101         else if (mxIsDouble(dataref) ){
     97        if (mxIsDouble(dataref) ){
    10298
    10399                /*Check dataref is not pointing to NaN: */
  • issm/trunk/src/c/modules/Solverx/Solverx.cpp

    r7187 r7188  
    4040
    4141        /*First, check that f-set is not NULL, ie model is fully constrained: */
     42        _assert_(Kff);
    4243        MatGetSize(Kff,&global_m,&global_n); _assert_(global_m==global_m);
    4344        if(!global_n){
  • issm/trunk/src/c/toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp

    r3595 r7188  
    5454                cols=mxGetN(mxmatrix);
    5555                nnz=mxGetNzmax(mxmatrix);
    56                 nz=(int)((double)nnz/(double)rows);
     56                if(rows){
     57                        nz=(int)((double)nnz/(double)rows);
     58                }
     59                else{
     60                        nz=0;
     61                }
    5762
    5863                ierr=MatCreateSeqAIJ(PETSC_COMM_SELF,rows,cols,nz,PETSC_NULL,&matrix);CHKERRQ(ierr);
Note: See TracChangeset for help on using the changeset viewer.