Changeset 13375


Ignore:
Timestamp:
09/14/12 15:36:14 (13 years ago)
Author:
Mathieu Morlighem
Message:

NEW: enable to Fetch matlab single vectors

Location:
issm/trunk-jpl/src/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/matlab/io/FetchMatlabData.cpp

    r13353 r13375  
    7272                outmatrix=NULL;
    7373        }
    74         else if (mxIsClass(dataref,"double") ){
     74        else if( mxIsClass(dataref,"double") ||
     75                                mxIsClass(dataref,"single") ||
     76                                mxIsClass(dataref,"int16") ||
     77                                mxIsClass(dataref,"int8") ||
     78                                mxIsClass(dataref,"uint8")){
    7579
    7680                /*Check dataref is not pointing to NaN: */
     
    8286                }
    8387                else{
    84 
     88                        if(!mxIsClass(dataref,"double") && !mxIsClass(dataref,"single")){
     89                                _printLine_("Warning: converting matlab data from '" << mxGetClassName(dataref) << "' to 'double'");
     90                        }
    8591                        /*Convert matlab n-dim array to double* matrix: */
    8692                        MatlabNArrayToNArray(&outmatrix,&outmatrix_numel,&outmatrix_ndims,&outmatrix_size,dataref);
     
    114120                outmatrix=NULL;
    115121        }
    116         else if (mxIsClass(dataref,"double") ){
     122        else if( mxIsClass(dataref,"double") ||
     123                                mxIsClass(dataref,"single") ||
     124                                mxIsClass(dataref,"int16") ||
     125                                mxIsClass(dataref,"int8") ||
     126                                mxIsClass(dataref,"uint8")){
    117127
    118128                /*Check dataref is not pointing to NaN: */
     
    123133                }
    124134                else{
    125 
     135                        if(!mxIsClass(dataref,"double") && !mxIsClass(dataref,"single")){
     136                                _printLine_("Warning: converting matlab data from '" << mxGetClassName(dataref) << "' to 'double'");
     137                        }
    126138                        /*Convert matlab matrix to double* matrix: */
    127139                        MatlabMatrixToDoubleMatrix(&doublematrix,&outmatrix_rows,&outmatrix_cols,dataref);
  • issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp

    r13364 r13375  
    2525void SolverxSeq(SeqVec<IssmDouble>** puf,SeqMat<IssmDouble>* Kff, SeqVec<IssmDouble>* pf, Parameters* parameters){/*{{{*/
    2626
    27         #ifdef _HAVE_GSL_
     27#ifdef _HAVE_GSL_
    2828        /*Intermediary: */
    2929        int M,N,N2,s;
     
    3535        if(N!=N2)_error_("Right hand side vector of size " << N2 << ", when matrix is of size " << M << "-" << N << " !");
    3636        if(M!=N)_error_("Stiffness matrix should be square!");
    37         IssmDouble *x  = xNew<IssmDouble>(N);
     37        IssmDouble *x  = xNew<IssmDouble>(N);
     38
    3839#ifdef _HAVE_ADOLC_
    3940        SolverxSeq(x,Kff->matrix,pf->vector,N,parameters);
     
    4142        SolverxSeq(x,Kff->matrix,pf->vector,N);
    4243#endif
     44
    4345        uf=new SeqVec<IssmDouble>(x,N);
    4446        xDelete(x);
     
    4749        *puf=uf;
    4850
    49         #else
    50                 _error_("GSL support not compiled in!");
    51         #endif
     51#else
     52        _error_("GSL support not compiled in!");
     53#endif
    5254
    5355}/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.