Changeset 13267


Ignore:
Timestamp:
09/05/12 13:55:27 (13 years ago)
Author:
Mathieu Morlighem
Message:

NEW: enable Double option (not merged with DoubleArray options)

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Container/Observations.cpp

    r13261 r13267  
    4242        int          i,j,maxdepth,level,counter,index;
    4343        int          xi,yi;
    44         IssmPDouble       xmin,xmax,ymin,ymax;
    45         IssmPDouble       offset,minlength,minspacing,mintrimming,maxtrimming;
     44        IssmPDouble  xmin,xmax,ymin,ymax;
     45        IssmPDouble  offset,minlength,minspacing,mintrimming,maxtrimming;
    4646        Observation *observation = NULL;
    4747
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r13222 r13267  
    888888        switch(code){
    889889                case 3: {//IssmDouble
    890                                         GenericOption<IssmDouble*>* option;
    891                                         IssmDouble *value = NULL;
    892                                         value=xNew<IssmDouble>(1);
    893                                         FetchData(value,index+1);
    894                                         option = new GenericOption<IssmDouble*>();
     890                                        GenericOption<IssmDouble>* option;
     891                                        IssmPDouble value;
     892                                        FetchData(&value,index+1);
     893                                        option = new GenericOption<IssmDouble>();
    895894                                        option->value = value;
    896895                                        option->name  = name;
  • issm/trunk-jpl/src/c/classes/objects/Options/Option.h

    r13216 r13267  
    2323                ~Option(){};
    2424                /*}}}*/
    25                
    2625                /*Object virtual functions definitions:{{{*/
    27                 virtual void  Echo()=0;
    28                 virtual void  DeepEcho()=0;
    29                 virtual void  DeepEcho(char* indent)=0;
    30                 int   Id(){_error_("Not implemented yet");};
    31                 int   MyRank(){_error_("Not implemented yet");};
    32                 int   ObjectEnum(){return OptionEnum;};
    33                 Object* copy(){_error_("Not implemented yet");};
     26                virtual void  Echo()= 0;
     27                virtual void  DeepEcho()= 0;
     28                virtual void  DeepEcho(char  *indent)=0;
     29                int           Id(){_error_("Not implemented yet"); };
     30                int           MyRank(){_error_("Not implemented yet"); };
     31                int           ObjectEnum(){return OptionEnum;              };
     32                Object       *copy(){_error_("Not implemented yet"); };
    3433                /*}}}*/
    3534
  • issm/trunk-jpl/src/c/matlab/io/OptionParse.cpp

    r13216 r13267  
    1515#include "./matlabio.h"
    1616
    17 GenericOption<double*>* OptionDoubleParse( char* name, const mxArray* prhs[]){ /*{{{*/
     17GenericOption<double>* OptionDoubleParse( char* name, const mxArray* prhs[]){ /*{{{*/
     18
     19        GenericOption<double> *odouble = NULL;
     20
     21        /*check and parse the name  */
     22        odouble=new GenericOption<double>();
     23        odouble->name =xNew<char>(strlen(name)+1);
     24        memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
     25        FetchData(&odouble->value,prhs[0]);
     26        odouble->numel=1;
     27        odouble->ndims=1;
     28        odouble->size=NULL;
     29
     30        return(odouble);
     31}/*}}}*/
     32GenericOption<double*>* OptionDoubleArrayParse( char* name, const mxArray* prhs[]){ /*{{{*/
    1833
    1934        GenericOption<double*> *odouble = NULL;
     
    160175Option* OptionParse(char* name, const mxArray* prhs[]){ /*{{{*/
    161176
    162         Option *option = NULL;
    163         mxArray       *lhs[1];
     177        Option  *option = NULL;
     178        mxArray *lhs[1];
    164179
    165180        /*parse the value according to the matlab data type  */
    166         if     (mxIsClass(prhs[0],"double"))  option=(Option*)OptionDoubleParse(name,prhs);
    167         else if(mxIsClass(prhs[0],"logical")) option=(Option*)OptionLogicalParse(name,prhs);
    168         else if(mxIsClass(prhs[0],"char"))    option=(Option*)OptionCharParse(name,prhs);
    169         else if(mxIsClass(prhs[0],"struct"))  option=(Option*)OptionStructParse(name,prhs);
    170         else if(mxIsClass(prhs[0],"cell"))    option=(Option*)OptionCellParse(name,prhs);
     181        if     (mxIsClass(prhs[0],"double")  && (mxGetNumberOfElements(prhs[0])==1))
     182         option=(Option*)OptionDoubleParse(name,prhs);
     183        else if(mxIsClass(prhs[0],"double")  && (mxGetNumberOfElements(prhs[0])!=1))
     184         option=(Option*)OptionDoubleArrayParse(name,prhs);
     185        else if(mxIsClass(prhs[0],"logical"))
     186         option=(Option*)OptionLogicalParse(name,prhs);
     187        else if(mxIsClass(prhs[0],"char"))
     188         option=(Option*)OptionCharParse(name,prhs);
     189        else if(mxIsClass(prhs[0],"struct"))
     190         option=(Option*)OptionStructParse(name,prhs);
     191        else if(mxIsClass(prhs[0],"cell"))
     192         option=(Option*)OptionCellParse(name,prhs);
    171193        else {
    172194                _pprintLine_("  Converting value of option \"" << name << "\" from unrecognized class \"" << mxGetClassName(prhs[0]) << "\" to class \"" << "struct" << "\".");
  • issm/trunk-jpl/src/c/matlab/io/matlabio.h

    r13242 r13267  
    5151
    5252Option* OptionParse(char* name, const mxArray* prhs[]);
    53 GenericOption<double*>*   OptionDoubleParse( char* name, const mxArray* prhs[]);
     53GenericOption<double>*    OptionDoubleParse( char* name, const mxArray* prhs[]);
     54GenericOption<double*>*   OptionDoubleArrayParse( char* name, const mxArray* prhs[]);
    5455GenericOption<bool*>*     OptionLogicalParse( char* name, const mxArray* prhs[]);
    5556GenericOption<char*>*     OptionCharParse( char* name, const mxArray* prhs[]);
  • issm/trunk-jpl/src/c/solutions/kriging.cpp

    r13056 r13267  
    2323
    2424        /*Input*/
    25         int      ninterp,nobs;
    26         IssmDouble  *x        = NULL;
    27         IssmDouble  *y        = NULL;
    28         IssmDouble  *data     = NULL;
    29         IssmDouble  *x_interp = NULL;
    30         IssmDouble  *y_interp = NULL;
    31         Options *options  = NULL;
     25        int         ninterp,nobs;
     26        IssmDouble *x        = NULL;
     27        IssmDouble *y        = NULL;
     28        IssmDouble *data     = NULL;
     29        IssmDouble *x_interp = NULL;
     30        IssmDouble *y_interp = NULL;
     31        Options    *options  = NULL;
    3232
    3333        /*Output*/
Note: See TracChangeset for help on using the changeset viewer.