59 double vfrac,lam,area,o1[3],o2[3],o3[3];
66 lam = v[i0] / (v[i0]-v[i1]);
67 o1[0] = ppt[i0]->
c[0] + lam*(ppt[i1]->
c[0]-ppt[i0]->
c[0]);
68 o1[1] = ppt[i0]->
c[1] + lam*(ppt[i1]->
c[1]-ppt[i0]->
c[1]);
69 o1[2] = ppt[i0]->
c[2] + lam*(ppt[i1]->
c[2]-ppt[i0]->
c[2]);
71 lam = v[i0] / (v[i0]-v[i2]);
72 o2[0] = ppt[i0]->
c[0] + lam*(ppt[i2]->
c[0]-ppt[i0]->
c[0]);
73 o2[1] = ppt[i0]->
c[1] + lam*(ppt[i2]->
c[1]-ppt[i0]->
c[1]);
74 o2[2] = ppt[i0]->
c[2] + lam*(ppt[i2]->
c[2]-ppt[i0]->
c[2]);
76 lam = v[i0] / (v[i0]-v[i3]);
77 o3[0] = ppt[i0]->
c[0] + lam*(ppt[i3]->
c[0]-ppt[i0]->
c[0]);
78 o3[1] = ppt[i0]->
c[1] + lam*(ppt[i3]->
c[1]-ppt[i0]->
c[1]);
79 o3[2] = ppt[i0]->
c[2] + lam*(ppt[i3]->
c[2]-ppt[i0]->
c[2]);
87 area =
MMG5_det4pt(ppt[0]->c,ppt[1]->c,ppt[2]->c,ppt[3]->c);
88 vfrac = fabs(area) - vfrac;
110 double v[4],vfm,vfp,lam,eps,o[18];
111 int nplus,nminus,nzero;
114 int8_t i,i0,i1,imin1,imin2,iplus1,iplus2,iz;
116 const uint8_t *taued;
138 nplus = nminus = nzero = 0;
139 imin1 = imin2 = iplus1 = iplus2 = iz = -1;
141 for (i=0; i<4; i++) {
142 if ( fabs(v[i]) < eps ) {
144 if ( iz < 0 ) iz = i;
146 else if ( v[i] >= eps ) {
148 if ( iplus1 < 0 ) iplus1 = i;
149 else if ( iplus2 < 0 ) iplus2 = i;
153 if ( imin1 < 0 ) imin1 = i;
154 else if ( imin2 < 0 ) imin2 = i;
159 if ( nzero == 4 )
return 0.0;
163 vfp =
MMG5_det4pt(ppt[0]->c,ppt[1]->c,ppt[2]->c,ppt[3]->c);
165 if ( pm == 1 )
return vfp;
171 vfm =
MMG5_det4pt(ppt[0]->c,ppt[1]->c,ppt[2]->c,ppt[3]->c);
173 if ( pm == -1 )
return vfm;
188 for ( ia=0; ia<18; ++ia ) {
193 assert ( nplus==2 && nminus==2 );
196 for ( ia=0; ia<6; ++ia ) {
201 else if (
MG_SMSGN(v[i0],v[i1]) )
continue;
206 lam = v[i0] / (v[i0]-v[i1]);
207 o[3*ia ] = ppt[i0]->
c[0] + lam*(ppt[i1]->
c[0]-ppt[i0]->
c[0]);
208 o[3*ia+1] = ppt[i0]->
c[1] + lam*(ppt[i1]->
c[1]-ppt[i0]->
c[1]);
209 o[3*ia+2] = ppt[i0]->
c[2] + lam*(ppt[i1]->
c[2]-ppt[i0]->
c[2]);
212 assert ( flag==30 || flag==45 || flag==51 );
215 tau[0] = 0 ; tau[1] = 1 ; tau[2] = 2 ; tau[3] = 3;
220 tau[0] = 1 ; tau[1] = 3 ; tau[2] = 2 ; tau[3] = 0;
225 tau[0] = 1 ; tau[1] = 2 ; tau[2] = 0 ; tau[3] = 3;
231 if ( v[tau[0]] < 0.0 ) {
242 if ( v[tau[0]] < 0.0 ) {
250 assert ( cfg == 0 || cfg == 2 );
254 vfp = fabs (
MMG5_det4pt(ppt[tau[0]]->c,ppt[tau[1]]->c,&o[3*taued[3]],&o[3*taued[4]]) );
255 vfp += fabs (
MMG5_det4pt(ppt[tau[0]]->c,&o[3*taued[4]],&o[3*taued[3]],&o[3*taued[2]]) );
256 vfp += fabs (
MMG5_det4pt(ppt[tau[0]]->c,&o[3*taued[3]],&o[3*taued[1]],&o[3*taued[2]]) );
261 else if ( cfg == 2 ) {
262 vfm = fabs (
MMG5_det4pt(&o[3*taued[2]],&o[3*taued[4]],ppt[tau[2]]->c,ppt[tau[3]]->c) );
263 vfm += fabs (
MMG5_det4pt(&o[3*taued[2]],&o[3*taued[3]],ppt[tau[2]]->c,&o[3*taued[4]]) );
264 vfm += fabs (
MMG5_det4pt(&o[3*taued[1]],&o[3*taued[3]],ppt[tau[2]]->c,&o[3*taued[2]]) );
274 vfm = fabs (
MMG5_det4pt(&o[3*taued[2]],&o[3*taued[4]],ppt[tau[2]]->c,ppt[tau[3]]->c) );
275 vfm += fabs (
MMG5_det4pt(&o[3*taued[2]],&o[3*taued[3]],ppt[tau[2]]->c,&o[3*taued[4]]) );
276 vfm += fabs (
MMG5_det4pt(&o[3*taued[1]],&o[3*taued[3]],ppt[tau[2]]->c,&o[3*taued[2]]) );
278 else if ( cfg == 2 ) {
279 vfp = fabs (
MMG5_det4pt(ppt[tau[0]]->c,ppt[tau[1]]->c,&o[3*taued[3]],&o[3*taued[4]]) );
280 vfp += fabs (
MMG5_det4pt(ppt[tau[0]]->c,&o[3*taued[4]],&o[3*taued[3]],&o[3*taued[2]]) );
281 vfp += fabs (
MMG5_det4pt(ppt[tau[0]]->c,&o[3*taued[3]],&o[3*taued[1]],&o[3*taued[2]]) );
287 vf = fabs (
MMG5_det4pt(ppt[0]->c,ppt[1]->c,ppt[2]->c,ppt[3]->c) );
321 for (k=1; k<=
mesh->
ne; k++) {
323 if ( !
MG_EOK(pt) )
continue;
325 for (i=0; i<4; i++) {
340 for ( k=1; k<=
mesh->
ne; k++ ) {
343 if ( !
MG_EOK(pt) )
continue;
367 detA = A[0][0]*(A[1][1]*A[2][2] - A[2][1]*A[1][2]) \
368 - A[0][1]*(A[1][0]*A[2][2] - A[2][0]*A[1][2]) \
369 + A[0][2]*(A[1][0]*A[2][1] - A[2][0]*A[1][1]);
373 r[0] = b[0]*(A[1][1]*A[2][2] - A[2][1]*A[1][2]) \
374 - A[0][1]*(b[1]*A[2][2] - b[2]*A[1][2]) \
375 + A[0][2]*(b[1]*A[2][1] - b[2]*A[1][1]);
377 r[1] = A[0][0]*(b[1]*A[2][2] - b[2]*A[1][2]) \
378 - b[0]*(A[1][0]*A[2][2] - A[2][0]*A[1][2]) \
379 + A[0][2]*(A[1][0]*b[2] - A[2][0]*b[1]);
381 r[2] = A[0][0]*(A[1][1]*b[2] - A[2][1]*b[1]) \
382 - A[0][1]*(A[1][0]*b[2] - A[2][0]*b[1]) \
383 + b[0]*(A[1][0]*A[2][1] - A[2][0]*A[1][1]);
411 int ibdy,ilist,cur,l;
413 int8_t i,i0,i1,i2,j0,j1,j2,j,ip,nzeros,nopp,nsame;
414 static int8_t mmgWarn0 = 0;
420 memset(bdy,0,(
MMG3D_LMAX+1)*
sizeof(MMG5_int));
421 memset(list,0,(
MMG3D_LMAX+1)*
sizeof(MMG5_int));
424 for (j=0; j<3; j++) {
431 fprintf(stderr,
"\n ## Warning: %s: at least 1 tetra with 4 null"
432 " values.\n",__func__);
441 list[ilist] = 4*k+indp;
447 while ( cur < ilist ) {
455 for (j=0; j<3; j++) {
458 if ( ( v1 != 0.0 ) && !
MG_SMSGN(v,v1) ) {
466 for (j=0; j<3; j++) {
472 if ( ( ( v1 != 0.0 ) &&
MG_SMSGN(v,v1) ) ||
473 ( ( v2 != 0.0 ) &&
MG_SMSGN(v,v2) ) ) {
480 if ( pt1->
flag == base )
continue;
481 for (ip=0; ip<4; ip++) {
482 if ( pt1->
v[ip] == np )
break;
486 list[ilist] = 4*jel + ip;
496 for(l=0; l<ilist; l++) {
501 nzeros = nsame = nopp = 0;
535 if ( !res && nzeros == 2 && nsame == 1 ) {
536 for (j=0; j<3; j++) {
539 if ( v0 != 0.0 &&
MG_SMSGN(v,v0) )
break;
546 v1 =
sol->m[pt1->
v[j0]];
547 if ( v1 != 0.0 && !
MG_SMSGN(v,v1) ) {
549 if ( pt1->
v[j] == np )
break;
554 if ( ( nzeros == 2 && nsame == 1 ) || ( nsame >= 1 && nopp >= 1 ) ) {
570 memset(list,0,(
MMG3D_LMAX+1)*
sizeof(MMG5_int));
574 while ( cur < ilist ) {
581 for (j=0; j<3; j++) {
587 if ( v1 == 0.0 && v2 == 0.0 ) {
595 else if ( ( ( v1 != 0.0 ) && (!
MG_SMSGN(v,v1)) ) || ( ( v2 != 0.0 ) && (!
MG_SMSGN(v,v2)) ) ) {
609 nzeros = nsame = nopp = 0;
632 if ( ( nzeros == 2 && nsame == 1 ) || ( nsame >= 1 && nopp >= 1 ) ) {
633 if ( pt1->
flag < base - 1 )
return 0;
636 if ( pt1->
flag == base )
continue;
637 for (ip=0; ip<4; ip++) {
638 if ( pt1->
v[ip] == np )
break;
642 list[ilist] = 4*jel + ip;
651 for (l=0; l<ibdy; l++) {
654 if ( pt->
flag != base )
return 0;
678 fprintf(stderr,
"\n ## Error: %s: hashing problem (1). Exit program.\n",
684 for (k=1; k<=
mesh->
np; k++)
688 fprintf(stderr,
" Exit program.\n");
693 for (k=1; k<=
mesh->
ne; k++) {
695 if ( !pt->
v[0] )
continue;
697 for (i=0; i<4; i++) {
702 for (i=0; i<4; i++) {
712 for (k=1; k<=
mesh->
np; k++) {
714 if ( !
MG_VOK(p0) )
continue;
717 fprintf(stderr,
" ## Warning: %s: snapping value %" MMG5_PRId
"; "
718 "previous value: %E.\n",__func__,k,fabs(
sol->m[k]));
731 for (k=1; k<=
mesh->
ne; k++) {
733 if ( !
MG_EOK(pt) )
continue;
734 for (i=0; i<4; i++) {
737 if ( p0->
flag == 1 ) {
754 fprintf(stdout,
" %8" MMG5_PRId
" points snapped, %" MMG5_PRId
" corrected\n",ns,nc);
757 for (k=1; k<=
mesh->
np; k++)
780 double volc,voltot,v0,v1,v2,v3;
782 MMG5_int ncp,ncm,base,k,kk,ll,ip0,ip1,ip2,ip3,*adja,*pile;
793 for (k=1; k<=
mesh->
ne; k++) {
795 if ( !
MG_EOK(pt) )
continue;
801 printf(
" Exit program.\n");
808 for (k=1; k<=
mesh->
ne; k++) {
812 if ( !
MG_EOK(pt) )
continue;
813 if ( pt->
flag == base )
continue;
826 if ( v0 <= 0.0 && v1 <= 0.0 && v2 <= 0.0 && v3 <= 0.0 )
continue;
833 fprintf(stderr,
"\n ## Problem in length of pile; function rmc.\n"
834 " Check that the level-set intersect the mesh.\n"
851 for (i=0; i<4; i++) {
855 for ( i1=0; i1<3; ++i1 ) {
865 fprintf(stderr,
"\n ## Problem in length of pile; function rmc. Exit program.\n");
872 while ( ++cur < ipile );
875 if ( volc < mesh->
info.
rmc * voltot ) {
876 for (l=0; l<ipile; l++) {
878 for (i=0; i<4; i++) {
892 for (k=1; k<=
mesh->
ne; k++) {
896 if ( !
MG_EOK(pt) )
continue;
897 if ( pt->
flag == base )
continue;
910 if ( v0 >= 0.0 && v1 >= 0.0 && v2 >= 0.0 && v3 >= 0.0 )
continue;
917 fprintf(stderr,
"\n ## Problem in length of pile; function rmc. Exit program.\n");
932 for (i=0; i<4; i++) {
936 for ( i1=0; i1<3; ++i1 ) {
946 fprintf(stderr,
"\n ## Problem in length of pile; function rmc. Exit program.\n");
953 while ( ++cur < ipile );
956 if ( volc < mesh->
info.
rmc * voltot ) {
957 for (l=0; l<ipile; l++) {
959 for (i=0; i<4; i++) {
970 for (l=0; l<ipile; l++) {
974 for (i=0; i<4; i++) {
976 for (j=0; j<3; j++) {
990 for (l=0; l<ipile; l++) {
992 for (i=0; i<4; i++) {
1009 printf(
"\n *** Removed %" MMG5_PRId
" positive parasitic bubbles and %" MMG5_PRId
" negative parasitic bubbles\n",ncp,ncm);
1030 double c[3],v0,v1,s;
1032 MMG5_int vx[6],k,ip0,ip1,np,nb,ns,ne,src,refext,refint;
1034 static int8_t mmgWarn = 0;
1037 for (k=1; k<=
mesh->
np; k++)
1042 for (k=1; k<=
mesh->
ne; k++) {
1044 for (ia=0; ia<6; ia++) {
1049 if ( p0->
flag && p1->
flag )
continue;
1062 if ( ! nb )
return 1;
1067 for (k=1; k<=
mesh->
ne; k++) {
1069 if ( !
MG_EOK(pt) )
continue;
1073 for (ia=0; ia<6; ia++) {
1082 if ( !pt->
xt )
continue;
1085 for (ia=0; ia<4; ia++) {
1088 for (j=0; j<3; j++) {
1100 for (k=1; k<=
mesh->
ne; k++) {
1102 if ( !
MG_EOK(pt) )
continue;
1104 for (ia=0; ia<6; ia++) {
1109 if ( np>0 )
continue;
1118 else if (
MG_SMSGN(v0,v1) )
continue;
1119 else if ( !p0->
flag || !p1->
flag )
continue;
1126 c[0] = p0->
c[0] + s*(p1->
c[0]-p0->
c[0]);
1127 c[1] = p0->
c[1] + s*(p1->
c[1]-p0->
c[1]);
1128 c[2] = p0->
c[2] + s*(p1->
c[2]-p0->
c[2]);
1139 fprintf(stderr,
"\n ## Error: %s: unable to"
1140 " allocate a new point\n",__func__);
1156 double,
"larger solution",
1169 if ( met && met->
m ) {
1170 if ( met->
size > 1 ) {
1178 fprintf(stderr,
"\n ## Error: %s: unable to"
1179 " interpolate the metric during the level-set"
1180 " discretization\n",__func__);
1189 fprintf(stderr,
" ## Warning: %s: the level-set intersect at least"
1190 " one required entity. Required entity ignored.\n\n",__func__);
1203 for (k=1; k<=ne; k++) {
1205 if ( !
MG_EOK(pt) )
continue;
1207 memset(vx,0,6*
sizeof(MMG5_int));
1208 for (ia=0; ia<6; ia++) {
1213 case 1:
case 2:
case 4:
case 8:
case 16:
case 32:
1218 case 48:
case 24:
case 40:
case 6:
case 34:
case 36:
1219 case 20:
case 5:
case 17:
case 9:
case 3:
case 10:
1224 case 7:
case 25:
case 42:
case 52:
1229 case 30:
case 45:
case 51:
1235 assert(pt->
flag == 0);
1238 if ( !
ier )
return 0;
1241 fprintf(stdout,
" %7" MMG5_PRId
" splitted\n",ns);
1260 MMG5_int ref,refint,refext,k,ip;
1261 int8_t nmns,npls,nz,i;
1263 for (k=1; k<=
mesh->
ne; k++) {
1265 if ( !
MG_EOK(pt) )
continue;
1269 nmns = npls = nz = 0;
1270 for (i=0; i<4; i++) {
1313 MMG5_int *adja,k,jel;
1324 fprintf(stderr,
"\n ## Error: %s: the xtetra array must be allocated.\n",
1329 fprintf(stderr,
"\n ## Error: %s: the ajda array must be allocated.\n",
1335 for (k=1; k<=
mesh->
ne; k++) {
1340 for (i=0; i<4; i++) {
1349 if ( pt->
ref == pt1->
ref ) {
1356 if ( pt->
ref > pt1->
ref ) {
1375 "larger xtetra table",
1377 fprintf(stderr,
" Exit program.\n");
return 0;);
1392 "larger xtetra table",
1394 fprintf(stderr,
" Exit program.\n");
return 0;);
1422 MMG5_int base,ref,*adja,list[
MMG3D_LMAX+2],k,k1,nump;
1434 list[ilist] = 4*start+ip;
1439 while( cur < ilist ) {
1454 if( pt1->
ref != ref )
continue;
1456 if( pt1->
flag == base )
continue;
1459 for(j=0; j<4 ; j++){
1460 if(pt1->
v[j] == nump)
1467 list[ilist] = 4*k1+j;
1487 if ( !k1 )
continue;
1493 if(pt1->
flag == base)
continue;
1496 for(j=0; j<4 ; j++){
1497 if(pt1->
v[j] == nump)
1504 list[ilist] = 4*k1+j;
1511 for(cur=nref; cur<ilist; cur++) {
1514 if( pt->
ref == ref ) {
1515 fprintf(stderr,
" *** Topological problem\n");
1516 fprintf(stderr,
" non manifold surface at point %" MMG5_PRId
" %" MMG5_PRId
"\n",nump,
MMG3D_indPt(
mesh,nump));
1517 fprintf(stderr,
" non manifold surface at tet %" MMG5_PRId
" (ip %d)\n",
MMG3D_indElt(
mesh,start),ip);
1518 fprintf(stderr,
" nref (color %d) %" MMG5_PRId
"\n",nref,ref);
1530 MMG5_int iel,k,*adja;
1532 static int8_t mmgWarn0 = 0;
1534 for(k=1; k<=
mesh->
np; k++){
1539 for(k=1; k<=
mesh->
ne; k++) {
1541 if ( !
MG_EOK(pt) )
continue;
1546 for(i=0; i<4; i++) {
1552 if ( pt1->
ref != ref ) cnt++;
1558 fprintf(stderr,
"\n ## Warning: %s: at least 1 tetra with 4 boundary"
1559 " faces.\n",__func__);
1566 for(k=1; k<=
mesh->
ne; k++){
1572 if(!adja[i])
continue;
1587 fprintf(stdout,
" *** Manifold implicit surface.\n");
1607 for(k=1; k<=
mesh->
np; k++){
1612 for(k=1; k<=
mesh->
ne; k++){
1617 for(j=0; j<4; j++) {
1621 fprintf(stderr,
"\n ## Error: %s: tetra %" MMG5_PRId
": 4 vertices on implicit boundary.\n",
1628 for(k=1; k<=
mesh->
ne; k++){
1634 if(!adja[i])
continue;
1637 if(pt1->
ref == pt->
ref)
continue;
1643 fprintf(stderr,
"\n ## Error: %s: non orientable implicit surface:"
1644 " ball of point %" MMG5_PRId
".\n",__func__,pt->
v[ip]);
1650 if (
mesh->
info.
ddebug ) fprintf(stdout,
" *** Manifold implicit surface.\n");
1676 MMG5_int ref,nump,numq,list[
MMG3D_LMAX+2],*adja,*adja1,iel,jel,ndepmq,ndeppq,base;
1677 int8_t i,j,ip,jp,iq,jq,voy,indp,indq,isminq,isplq,ismin,ispl;
1680 ndepmq = ndeppq = 0;
1691 if ( !ndepmin || !ndepplus ) {
1695 for(j=0; j<4; j++) {
1696 if ( pt->
v[j] == numq )
break;
1699 list[ilist] = 4*k+j;
1704 if ( pt->
ref == refmin ) isminq = 1;
1705 else if ( pt->
ref == refplus ) isplq = 1;
1708 while( cur < ilist ) {
1709 iel = list[cur] / 4;
1713 for (j=0; j<3; j++) {
1716 if ( !jel )
continue;
1721 if ( pt1->
ref == refmin ) isminq = 1;
1722 else if ( pt1->
ref == refplus ) isplq = 1;
1724 if ( pt1->
flag == base )
continue;
1726 for(iq=0; iq<4; iq++)
1727 if ( pt1->
v[iq] == numq )
break;
1732 list[ilist] = 4*jel+iq;
1736 if ( !ndeppq && pt1->
ref == refplus ) {
1737 for(ip=0; ip<4; ip++)
1738 if ( pt1->
v[ip] == nump )
break;
1739 if( ip == 4 ) ndeppq = jel;
1741 if( !ndepmq && pt1->
ref == refmin ) {
1742 for(ip=0; ip<4; ip++)
1743 if ( pt1->
v[ip] == nump )
break;
1744 if( ip == 4 ) ndepmq = jel;
1750 memset(list,0,(
MMG3D_LMAX+2)*
sizeof(MMG5_int));
1754 ispl = ( isplp || isplq ) ? 1 : 0;
1755 ismin = ( isminp || isminq ) ? 1 : 0;
1766 for(j=0; j<4; j++) {
1767 if ( pt->
v[j] == nump )
break;
1772 list[ilist] = - (4*ndepmin+j);
1775 else if ( ndepmq ) {
1779 for(j=0; j<4; j++) {
1780 if ( pt->
v[j] == numq )
break;
1785 list[ilist] = 4*ndepmq+j;
1789 if ( ismin && ispl )
1797 while ( cur < ilist ) {
1808 for (i=0; i<3; i++) {
1811 if ( !jel )
continue;
1817 if ( pt1->
ref != ref )
continue;
1820 if( pt1->
v[voy] == numq ) {
1823 if (pt1->
v[j] == nump )
break;
1827 if (!jel )
continue;
1832 if ( pt1->
ref != ref)
continue;
1833 if ( pt1->
flag == base )
continue;
1836 for(j=0; j<4; j++) {
1837 if ( pt1->
v[j] == nump )
break;
1839 if ( j<4 )
continue;
1844 if ( pt1->
v[j] == numq )
break;
1847 list[ilist] = 4*jel+j;
1852 if ( pt1->
flag == base )
continue;
1855 if ( pt1->
v[j] == nump )
break;
1858 list[ilist] = - (4*jel+j);
1872 for (i=0; i<3; i++) {
1875 if ( !jel )
continue;
1881 if ( pt1->
ref != ref )
continue;
1884 if( pt1->
v[voy] == nump ) {
1887 if (pt1->
v[j] == numq )
break;
1891 if (!jel )
continue;
1896 if ( pt1->
ref != ref)
continue;
1897 if ( pt1->
flag == base )
continue;
1900 for(j=0; j<4; j++) {
1901 if ( pt1->
v[j] == numq )
break;
1903 if ( j<4 )
continue;
1907 if (pt1->
v[j] == nump )
break;
1910 list[ilist] = -(4*jel+j);
1915 if ( pt1->
flag == base )
continue;
1918 if (pt1->
v[j] == numq )
break;
1921 list[ilist] = 4*jel+j;
1930 assert( cur == ilist );
1935 for(j=0; j<4; j++) {
1936 if ( pt->
v[j] == nump )
break;
1941 list[ilist] = - (4*ndepplus+j);
1945 else if ( ndeppq ) {
1947 for(j=0; j<4; j++) {
1948 if ( pt->
v[j] == numq )
break;
1953 list[ilist] = 4*ndeppq+j;
1958 if ( ismin && ispl )
1964 while ( cur < ilist ) {
1976 for (i=0; i<3; i++) {
1980 if ( !jel )
continue;
1986 if ( pt1->
ref != ref )
continue;
1989 if( pt1->
v[voy] == numq ) {
1992 if (pt1->
v[j] == nump )
break;
1996 if (!jel )
continue;
2000 if ( pt1->
ref != ref)
continue;
2001 if ( pt1->
flag == base )
continue;
2004 for(j=0; j<4; j++) {
2005 if ( pt1->
v[j] == nump )
break;
2007 if ( j<4 )
continue;
2011 if ( pt1->
v[j] == numq )
break;
2014 list[ilist] = 4*jel+j;
2019 if ( pt1->
flag == base )
continue;
2022 if (pt1->
v[j] == nump )
break;
2025 list[ilist] = - (4*jel+j);
2040 for (i=0; i<3; i++) {
2044 if ( !jel )
continue;
2051 if ( pt1->
ref != ref )
continue;
2054 if( pt1->
v[voy] == nump ) {
2057 if (pt1->
v[j] == numq )
break;
2061 if (!jel )
continue;
2065 if ( pt1->
ref != ref)
continue;
2066 if ( pt1->
flag == base )
continue;
2069 for(j=0; j<4; j++) {
2070 if ( pt1->
v[j] == numq )
break;
2072 if ( j<4 )
continue;
2076 if (pt1->
v[j] == nump )
break;
2079 list[ilist] = -(4*jel+j);
2084 if ( pt1->
flag == base )
continue;
2087 if (pt1->
v[j] == numq )
break;
2090 list[ilist] = 4*jel+j;
2098 assert( cur == ilist );
2103 while ( cur < ilist ) {
2113 for(i=0; i<3; i++) {
2117 if ( !jel )
continue;
2121 if (pt1->
flag == base )
continue;
2126 for(j=0; j<4; j++) {
2127 if ( pt1->
v[j] == nump )
2129 else if ( pt1->
v[j] == numq )
2132 assert( indp >= 0 && indp < 4 );
2138 fprintf(stderr,
"\n ## Warning: %s: we should rarely passed here. "
2139 "tetra %" MMG5_PRId
" = %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
", ref = %" MMG5_PRId
".",__func__,
2140 jel,pt1->
v[0],pt1->
v[1],pt1->
v[2],pt1->
v[3],pt1->
ref);
2145 list[ilist] = -(4*jel+indp);
2156 for(i=0; i<3; i++) {
2160 if ( !jel )
continue;
2164 if (pt1->
flag == base )
continue;
2170 for(j=0; j<4; j++) {
2171 if ( pt1->
v[j] == nump )
2173 else if ( pt1->
v[j] == numq )
2176 assert( indq >= 0 && indq < 4 );
2181 fprintf(stderr,
"\n ## Warning: %s: we should rarely passed here. "
2182 "tetra %" MMG5_PRId
" = %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
" %" MMG5_PRId
", ref = %" MMG5_PRId
"\n",__func__,
2183 jel,pt1->
v[0],pt1->
v[1],pt1->
v[2],pt1->
v[3],pt1->
ref);
2188 list[ilist] = 4*jel+indq;
2213 strcat(str,
"(BOUNDARY PART)");
2228 fprintf(stdout,
" ** ISOSURFACE EXTRACTION %s\n",str);
2231 fprintf(stderr,
"\n ## Error: Isosurface extraction not available with"
2232 " hybrid meshes. Exit program.\n");
2237 if ( !MMG3D_snpval(
mesh,
sol) ) {
2238 fprintf(stderr,
"\n ## Problem with implicit function. Exit program.\n");
2243 fprintf(stderr,
"\n ## Hashing problem. Exit program.\n");
2249 fprintf(stderr,
"\n ## Boundary orientation problem. Exit program.\n");
2254 fprintf(stderr,
"\n ## Boundary problem. Exit program.\n");
2260 fprintf(stderr,
"\n ## Hashing problem (0). Exit program.\n");
2265 fprintf(stderr,
"\n ## Problem in setting boundary. Exit program.\n");
2270 if ( !MMG3D_resetRef(
mesh) ) {
2271 fprintf(stderr,
"\n ## Problem in resetting references. Exit program.\n");
2278 fprintf(stderr,
"\n ## Error in removing small parasitic components."
2279 " Exit program.\n");
2286 fprintf(stdout,
"\n ## Warning: rmc option not implemented for boundary"
2287 " isosurface extraction.\n");
2291 if ( !MMG3D_cuttet(
mesh,
sol,met) ) {
2292 fprintf(stderr,
"\n ## Problem in discretizing implicit function. Exit program.\n");
2302 if ( !MMG3D_setref(
mesh,
sol) ) {
2303 fprintf(stderr,
"\n ## Problem in setting references. Exit program.\n");
2308 for ( MMG5_int k=1; k<=
mesh->
np; ++k ) {
MMG5_pMesh MMG5_pSol * sol
int MMG5_hashUpdate(MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int hsiz, MMG5_int hmax)
MMG5_int MMG5_hashGet(MMG5_Hash *hash, MMG5_int a, MMG5_int b)
int MMG5_hashEdge(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
int MMG3D_hashTetra(MMG5_pMesh mesh, int pack)
int MMG5_hGeom(MMG5_pMesh mesh)
int MMG5_chkBdryTria(MMG5_pMesh mesh)
int MMG5_bdrySet(MMG5_pMesh mesh)
int MMG5_bdryPerm(MMG5_pMesh mesh)
int MMG3D_intmet33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int ip, double s)
int MMG5_intmet_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int ip, double s)
API headers for the mmg3d library.
int MMG3D_cuttet_lssurf(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol met)
MMG5_int MMG3D_newPt(MMG5_pMesh mesh, double c[3], int16_t tag, MMG5_int src)
int MMG5_split4op(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, MMG5_int vx[6], int8_t)
int MMG3D_snpval_lssurf(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG5_split1(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, MMG5_int vx[6], int8_t metRidTyp)
static const uint8_t MMG5_permedge[12][6]
MMG5_int MMG3D_indPt(MMG5_pMesh mesh, MMG5_int kp)
static const int8_t MMG5_iarf[4][3]
iarf[i]: edges of face opposite to vertex i
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
int MMG3D_setref_lssurf(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG5_split2sf(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, MMG5_int vx[6], int8_t)
#define MMG3D_POINT_REALLOC(mesh, sol, ip, wantedGap, law, o, tag, src)
int MMG5_split3cone(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, MMG5_int vx[6], int8_t)
static const uint8_t MMG5_inxt3[7]
next vertex of tetra: {1,2,3,0,1,2,3}
int MMG3D_resetRef_lssurf(MMG5_pMesh mesh)
static const uint8_t MMG5_idir[4][3]
idir[i]: vertices of face opposite to vertex i
MMG5_int MMG3D_indElt(MMG5_pMesh mesh, MMG5_int kel)
int MMG5_isLevelSet(MMG5_pMesh mesh, MMG5_int ref0, MMG5_int ref1)
int MMG5_isNotSplit(MMG5_pMesh mesh, MMG5_int ref)
static int MMG5_isbr(MMG5_pMesh mesh, MMG5_int ref)
int MMG5_isSplit(MMG5_pMesh mesh, MMG5_int ref, MMG5_int *refint, MMG5_int *refext)
int MMG5_getStartRef(MMG5_pMesh mesh, MMG5_int ref, MMG5_int *pref)
int MMG3D_update_xtetra(MMG5_pMesh mesh)
int MMG3D_chkmanicoll(MMG5_pMesh mesh, MMG5_int k, int iface, int iedg, MMG5_int ndepmin, MMG5_int ndepplus, MMG5_int refmin, MMG5_int refplus, int8_t isminp, int8_t isplp)
int MMG3D_chkmaniball(MMG5_pMesh mesh, MMG5_int start, int8_t ip)
int MMG3D_chkmani2(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG3D_setref_ls(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG3D_chkmani(MMG5_pMesh mesh)
static int MMG3D_ismaniball(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, int indp)
int MMG3D_mmg3d2(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol met)
int MMG3D_cuttet_ls(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_pSol met)
static double MMG3D_vfrac_1vertex(MMG5_pPoint ppt[4], int8_t i0, double v[4], int8_t part_opp)
int MMG3D_rmc(MMG5_pMesh mesh, MMG5_pSol sol)
static int MMG5_invsl(double A[3][3], double b[3], double r[3])
int MMG3D_snpval_ls(MMG5_pMesh mesh, MMG5_pSol sol)
int MMG3D_resetRef_ls(MMG5_pMesh mesh)
double MMG3D_vfrac(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, int pm)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define MMG5_INCREASE_MEM_MESSAGE()
#define MG_CLR(flag, bit)
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MMG5_SAFE_REALLOC(ptr, prevSize, newSize, type, message, law)
static const uint8_t MMG5_iprv2[3]
double MMG5_det4pt(double c0[3], double c1[3], double c2[3], double c3[3])
#define MMG5_TAB_RECALLOC(mesh, ptr, initSize, wantedGap, type, message, law)
static const uint8_t MMG5_inxt2[6]
double MMG5_orvol(MMG5_pPoint point, MMG5_int *v)
#define MMG5_DEL_MEM(mesh, ptr)
#define MG_SET(flag, bit)
#define MMG5_SAFE_RECALLOC(ptr, prevSize, newSize, type, message, law)
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Structure to store points of a MMG mesh.
Structure to store the surface tetrahedra of a MMG mesh.