Changeset 4059


Ignore:
Timestamp:
06/21/10 07:30:17 (15 years ago)
Author:
Eric.Larour
Message:

Start diagnostic.m rewrite.
New SetValues routine in Param objects.

Location:
issm/trunk/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk/src/c/DataSet/DataSet.h

    r4055 r4059  
    158158                int   FindParam(Vec* pvec,int enum_type);
    159159                int   FindParam(Mat* pmat,int enum_type);
     160               
     161                void  SetParam(bool boolean,int enum_type);
     162                void  SetParam(int integer,int enum_type);
     163                void  SetParam(double scalar, int enum_type);
     164                void  SetParam(char* string,int enum_type);
     165                void  SetParam(char** stringarray,int M,int enum_type);
     166                void  SetParam(double* doublearray,int M,int enum_type);
     167                void  SetParam(double* doublearray,int M,int N,int enum_type);
     168                void  SetParam(Vec vec,int enum_type);
     169                void  SetParam(Mat mat,int enum_type);
     170
    160171                Object* FindParamObject(int enum_type);
    161172                /*}}}*/
  • TabularUnified issm/trunk/src/c/DataSet/Parameters.cpp

    r3775 r4059  
    256256}
    257257/*}}}*/
    258 /*FUNCTION Parameters::FindParamMat* pmat,int enum_type){{{1*/
     258/*FUNCTION Parameters::FindParam(Mat* pmat,int enum_type){{{1*/
    259259int   Parameters::FindParam(Mat* pmat,int enum_type){
    260260       
     
    283283}
    284284/*}}}*/
     285
     286/*FUNCTION Parameters::SetParam(bool boolean,int enum_type);{{{1*/
     287void   Parameters::SetParam(bool boolean,int enum_type){
     288
     289        Param* param=NULL;
     290       
     291        /*first, figure out if the param has already been created: */
     292        param=(Param*)this->FindParamObject(enum_type);
     293
     294        if(param) param->SetValue(boolean); //already exists, just set it.
     295        else this->AddObject(new BoolParam(enum_type,boolean)); //just add the new parameter.
     296}
     297/*}}}*/
     298/*FUNCTION Parameters::SetParam(int integer,int enum_type);{{{1*/
     299void   Parameters::SetParam(int integer,int enum_type){
     300
     301        Param* param=NULL;
     302       
     303        /*first, figure out if the param has already been created: */
     304        param=(Param*)this->FindParamObject(enum_type);
     305
     306        if(param) param->SetValue(integer); //already exists, just set it.
     307        else this->AddObject(new IntParam(enum_type,integer)); //just add the new parameter.
     308}
     309/*}}}*/
     310/*FUNCTION Parameters::SetParam(double scalar,int enum_type);{{{1*/
     311void   Parameters::SetParam(double scalar,int enum_type){
     312
     313        Param* param=NULL;
     314       
     315        /*first, figure out if the param has already been created: */
     316        param=(Param*)this->FindParamObject(enum_type);
     317
     318        if(param) param->SetValue(scalar); //already exists, just set it.
     319        else this->AddObject(new DoubleParam(enum_type,scalar)); //just add the new parameter.
     320}
     321/*}}}*/
     322/*FUNCTION Parameters::SetParam(char* string,int enum_type);{{{1*/
     323void   Parameters::SetParam(char* string,int enum_type){
     324
     325        Param* param=NULL;
     326       
     327        /*first, figure out if the param has already been created: */
     328        param=(Param*)this->FindParamObject(enum_type);
     329
     330        if(param) param->SetValue(string); //already exists, just set it.
     331        else this->AddObject(new StringParam(enum_type,string)); //just add the new parameter.
     332}
     333/*}}}*/
     334/*FUNCTION Parameters::SetParam(char** stringarray,int M, int enum_type);{{{1*/
     335void   Parameters::SetParam(char** stringarray,int M, int enum_type){
     336
     337        Param* param=NULL;
     338       
     339        /*first, figure out if the param has already been created: */
     340        param=(Param*)this->FindParamObject(enum_type);
     341
     342        if(param) param->SetValue(stringarray,M); //already exists, just set it.
     343        else this->AddObject(new StringArrayParam(enum_type,stringarray,M)); //just add the new parameter.
     344}
     345/*}}}*/
     346/*FUNCTION Parameters::SetParam(double* doublearray,int M,int enum_type);{{{1*/
     347void   Parameters::SetParam(double* doublearray,int M, int enum_type){
     348
     349        Param* param=NULL;
     350       
     351        /*first, figure out if the param has already been created: */
     352        param=(Param*)this->FindParamObject(enum_type);
     353
     354        if(param) param->SetValue(doublearray,M); //already exists, just set it.
     355        else this->AddObject(new DoubleVecParam(enum_type,doublearray,M)); //just add the new parameter.
     356}
     357/*}}}*/
     358/*FUNCTION Parameters::SetParam(double* doublearray,int M,int N, int enum_type);{{{1*/
     359void   Parameters::SetParam(double* doublearray,int M, int N, int enum_type){
     360
     361        Param* param=NULL;
     362       
     363        /*first, figure out if the param has already been created: */
     364        param=(Param*)this->FindParamObject(enum_type);
     365
     366        if(param) param->SetValue(doublearray,M,N); //already exists, just set it.
     367        else this->AddObject(new DoubleMatParam(enum_type,doublearray,M,N)); //just add the new parameter.
     368}
     369/*}}}*/
     370/*FUNCTION Parameters::SetParam(Vec vector,int enum_type);{{{1*/
     371void   Parameters::SetParam(Vec vector,int enum_type){
     372
     373        Param* param=NULL;
     374       
     375        /*first, figure out if the param has already been created: */
     376        param=(Param*)this->FindParamObject(enum_type);
     377
     378        if(param) param->SetValue(vector); //already exists, just set it.
     379        else this->AddObject(new PetscVecParam(enum_type,vector)); //just add the new parameter.
     380}
     381/*}}}*/
     382/*FUNCTION Parameters::SetParam(Mat matrix,int enum_type);{{{1*/
     383void   Parameters::SetParam(Mat matrix,int enum_type){
     384
     385        Param* param=NULL;
     386       
     387        /*first, figure out if the param has already been created: */
     388        param=(Param*)this->FindParamObject(enum_type);
     389
     390        if(param) param->SetValue(matrix); //already exists, just set it.
     391        else this->AddObject(new PetscMatParam(enum_type,matrix)); //just add the new parameter.
     392}
     393/*}}}*/
     394
    285395/*FUNCTION Parameters::FindParamObject{{{1*/
    286396Object* Parameters::FindParamObject(int enum_type){
  • TabularUnified issm/trunk/src/c/objects/FemModel.cpp

    r4055 r4059  
    169169        ys=m_ys[analysis_counter];
    170170
     171        /*Now, plug analysis_counter and analysis_type inside the parameters: */
     172        this->parameters->SetParam(analysis_counter,AnalysisCounterEnum);
     173        this->parameters->SetParam(analysis_type,AnalysisTypeEnum);
    171174}
    172175/*}}}1*/
    173176/*FUNCTION FemModel::SetCurrentAnalysisAlias {{{1*/
    174177void FemModel::SetCurrentAnalysisAlias(int base_analysis_type,int real_analysis_type){
     178
     179        /*Use base_analysis_type to setup the analysis counter, but the analysis type of the FemModel will remain
     180         * real_analysis_type. This means we are using the base_analysis_type settings to run a similar, compatible
     181         * analysis called real_analysis_type: */
     182
    175183        int found=-1;
    176184        for(int i=0;i<nummodels;i++){
     
    182190        if(found!=-1) analysis_counter=found;
    183191        else ISSMERROR("Could not find alias for analysis_type %s in list of FemModel analyses",EnumAsString(base_analysis_type));
    184 }
    185 /*}}}1*/
    186 
     192
     193        /*activate matrices/vectors: */
     194        Rmg=m_Rmg[analysis_counter];
     195        Gmn=m_Gmn[analysis_counter];
     196        nodesets=m_nodesets[analysis_counter];
     197        yg=m_yg[analysis_counter];
     198        ys=m_ys[analysis_counter];
     199
     200        /*Now, plug analysis_counter and real_analysis_type inside the parameters: */
     201        this->parameters->SetParam(analysis_counter,AnalysisCounterEnum);
     202        this->parameters->SetParam(real_analysis_type,AnalysisTypeEnum);
     203}
     204/*}}}1*/
  • TabularUnified issm/trunk/src/c/objects/Params/BoolParam.h

    r4043 r4059  
    7070                void  GetParameterValue(Vec* pvec){ISSMERROR("Bool param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    7171                void  GetParameterValue(Mat* pmat){ISSMERROR("Bool param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     72
     73                void  SetValue(bool boolean){this->value=boolean;}
     74                void  SetValue(int integer){this->value=(bool)integer;}
     75                void  SetValue(double scalar){this->value=(bool)scalar;}
     76                void  SetValue(char* string){ISSMERROR("Bool param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     77                void  SetValue(char** stringarray,int M){ISSMERROR("Bool param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(double* doublearray,int M){ISSMERROR("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(Vec vec){ISSMERROR("Bool param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(Mat mat){ISSMERROR("Bool param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     82               
    7283                char* GetParameterName(void);
    7384                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/DoubleMatParam.cpp

    r3834 r4059  
    230230}
    231231/*}}}*/
     232/*FUNCTION DoubleMatParam::SetValue(double* doublearray,int M,int N);{{{1*/
     233void  DoubleMatParam::SetValue(double* doublearray,int in_M,int in_N){
     234
     235        /*avoid leak: */
     236        xfree((void**)&this->value);
     237
     238        this->value=(double*)xmalloc(in_M*in_N*sizeof(double));
     239        memcpy(this->value,doublearray,in_M*in_N*sizeof(double));
     240
     241        this->M=in_M;
     242        this->N=in_N;
     243}
     244/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Params/DoubleMatParam.h

    r4043 r4059  
    7474                void  GetParameterValue(Vec* pvec){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    7575                void  GetParameterValue(Mat* pmat){ISSMERROR("DoubleMat param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     76
     77                void  SetValue(bool boolean){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(int integer){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(double scalar){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(char* string){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(char** stringarray,int M){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     82                void  SetValue(double* doublearray,int M){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a double vec array",enum_type,EnumAsString(enum_type));}
     83                void  SetValue(double* doublearray,int M,int N);
     84                void  SetValue(Vec vec){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     85                void  SetValue(Mat mat){ISSMERROR("DoubleMat param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     86
    7687                char* GetParameterName(void);
    7788                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/DoubleParam.h

    r4043 r4059  
    7272                void  GetParameterValue(Vec* pvec){ISSMERROR("Double param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    7373                void  GetParameterValue(Mat* pmat){ISSMERROR("Double param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     74
     75                void  SetValue(bool boolean){this->value=(double)boolean;}
     76                void  SetValue(int integer){this->value=(double)integer;}
     77                void  SetValue(double scalar){this->value=(double)scalar;}
     78                void  SetValue(char* string){ISSMERROR("Double param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(char** stringarray,int M){ISSMERROR("Double param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(double* doublearray,int M){ISSMERROR("Double param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("Double param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     82                void  SetValue(Vec vec){ISSMERROR("Double param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     83                void  SetValue(Mat mat){ISSMERROR("Double param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     84
    7485                char* GetParameterName(void);
    7586                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/DoubleVecParam.cpp

    r4050 r4059  
    240240}
    241241/*}}}*/
     242/*FUNCTION DoubleVecParam::SetValue(double* doublearray,int M);{{{1*/
     243void  DoubleVecParam::SetValue(double* doublearray,int in_M){
     244
     245        /*avoid leak: */
     246        xfree((void**)&this->values);
     247
     248        this->values=(double*)xmalloc(in_M*sizeof(double));
     249        memcpy(this->values,doublearray,in_M*sizeof(double));
     250
     251        this->M=in_M;
     252}
     253/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Params/DoubleVecParam.h

    r4050 r4059  
    7171                void  GetParameterValue(Vec* pvec){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    7272                void  GetParameterValue(Mat* pmat){ISSMERROR("DoubleVec param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     73
     74                void  SetValue(bool boolean){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
     75                void  SetValue(int integer){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double scalar){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
     77                void  SetValue(char* string){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(char** stringarray,int M){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(double* doublearray,int M);
     80                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a double mat array",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(Vec vec){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     82                void  SetValue(Mat mat){ISSMERROR("DoubleVec param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     83
    7384                char* GetParameterName(void);
    7485                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/IntParam.h

    r4043 r4059  
    7171                void  GetParameterValue(Vec* pvec){ISSMERROR("Int param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    7272                void  GetParameterValue(Mat* pmat){ISSMERROR("Int param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     73
     74                void  SetValue(bool boolean){this->value=(int)boolean;}
     75                void  SetValue(int integer){this->value=integer;}
     76                void  SetValue(double scalar){this->value=(int)scalar;}
     77                void  SetValue(char* string){ISSMERROR("Int param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(char** stringarray,int M){ISSMERROR("Int param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(double* doublearray,int M){ISSMERROR("Int param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("Int param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(Vec vec){ISSMERROR("Int param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     82                void  SetValue(Mat mat){ISSMERROR("Int param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     83
    7384                char* GetParameterName(void);
    7485                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/Param.h

    r3715 r4059  
    4141                virtual void  GetParameterValue(Vec* pvec)=0;
    4242                virtual void  GetParameterValue(Mat* pmat)=0;
     43               
     44                virtual void  SetValue(bool boolean)=0;
     45                virtual void  SetValue(int integer)=0;
     46                virtual void  SetValue(double scalar)=0;
     47                virtual void  SetValue(char* string)=0;
     48                virtual void  SetValue(char** stringarray,int M)=0;
     49                virtual void  SetValue(double* doublearray,int M)=0;
     50                virtual void  SetValue(double* pdoublearray,int M,int N)=0;
     51                virtual void  SetValue(Vec vec)=0;
     52                virtual void  SetValue(Mat mat)=0;
     53
    4354                virtual char* GetParameterName(void)=0;
    4455                virtual void  Process(double* partition,int numberofvertices)=0;
  • TabularUnified issm/trunk/src/c/objects/Params/PetscMatParam.cpp

    r3834 r4059  
    257257}
    258258/*}}}*/
     259/*FUNCTION PetscMatParam::SetValue(Mat matrix){{{1*/
     260void  PetscMatParam::SetValue(Mat matrix){
     261       
     262        /*avoid leak: */
     263        MatFree(&value);
     264       
     265        /*copy: */
     266        MatDuplicate(matrix,MAT_COPY_VALUES,&value);
     267}
     268/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Params/PetscMatParam.h

    r4043 r4059  
    7171                void  GetParameterValue(Vec* pvec){ISSMERROR("PetscMat param of enum %i (%s) cannot return a vec",enum_type,EnumAsString(enum_type));}
    7272                void  GetParameterValue(Mat* poutput);
     73
     74                void  SetValue(bool boolean){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
     75                void  SetValue(int integer){ISSMERROR("PetscMat param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double scalar){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
     77                void  SetValue(char* string){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(char** stringarray,int M){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(double* doublearray,int M){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(Vec vec){ISSMERROR("PetscMat param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     82                void  SetValue(Mat mat);
     83
    7384                char* GetParameterName(void);
    7485                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/PetscVecParam.cpp

    r3834 r4059  
    251251}
    252252/*}}}*/
     253/*FUNCTION PetscVecParam::SetValue(Vec vector){{{1*/
     254void  PetscVecParam::SetValue(Vec vector){
     255
     256        /*avoid leak: */
     257        VecFree(&value);
     258       
     259        /*copy: */
     260        VecDuplicate(vector,&value);
     261        VecCopy(vector,value);
     262}
     263/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Params/PetscVecParam.h

    r4043 r4059  
    7171                void  GetParameterValue(Mat* pmat){ISSMERROR("PetscVec param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
    7272                void  GetParameterValue(Vec* poutput);
     73
     74                void  SetValue(bool boolean){ISSMERROR("Bool param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
     75                void  SetValue(int integer){ISSMERROR("Bool param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double scalar){ISSMERROR("Bool param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
     77                void  SetValue(char* string){ISSMERROR("Bool param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(char** stringarray,int M){ISSMERROR("Bool param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(double* doublearray,int M){ISSMERROR("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("Bool param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(Vec vec);
     82                void  SetValue(Mat mat){ISSMERROR("Bool param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     83
    7384                char* GetParameterName(void);
    7485                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/StringArrayParam.cpp

    r3834 r4059  
    280280}
    281281/*}}}*/
     282/*FUNCTION StringArrayParam::SetValue(char** stringarray, int M){{{1*/
     283void  StringArrayParam::SetValue(char** stringarray,int M){
     284       
     285        int   i;
     286        char *string     = NULL;
     287        char *string2    = NULL;
     288        int   stringsize;
     289
     290        /*first, avoid leak: */
     291        for(i=0;i<this->numstrings;i++){
     292                string=this->value[i];
     293                xfree((void**)&string);
     294        }
     295        xfree((void**)&this->value);
     296
     297        /*copy: */
     298        this->numstrings=M;
     299        this->value=(char**)xmalloc(this->numstrings*sizeof(char*));
     300        for(i=0;i<this->numstrings;i++){
     301                string=stringarray[i];
     302                stringsize=strlen(string)+1;
     303
     304                string2=(char*)xmalloc(stringsize*sizeof(char));
     305                memcpy(string2,string,stringsize*sizeof(char));
     306
     307                this->value[i]=string2;
     308        }
     309}
     310/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Params/StringArrayParam.h

    r4043 r4059  
    7373                void  GetParameterValue(Vec* pvec){ISSMERROR("StringArray param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    7474                void  GetParameterValue(Mat* pmat){ISSMERROR("StringArray param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     75
     76                void  SetValue(bool boolean){ISSMERROR("StringArray param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
     77                void  SetValue(int integer){ISSMERROR("StringArray param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
     78                void  SetValue(double scalar){ISSMERROR("StringArray param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(char* string){ISSMERROR("StringArray param of enum %i (%s) cannot hold a string",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(char** stringarray,int M);
     81                void  SetValue(double* doublearray,int M){ISSMERROR("StringArray param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     82                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("StringArray param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     83                void  SetValue(Vec vec){ISSMERROR("StringArray param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     84                void  SetValue(Mat mat){ISSMERROR("StringArray param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     85
    7586                char* GetParameterName(void);
    7687                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/c/objects/Params/StringParam.cpp

    r3834 r4059  
    206206}
    207207/*}}}*/
     208/*FUNCTION StringParam::SetValue(char* string){{{1*/
     209void  StringParam::SetValue(char* string){
     210       
     211        int   stringsize;
     212       
     213        /*avoid leak: */
     214        xfree((void**)&this->value);
     215
     216        /*copy: */
     217        stringsize=strlen(string)+1;
     218        this->value=(char*)xmalloc(stringsize*sizeof(char));
     219        memcpy(this->value,string,stringsize*sizeof(char));
     220
     221}
     222/*}}}*/
  • TabularUnified issm/trunk/src/c/objects/Params/StringParam.h

    r4043 r4059  
    7171                void  GetParameterValue(Vec* pvec){ISSMERROR("String param of enum %i (%s) cannot return a Vec",enum_type,EnumAsString(enum_type));}
    7272                void  GetParameterValue(Mat* pmat){ISSMERROR("String param of enum %i (%s) cannot return a Mat",enum_type,EnumAsString(enum_type));}
     73
     74                void  SetValue(bool boolean){ISSMERROR("String param of enum %i (%s) cannot hold a boolean",enum_type,EnumAsString(enum_type));}
     75                void  SetValue(int integer){ISSMERROR("String param of enum %i (%s) cannot hold an integer",enum_type,EnumAsString(enum_type));}
     76                void  SetValue(double scalar){ISSMERROR("String param of enum %i (%s) cannot hold a scalar",enum_type,EnumAsString(enum_type));}
     77                void  SetValue(char* string);
     78                void  SetValue(char** stringarray,int M){ISSMERROR("String param of enum %i (%s) cannot hold a string array",enum_type,EnumAsString(enum_type));}
     79                void  SetValue(double* doublearray,int M){ISSMERROR("String param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     80                void  SetValue(double* pdoublearray,int M,int N){ISSMERROR("String param of enum %i (%s) cannot hold a double array",enum_type,EnumAsString(enum_type));}
     81                void  SetValue(Vec vec){ISSMERROR("String param of enum %i (%s) cannot hold a Vec",enum_type,EnumAsString(enum_type));}
     82                void  SetValue(Mat mat){ISSMERROR("String param of enum %i (%s) cannot hold a Mat",enum_type,EnumAsString(enum_type));}
     83
    7384                char* GetParameterName(void);
    7485                void  Process(double* partition,int numberofvertices);
  • TabularUnified issm/trunk/src/m/solutions/jpl/diagnostic.m

    r4028 r4059  
    88        t1=clock;
    99
     10        analysis_types=[DiagnosticHorizAnalysisEnum,DiagnosticVertAnalysisEnum,DiagnosticStokesAnalysisEnum,DiagnosticHutterAnalysisEnum,SlopeAnalysisEnum];
    1011        solution_type=DiagnosticAnalysisEnum;
    11         analysis_types=[DiagnosticHorizAnalysisEnum,DiagnosticVertAnalysisEnum,DiagnosticStokesAnalysisEnum,DiagnosticHutterAnalysisEnum,SlopecomputeAnalysisEnum];
    1212
    13         displaystring(md.verbose,'%s',['create fem model']);
    14         femmodel=CreateFemModel(md,solution_type,analysis_types);
     13        displaystring(md.verbose,'%s',['create finite element model']);
     14        femmodel=NewFemModel(md,solution_type,analysis_types);
     15
     16        %retrieve parameters
     17        verbose=femmodel.parameters.Verbose;
     18        qmu_analysis=femmodel.parameters.QmuAnalysis;
     19        control_analysis=femmodel.parameters.ControlAnalysis;
    1520
    1621        %compute solution
    17         if ~femmodel.parameters.QmuAnalysis,
    18                 if femodel.parameters.control_analysis,
     22        if ~qmu_analysis,
     23                if ~control_analysis,
    1924                       
    20                         %launch core of control solution.
    21                         md.results.DiagnosticAnalysis=control_core(femmodel);
     25                        displaystring(verbose,'%s',['call computational core']);
     26                        diagnostic_core(femmodel);
    2227
    2328                else,
    2429                       
    25                         %launch core of diagnostic solution.
    26                         md.results.DiagnosticAnalysis=diagnostic_core(femmodel);
     30                        displaystring(verbose,'%s',['call computational core']);
     31                        control_core(femmodel);
    2732
    2833                end
Note: See TracChangeset for help on using the changeset viewer.