Changeset 7740


Ignore:
Timestamp:
03/31/11 16:40:45 (14 years ago)
Author:
Mathieu Morlighem
Message:

Use MxIsClass instead of MxIsDouble, MxIsChar, etc...

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

Legend:

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

    r7218 r7740  
    2424
    2525        /*First, check that our reference is a double, otherwise, error out: */
    26         if (mxIsDouble(dataref)){
     26        if (mxIsClass(dataref,"double")){
    2727                       
    2828                /*We need to copy the data pointed by dataref, so that our dataset is not actually a pointer!:*/
     
    6161                outmatrix=NULL;
    6262        }
    63         else if (mxIsDouble(dataref) ){
     63        else if (mxIsClass(dataref,"double") ){
    6464
    6565                /*Check dataref is not pointing to NaN: */
     
    100100                outmatrix=NULL;
    101101        }
    102         else if (mxIsDouble(dataref) ){
     102        else if (mxIsClass(dataref,"double") ){
    103103
    104104                /*Check dataref is not pointing to NaN: */
     
    142142                outmatrix=NULL;
    143143        }
    144         else if (mxIsDouble(dataref) ){
     144        else if (mxIsClass(dataref,"double") ){
    145145
    146146                /*Check dataref is not pointing to NaN: */
     
    177177        int dummy=0;
    178178
    179         if (mxIsDouble(dataref) ){
     179        if (mxIsClass(dataref,"double") ){
    180180
    181181                /*Check dataref is not pointing to NaN: */
     
    209209                outvector=NULL;
    210210        }
    211         else if (mxIsDouble(dataref) ){
     211        else if (mxIsClass(dataref,"double") ){
    212212
    213213                /*Convert matlab vector to double*  vector: */
     
    238238                outvector=NULL;
    239239        }
    240         else if (mxIsDouble(dataref) ){
     240        else if (mxIsClass(dataref,"double") ){
    241241
    242242                /*Convert matlab vector to double*  vector: */
     
    270270                outvector=NULL;
    271271        }
    272         else if (mxIsDouble(dataref) ){
     272        else if (mxIsClass(dataref,"double") ){
    273273
    274274                /*Convert matlab vector to double*  vector: */
     
    302302                outvector=NULL;
    303303        }
    304         else if (mxIsDouble(dataref) ){
     304        else if (mxIsClass(dataref,"double") ){
    305305
    306306                /*Convert matlab vector to double*  vector: */
     
    331331                vector=NULL;
    332332        }
    333         else if (mxIsDouble(dataref) ){
     333        else if (mxIsClass(dataref,"double") ){
    334334
    335335                /*Convert matlab vector to petsc vector: */
     
    352352
    353353        /*Ok, the string should be coming directly from the matlab workspace: */
    354         if (!mxIsChar(dataref)){
     354        if (!mxIsClass(dataref,"char")){
    355355                _error_("input data_type is not a string!");
    356356        }
     
    373373        double scalar;
    374374
    375         if (!mxIsDouble(dataref)){
     375        if (!mxIsClass(dataref,"double")){
    376376                _error_("input data_type is not a double!");
    377377        }
     
    390390        int integer;
    391391
    392         if (!mxIsDouble(dataref)){
     392        if (!mxIsClass(dataref,"double")){
    393393                _error_("input data_type is not a scalar!");
    394394        }
  • issm/trunk/src/c/io/FetchParams.cpp

    r6412 r7740  
    5858               
    5959                /*Check type of field: */
    60                 if (mxIsDouble(pfield)){
     60                if (mxIsClass(pfield,"double")){
    6161                       
    6262                        /*could be  DOUBLE, DOUBLEVEC or DOUBLEMAT, depends on dimensions: */
     
    100100
    101101                }
    102                 else if (mxIsChar(pfield)){
     102                else if (mxIsClass(pfield,"char")){
    103103                        /* we have a string parameter:*/
    104104                       
     
    115115                        xfree((void**)&string);
    116116                }
    117                 else if (mxIsCell(pfield)){
     117                else if (mxIsClass(pfield,"cell")){
    118118
    119119                        /*This can be a string array, or a matrix array. Check the first
    120120                         *element type to decide: */
    121121                        pfield2=mxGetCell(pfield,0);
    122                         if (mxIsChar(pfield2)){
     122                        if (mxIsClass(pfield2,"char")){
    123123                               
    124124                                /*string array: */
  • issm/trunk/src/c/io/OptionParse.cpp

    r7739 r7740  
    2222
    2323        /*parse the value according to the matlab data type  */
    24         if      (mxIsDouble(prhs[0]))
    25                 oobject=(Option*)OptionDoubleParse(name,prhs);
    26         else if (mxIsLogical(prhs[0]))
    27                 oobject=(Option*)OptionLogicalParse(name,prhs);
    28         else if (mxIsChar(prhs[0]))
    29                 oobject=(Option*)OptionCharParse(name,prhs);
    30         else if (mxIsStruct(prhs[0]))
    31                 oobject=(Option*)OptionStructParse(name,prhs);
    32         else if (mxIsCell(prhs[0]))
    33                 oobject=(Option*)OptionCellParse(name,prhs);
     24        if     (mxIsClass(prhs[0],"double"))  oobject=(Option*)OptionDoubleParse(name,prhs);
     25        else if(mxIsClass(prhs[0],"logical")) oobject=(Option*)OptionLogicalParse(name,prhs);
     26        else if(mxIsClass(prhs[0],"char"))    oobject=(Option*)OptionCharParse(name,prhs);
     27        else if(mxIsClass(prhs[0],"struct"))  oobject=(Option*)OptionStructParse(name,prhs);
     28        else if(mxIsClass(prhs[0],"cell"))    oobject=(Option*)OptionCellParse(name,prhs);
    3429        else {
    3530                _printf_(true,"  Converting value of option \"%s\" from unrecognized class \"%s\" to class \"%s\".\n",name,mxGetClassName(prhs[0]),"struct");
     
    5550
    5651        /*check and parse the value  */
    57         if (!mxIsDouble(prhs[0])){
     52        if (!mxIsClass(prhs[0],"double")){
    5853                _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",odouble->name,"double",odouble->name,mxGetClassName(prhs[0]));
    5954        }
     
    8681
    8782        /*check and parse the value  */
    88         if (!mxIsLogical(prhs[0])){
     83        if (!mxIsClass(prhs[0],"logical")){
    8984                _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ological->name,"logical",ological->name,mxGetClassName(prhs[0]));
    9085        }
     
    121116
    122117        /*check and parse the value  */
    123         if (!mxIsChar(prhs[0])){
     118        if (!mxIsClass(prhs[0],"char")){
    124119                _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ochar->name,"char",ochar->name,mxGetClassName(prhs[0]));
    125120        }
     
    156151
    157152        /*check and parse the value  */
    158         if (!mxIsStruct(prhs[0])){
     153        if (!mxIsClass(prhs[0],"struct")){
    159154                _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ostruct->name,"struct",ostruct->name,mxGetClassName(prhs[0]));
    160155        }
     
    203198
    204199        /*check and parse the value  */
    205         if (!mxIsCell(prhs[0])){
     200        if (!mxIsClass(prhs[0],"cell")){
    206201                _error_("Value of option \"%s\" must be class \"%s\", not class \"%s\".",ocell->name,"cell",ocell->name,mxGetClassName(prhs[0]));
    207202        }
Note: See TracChangeset for help on using the changeset viewer.