1 | #include <stdio.h>
|
---|
2 | #include "../../shared/shared.h"
|
---|
3 | #include "../../include/include.h"
|
---|
4 | #include "../objects.h"
|
---|
5 | #include "../../io/io.h"
|
---|
6 |
|
---|
7 | /*Constructors/Destructors*/
|
---|
8 | /*FUNCTION BamgOpts::BamgOpts() {{{1*/
|
---|
9 | BamgOpts::BamgOpts(){
|
---|
10 |
|
---|
11 | this->anisomax=0;
|
---|
12 | this->cutoff=0;
|
---|
13 | this->coeff=0;
|
---|
14 | this->errg=0;
|
---|
15 | this->gradation=0;
|
---|
16 | this->Hessiantype=0;
|
---|
17 | this->MaxCornerAngle=0;
|
---|
18 | this->maxnbv=0;
|
---|
19 | this->maxsubdiv=0;
|
---|
20 | this->Metrictype=0;
|
---|
21 | this->nbjacobi=0;
|
---|
22 | this->nbsmooth=0;
|
---|
23 | this->omega=0;
|
---|
24 | this->power=0;
|
---|
25 | this->verbose=0;
|
---|
26 |
|
---|
27 | this->Crack=0;
|
---|
28 | this->geometricalmetric=0;
|
---|
29 | this->KeepVertices=0;
|
---|
30 | this->splitcorners=0;
|
---|
31 |
|
---|
32 | this->hmin=0;
|
---|
33 | this->hmax=0;
|
---|
34 | this->hminVertices=NULL; this->hminVerticesSize[0]=this->hminVerticesSize[1]=0;
|
---|
35 | this->hmaxVertices=NULL; this->hmaxVerticesSize[0]=this->hmaxVerticesSize[1]=0;
|
---|
36 | this->hVertices=NULL; this->hVerticesSize[0]=this->hVerticesSize[1]=0;
|
---|
37 | this->metric=NULL; this->metricSize[0]=this->metricSize[1]=0;
|
---|
38 | this->field=NULL; this->fieldSize[0]=this->fieldSize[1]=0;
|
---|
39 | this->err=NULL; this->errSize[0]=this->errSize[1]=0;
|
---|
40 |
|
---|
41 | }
|
---|
42 | /*}}}*/
|
---|
43 | /*FUNCTION BamgOpts::~BamgOpts() {{{1*/
|
---|
44 | BamgOpts::~BamgOpts(){
|
---|
45 |
|
---|
46 | xfree((void**)&this->hminVertices);
|
---|
47 | xfree((void**)&this->hmaxVertices);
|
---|
48 | xfree((void**)&this->hVertices);
|
---|
49 | xfree((void**)&this->metric);
|
---|
50 | xfree((void**)&this->field);
|
---|
51 | xfree((void**)&this->err);
|
---|
52 |
|
---|
53 | }
|
---|
54 | /*}}}*/
|
---|
55 |
|
---|
56 | /*Methods*/
|
---|
57 | /*FUNCTION BamgOpts::Check{{{1*/
|
---|
58 | void BamgOpts::Check(void){
|
---|
59 |
|
---|
60 | int i;
|
---|
61 |
|
---|
62 | if (this->anisomax<1) _error_("'anisomax' option should be >=1");
|
---|
63 | if (this->coeff==0) _error_("'coeff' should be positive");
|
---|
64 | if (this->errg<0) _error_("'errg' option should be >0");
|
---|
65 | if (this->gradation<1) _error_("'gradation' option should be >=1");
|
---|
66 | if (this->Hessiantype!=0 && this->Hessiantype!=1) _error_("'Hessiantype' supported options are 0 and 1");
|
---|
67 | if (this->maxnbv<3) _error_("'maxnbv' option should be >3");
|
---|
68 | if (this->maxsubdiv<=1) _error_("'maxsubdiv' should be >1");
|
---|
69 | if (this->Metrictype!=0 && this->Metrictype!=1 && this->Metrictype!=2) _error_("'Metrictype' supported options are 0, 1 and 2");
|
---|
70 | if (this->nbjacobi<=0) _error_("'nbjacobi' option should be >0");
|
---|
71 | if (this->nbsmooth<=0) _error_("'nbsmooth' option should be >0");
|
---|
72 |
|
---|
73 | if (this->Crack!=0 && this->Crack!=1) _error_("'Crack' supported options are 0 and 1");
|
---|
74 | if (this->KeepVertices!=0 && this->KeepVertices!=1) _error_("'KeepVertices' supported options are 0 and 1");
|
---|
75 | if (this->geometricalmetric!=0 && this->geometricalmetric!=1) _error_("'geometricalmetric' supported options are 0 and 1");
|
---|
76 |
|
---|
77 | if (this->hmin<=0) _error_("'hmin' option should be >0");
|
---|
78 | if (this->hmax<=0 || this->hmax<this->hmin) _error_("'hmax' option should be between 0 and hmin=%g",this->hmin);
|
---|
79 | if (this->hminVertices && this->hminVerticesSize[1]!=1) _error_("'hminVertices' should be a column");
|
---|
80 | if (this->hmaxVertices && this->hmaxVerticesSize[1]!=1) _error_("'hmaxVertices' should be a column");
|
---|
81 | if (this->hVertices && this->hVerticesSize[1]!=1) _error_("'hVertices' should be a column");
|
---|
82 | if (this->metric && (this->metricSize[1]!=1 && this->metricSize[1]!=3)) _error_("'metric' should have either 1 (iso) or 3 (aniso) columns.");
|
---|
83 | if (this->field){
|
---|
84 | if (this->errSize[0]!=1 || this->errSize[1]!=this->fieldSize[1]) _error_("'err' should be of size %i x %i",1,this->fieldSize[1]);
|
---|
85 | for (i=0;i<this->fieldSize[1];i++) {if (this->err[i]<=0) _error_("'err' option should be >0");};
|
---|
86 | }
|
---|
87 |
|
---|
88 | }
|
---|
89 | /*}}}*/
|
---|