8 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
12 #include "../bamg/bamgobjects.h"
13 #include "../modules/Bamgx/Bamgx.h"
23 this->keepmetric = -1;
24 this->groundingline_resolution = -1;
25 this->groundingline_distance = -1;
26 this->icefront_resolution = -1;
27 this->icefront_distance = -1;
28 this->thicknesserror_resolution = -1;
29 this->thicknesserror_threshold = -1;
30 this->thicknesserror_groupthreshold = -1;
31 this->thicknesserror_maximum = -1;
32 this->deviatoricerror_resolution = -1;
33 this->deviatoricerror_threshold = -1;
34 this->deviatoricerror_groupthreshold = -1;
35 this->deviatoricerror_maximum = -1;
38 this->geometry = NULL;
39 this->fathermesh = NULL;
40 this->previousmesh = NULL;
41 this->elementslist = NULL;
44 this->numberofvertices = -1;
45 this->numberofelements = -1;
49 this->options->anisomax = 10.e30;
50 this->options->cutoff = 10.e-5;
51 this->options->coeff = 1;
52 this->options->errg = 0.1;
53 this->options->gradation = -1;
54 this->options->Hessiantype = 0;
55 this->options->maxnbv = 1e6;
56 this->options->maxsubdiv = 10;
57 this->options->Metrictype = 0;
58 this->options->nbjacobi = 1;
59 this->options->nbsmooth = 3;
60 this->options->omega = 1.8;
61 this->options->power = 1;
62 this->options->verbose = 0;
63 this->options->Crack = 0;
64 this->options->KeepVertices = 1;
65 this->options->splitcorners = 1;
66 this->options->hmin = -1;
67 this->options->hmax = -1;
68 this->options->err = xNew<IssmDouble>(1);
69 this->options->err[0] = -1;
70 this->options->errSize[0] = 1;
71 this->options->errSize[1] = 1;
76 if(this->geometry)
delete this->geometry;
77 if(this->fathermesh)
delete this->fathermesh;
78 if(this->previousmesh)
delete this->previousmesh;
79 if(this->options)
delete this->options;
80 if(this->x) xDelete<IssmDouble>(this->x);
81 if(this->y) xDelete<IssmDouble>(this->y);
82 if(this->elementslist) xDelete<int>(this->elementslist);
90 if(this->elementslist) xDelete<int>(this->elementslist);
91 if(this->x) xDelete<IssmDouble>(this->x);
92 if(this->y) xDelete<IssmDouble>(this->y);
94 this->elementslist = *elementslist_in;
97 this->numberofvertices = *numberofvertices_in;
98 this->numberofelements = *numberofelements_in;
103 *elementslist_out = this->elementslist;
106 *numberofvertices_out= this->numberofvertices;
107 *numberofelements_out= this->numberofelements;
113 this->options->Check();
116 Mesh* Th=
new Mesh(this->elementslist,this->x,this->y,this->numberofvertices,this->numberofelements,this->options);
124 Th->
WriteMesh(this->fathermesh,this->options);
142 this->options->field = field;
143 this->options->hmaxVertices = hmaxVertices;
146 if(this->previousmesh){
147 this->options->fieldSize[0] = this->previousmesh->VerticesSize[0];
148 this->options->fieldSize[1] = 1;
149 this->options->hmaxVerticesSize[0] = this->previousmesh->VerticesSize[0];
150 this->options->hmaxVerticesSize[1] = 1;
151 Bamgx(meshout,geomout,this->previousmesh,this->geometry,this->options);
154 this->options->fieldSize[0] = this->fathermesh->VerticesSize[0];
155 this->options->fieldSize[1] = 1;
156 this->options->hmaxVerticesSize[0] = this->fathermesh->VerticesSize[0];
157 this->options->hmaxVerticesSize[1] = 1;
158 Bamgx(meshout,geomout,this->fathermesh,this->geometry,this->options);
162 this->options->field = NULL;
163 this->options->fieldSize[0] = 0;
164 this->options->fieldSize[1] = 0;
165 this->options->hmaxVertices = NULL;
166 this->options->hmaxVerticesSize[0] = 0;
167 this->options->hmaxVerticesSize[1] = 0;
170 if(this->keepmetric==0){
171 if(this->options->metric) xDelete<IssmDouble>(this->options->metric);
172 this->options->metricSize[0] = 0;
173 this->options->metricSize[1] = 0;
177 if(this->previousmesh)
delete this->previousmesh;
178 this->previousmesh = meshout;
183 int *datalist = xNew<int>(2);
185 int* elementslist = xNew<int>(nbt*3);
190 for(
int i=0;i<nbv;i++){
191 xylist[2*i] = meshout->
Vertices[i*3+0];
192 xylist[2*i+1] = meshout->
Vertices[i*3+1];
195 for(
int i=0;i<nbt;i++){
196 elementslist[3*i+0] = reCast<int>(meshout->
Triangles[4*i+0]);
197 elementslist[3*i+1] = reCast<int>(meshout->
Triangles[4*i+1]);
198 elementslist[3*i+2] = reCast<int>(meshout->
Triangles[4*i+2]);
202 *pdatalist = datalist;
204 *pelementslist = elementslist;
211 if(!this->options)
_error_(
"AmrBamg->options is NULL!");
213 this->options->hmin = hmin_in;
214 this->options->hmax = hmax_in;
215 this->options->err[0] = err_in;
216 this->options->gradation= gradation_in;