118 mesh->info.imprim = val;
122 fprintf(stderr,
"\n ## Warning: %s: maximal memory authorized must"
123 " be strictly positive.\n",__func__);
124 fprintf(stderr,
" Reset to default value.\n");
127 mesh->info.mem = val;
131 mesh->info.ddebug = val;
135 if (
mesh->htab.geom )
144 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
145 fprintf(stderr,
"\n ## Warning: %s: angle detection parameter"
146 " set to default value\n",__func__);
151 mesh->info.setfem = (val==1)? 0 : 1;
154 mesh->info.opnbdy = val;
157 mesh->info.iso = val;
160 mesh->info.isoref = val;
163 mesh->info.isosurf = val;
167 if ( val < 0 || val > 2 )
169 mesh->info.lag = val;
176 fprintf(stderr,
"\n ## Error: %s"
177 " \"lagrangian motion\" option unavailable (-lag):\n"
178 " set the USE_ELAS CMake's flag to ON when compiling the mmg3d"
179 " library to enable this feature.\n",__func__);
184 mesh->info.renum = val;
187 mesh->info.nsd = val;
190 mesh->info.optim = val;
193 mesh->info.noinsert = val;
196 mesh->info.noswap = val;
199 mesh->info.nomove = val;
202 mesh->info.nosurf = val;
205 mesh->info.nreg = val;
208 mesh->info.xreg = val;
211 mesh->info.nosizreq = val;
214 if (
mesh->info.par ) {
216 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
217 fprintf(stderr,
"\n ## Warning: %s: new local parameter values\n",__func__);
219 mesh->info.npar = val;
220 mesh->info.npari = 0;
221 mesh->info.parTyp = 0;
224 printf(
" Exit program.\n");
228 MMG5_int inival = MMG5_INTMAX;
230 for (k=0; k<
mesh->info.npar; k++) {
232 mesh->info.par[k].ref = inival;
233 mesh->info.par[k].hausd =
mesh->info.hausd;
234 mesh->info.par[k].hmin =
mesh->info.hmin;
235 mesh->info.par[k].hmax =
mesh->info.hmax;
239 if (
mesh->info.br ) {
241 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
242 fprintf(stderr,
"\n ## Warning: %s: new level-set based references values\n",__func__);
244 mesh->info.nbr = val;
247 printf(
" Exit program.\n");
251 for (k=0; k<
mesh->info.nbr; k++)
252 mesh->info.br[k] = 0;
257 if (
mesh->info.mat ) {
259 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
260 fprintf(stderr,
"\n ## Warning: %s: new multi materials values\n",__func__);
262 mesh->info.nmat = val;
263 mesh->info.nmati = 0;
266 printf(
" Exit program.\n");
272 mesh->info.ani = val;
275 fprintf(stderr,
"\n ## Error: %s: unknown type of parameter\n",__func__);
288 mesh->info.dhd = val;
290 mesh->info.dhd = cos(
mesh->info.dhd*M_PI/180.0);
293 mesh->info.sethmin = 1;
294 mesh->info.hmin = val;
295 if (
mesh->info.sethmax && (
mesh->info.hmin >=
mesh->info.hmax ) ) {
296 fprintf(stderr,
"\n ## Error: hmin value must be strictly lower than hmax one"
297 " (hmin = %lf hmax = %lf ).\n",
mesh->info.hmin,
mesh->info.hmax);
301 fprintf(stderr,
"\n ## Error: hmin must be strictly positive "
302 "(minimal edge length).\n");
308 mesh->info.sethmax = 1;
309 mesh->info.hmax = val;
310 if (
mesh->info.sethmin && (
mesh->info.hmin >=
mesh->info.hmax ) ) {
311 fprintf(stderr,
"\n ## Error: hmin value must be strictly lower than hmax one"
312 " (hmin = %lf hmax = %lf ).\n",
mesh->info.hmin,
mesh->info.hmax);
316 fprintf(stderr,
"\n ## Error: hmax must be strictly positive "
317 "(maximal edge length).\n");
323 mesh->info.hsiz = val;
326 mesh->info.hgrad = val;
327 if (
mesh->info.hgrad <= 0.0 ) {
331 mesh->info.hgrad = log(
mesh->info.hgrad);
335 mesh->info.hgradreq = val;
336 if (
mesh->info.hgradreq <= 0.0 ) {
340 mesh->info.hgradreq = log(
mesh->info.hgradreq);
345 fprintf(stderr,
"\n ## Error: %s: hausdorff number must be"
346 " strictly positive.\n",__func__);
350 mesh->info.hausd = val;
356 if (val < 0.0 || val > 1.0) {
357 fprintf(stderr,
"\n ## Error: %s: Coordinate regularization parameter must be comprised between 0 and 1.\n",__func__);
360 mesh->info.lxreg = val;
369 mesh->info.rmc = val;
373 fprintf(stderr,
"\n ## Error: %s: unknown type of parameter\n",
381 double hmin,
double hmax,
double hausd){
385 if ( !
mesh->info.npar ) {
386 fprintf(stderr,
"\n ## Error: %s: You must set the number of local"
387 " parameters",__func__);
388 fprintf(stderr,
" with the MMG2D_Set_iparameters function before setting");
389 fprintf(stderr,
" values in local parameters structure. \n");
392 if (
mesh->info.npari >=
mesh->info.npar ) {
393 fprintf(stderr,
"\n ## Error: %s: unable to set a new local parameter.\n",
395 fprintf(stderr,
" max number of local parameters: %d\n",
mesh->info.npar);
399 fprintf(stderr,
"\n ## Warning: %s: you must apply your local parameters",
401 fprintf(stderr,
" on triangles (MMG5_Triangle or %d) or edges"
403 fprintf(stderr,
"\n ## Unknown type of entity: ignored.\n");
407 fprintf(stderr,
"\n ## Error: %s: negative references are not allowed.\n",
412 fprintf(stderr,
"\n ## Error: %s: negative hmin value is not allowed.\n",
417 fprintf(stderr,
"\n ## Error: %s: negative hmax value is not allowed.\n",
422 fprintf(stderr,
"\n ## Error: %s: negative hausd value is not allowed.\n",
427 for (k=0; k<
mesh->info.npari; k++) {
428 par = &
mesh->info.par[k];
430 if ( par->
elt == typ && par->
ref == ref ) {
434 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) {
435 fprintf(stderr,
"\n ## Warning: %s: new parameters (hausd, hmin and hmax)",
437 fprintf(stderr,
" for entities of type %d and of ref %" MMG5_PRId
"\n",typ,ref);
443 mesh->info.par[
mesh->info.npari].elt = typ;
444 mesh->info.par[
mesh->info.npari].ref = ref;
445 mesh->info.par[
mesh->info.npari].hmin = hmin;
446 mesh->info.par[
mesh->info.npari].hmax = hmax;
447 mesh->info.par[
mesh->info.npari].hausd = hausd;
458 fprintf(stderr,
"\n ## Error: %s: unexpected entity type: %s.\n",
469 int split,MMG5_int rin,MMG5_int rout){
480 if ( ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) &&
482 fprintf(stderr,
"\n ## Warning: %s: old mesh deletion.\n",__func__);
502 if(
mesh->info.mem > 0) {
505 }
else if(
mesh->info.mem < 39) {
506 fprintf(stderr,
"\n ## Error: %s: not enough memory (%d).\n",
507 __func__,
mesh->info.mem);
522 if ( ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) &&
sol->m )
523 fprintf(stderr,
"\n ## Warning: %s: old solution deletion.\n",__func__);
526 fprintf(stderr,
"\n ## Error: %s: mmg2d need a solution imposed on vertices.\n",
543 fprintf(stderr,
"\n ## Error: %s: type of solution not yet implemented.\n",
557 printf(
" Exit program.\n");
565 MMG5_int np,
int *typSol) {
570 if ( ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) &&
mesh->nsols ) {
572 fprintf(stderr,
"\n ## Warning: %s: old solutions array deletion.\n",
585 for ( j=0; j<nsols; ++j ) {
590 sprintf(data,
"sol_%d",j);
595 sprintf(data,
"sol_%d.o",j);
601 fprintf(stderr,
"\n ## Error: %s: unable to set the size of the"
602 " solution num %d.\n",__func__,j);
612 if ( typEntity != NULL )
615 if ( typSol != NULL ) {
616 if (
sol->size == 1 )
618 else if (
sol->size == 2 )
620 else if (
sol->size == 3 )
635 MMG5_int* np,
int* typSol) {
640 fprintf(stderr,
"\n ## Error: %s: your mesh structure must be allocated"
641 " and filled\n",__func__);
646 *nsols =
mesh->nsols;
648 for ( j=0; j<
mesh->nsols; ++j ) {
651 if ( typSol != NULL ) {
652 typSol[j] = psl->
type;
655 assert( (!psl->
np) || (psl->
np ==
mesh->np));
672 *nquad =
mesh->nquad;
678 for (k=1; k<=
mesh->na; k++) {
679 if (
mesh->edge[k].a ) ++(*na);
690 fprintf(stderr,
"\n ## Error: %s: you must set the number of points with the",
692 fprintf(stderr,
" MMG2D_Set_meshSize function before setting vertices in mesh\n");
696 if ( pos >
mesh->npmax ) {
697 fprintf(stderr,
"\n ## Error: %s: unable to allocate a new point.\n",
699 fprintf(stderr,
" max number of points: %" MMG5_PRId
"\n",
mesh->npmax);
704 if ( pos >
mesh->np ) {
705 fprintf(stderr,
"\n ## Error: %s: attempt to set new vertex at position %" MMG5_PRId
".",
707 fprintf(stderr,
" Overflow of the given number of vertices: %" MMG5_PRId
"\n",
mesh->np);
708 fprintf(stderr,
" ## Check the mesh size, its compactness or the position");
709 fprintf(stderr,
" of the vertex.\n");
713 mesh->point[pos].c[0] = c0;
714 mesh->point[pos].c[1] = c1;
715 mesh->point[pos].ref = ref;
721 mesh->point[pos].flag = 0;
722 mesh->point[pos].tmp = 0;
728 assert ( k <= mesh->np );
734 assert ( k <= mesh->np );
740 assert ( k <= mesh->np );
747 assert ( k <= mesh->np );
753 int* isCorner,
int* isRequired) {
757 if (
mesh->info.ddebug ) {
758 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of points.\n",
760 fprintf(stderr,
" You must pass here exactly one time (the first time ");
761 fprintf(stderr,
"you call the MMG2D_Get_vertex function).\n");
762 fprintf(stderr,
" If not, the number of call of this function");
763 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",
mesh->np);
770 fprintf(stderr,
" ## Error: %s: unable to get point.\n",__func__);
771 fprintf(stderr,
" The number of call of MMG2D_Get_vertex function");
772 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",
mesh->np);
780 int* isCorner,
int* isRequired, MMG5_int idx) {
782 if ( idx < 1 || idx >
mesh->np ) {
783 fprintf(stderr,
"\n ## Error: %s: unable to get point at position %" MMG5_PRId
".\n",
785 fprintf(stderr,
" Your vertices numbering goes from 1 to %" MMG5_PRId
"\n",
mesh->np);
789 *c0 =
mesh->point[idx].c[0];
790 *c1 =
mesh->point[idx].c[1];
792 *ref =
mesh->point[idx].ref;
794 if ( isCorner != NULL ) {
801 if ( isRequired != NULL ) {
816 for (i=1;i<=
mesh->np;i++)
818 ppt = &
mesh->point[i];
821 ppt->
c[0] = vertices[j];
822 ppt->
c[1] = vertices[j+1];
828 ppt->
ref = refs[i-1];
840 int* areCorners,
int* areRequired) {
844 for (i=1;i<=
mesh->np;i++)
846 ppt = &
mesh->point[i];
849 vertices[j] = ppt->
c[0];
850 vertices[j+1] = ppt->
c[1];
856 if ( areCorners !=NULL ) {
863 if ( areRequired != NULL ) {
882 fprintf(stderr,
" ## Error: %s: You must set the number of elements with the",
884 fprintf(stderr,
" MMG2D_Set_meshSize function before setting elements in mesh\n");
888 if ( pos >
mesh->ntmax ) {
889 fprintf(stderr,
" ## Error: %s: unable to allocate a new element.\n",
891 fprintf(stderr,
" max number of element: %" MMG5_PRId
"\n",
mesh->ntmax);
896 if ( pos >
mesh->nt ) {
897 fprintf(stderr,
"\n ## Error: %s: attempt to set new triangle at position %" MMG5_PRId
".",
899 fprintf(stderr,
" Overflow of the given number of triangle: %" MMG5_PRId
"\n",
mesh->nt);
900 fprintf(stderr,
" ## Check the mesh size, its compactness or the position");
901 fprintf(stderr,
" of the triangle.\n");
905 pt = &
mesh->tria[pos];
919 mesh->point[pt->
v[2]].c);
922 fprintf(stderr,
"\n ## Error: %s: triangle %" MMG5_PRId
" has null area.\n",
924 for ( ip=0; ip<3; ip++ ) {
925 ppt = &
mesh->point[pt->
v[ip]];
926 for ( j=0; j<3; j++ ) {
927 if ( fabs(ppt->
c[j])>0. ) {
928 fprintf(stderr,
" Check that you don't have a sliver triangle.\n");
941 if (
mesh->info.ddebug && (
mesh->nt == pos) &&
mesh->xt > 0 ) {
942 fprintf(stderr,
"\n ## Warning: %s: %" MMG5_PRId
" triangles reoriented\n",
953 assert ( k <= mesh->nt );
966 assert ( k <= mesh->nt );
982 if (
mesh->info.ddebug ) {
983 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of"
984 " triangles.\n",__func__);
985 fprintf(stderr,
" You must pass here exactly one time (the first time ");
986 fprintf(stderr,
"you call the MMG2D_Get_triangle function).\n");
987 fprintf(stderr,
" If not, the number of call of this function");
988 fprintf(stderr,
" exceed the number of triangles: %" MMG5_PRId
"\n ",
mesh->nt);
995 fprintf(stderr,
"\n ## Error: %s: unable to get triangle.\n",
997 fprintf(stderr,
" The number of call of MMG2D_Get_triangle function");
998 fprintf(stderr,
" can not exceed the number of triangles: %" MMG5_PRId
"\n ",
mesh->nt);
1010 if ( isRequired != NULL ) {
1029 for (i=1;i<=
mesh->nt;i++)
1032 ptt = &
mesh->tria[i];
1033 ptt->
v[0] = tria[j] ;
1034 ptt->
v[1] = tria[j+1];
1035 ptt->
v[2] = tria[j+2];
1037 ptt->
ref = refs[i-1];
1044 for( ii=0 ; ii<3 ; ii++)
1048 mesh->point[ptt->
v[2]].c);
1051 fprintf(stderr,
"\n ## Error: %s: triangle %" MMG5_PRId
" has null area.\n",
1053 for ( ip=0; ip<3; ip++ ) {
1054 ppt = &
mesh->point[ptt->
v[ip]];
1056 for ( jj=0; jj<3; jj++ ) {
1057 if ( fabs(ppt->
c[jj])>0. ) {
1058 fprintf(stderr,
" Check that you don't have a sliver triangle.\n");
1066 ptt->
v[2] = ptt->
v[1];
1071 if (
mesh->info.ddebug &&
mesh->xt > 0 ) {
1072 fprintf(stderr,
"\n ## Warning: %s: %" MMG5_PRId
" triangles reoriented\n",
1084 for (i=1;i<=
mesh->nt;i++)
1087 ptt = &
mesh->tria[i];
1088 tria[j] = ptt->
v[0];
1089 tria[j+1] = ptt->
v[1];
1090 tria[j+2] = ptt->
v[2];
1093 refs[i-1] = ptt->
ref ;
1094 if ( areRequired != NULL ) {
1097 areRequired[i-1] = 1;
1099 areRequired[i-1] = 0;
1108 if ( !
mesh->nquad ) {
1109 fprintf(stderr,
"\n ## Error: %s: You must set the number of quadrilaterals with the",
1111 fprintf(stderr,
" MMG2D_Set_meshSize function before setting elements in mesh\n");
1115 if ( pos >
mesh->nquad ) {
1116 fprintf(stderr,
"\n ## Error: %s: attempt to set new quad at position %" MMG5_PRId
".",
1118 fprintf(stderr,
" Overflow of the given number of quads: %" MMG5_PRId
"\n",
mesh->nquad);
1119 fprintf(stderr,
"\n ## Check the mesh size, its compactness or the position");
1120 fprintf(stderr,
" of the quad.\n");
1124 pq = &
mesh->quadra[pos];
1140 MMG5_int* ref,
int* isRequired) {
1141 static MMG5_int nqi = 0;
1143 if ( nqi ==
mesh->nquad ) {
1145 if (
mesh->info.ddebug ) {
1146 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of"
1147 " quadrilaterals.\n",__func__);
1148 fprintf(stderr,
" You must pass here exactly one time (the first time ");
1149 fprintf(stderr,
"you call the MMG2D_Get_quadrilateral function).\n");
1150 fprintf(stderr,
" If not, the number of call of this function");
1151 fprintf(stderr,
" exceed the number of quadrilaterals: %" MMG5_PRId
"\n ",
mesh->nquad);
1157 if ( nqi >
mesh->nquad ) {
1158 fprintf(stderr,
"\n ## Error: %s: unable to get quadra.\n",__func__);
1159 fprintf(stderr,
" The number of call of MMG2D_Get_quadrilateral function");
1160 fprintf(stderr,
" can not exceed the number of quadra: %" MMG5_PRId
"\n ",
mesh->nquad);
1164 *v0 =
mesh->quadra[nqi].v[0];
1165 *v1 =
mesh->quadra[nqi].v[1];
1166 *v2 =
mesh->quadra[nqi].v[2];
1167 *v3 =
mesh->quadra[nqi].v[3];
1169 if ( ref != NULL ) {
1170 *ref =
mesh->quadra[nqi].ref;
1173 if ( isRequired != NULL ) {
1189 for (i=1;i<=
mesh->nquad;i++)
1192 pq = &
mesh->quadra[i];
1193 pq->
v[0] = quadra[j];
1194 pq->
v[1] = quadra[j+1];
1195 pq->
v[2] = quadra[j+2];
1196 pq->
v[3] = quadra[j+3];
1199 pq->
ref = refs[i-1];
1214 for (i=1;i<=
mesh->nquad;i++)
1217 pq = &
mesh->quadra[i];
1218 quadra[j] = pq->
v[0];
1219 quadra[j+1] = pq->
v[1];
1220 quadra[j+2] = pq->
v[2];
1221 quadra[j+3] = pq->
v[3];
1224 refs[i-1] = pq->
ref ;
1226 if ( areRequired != NULL ) {
1229 areRequired[i-1] = 1;
1232 areRequired[i-1] = 0;
1244 fprintf(stderr,
"\n ## Error: %s: you must set the number of elements"
1245 " with the",__func__);
1246 fprintf(stderr,
" MMG2D_Set_meshSize function before setting elements in mesh\n");
1250 if ( pos >
mesh->na ) {
1251 fprintf(stderr,
"\n ## Error: %s: attempt to set new edge at position %" MMG5_PRId
".",
1253 fprintf(stderr,
" Overflow of the given number of edge: %" MMG5_PRId
"\n",
mesh->na);
1254 fprintf(stderr,
" ## Check the mesh size, its compactness or the position");
1255 fprintf(stderr,
" of the edge.\n");
1259 pt = &
mesh->edge[pos];
1274 assert ( k <= mesh->na );
1276 ped = &
mesh->edge[k];
1286 assert ( k <= mesh->na );
1288 ped = &
mesh->edge[k];
1299 assert ( k <= mesh->na );
1301 ped = &
mesh->edge[k];
1305 ppt = &
mesh->point[ped->
a];
1307 ppt = &
mesh->point[ped->
b];
1314 ,
int* isRidge,
int* isRequired) {
1319 if (
mesh->info.ddebug ) {
1320 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of edges.\n",
1322 fprintf(stderr,
" You must pass here exactly one time (the first time ");
1323 fprintf(stderr,
"you call the MMG2D_Get_edge function).\n");
1324 fprintf(stderr,
" If not, the number of call of this function");
1325 fprintf(stderr,
" exceed the number of edges.\n ");
1326 fprintf(stderr,
" Please, call the MMG2D_Get_meshSize function to get"
1327 " this number.\n ");
1334 fprintf(stderr,
"\n ## Error: %s: unable to get edge.\n",__func__);
1335 fprintf(stderr,
" The number of call of MMG2D_Get_edge function");
1336 fprintf(stderr,
" can not exceed the number of edges: %" MMG5_PRId
"\n ",
mesh->na);
1342 while ( !ped->
a && ++
mesh->nai <=
mesh->na ) {
1352 if ( isRidge != NULL ) {
1359 if ( isRequired != NULL ) {
1372 for (i=1;i<=
mesh->na;i++)
1376 mesh->edge[i].a = edges[j];
1377 mesh->edge[i].b = edges[j+1];
1379 mesh->edge[i].ref = refs[i-1];
1392 for (i=1;i<=
mesh->na;i++)
1395 edges[j] =
mesh->edge[i].a;
1396 edges[j+1] =
mesh->edge[i].b;
1399 refs[i-1] =
mesh->edge[i].ref;
1401 if ( areRidges != NULL ) {
1408 if ( areRequired != NULL ) {
1410 areRequired[i-1] = 1;
1412 areRequired[i-1] = 0;
1423 if ( k < 1 || k >
mesh->nt ) {
1424 fprintf(stderr,
"\n ## Error: %s: unable to access to triangle %" MMG5_PRId
".\n",
1426 fprintf(stderr,
" Tria numbering goes from 1 to %" MMG5_PRId
"\n",
mesh->nt);
1429 pt = &
mesh->tria[k];
1432 if ( (!met) || (!met->
m) || met->
size==1 ) {
1446 fprintf(stderr,
"\n ## Error: %s: You must set the number of"
1447 " solution with the",__func__);
1448 fprintf(stderr,
" MMG2D_Set_solSize function before setting values");
1449 fprintf(stderr,
" in solution structure \n");
1453 if ( pos >= met->
npmax ) {
1454 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
1456 fprintf(stderr,
" max number of solutions: %" MMG5_PRId
"\n",met->
npmax);
1460 if ( pos > met->
np ) {
1461 fprintf(stderr,
"\n ## Error: %s: attempt to set new solution"
1462 " at position %" MMG5_PRId
".",__func__,pos);
1463 fprintf(stderr,
" Overflow of the given number of solutions: %" MMG5_PRId
"\n",met->
np);
1464 fprintf(stderr,
" ## Check the solution size, its compactness or the position");
1465 fprintf(stderr,
" of the solution.\n");
1477 if ( met->
npi == met->
np ) {
1480 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter"
1481 " of points.\n",__func__);
1482 fprintf(stderr,
" You must pass here exactly one time (the first time ");
1483 fprintf(stderr,
"you call the MMG2D_Get_scalarSol function).\n");
1484 fprintf(stderr,
" If not, the number of call of this function");
1485 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1491 if ( met->
npi > met->
np ) {
1492 fprintf(stderr,
"\n ## Error: %s: unable to get solution.\n",
1494 fprintf(stderr,
" The number of call of MMG2D_Get_scalarSol function");
1495 fprintf(stderr,
" can not exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1499 *s = met->
m[met->
npi];
1508 fprintf(stderr,
"\n ## Error: %s: you must set the number of"
1509 " solution with the",__func__);
1510 fprintf(stderr,
" MMG2D_Set_solSize function before setting values");
1511 fprintf(stderr,
" in solution structure \n");
1515 for ( k=0; k<met->
np; ++k )
1524 for ( k=0; k<met->
np; ++k )
1534 fprintf(stderr,
"\n ## Error: %s: you must set the number of"
1535 " solution with the",__func__);
1536 fprintf(stderr,
" MMG2D_Set_solSize function before setting values");
1537 fprintf(stderr,
" in solution structure \n");
1541 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
1543 fprintf(stderr,
" Minimal index of the solution position must be 1.\n");
1546 if ( pos >= met->
npmax ) {
1547 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
1549 fprintf(stderr,
" max number of solutions: %" MMG5_PRId
"\n",met->
npmax);
1553 if ( pos > met->
np ) {
1554 fprintf(stderr,
"\n ## Error: %s: attempt to set new solution"
1555 " at position %" MMG5_PRId
".",__func__,pos);
1556 fprintf(stderr,
" Overflow of the given number of solutions: %" MMG5_PRId
"\n",met->
np);
1557 fprintf(stderr,
"\n ## Check the solution size, its compactness or the position");
1558 fprintf(stderr,
" of the solution.\n");
1562 isol = (pos-1) * met->
size + 1;
1565 met->
m[isol+1] = vy;
1575 if ( met->
npi == met->
np ) {
1578 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of points.\n",
1580 fprintf(stderr,
" You must pass here exactly one time (the first time ");
1581 fprintf(stderr,
"you call the MMG2D_Get_vectorSol function).\n");
1582 fprintf(stderr,
" If not, the number of call of this function");
1583 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1589 if ( met->
npi > met->
np ) {
1590 fprintf(stderr,
"\n ## Error: %s: unable to get solution.\n",__func__);
1591 fprintf(stderr,
" The number of call of MMG2D_Get_vectorSol function");
1592 fprintf(stderr,
" can not exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1596 *vx = met->
m[met->
size*(met->
npi-1)+1];
1597 *vy = met->
m[met->
size*(met->
npi-1)+2];
1607 fprintf(stderr,
"\n ## Error: %s: you must set the number of"
1608 " solution with the",__func__);
1609 fprintf(stderr,
" MMG2D_Set_solSize function before setting values");
1610 fprintf(stderr,
" in solution structure \n");
1614 for ( k=0; k<met->
np; ++k ) {
1628 for ( k=0; k<met->
np; ++k ) {
1645 fprintf(stderr,
"\n ## Error: %s: you must set the number of"
1646 " solution with the",__func__);
1647 fprintf(stderr,
" MMG2D_Set_solSize function before setting values");
1648 fprintf(stderr,
" in solution structure \n");
1652 if ( pos >= met->
npmax ) {
1653 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
1655 fprintf(stderr,
" max number of solutions: %" MMG5_PRId
"\n",met->
npmax);
1659 if ( pos > met->
np ) {
1660 fprintf(stderr,
"\n ## Error: %s: attempt to set new solution "
1661 "at position %" MMG5_PRId
".",__func__,pos);
1662 fprintf(stderr,
" Overflow of the given number of solutions: %" MMG5_PRId
"\n",met->
np);
1663 fprintf(stderr,
" ## Check the solution size, its compactness or the position");
1664 fprintf(stderr,
" of the solution.\n");
1667 isol = pos * met->
size;
1668 met->
m[isol ] = m11;
1669 met->
m[isol + 1] = m12;
1670 met->
m[isol + 2] = m22;
1679 if ( met->
npi == met->
np ) {
1682 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of points.\n",
1684 fprintf(stderr,
" You must pass here exactly one time (the first time ");
1685 fprintf(stderr,
"you call the MMG2D_Get_tensorSol function).\n");
1686 fprintf(stderr,
" If not, the number of call of this function");
1687 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1693 if ( met->
npi > met->
np ) {
1694 fprintf(stderr,
"\n ## Error: %s: unable to get solution.\n",__func__);
1695 fprintf(stderr,
" The number of call of MMG2D_Get_tensorSol function");
1696 fprintf(stderr,
" can not exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1701 *m11 = met->
m[isol ];
1702 *m12 = met->
m[isol+1];
1703 *m22 = met->
m[isol+2];
1713 fprintf(stderr,
"\n ## Error: %s: You must set the number"
1714 " of solution with the",__func__);
1715 fprintf(stderr,
" MMG2D_Set_solSize function before setting values");
1716 fprintf(stderr,
" in solution structure \n");
1720 for ( k=0; k<met->
np; ++k ) {
1735 for ( k=0; k<met->
np; ++k ) {
1753 switch ( psl->
type ) {
1767 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s.\n",
1781 switch ( psl->
type ) {
1795 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s\n",
1809 switch ( psl->
type ) {
1823 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s.\n",
1838 switch ( psl->
type ) {
1852 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s\n",
1863 fprintf(stderr,
"\n ## Error: %s: if you don't use the MMG2D_loadMesh function,",
1865 fprintf(stderr,
" you must call the MMG2D_Set_meshSize function to have a");
1866 fprintf(stderr,
" valid mesh.\n");
1867 fprintf(stderr,
" Missing datas.\n");
1871 if ( met->
npi != met->
np ) {
1872 fprintf(stderr,
"\n ## Error: %s: if you don't use the MMG2D_loadMet function,",
1874 fprintf(stderr,
" you must call the MMG2D_Set_solSize function to have a");
1875 fprintf(stderr,
" valid solution.\n");
1876 fprintf(stderr,
" Missing datas.\n");
1881 if (
mesh->info.ddebug ) {
1882 if ( (!
mesh->np) || (!
mesh->point) ||
1884 fprintf(stderr,
" ** MISSING DATA.\n");
1885 fprintf(stderr,
" Check that your mesh contains points.\n");
1886 fprintf(stderr,
" Exit program.\n");
1891 if (
mesh->dim != 2 ) {
1892 fprintf(stderr,
" ** 2 DIMENSIONAL MESH NEEDED. Exit program.\n");
1895 if ( met->
dim != 2 ) {
1896 fprintf(stderr,
" ** WRONG DIMENSION FOR METRIC. Exit program.\n");
1900 if ( !met ->ver ) met ->
ver = 2;
const char * MMG5_Get_typeName(enum MMG5_type typ)
int MMG5_Set_inputParamName(MMG5_pMesh mesh, const char *fparamin)
int MMG5_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
int MMG5_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
int MMG5_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
int MMG5_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
void MMG5_Init_parameters(MMG5_pMesh mesh)
const char * MMG5_Get_entitiesName(enum MMG5_entities ent)
void MMG5_Init_fileNames(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG5_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
int MMG2D_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
Set level-set base reference.
int MMG2D_Set_scalarSol(MMG5_pSol met, double s, MMG5_int pos)
Set a single value of a sol structure.
int MMG2D_Get_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
Get one out of several scalar solutions at all vertices in the mesh.
void MMG2D_Init_parameters(MMG5_pMesh mesh)
Initialize the input parameters (stored in the Info structure).
void MMG2D_Init_fileNames(MMG5_pMesh mesh, MMG5_pSol sol)
Initialize file names to their default values.
int MMG2D_Set_quadrilateral(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int v3, MMG5_int ref, MMG5_int pos)
Set the vertices and reference of a single quadrangle in a mesh.
int MMG2D_Unset_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from edge k.
int MMG2D_Set_vertex(MMG5_pMesh mesh, double c0, double c1, MMG5_int ref, MMG5_int pos)
Set the coordinates and reference of a single vertex.
int MMG2D_Set_scalarSols(MMG5_pSol met, double *s)
Set all values of a scalar sol structure.
int MMG2D_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMG2D_Get_vectorSols(MMG5_pSol met, double *sols)
Get all elements of a vector sol structure.
int MMG2D_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val)
Set integer parameter iparam to value val.
int MMG2D_Set_meshSize(MMG5_pMesh mesh, MMG5_int np, MMG5_int nt, MMG5_int nquad, MMG5_int na)
Set the numbers of entities in the mesh.
int MMG2D_Set_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
Give edge k the "required" attribute.
int MMG2D_Get_quadrilateral(MMG5_pMesh mesh, MMG5_int *v0, MMG5_int *v1, MMG5_int *v2, MMG5_int *v3, MMG5_int *ref, int *isRequired)
Get the vertices and reference of the next quadrangle of the mesh.
int MMG2D_Set_tensorSol(MMG5_pSol met, double m11, double m12, double m22, MMG5_int pos)
Set a single element of a tensor sol structure.
int MMG2D_Get_vectorSol(MMG5_pSol met, double *vx, double *vy)
Get the next element of a vector sol structure.
int MMG2D_Set_edge(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int ref, MMG5_int pos)
Define a single edge.
int MMG2D_Set_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
Set all elements of one out of multiple solution fields that are defined on vertices.
int MMG2D_Unset_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from triangle k.
int MMG2D_Set_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs)
Set the vertices and references of all triangles in a mesh.
int MMG2D_GetByIdx_vertex(MMG5_pMesh mesh, double *c0, double *c1, MMG5_int *ref, int *isCorner, int *isRequired, MMG5_int idx)
Get the coordinates and reference of a specific vertex in the mesh.
int MMG2D_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
Deallocate an array of solution fields.
int MMG2D_Set_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
Set a single element of one out of multiple solution fields that are defined on vertices.
int MMG2D_Get_scalarSol(MMG5_pSol met, double *s)
Get the scalar solution value s of next element of a solution.
int MMG2D_Get_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs, int *areCorners, int *areRequired)
Get the coordinates and references of all vertices in the mesh.
int MMG2D_Unset_corner(MMG5_pMesh mesh, MMG5_int k)
Remove the "corner" attribute from a vertex.
int MMG2D_Get_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int *typEntity, MMG5_int *np, int *typSol)
Get the number of solutions, their dimension and their type.
int MMG2D_Get_tensorSol(MMG5_pSol met, double *m11, double *m12, double *m22)
Get the next element of a tensor sol structure.
int MMG2D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Set the size and type of a solution field.
int MMG2D_Free_structures(const int starter,...)
Structure deallocations before return.
int MMG2D_Chk_meshData(MMG5_pMesh mesh, MMG5_pSol met)
Check if the number of given entities match with mesh and sol size.
int MMG2D_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
Set the name of the input solution file.
int MMG2D_Set_tensorSols(MMG5_pSol met, double *sols)
Set all elements of a tensor sol structure.
int MMG2D_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
Set the name of the input mesh.
int MMG2D_Get_vertex(MMG5_pMesh mesh, double *c0, double *c1, MMG5_int *ref, int *isCorner, int *isRequired)
Get the coordinates and reference ref of the next vertex of a mesh.
int MMG2D_Get_scalarSols(MMG5_pSol met, double *s)
Get all elements of a scalar sol structure.
int MMG2D_Set_vectorSol(MMG5_pSol met, double vx, double vy, MMG5_int pos)
Set a single vector value in a sol structure.
int MMG2D_Get_edge(MMG5_pMesh mesh, MMG5_int *e0, MMG5_int *e1, MMG5_int *ref, int *isRidge, int *isRequired)
Get the vertices and reference of the next edge in the mesh.
double MMG2D_Get_triangleQuality(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k)
Get the quality measure of a single triangle in the mesh.
int MMG2D_Set_triangle(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int ref, MMG5_int pos)
Set the vertices and reference of a single triangle in a mesh.
int MMG2D_Set_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int nsols, MMG5_int np, int *typSol)
Initialize an array of solutions field defined at vertices.
int MMG2D_Get_tensorSols(MMG5_pSol met, double *sols)
Get all elements of a tensor sol structure.
int MMG2D_Get_meshSize(MMG5_pMesh mesh, MMG5_int *np, MMG5_int *nt, MMG5_int *nquad, MMG5_int *na)
Get the number of vertices, triangles and edges of the mesh.
int MMG2D_Get_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs, int *areRidges, int *areRequired)
Get the vertices and references of all edges in a mesh.
int MMG2D_Get_quadrilaterals(MMG5_pMesh mesh, MMG5_int *quadra, MMG5_int *refs, int *areRequired)
Get the vertices and references of all quadrangles of the mesh.
int MMG2D_Set_localParameter(MMG5_pMesh mesh, MMG5_pSol sol, int typ, MMG5_int ref, double hmin, double hmax, double hausd)
Set local parameters.
int MMG2D_Set_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs)
Set the coordinates and references of all vertices in the mesh.
int MMG2D_Get_triangle(MMG5_pMesh mesh, MMG5_int *v0, MMG5_int *v1, MMG5_int *v2, MMG5_int *ref, int *isRequired)
Get the vertices and reference of the next triangle in the mesh.
int MMG2D_Set_vectorSols(MMG5_pSol met, double *sols)
Set all values in a vector sol structure.
int MMG2D_Set_corner(MMG5_pMesh mesh, MMG5_int k)
Assign the "corner" attribute to a vertex.
int MMG2D_Set_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs)
Set the vertices and references of all edges in a mesh.
int MMG2D_Set_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
Assign the "required" attribute to a vertex.
int MMG2D_Get_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
Get one out of several scalar solutions at a specific vertex.
int MMG2D_Set_parallelEdge(MMG5_pMesh mesh, MMG5_int k)
Give edge k the "parallel" attribute.
int MMG2D_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val)
Set double parameter dparam to value val.
int MMG2D_Free_all(const int starter,...)
Deallocations before return.
int MMG2D_Set_multiMat(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int ref, int split, MMG5_int rin, MMG5_int rout)
Set the reference mapping for the elements of ref ref in LS discretization mode.
int MMG2D_Get_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int *nsols, MMG5_int *np, int *typSol)
Get the number of elements and dimension of a solution defined on vertices.
int MMG2D_Get_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs, int *areRequired)
Get the vertices and references of all triangles in the mesh.
int MMG2D_Set_inputParamName(MMG5_pMesh mesh, const char *fparamin)
Set the name of the input parameter file.
int MMG2D_Set_quadrilaterals(MMG5_pMesh mesh, MMG5_int *quadra, MMG5_int *refs)
Set the vertices and references of all quadrangles in a mesh.
int MMG2D_Free_names(const int starter,...)
Structure deallocations before return.
int MMG2D_Unset_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from a vertex.
int MMG2D_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
Set the name of the output mesh file.
int MMG2D_Set_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
Give triangle k the "required" attribute.
int MMG2D_Set_outputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solout)
Set the name of the output solution file.
MMG5_pMesh MMG5_pSol * sol
va_start(argptr, starter)
API headers and documentation for the mmg2d library.
@ MMG2D_IPARAM_numsubdomain
@ MMG2D_IPARAM_numberOfLocalParam
@ MMG2D_IPARAM_numberOfLSBaseReferences
@ MMG2D_IPARAM_numberOfMat
@ MMG2D_DPARAM_angleDetection
int MMG2D_setMeshSize_alloc(MMG5_pMesh)
int MMG2D_memOption(MMG5_pMesh mesh)
double MMG2D_caltri_ani(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
double MMG2D_caltri_iso(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pTria)
int MMG2D_Free_all_var(va_list argptr)
int MMG2D_Free_structures_var(va_list argptr)
int MMG2D_Free_names_var(va_list argptr)
int MMG2D_Init_mesh_var(va_list argptr)
LIBMMG_CORE_EXPORT int MMG5_Set_multiMat(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int ref, int split, MMG5_int rin, MMG5_int rex)
#define MMG5_VOLFRAC
API header for the common part of the MMG libraries.
LIBMMG_CORE_EXPORT int MMG5_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
double MMG2D_quickarea(double a[2], double b[2], double c[2])
#define MMG5_INCREASE_MEM_MESSAGE()
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MMG5_DEL_MEM(mesh, ptr)
To store user-defined references in the mesh (useful in LS mode)
Local parameters for a specific entity and reference.