Changeset 4205


Ignore:
Timestamp:
06/24/10 16:17:42 (15 years ago)
Author:
Mathieu Morlighem
Message:

Added check so that only column vector are supported

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/toolkits/petsc/patches/MatlabVectorToDoubleVector.cpp

    r1 r4205  
    2828int MatlabVectorToDoubleVector(double** pvector,int* pvector_rows,const mxArray* mxvector){
    2929
    30         int rows, cols;
     30        int rows,cols,size;
    3131        double* mxvector_ptr=NULL;
    3232        int ierr;
     
    5252                cols=mxGetN(mxvector);
    5353                nnz=mxGetNzmax(mxvector);
     54               
     55                /*Check that input is actualy a vector*/
     56                if (cols!=1) ISSMERROR("input vector of size %ix%i should have only one column",rows,cols);
     57
    5458                nz=(int)((double)nnz/(double)rows);
    5559
     
    7882                cols=mxGetN(mxvector);
    7983
     84                /*Check that input is actualy a vector*/
     85                if (cols!=1) ISSMERROR("input vector of size %ix%i should have only one column",rows,cols);
     86
    8087                /*allocate and memcpy*/
    8188                vector=(double*)xmalloc(rows*sizeof(double));
Note: See TracChangeset for help on using the changeset viewer.