95 if ( ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) &&
sol->m )
96 fprintf(stderr,
"\n ## Warning: %s: old solution deletion.\n",__func__);
99 fprintf(stderr,
"\n ## Error: %s: mmgs need a solution imposed on vertices.\n",
115 mesh->info.metRidTyp = 0;
118 fprintf(stderr,
"\n ## Error: %s: type of solution not yet implemented.\n",
133 fprintf(stderr,
" Exit program.\n");
141 MMG5_int nentities,
int *typSol) {
146 if ( ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) &&
mesh->nsols ) {
148 fprintf(stderr,
"\n ## Warning: %s: old solutions array deletion.\n",
161 for ( j=0; j<nsols; ++j ) {
166 sprintf(data,
"sol_%d",j);
171 sprintf(data,
"sol_%d.o",j);
177 fprintf(stderr,
"\n ## Error: %s: unable to set the size of the"
178 " solution num %d.\n",__func__,j);
187 if ( ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) &&
189 fprintf(stderr,
"\n ## Warning: %s: old mesh deletion.\n",__func__);
199 fprintf(stderr,
" ** MISSING DATA:\n");
200 fprintf(stderr,
" Your mesh must contains at least points and triangles.\n");
212 if(
mesh->info.mem > 0) {
215 }
else if(
mesh->info.mem < 39) {
216 fprintf(stderr,
"\n ## Error: %s: not enough memory %d\n",
217 __func__,
mesh->info.mem);
232 if ( typEntity != NULL )
235 if ( typSol != NULL ) {
236 if (
sol->size == 1 )
238 else if (
sol->size == 3 )
240 else if (
sol->size == 6 )
257 MMG5_int* np,
int* typSol) {
262 fprintf(stderr,
"\n ## Error: %s: your mesh structure must be allocated"
263 " and filled\n",__func__);
268 *nsols =
mesh->nsols;
270 for ( j=0; j<
mesh->nsols; ++j ) {
273 if ( typSol != NULL ) {
274 typSol[j] = psl->
type;
277 assert( (!psl->
np) || (psl->
np ==
mesh->np));
300 fprintf(stderr,
"\n ## Error: %s: you must set the number of points with the",
302 fprintf(stderr,
" MMGS_Set_meshSize function before setting vertices in mesh.\n");
306 if ( pos >
mesh->npmax ) {
307 fprintf(stderr,
"\n ## Error: %s: unable to allocate a new point.\n",__func__);
308 fprintf(stderr,
" max number of points: %" MMG5_PRId
"\n",
mesh->npmax);
313 if ( pos >
mesh->np ) {
314 fprintf(stderr,
"\n ## Error: %s: attempt to set new vertex at position %" MMG5_PRId
".",
316 fprintf(stderr,
" Overflow of the given number of vertices: %" MMG5_PRId
"\n",
mesh->np);
317 fprintf(stderr,
"\n ## Check the mesh size, its compactness or the position");
318 fprintf(stderr,
" of the vertex.\n");
322 mesh->point[pos].c[0] = c0;
323 mesh->point[pos].c[1] = c1;
324 mesh->point[pos].c[2] = c2;
325 mesh->point[pos].ref = ref;
327 mesh->point[pos].flag = 0;
328 mesh->point[pos].tmp = 0;
339 for (i=1;i<=
mesh->np;i++)
341 ppt = &
mesh->point[i];
344 ppt->
c[0] = vertices[j];
345 ppt->
c[1] = vertices[j+1];
346 ppt->
c[2] = vertices[j+2];
353 ppt->
ref = refs[i-1];
361 int* isCorner,
int* isRequired) {
365 if (
mesh->info.ddebug ) {
366 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of points.\n",
368 fprintf(stderr,
" You must pass here exactly one time (the first time ");
369 fprintf(stderr,
"you call the MMGS_Get_vertex function).\n");
370 fprintf(stderr,
" If not, the number of call of this function");
371 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",
mesh->np);
378 fprintf(stderr,
"\n ## Error: %s: unable to get point.\n",__func__);
379 fprintf(stderr,
" The number of call of MMGS_Get_vertex function");
380 fprintf(stderr,
" can not exceed the number of points: %" MMG5_PRId
"\n ",
mesh->np);
388 int* isCorner,
int* isRequired, MMG5_int idx) {
390 if ( idx < 1 || idx >
mesh->np ) {
391 fprintf(stderr,
"\n ## Error: %s: unable to get point at position %" MMG5_PRId
".\n",
393 fprintf(stderr,
" Your vertices numbering goes from 1 to %" MMG5_PRId
"\n",
mesh->np);
397 *c0 =
mesh->point[idx].c[0];
398 *c1 =
mesh->point[idx].c[1];
399 *c2 =
mesh->point[idx].c[2];
401 *ref =
mesh->point[idx].ref;
403 if ( isCorner != NULL ) {
410 if ( isRequired != NULL ) {
421 int* areCorners,
int* areRequired) {
425 for (i=1;i<=
mesh->np;i++)
427 ppt = &
mesh->point[i];
430 vertices[j] = ppt->
c[0];
431 vertices[j+1] = ppt->
c[1];
432 vertices[j+2] = ppt->
c[2];
438 if ( areCorners !=NULL ) {
445 if ( areRequired != NULL ) {
459 fprintf(stderr,
"\n ## Error: %s: You must set the number of triangles"
460 " with the",__func__);
461 fprintf(stderr,
" MMGS_Set_meshSize function before setting triangles in mesh\n");
465 if ( pos >
mesh->ntmax ) {
466 fprintf(stderr,
"\n ## Error: %s: unable to allocate a new triangle.\n",
468 fprintf(stderr,
" max number of triangle: %" MMG5_PRId
"\n",
mesh->ntmax);
473 if ( pos >
mesh->nt ) {
474 fprintf(stderr,
"\n ## Error: %s: attempt to set new triangle at position %" MMG5_PRId
".",
476 fprintf(stderr,
" Overflow of the given number of triangles: %" MMG5_PRId
"\n",
mesh->nt);
477 fprintf(stderr,
"\n ## Check the mesh size, its compactness or the position");
478 fprintf(stderr,
" of the triangle.\n");
482 mesh->tria[pos].v[0] = v0;
483 mesh->tria[pos].v[1] = v1;
484 mesh->tria[pos].v[2] = v2;
485 mesh->tria[pos].ref = ref;
500 if (
mesh->info.ddebug ) {
501 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of triangles.\n",
503 fprintf(stderr,
" You must pass here exactly one time (the first time ");
504 fprintf(stderr,
"you call the MMGS_Get_triangle function).\n");
505 fprintf(stderr,
" If not, the number of call of this function");
506 fprintf(stderr,
" exceed the number of triangles: %" MMG5_PRId
"\n ",
mesh->nt);
513 fprintf(stderr,
"\n ## Error: %s: unable to get triangle.\n",__func__);
514 fprintf(stderr,
" The number of call of MMGS_Get_triangle function");
515 fprintf(stderr,
" can not exceed the number of triangles: %" MMG5_PRId
"\n ",
mesh->nt);
526 if ( isRequired != NULL ) {
541 for (i=1;i<=
mesh->nt;i++)
544 ptt = &
mesh->tria[i];
545 ptt->
v[0] = tria[j] ;
546 ptt->
v[1] = tria[j+1];
547 ptt->
v[2] = tria[j+2];
554 ptt->
ref = refs[i-1];
563 for (i=1;i<=
mesh->nt;i++)
566 ptt = &
mesh->tria[i];
568 tria[j+1] = ptt->
v[1];
569 tria[j+2] = ptt->
v[2];
572 refs[i-1] = ptt->
ref ;
573 if ( areRequired != NULL ) {
576 areRequired[i-1] = 1;
578 areRequired[i-1] = 0;
588 fprintf(stderr,
"\n ## Error: %s: You must set the number of edges with the",
590 fprintf(stderr,
" MMGS_Set_meshSize function before setting edges in mesh\n");
593 if ( pos >
mesh->namax ) {
594 fprintf(stderr,
"\n ## Error: %s: unable to allocate a new edge.\n",
596 fprintf(stderr,
" max number of edge: %" MMG5_PRId
"\n",
mesh->namax);
600 if ( pos >
mesh->na ) {
601 fprintf(stderr,
"\n ## Error: %s: attempt to set new edge at position %" MMG5_PRId
".",
603 fprintf(stderr,
" Overflow of the given number of edges: %" MMG5_PRId
"\n",
mesh->na);
604 fprintf(stderr,
"\n ## Check the mesh size, its compactness or the position");
605 fprintf(stderr,
" of the edge.\n");
609 mesh->edge[pos].a = v0;
610 mesh->edge[pos].b = v1;
611 mesh->edge[pos].ref = ref;
618 ,
int* isRidge,
int* isRequired) {
622 if (
mesh->info.ddebug ) {
623 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of edges.\n",
625 fprintf(stderr,
" You must pass here exactly one time (the first time ");
626 fprintf(stderr,
"you call the MMGS_Get_edge function).\n");
627 fprintf(stderr,
" If not, the number of call of this function");
628 fprintf(stderr,
" exceed the number of edges: %" MMG5_PRId
"\n ",
mesh->na);
635 fprintf(stderr,
"\n ## Error: %s: unable to get edge.\n",__func__);
636 fprintf(stderr,
" The number of call of MMGS_Get_edge function");
637 fprintf(stderr,
" can not exceed the number of edges: %" MMG5_PRId
"\n ",
mesh->na);
646 if ( isRidge != NULL ) {
653 if ( isRequired != NULL ) {
666 for (i=1;i<=
mesh->na;i++)
670 mesh->edge[i].a = edges[j];
671 mesh->edge[i].b = edges[j+1];
673 mesh->edge[i].ref = refs[i];
683 for (i=1;i<=
mesh->na;i++)
686 edges[j] =
mesh->edge[i].a;
687 edges[j+1] =
mesh->edge[i].b;
690 refs[i-1] =
mesh->edge[i].ref;
692 if ( areRidges != NULL ) {
699 if ( areRequired != NULL ) {
701 areRequired[i-1] = 1;
703 areRequired[i-1] = 0;
711 assert ( k <= mesh->np );
717 assert ( k <= mesh->np );
723 assert ( k <= mesh->np );
730 assert ( k <= mesh->np );
736 assert ( k <= mesh->nt );
744 assert ( k <= mesh->nt );
752 assert ( k <= mesh->na );
757 assert ( k <= mesh->na );
763 assert ( k <= mesh->na );
769 assert ( k <= mesh->na );
776 assert ( k <= mesh->np );
777 mesh->point[k].n[0] = n0;
778 mesh->point[k].n[1] = n1;
779 mesh->point[k].n[2] = n2;
788 assert ( k <= mesh->np );
789 (*n0) =
mesh->point[k].n[0];
790 (*n1) =
mesh->point[k].n[1];
791 (*n2) =
mesh->point[k].n[2];
800 if ( k < 1 || k >
mesh->nt ) {
801 fprintf(stderr,
"\n ## Error: %s: unable to access to triangle %" MMG5_PRId
".\n",
803 fprintf(stderr,
" Tria numbering goes from 1 to %" MMG5_PRId
"\n",
mesh->nt);
809 if ( (!met) || (!met->
m) || met->
size==1 ) {
813 else if ( !
mesh->info.metRidTyp ) {
826 fprintf(stderr,
"\n ## Error: %s: You must set the number of solution"
827 " with the",__func__);
828 fprintf(stderr,
" MMGS_Set_solSize function before setting values");
829 fprintf(stderr,
" in solution structure \n");
833 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
835 fprintf(stderr,
" Minimal index of the solution position must be 1.\n");
838 if ( pos >= met->
npmax ) {
839 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
841 fprintf(stderr,
" max number of solutions: %" MMG5_PRId
"\n",met->
npmax);
845 if ( pos > met->
np ) {
846 fprintf(stderr,
"\n ## Error: %s: attempt to set new solution at"
847 " position %" MMG5_PRId
".",__func__,pos);
848 fprintf(stderr,
" Overflow of the given number of solutions: %" MMG5_PRId
"\n",met->
np);
849 fprintf(stderr,
"\n ## Check the solution size, its compactness or the position");
850 fprintf(stderr,
" of the solution.\n");
861 if ( met->
npi == met->
np ) {
864 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of points.\n",
866 fprintf(stderr,
" You must pass here exactly one time (the first time ");
867 fprintf(stderr,
"you call the MMGS_Get_scalarSol function).\n");
868 fprintf(stderr,
" If not, the number of call of this function");
869 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
875 if ( met->
npi > met->
np ) {
876 fprintf(stderr,
"\n ## Error: %s: unable to get solution.\n",__func__);
877 fprintf(stderr,
" The number of call of MMGS_Get_scalarSol function");
878 fprintf(stderr,
" can not exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
882 *s = met->
m[met->
npi];
891 fprintf(stderr,
"\n ## Error: %s: You must set the number of solution"
892 " with the",__func__);
893 fprintf(stderr,
" MMGS_Set_solSize function before setting values");
894 fprintf(stderr,
" in solution structure \n");
898 for ( k=0; k<met->
np; ++k )
907 for ( k=0; k<met->
np; ++k )
917 fprintf(stderr,
"\n ## Error: %s: You must set the number of"
918 " solution with the",__func__);
919 fprintf(stderr,
" MMGS_Set_solSize function before setting values");
920 fprintf(stderr,
" in solution structure \n");
924 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
926 fprintf(stderr,
" Minimal index of the solution position must be 1.\n");
929 if ( pos >= met->
npmax ) {
930 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
932 fprintf(stderr,
" max number of solutions: %" MMG5_PRId
"\n",met->
npmax);
936 if ( pos > met->
np ) {
937 fprintf(stderr,
"\n ## Error: %s: attempt to set new solution at position %" MMG5_PRId
".",
939 fprintf(stderr,
" Overflow of the given number of solutions: %" MMG5_PRId
"\n",met->
np);
940 fprintf(stderr,
"\n ## Check the solution size, its compactness or the position");
941 fprintf(stderr,
" of the solution.\n");
946 met->
m[3*pos+1] = vy;
947 met->
m[3*pos+2] = vz;
955 if ( met->
npi == met->
np ) {
958 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of points.\n",
960 fprintf(stderr,
" You must pass here exactly one time (the first time ");
961 fprintf(stderr,
"you call the MMGS_Get_vectorSol function).\n");
962 fprintf(stderr,
" If not, the number of call of this function");
963 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
969 if ( met->
npi > met->
np ) {
970 fprintf(stderr,
"\n ## Error: %s: unable to get solution.\n",__func__);
971 fprintf(stderr,
" The number of call of MMGS_Get_vectorSol function");
972 fprintf(stderr,
" can not exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
976 *vx = met->
m[3*met->
npi];
977 *vy = met->
m[3*met->
npi+1];
978 *vz = met->
m[3*met->
npi+2];
989 fprintf(stderr,
"\n ## Error: %s: You must set the number of"
990 " solution with the",__func__);
991 fprintf(stderr,
" MMGS_Set_solSize function before setting values");
992 fprintf(stderr,
" in solution structure \n");
996 for ( k=0; k<met->
np; ++k ) {
1011 for ( k=0; k<met->
np; ++k ) {
1023 double m22,
double m23,
double m33, MMG5_int pos) {
1026 fprintf(stderr,
"\n ## Error: %s: You must set the number of"
1027 " solution with the",__func__);
1028 fprintf(stderr,
" MMGS_Set_solSize function before setting values");
1029 fprintf(stderr,
" in solution structure \n");
1033 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
1035 fprintf(stderr,
" Minimal index of the solution position must be 1.\n");
1038 if ( pos >= met->
npmax ) {
1039 fprintf(stderr,
"\n ## Error: %s: unable to set a new solution.\n",
1041 fprintf(stderr,
" max number of solutions: %" MMG5_PRId
"\n",met->
npmax);
1045 if ( pos > met->
np ) {
1046 fprintf(stderr,
"\n ## Error: %s: attempt to set new solution"
1047 " at position %" MMG5_PRId
".",__func__,pos);
1048 fprintf(stderr,
" Overflow of the given number of solutions: %" MMG5_PRId
"\n",met->
np);
1049 fprintf(stderr,
"\n ## Check the solution size, its compactness or the position");
1050 fprintf(stderr,
" of the solution.\n");
1054 met->
m[6*pos] = m11;
1055 met->
m[6*pos+1] = m12;
1056 met->
m[6*pos+2] = m13;
1057 met->
m[6*pos+3] = m22;
1058 met->
m[6*pos+4] = m23;
1059 met->
m[6*pos+5] = m33;
1065 double *m22,
double *m23,
double *m33) {
1069 if ( met->
npi == met->
np ) {
1072 fprintf(stderr,
"\n ## Warning: %s: reset the internal counter of"
1073 " points.\n",__func__);
1074 fprintf(stderr,
" You must pass here exactly one time (the first time ");
1075 fprintf(stderr,
"you call the MMGS_Get_tensorSol function).\n");
1076 fprintf(stderr,
" If not, the number of call of this function");
1077 fprintf(stderr,
" exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1083 if ( met->
npi > met->
np ) {
1084 fprintf(stderr,
"\n ## Error: %s: unable to get solution.\n",__func__);
1085 fprintf(stderr,
" The number of call of MMGS_Get_tensorSol function");
1086 fprintf(stderr,
" can not exceed the number of points: %" MMG5_PRId
"\n ",met->
np);
1090 *m11 = met->
m[6*met->
npi];
1091 *m12 = met->
m[6*met->
npi+1];
1092 *m13 = met->
m[6*met->
npi+2];
1093 *m22 = met->
m[6*met->
npi+3];
1094 *m23 = met->
m[6*met->
npi+4];
1095 *m33 = met->
m[6*met->
npi+5];
1106 fprintf(stderr,
"\n ## Error: %s: You must set the number"
1107 " of solution with the",__func__);
1108 fprintf(stderr,
" MMGS_Set_solSize function before setting values");
1109 fprintf(stderr,
" in solution structure \n");
1113 for ( k=0; k<met->
np; ++k ) {
1131 for ( k=0; k<met->
np; ++k ) {
1152 switch ( psl->
type ) {
1166 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s.\n",
1181 switch ( psl->
type ) {
1195 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s\n",
1209 switch ( psl->
type ) {
1223 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s.\n",
1237 switch ( psl->
type ) {
1251 fprintf(stderr,
"\n ## Error: %s: unexpected type of solution: %s\n",
1263 fprintf(stderr,
"\n ## Error: %s: if you don't use the MMGS_loadMesh"
1264 " function,",__func__);
1265 fprintf(stderr,
" you must call the MMGS_Set_meshSize function to have a");
1266 fprintf(stderr,
" valid mesh.\n");
1267 fprintf(stderr,
" Missing datas.\n");
1271 if ( met->
npi != met->
np ) {
1272 fprintf(stderr,
"\n ## Error: %s: if you don't use the MMGS_loadSol"
1273 " function,",__func__);
1274 fprintf(stderr,
" you must call the MMGS_Set_solSize function to have a");
1275 fprintf(stderr,
" valid solution.\n");
1276 fprintf(stderr,
" Missing datas.\n");
1281 if (
mesh->info.ddebug ) {
1282 if ( (!
mesh->np) || (!
mesh->point) ||
1284 fprintf(stderr,
" ** MISSING DATA.\n");
1285 fprintf(stderr,
" Check that your mesh contains points and triangles.\n");
1286 fprintf(stderr,
" Exit program.\n");
1291 if (
mesh->dim != 3 ) {
1292 fprintf(stderr,
" ** 3 DIMENSIONAL MESH NEEDED. Exit program.\n");
1295 if ( met->
dim != 3 ) {
1296 fprintf(stderr,
" ** WRONG DIMENSION FOR METRIC. Exit program.\n");
1300 if ( !met ->ver ) met ->
ver = 2;
1311 mesh->info.imprim = val;
1315 fprintf(stderr,
"\n ## Warning: %s: maximal memory authorized must be"
1316 " strictly positive.\n",__func__);
1317 fprintf(stderr,
" Reset to default value.\n");
1320 mesh->info.mem = val;
1324 mesh->info.ddebug = val;
1330 mesh->info.dhd = -1.;
1332 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
1333 fprintf(stderr,
"\n ## Warning: %s: angle detection parameter set"
1334 " to default value\n",__func__);
1339 if ( !
mesh->info.iso )
1340 mesh->info.iso = val;
1343 mesh->info.isoref = val;
1346 mesh->info.isosurf = val;
1349 if (
mesh->info.nmat ) {
1350 fprintf(stderr,
"\n ## Warning: %s: multi material mode not compatible with"
1351 " references preservation. Refs preservation disabled.\n",__func__);
1358 mesh->info.nsd = val;
1361 mesh->info.optim = val;
1364 mesh->info.noinsert = val;
1367 mesh->info.noswap = val;
1370 mesh->info.nomove = val;
1373 mesh->info.nreg = val;
1376 mesh->info.xreg = val;
1379 mesh->info.nosizreq = val;
1382 if (
mesh->info.par ) {
1384 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
1385 fprintf(stderr,
"\n ## Warning: %s: new local parameter values\n",__func__);
1387 mesh->info.npar = val;
1388 mesh->info.npari = 0;
1389 mesh->info.parTyp = 0;
1392 fprintf(stderr,
" Exit program.\n");
1397 inival = MMG5_INTMAX;
1399 for (k=0; k<
mesh->info.npar; k++) {
1401 mesh->info.par[k].ref = inival;
1402 mesh->info.par[k].hausd =
mesh->info.hausd;
1403 mesh->info.par[k].hmin =
mesh->info.hmin;
1404 mesh->info.par[k].hmax =
mesh->info.hmax;
1408 if (
mesh->info.br ) {
1410 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
1411 fprintf(stderr,
"\n ## Warning: %s: new level-set based references values\n",__func__);
1413 mesh->info.nbr = val;
1414 mesh->info.nbri = 0;
1416 printf(
" Exit program.\n");
1420 for (k=0; k<
mesh->info.nbr; k++)
1421 mesh->info.br[k] = 0;
1426 if (
mesh->info.mat ) {
1428 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug )
1429 fprintf(stderr,
"\n ## Warning: %s: new multi materials values\n",__func__);
1431 if (
mesh->info.iso == 2 ) {
1432 fprintf(stderr,
"\n ## Warning: %s: multi material mode not compatible with"
1433 " references preservation. Refs preservation disabled.\n",__func__);
1436 mesh->info.nmat = val;
1437 mesh->info.nmati = 0;
1440 printf(
" Exit program.\n");
1447 mesh->info.renum = val;
1451 mesh->info.ani = val;
1454 fprintf(stderr,
"\n ## Error: %s: unknown type of parameter\n",__func__);
1466 return mesh->info.imprim;
1469 return mesh->info.mem;
1472 return mesh->info.ddebug;
1475 if (
mesh->info.dhd <= 0. ) {
1483 return mesh->info.noinsert;
1486 return mesh->info.noswap;
1489 return mesh->info.nomove;
1492 return mesh->info.nreg;
1495 return mesh->info.xreg;
1498 return mesh->info.npar;
1502 return mesh->info.renum;
1506 fprintf(stderr,
"\n ## Error: %s: unknown type of parameter\n",__func__);
1516 mesh->info.dhd = val;
1518 mesh->info.dhd = cos(
mesh->info.dhd*M_PI/180.0);
1521 mesh->info.sethmin = 1;
1522 mesh->info.hmin = val;
1523 if (
mesh->info.sethmax && (
mesh->info.hmin >=
mesh->info.hmax ) ) {
1524 fprintf(stderr,
"\n ## Warning: hmin value must be strictly lower than hmax one"
1525 " (hmin = %lf hmax = %lf ).\n",
mesh->info.hmin,
mesh->info.hmax);
1530 mesh->info.sethmax = 1;
1531 mesh->info.hmax = val;
1532 if (
mesh->info.sethmin && (
mesh->info.hmin >=
mesh->info.hmax ) ) {
1533 fprintf(stderr,
"\n ## Warning: hmin value must be strictly lower than hmax one"
1534 " (hmin = %lf hmax = %lf ).\n",
mesh->info.hmin,
mesh->info.hmax);
1539 mesh->info.hsiz = val;
1542 mesh->info.hgrad = val;
1543 if (
mesh->info.hgrad <= 0.0 )
1544 mesh->info.hgrad = -1.0;
1546 mesh->info.hgrad = log(
mesh->info.hgrad);
1549 mesh->info.hgradreq = val;
1550 if (
mesh->info.hgradreq <= 0.0 )
1551 mesh->info.hgradreq = -1.0;
1553 mesh->info.hgradreq = log(
mesh->info.hgradreq);
1557 fprintf(stderr,
"\n ## Error: %s: hausdorff number must be strictly"
1558 " positive.\n",__func__);
1562 mesh->info.hausd = val;
1565 mesh->info.ls = val;
1568 if (val < 0.0 || val > 1.0) {
1569 fprintf(stderr,
"\n ## Error: %s: Coordinate regularization parameter must be comprised between 0 and 1.\n",__func__);
1572 mesh->info.lxreg = val;
1581 mesh->info.rmc = val;
1585 fprintf(stderr,
"\n ## Error: %s: unknown type of parameter\n",__func__);
1592 double hmin,
double hmax,
double hausd){
1596 if ( !
mesh->info.npar ) {
1597 fprintf(stderr,
"\n ## Error: %s: You must set the number of local"
1598 " parameters",__func__);
1599 fprintf(stderr,
" with the MMGS_Set_iparameters function before setting");
1600 fprintf(stderr,
" values in local parameters structure. \n");
1603 if (
mesh->info.npari >
mesh->info.npar ) {
1604 fprintf(stderr,
"\n ## Error: %s: unable to set a new local parameter.\n",
1606 fprintf(stderr,
" max number of local parameters: %d\n",
mesh->info.npar);
1610 fprintf(stderr,
"\n ## Warning: %s: you must apply your local parameters",
1612 fprintf(stderr,
" on triangles (MMG5_Triangle or %d).\n",
MMG5_Triangle);
1613 fprintf(stderr,
" ## Unknown type of entity: ignored.\n");
1617 fprintf(stderr,
"\n ## Error: %s: negative references are not allowed.\n",
1623 fprintf(stderr,
"\n ## Error: %s: negative hmin value is not allowed.\n",
1628 fprintf(stderr,
"\n ## Error: %s: negative hmax value is not allowed.\n",
1633 fprintf(stderr,
"\n ## Error: %s: negative hausd value is not allowed.\n",
1638 for (k=0; k<
mesh->info.npari; k++) {
1639 par = &
mesh->info.par[k];
1641 if ( par->
elt == typ && par->
ref == ref ) {
1645 if ( (
mesh->info.imprim > 5) ||
mesh->info.ddebug ) {
1646 fprintf(stderr,
"\n ## Warning: %s: new parameters (hausd, hmin and hmax)",
1648 fprintf(stderr,
" for entities of type %d and of ref %" MMG5_PRId
"\n",typ,ref);
1654 mesh->info.par[
mesh->info.npari].elt = typ;
1655 mesh->info.par[
mesh->info.npari].ref = ref;
1656 mesh->info.par[
mesh->info.npari].hmin = hmin;
1657 mesh->info.par[
mesh->info.npari].hmax = hmax;
1658 mesh->info.par[
mesh->info.npari].hausd = hausd;
1666 fprintf(stderr,
"\n ## Error: %s: unexpected entity type: %s.\n",
1677 int split,MMG5_int rin,MMG5_int rout){
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 MMGS_Get_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs, int *areCorners, int *areRequired)
Get the coordinates, references and attributes of all vertices in the mesh.
int MMGS_Set_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs)
Set the vertices and references of all triangles in the mesh.
int MMGS_Set_iparameter(MMG5_pMesh mesh, MMG5_pSol sol, int iparam, MMG5_int val)
set an integer parameter of the remesher
int MMGS_Get_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs, int *areRidges, int *areRequired)
Get vertices, references and attributes of all edges in the mesh.
int MMGS_Get_edge(MMG5_pMesh mesh, MMG5_int *e0, MMG5_int *e1, MMG5_int *ref, int *isRidge, int *isRequired)
Get the vertices, reference, and attributes of the next edge in the mesh.
int MMGS_Set_inputMeshName(MMG5_pMesh mesh, const char *meshin)
Set the name of the input mesh.
int MMGS_Get_vectorSol(MMG5_pSol met, double *vx, double *vy, double *vz)
Get the next element of a vector solution structure.
int MMGS_Get_tensorSols(MMG5_pSol met, double *sols)
Get all elements of a tensor solution field.
int MMGS_Get_meshSize(MMG5_pMesh mesh, MMG5_int *np, MMG5_int *nt, MMG5_int *na)
Get the number of vertices, triangles, and edges of the mesh.
int MMGS_Set_vertices(MMG5_pMesh mesh, double *vertices, MMG5_int *refs)
Set the coordinates and references of all vertices in a mesh.
int MMGS_Get_vectorSols(MMG5_pSol met, double *sols)
Get all elements of a vector solution structure.
int MMGS_Set_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
Assign the "required" attribute to a vertex.
int MMGS_Set_localParameter(MMG5_pMesh mesh, MMG5_pSol sol, int typ, MMG5_int ref, double hmin, double hmax, double hausd)
set a local parameter
int MMGS_Init_mesh(const int starter,...)
Initialize a mesh structure and optionally the associated solution and metric structures.
int MMGS_Set_inputParamName(MMG5_pMesh mesh, const char *fparamin)
Set the name of the input parameter file.
int MMGS_Free_allSols(MMG5_pMesh mesh, MMG5_pSol *sol)
Deallocate an array of solution fields.
int MMGS_Unset_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from an edge.
int MMGS_Set_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int nsols, MMG5_int nentities, int *typSol)
Initialize an array of solution fields defined at vertices: set dimension, types and number of fields...
int MMGS_Get_tensorSol(MMG5_pSol met, double *m11, double *m12, double *m13, double *m22, double *m23, double *m33)
Get the next element of a tensor solution structure.
int MMGS_Set_vertex(MMG5_pMesh mesh, double c0, double c1, double c2, MMG5_int ref, MMG5_int pos)
Set the coordinates of a single vertex.
int MMGS_Get_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int *typEntity, MMG5_int *np, int *typSol)
Get the number of elements, dimension, and type of a solution.
int MMGS_Set_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
Assign the "required" attribute to a triangle.
int MMGS_Set_scalarSols(MMG5_pSol met, double *s)
Set the values of all elements of a scalar solution structure.
int MMGS_Get_ithSols_inSolsAtVertices(MMG5_pSol sol, int i, double *s)
Get one out of several solutions at all vertices in the mesh.
int MMGS_Free_structures(const int starter,...)
Structure deallocations before return.
int MMGS_Set_edges(MMG5_pMesh mesh, MMG5_int *edges, MMG5_int *refs)
Set the vertices and references of all edges in a mesh.
int MMGS_Unset_requiredVertex(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from a vertex.
int MMGS_Unset_requiredTriangle(MMG5_pMesh mesh, MMG5_int k)
Remove the "required" attribute from a vertex.
int MMGS_Free_all(const int starter,...)
Deallocations before return.
int MMGS_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 MMGS_Set_tensorSol(MMG5_pSol met, double m11, double m12, double m13, double m22, double m23, double m33, MMG5_int pos)
Set a single element of a tensor solution structure.
void MMGS_Init_parameters(MMG5_pMesh mesh)
Initialize the input parameters.
int MMGS_Set_requiredEdge(MMG5_pMesh mesh, MMG5_int k)
Assign the "required" attribute to an edge.
int MMGS_Set_ridge(MMG5_pMesh mesh, MMG5_int k)
Assign the "ridge" attribute to an edge.
int MMGS_GetByIdx_vertex(MMG5_pMesh mesh, double *c0, double *c1, double *c2, MMG5_int *ref, int *isCorner, int *isRequired, MMG5_int idx)
Get the coordinates and reference of a specific vertex in the mesh.
int MMGS_Get_scalarSol(MMG5_pSol met, double *s)
Get the next element of a scalar solution structure.
int MMGS_Set_inputSolName(MMG5_pMesh mesh, MMG5_pSol sol, const char *solin)
Set the name of the input solution file.
int MMGS_Get_ithSol_inSolsAtVertices(MMG5_pSol sol, int i, double *s, MMG5_int pos)
Get one out of several solutions at a specific vertex.
int MMGS_Set_edge(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int ref, MMG5_int pos)
Set the vertices and reference of one edge in the mesh.
int MMGS_Get_iparameter(MMG5_pMesh mesh, MMG5_int iparam)
Get the value of an integer parameter of the remesher.
void MMGS_Init_fileNames(MMG5_pMesh mesh, MMG5_pSol sol)
Initialize file names to their default values.
int MMGS_Set_lsBaseReference(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int br)
Set a new level-set base reference.
int MMGS_Set_corner(MMG5_pMesh mesh, MMG5_int k)
Assign the "corner" attribute to a vertex.
int MMGS_Set_scalarSol(MMG5_pSol met, double s, MMG5_int pos)
Set a single element of a scalar solution structure.
int MMGS_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Initialize an array of solution fields: set dimension, types and number of fields.
int MMGS_Get_solsAtVerticesSize(MMG5_pMesh mesh, MMG5_pSol *sol, int *nsols, MMG5_int *np, int *typSol)
Get the number of elements, type, and dimensions of several solutions defined on vertices.
int MMGS_Get_scalarSols(MMG5_pSol met, double *s)
Get all elements of a scalar solution structure.
int MMGS_Unset_corner(MMG5_pMesh mesh, MMG5_int k)
Remove the "corner" attribute from a vertex.
int MMGS_Set_vectorSols(MMG5_pSol met, double *sols)
Set all elements of a vector solution structure.
int MMGS_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 reference ref in level-set discretization mode.
int MMGS_Get_triangle(MMG5_pMesh mesh, MMG5_int *v0, MMG5_int *v1, MMG5_int *v2, MMG5_int *ref, int *isRequired)
Get the vertices, reference, and required attribute of the next triangle in the mesh.
int MMGS_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 MMGS_Set_meshSize(MMG5_pMesh mesh, MMG5_int np, MMG5_int nt, MMG5_int na)
Set the number of vertices, triangles and edges of the mesh and allocate the associated tables.
int MMGS_Set_vectorSol(MMG5_pSol met, double vx, double vy, double vz, MMG5_int pos)
Set a single element of a vector solution structure.
int MMGS_Set_triangle(MMG5_pMesh mesh, MMG5_int v0, MMG5_int v1, MMG5_int v2, MMG5_int ref, MMG5_int pos)
Set the coordinates and reference of a single triangle.
int MMGS_Get_normalAtVertex(MMG5_pMesh mesh, MMG5_int k, double *n0, double *n1, double *n2)
Get the normal orientation at an edge.
int MMGS_Get_vertex(MMG5_pMesh mesh, double *c0, double *c1, double *c2, MMG5_int *ref, int *isCorner, int *isRequired)
Get the coordinates c0, c1,c2 and reference ref of the next vertex of mesh.
double MMGS_Get_triangleQuality(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k)
Get the quality measure of a triangle.
int MMGS_Chk_meshData(MMG5_pMesh mesh, MMG5_pSol met)
Check if the numbers of given entities match with mesh and solution size and check mesh data.
int MMGS_Set_tensorSols(MMG5_pSol met, double *sols)
Set all elements of a tensor solution structure.
int MMGS_Unset_ridge(MMG5_pMesh mesh, MMG5_int k)
Remove the "ridge" attribute from an edge.
int MMGS_Set_normalAtVertex(MMG5_pMesh mesh, MMG5_int k, double n0, double n1, double n2)
Set the normal orientation at a single vertex.
int MMGS_Set_outputMeshName(MMG5_pMesh mesh, const char *meshout)
Set the name of the output mesh file.
int MMGS_Free_names(const int starter,...)
Structure deallocations before return.
int MMGS_Get_triangles(MMG5_pMesh mesh, MMG5_int *tria, MMG5_int *refs, int *areRequired)
Get the vertices, references, and required attributes of all triangles in the mesh.
int MMGS_Set_dparameter(MMG5_pMesh mesh, MMG5_pSol sol, int dparam, double val)
set a real-valued parameter of the remesher
int MMGS_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)
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)
API headers and documentation for the mmgs library.
@ MMGS_IPARAM_numberOfLocalParam
@ MMGS_IPARAM_numsubdomain
@ MMGS_DPARAM_angleDetection
@ MMGS_IPARAM_numberOfLSBaseReferences
@ MMGS_IPARAM_numberOfMat
int MMGS_Init_mesh_var(va_list argptr)
int MMGS_setMeshSize_alloc(MMG5_pMesh mesh)
int MMGS_Free_all_var(va_list argptr)
int MMGS_Free_names_var(va_list argptr)
int MMGS_memOption(MMG5_pMesh mesh)
int MMGS_Free_structures_var(va_list argptr)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
double MMG5_caltri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
#define MMG5_INCREASE_MEM_MESSAGE()
#define MMG5_ADD_MEM(mesh, size, message, law)
double MMG5_caltri_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
double MMG5_caltri33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt)
#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.