Changeset 3214


Ignore:
Timestamp:
03/08/10 11:57:54 (15 years ago)
Author:
Mathieu Morlighem
Message:

Added BamgOpts check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/mex/Bamg/Bamg.cpp

    r3211 r3214  
    4848        BamgOptsInit(&bamgopts);
    4949        FetchData(&bamgopts.coef,mxGetField(BAMGOPTIONS,0,"coef"));
    50         if (bamgopts.coef==0) throw ErrorException(__FUNCT__,exprintf("'coef' should be positive"));
    5150        FetchData(&bamgopts.maxsubdiv,mxGetField(BAMGOPTIONS,0,"maxsubdiv"));
    52         if (bamgopts.maxsubdiv<1) throw ErrorException(__FUNCT__,exprintf("'maxsubdiv' should be >=1"));
    5351        FetchData(&bamgopts.Hessiantype,mxGetField(BAMGOPTIONS,0,"Hessiantype"));
    54         if (bamgopts.Hessiantype!=0 && bamgopts.Hessiantype!=1) throw ErrorException(__FUNCT__,exprintf("'Hessiantype' supported options are 0 and 1"));
    5552        FetchData(&bamgopts.Metrictype,mxGetField(BAMGOPTIONS,0,"Metrictype"));
    56         if (bamgopts.Metrictype!=0 && bamgopts.Metrictype!=1 && bamgopts.Metrictype!=2) throw ErrorException(__FUNCT__,exprintf("'Metrictype' supported options are 0, 1 and 2"));
    5753        FetchData(&bamgopts.KeepVertices,mxGetField(BAMGOPTIONS,0,"KeepVertices"));
    58         if (bamgopts.KeepVertices!=0 && bamgopts.KeepVertices!=1) throw ErrorException(__FUNCT__,exprintf("'KeepVertices' supported options are 0 and 1"));
    5954        FetchData(&bamgopts.renumber,mxGetField(BAMGOPTIONS,0,"renumber"));
    60         if (bamgopts.renumber!=0 && bamgopts.renumber!=1 && bamgopts.renumber!=2) throw ErrorException(__FUNCT__,exprintf("'renumber' supported options are 0, 1 and 2"));
    6155        FetchData(&bamgopts.power,mxGetField(BAMGOPTIONS,0,"power"));
    6256        FetchData(&bamgopts.errg,mxGetField(BAMGOPTIONS,0,"errg"));
    63         if (bamgopts.errg<0) throw ErrorException(__FUNCT__,exprintf("'errg' option should be >0"));
    6457        FetchData(&bamgopts.nbjacobi,mxGetField(BAMGOPTIONS,0,"nbjacobi"));
    65         if (bamgopts.nbjacobi<=0) throw ErrorException(__FUNCT__,exprintf("'nbjacobi' option should be >0"));
    6658        FetchData(&bamgopts.NbSmooth,mxGetField(BAMGOPTIONS,0,"NbSmooth"));
    67         if (bamgopts.NbSmooth<=0) throw ErrorException(__FUNCT__,exprintf("'NbSmooth' option should be >0"));
    6859        FetchData(&bamgopts.omega,mxGetField(BAMGOPTIONS,0,"omega"));
    6960        FetchData(&bamgopts.maxnbv,mxGetField(BAMGOPTIONS,0,"maxnbv"));
    70         if (bamgopts.maxnbv<3) throw ErrorException(__FUNCT__,exprintf("'maxnbv' option should be >3"));
    7161        FetchData(&bamgopts.hmin,mxGetField(BAMGOPTIONS,0,"hmin"));
    72         if (bamgopts.hmin<=0) throw ErrorException(__FUNCT__,exprintf("'hmin' option should be >0"));
    7362        FetchData(&bamgopts.hmax,mxGetField(BAMGOPTIONS,0,"hmax"));
    74         if (bamgopts.hmax<=0 || bamgopts.hmax<bamgopts.hmin) throw ErrorException(__FUNCT__,exprintf("'hmax' option should be between 0 and hmin=%g",bamgopts.hmin));
    7563        FetchData(&bamgopts.anisomax,mxGetField(BAMGOPTIONS,0,"anisomax"));
    76         if (bamgopts.anisomax<1) throw ErrorException(__FUNCT__,exprintf("'anisomax' option should be >=1"));
    7764        FetchData(&bamgopts.gradation,mxGetField(BAMGOPTIONS,0,"gradation"));
    78         if (bamgopts.gradation<1) throw ErrorException(__FUNCT__,exprintf("'gradation' option should be >=1"));
    7965        FetchData(&bamgopts.cutoff,mxGetField(BAMGOPTIONS,0,"cutoff"));
    8066        FetchData(&bamgopts.verbose,mxGetField(BAMGOPTIONS,0,"verbose"));
     
    8773        FetchData(&bamgopts.err,NULL,&cols,mxGetField(BAMGOPTIONS,0,"err"));
    8874        if (bamgopts.numfields!=0 && cols!=bamgopts.numfields){throw ErrorException(__FUNCT__,exprintf("the size of 'err' should be the same as 'field'"));}
    89         for (i=0;i<bamgopts.numfields;i++) {if (bamgopts.err[i]<=0) throw ErrorException(__FUNCT__,exprintf("'err' option should be >0"));};
     75        BamgOptsCheck(&bamgopts);
    9076
    9177        /*!Generate internal degree of freedom numbers: */
Note: See TracChangeset for help on using the changeset viewer.