50 printf(
"--- Eigenvalues:\n");
51 printf(
"%e %e %e\n",dm[0],dm[1],dm[2]);
52 printf(
"---Eigenvectors (visualization by columns):\n");
53 printf(
"%e %e %e\n",vp[0][0],vp[1][0],vp[2][0]);
54 printf(
"%e %e %e\n",vp[0][1],vp[1][1],vp[2][1]);
55 printf(
"%e %e %e\n",vp[0][2],vp[1][2],vp[2][2]);
70 printf(
"%e %e %e\n",m[0],m[1],m[2]);
71 printf(
"%e %e %e\n",m[1],m[3],m[4]);
72 printf(
"%e %e %e\n",m[2],m[4],m[5]);
74 printf(
"%e %e %e\n",m[0],m[1],m[2]);
75 printf(
"%e %e %e\n",m[3],m[4],m[5]);
76 printf(
"%e %e %e\n",m[6],m[7],m[8]);
100 for( i = 0; i < dim; i++ )
101 if( fabs(m[i]) > dd )
105 for( i = 0; i < dim; i++ )
106 dm[i] = (m[i]-mr[i])*dd;
119 for(i=0 ; i<4 ; i++) {
150 static int8_t mmgWarn=0;
153 for (k=0; k<6; ++k) mm[k] = 0.;
154 for(i=0 ; i<4 ; i++) {
158 mp = &met->
m[6*pt->
v[i]];
159 for (k=0; k<6; ++k) {
165 if ( ddebug && !mmgWarn ) {
167 fprintf(stderr,
"\n ## Warning: %s: at least 1 tetra with 4 ridges vertices"
168 "... Unable to compute metric.\n",__func__);
173 for (k=0; k<6; ++k) m1[k] = mm[k]*dd;
196 double *m,n[3],isqhmin,isqhmax,b0[3],b1[3],ps1,tau[3];
197 double ntau2,gammasec[3];
198 double c[3],kappa,maxkappa,alpha, hausd,hausd_v;
201 int k,ilist,ifac,isloc,init_s,ilists,ilistv;
204 static int8_t mmgWarn = 0;
217 if (
mesh->
adja[4*(kel-1)+iface+1] )
return 0;
219 listv,&ilistv,lists,&ilists,(p0->
tag &
MG_NOM));
223 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
224 " unable to compute the ball of point\n",__func__);
242 for ( k=0; k<ilistv; ++k ) {
244 if ( par->
ref == pt->
ref ) {
245 hausd_v = par->
hausd;
258 for ( k=0; k<ilistv; ++k ) {
260 if ( par->
ref == pt->
ref ) {
274 for (k=0; k<ilists; k++) {
281 for ( i = 0; i < 3; i++ ) {
282 if ( pt->
v[
MMG5_idir[ifac][i]] == idp )
break;
298 tau[0] = 3.0*(b0[0] - p0->
c[0]);
299 tau[1] = 3.0*(b0[1] - p0->
c[1]);
300 tau[2] = 3.0*(b0[2] - p0->
c[2]);
301 ntau2 = tau[0]*tau[0] + tau[1]*tau[1] + tau[2]*tau[2];
304 gammasec[0] = 6.0*p0->
c[0] - 12.0*b0[0] + 6.0*b1[0];
305 gammasec[1] = 6.0*p0->
c[1] - 12.0*b0[1] + 6.0*b1[1];
306 gammasec[2] = 6.0*p0->
c[2] - 12.0*b0[2] + 6.0*b1[2];
311 ps1 = gammasec[0]*tau[0] + gammasec[1]*tau[1] + gammasec[2]*tau[2];
312 c[0] = gammasec[0] - ps1*tau[0]*ntau2;
313 c[1] = gammasec[1] - ps1*tau[1]*ntau2;
314 c[2] = gammasec[2] - ps1*tau[2]*ntau2;
316 kappa = ntau2 * sqrt(c[0]*c[0] + c[1]*c[1] + c[2]*c[2]);
356 maxkappa =
MG_MAX(kappa/hausd,maxkappa);
359 isqhmin = 1.0 / (isqhmin*isqhmin);
360 isqhmax = 1.0 / (isqhmax*isqhmax);
362 alpha = 1.0 / 8.0 * maxkappa;
363 alpha =
MG_MIN(alpha,isqhmin);
364 alpha =
MG_MAX(alpha,isqhmax);
367 memset(m,0,6*
sizeof(
double));
368 m[0] = m[3] = m[5] = alpha;
391 int iface, MMG5_int ip)
399 MMG5_int iel,idp,*list;
400 int k,ilist1,ilist2,ilist;
402 double *m,isqhmin,isqhmax,*n1,*n2,*n,*t;
403 double trot[2],u[2],ux,uy,uz,det,bcu[3];
406 int i,i0,i1,i2,ifac,isloc;
407 static int8_t mmgWarn = 0;
448 isqhmin = 1.0 / (isqhmin*isqhmin);
449 isqhmax = 1.0 / (isqhmax*isqhmax);
456 memset(m,0,6*
sizeof(
double));
465 &iprid[0],&iprid[1] );
468 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
469 " unable to compute the ball of point\n",__func__);
478 for (i=0; i<2; i++) {
494 for (k=0; k<ilist; k++) {
498 for ( i0=0; i0!=3; ++i0 ) {
505 ux = p1->
c[0] - p0->
c[0];
506 uy = p1->
c[1] - p0->
c[1];
507 uz = p1->
c[2] - p0->
c[2];
509 lispoi[3*k+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
510 lispoi[3*k+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
511 lispoi[3*k+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
519 ux = p2->
c[0] - p0->
c[0];
520 uy = p2->
c[1] - p0->
c[1];
521 uz = p2->
c[2] - p0->
c[2];
523 lispoi[3*ilist+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
524 lispoi[3*ilist+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
525 lispoi[3*ilist+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
531 trot[0] = r[0][0]*t[0] + r[0][1]*t[1] + r[0][2]*t[2];
532 trot[1] = r[1][0]*t[0] + r[1][1]*t[1] + r[1][2]*t[2];
538 for (k=0; k<ilist; k++) {
539 detg = lispoi[3*k+1]*u[1] - lispoi[3*k+2]*u[0];
540 detd = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
541 if ( detg > 0.0 && detd > 0.0 )
break;
549 for (k=0; k<ilist; k++) {
550 detg = lispoi[3*k+1]*u[1] - lispoi[3*k+2]*u[0];
551 detd = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
552 if ( detg > 0.0 && detd > 0.0 )
break;
555 if ( k == ilist )
continue;
560 for ( i0=0; i0!=3; ++i0 ) {
565 assert( 0<=ifac && ifac<4 &&
"unexpected local face idx");
569 if ( !MMG5_bezierCP(
mesh,&ptt,&b,
MG_GET(pxt->
ori,ifac)) )
continue;
572 detg = lispoi[3*k+1]*u[1] - lispoi[3*k+2]*u[0];
573 detd = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
579 bcu[1] = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
581 assert(bcu[1] <= 1.0);
582 bcu[2] = 1.0 - bcu[1];
616 int k,ilists,ilistv,ilist;
617 MMG5_int iel,ipref[2],idp;
619 double *m,isqhmin,isqhmax,*n,r[3][3],lispoi[3*
MMG3D_LMAX+1];
620 double ux,uy,uz,det2d,c[3];
621 double tAA[6],tAb[3], hausd;
622 uint8_t i1,i2,itri1,itri2,i;
623 static int8_t mmgWarn0=0,mmgWarn1=0;
625 ipref[0] = ipref[1] = 0;
641 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
642 " unable to compute the ball of point\n",__func__);
659 for ( k=0; k<ilistv; ++k ) {
661 if ( par->
ref == pt->
ref ) {
675 for ( k=0; k<ilistv; ++k ) {
677 if ( par->
ref == pt->
ref ) {
693 assert ( n[0]*n[0] + n[1]*n[1] + n[2]*n[2] >
MMG5_EPSD2 );
699 for (k=0; k<ilists; k++) {
706 for ( i = 0; i < 3; i++ ) {
707 if ( pt->
v[
MMG5_idir[ifac][i]] == idp )
break;
721 ipref[0] = pt->
v[i2];
723 else if ( !ipref[1] && (pt->
v[i2] != ipref[0]) ) {
724 ipref[1] = pt->
v[i2];
726 else if ( (pt->
v[i2] != ipref[0]) && (pt->
v[i2] != ipref[1]) ) {
728 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
729 " non singular point at intersection of 3 ref edges.\n",__func__);
738 ipref[0] = pt->
v[i1];
740 else if ( !ipref[1] && (pt->
v[i1] != ipref[0]) ) {
741 ipref[1] = pt->
v[i1];
743 else if ( (pt->
v[i1] != ipref[0]) && (pt->
v[i1] != ipref[1]) ) {
745 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
746 " non singular point at intersection of 3 ref edges.\n",__func__);
753 ux = p1->
c[0] - p0->
c[0];
754 uy = p1->
c[1] - p0->
c[1];
755 uz = p1->
c[2] - p0->
c[2];
757 lispoi[3*k+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
758 lispoi[3*k+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
759 lispoi[3*k+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
763 assert ( ilists >= 1 );
764 lispoi[3*ilists+1] = lispoi[1];
765 lispoi[3*ilists+2] = lispoi[2];
766 lispoi[3*ilists+3] = lispoi[3];
769 for (k=0; k<ilists-1; k++) {
770 det2d = lispoi[3*k+1]*lispoi[3*(k+1)+2] - lispoi[3*k+2]*lispoi[3*(k+1)+1];
772 if ( det2d <= 0.0 ) {
776 det2d = lispoi[3*(ilists-1)+1]*lispoi[3*0+2] - lispoi[3*(ilists-1)+2]*lispoi[3*0+1];
778 if ( det2d <= 0.0 ) {
781 assert(ipref[0] && ipref[1]);
789 memset(tAA,0x00,6*
sizeof(
double));
790 memset(tAb,0x00,3*
sizeof(
double));
792 for (k=0; k<ilists; k++) {
802 for ( i = 0; i < 3; i++ ) {
803 if ( pt->
v[
MMG5_idir[ifac][i]] == idp )
break;
809 assert( 0<=ifac && ifac<4 &&
"unexpected local face idx");
854 isqhmin = 1.0 / (isqhmin*isqhmin);
855 isqhmax = 1.0 / (isqhmax*isqhmax);
859 isqhmin, isqhmax, hausd);
885 int k,ilist,ilists,ilistv;
888 double *n,*m,r[3][3],ux,uy,uz,lispoi[3*
MMG3D_LMAX+1];
889 double det2d,c[3],isqhmin,isqhmax;
890 double tAA[6],tAb[3],hausd;
892 static int8_t mmgWarn = 0;
908 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
909 " unable to compute the ball of point.\n",
927 for ( k=0; k<ilistv; ++k ) {
929 if ( par->
ref == pt->
ref ) {
943 for ( k=0; k<ilistv; ++k ) {
945 if ( par->
ref == pt->
ref ) {
961 assert ( n[0]*n[0] + n[1]*n[1] + n[2]*n[2] >
MMG5_EPSD2 );
967 for (k=0; k<ilists; k++) {
973 for ( i = 0; i < 3; i++ ) {
974 if ( pt->
v[
MMG5_idir[ifac][i]] == idp )
break;
982 ux = p1->
c[0] - p0->
c[0];
983 uy = p1->
c[1] - p0->
c[1];
984 uz = p1->
c[2] - p0->
c[2];
986 lispoi[3*k+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
987 lispoi[3*k+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
988 lispoi[3*k+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
992 assert ( ilists >= 1 );
993 lispoi[3*ilists+1] = lispoi[1];
994 lispoi[3*ilists+2] = lispoi[2];
995 lispoi[3*ilists+3] = lispoi[3];
998 for (k=0; k<ilists-1; k++) {
999 det2d = lispoi[3*k+1]*lispoi[3*(k+1)+2] - lispoi[3*k+2]*lispoi[3*(k+1)+1];
1001 if ( det2d <= 0.0 ) {
1005 det2d = lispoi[3*(ilists-1)+1]*lispoi[3*0+2] - lispoi[3*(ilists-1)+2]*lispoi[3*0+1];
1007 if ( det2d <= 0.0 ) {
1016 memset(tAA,0x00,6*
sizeof(
double));
1017 memset(tAb,0x00,3*
sizeof(
double));
1019 for (k=0; k<ilists; k++) {
1024 ifac = lists[k] % 4;
1029 for ( i = 0; i < 3; i++ ) {
1030 if ( pt->
v[
MMG5_idir[ifac][i]] == idp )
break;
1036 assert( 0<=ifac && iface<4 &&
"unexpected local face idx");
1072 isqhmin = par->
hmin;
1073 isqhmax = par->
hmax;
1081 isqhmin = 1.0 / (isqhmin*isqhmin);
1082 isqhmax = 1.0 / (isqhmax*isqhmax);
1105 double isqhmax,isqhmin,*m;
1108 int l,i,j,isloc,ilist;
1115 for (k=1; k<=
mesh->
ne; k++) {
1117 if ( !
MG_EOK(pt) )
continue;
1119 for ( l=0; l<4; ++l ) {
1144 for ( j=0; j<ilist; ++j ) {
1146 if ( par->
ref == ptloc->
ref ) {
1147 isqhmax = par->
hmax;
1158 for ( j=0; j<ilist; ++j ) {
1160 if ( par->
ref == ptloc->
ref ) {
1167 isqhmax = 1./(isqhmax*isqhmax);
1171 m = &met->
m[met->
size*ip];
1185 for (k=1; k<=
mesh->
ne; k++) {
1187 if ( !
MG_EOK(pt) )
continue;
1189 for ( l=0; l<4; ++l ) {
1213 for ( j=0; j<ilist; ++j ) {
1215 if ( par->
ref == ptloc->
ref ) {
1216 isqhmin = par->
hmin;
1217 isqhmax = par->
hmax;
1228 for ( j=0; j<ilist; ++j ) {
1230 if ( par->
ref == ptloc->
ref ) {
1238 isqhmin = 1./(isqhmin*isqhmin);
1239 isqhmax = 1./(isqhmax*isqhmax);
1275 dummy_n[0] = dummy_n[1] = dummy_n[2] = 0.;
1319 static int8_t mmgErr = 0;
1325 for (k=1; k<=
mesh->
np; k++) {
1362 for (k=1; k<=
mesh->
ne; k++) {
1366 else if ( !pt->
xt )
continue;
1369 for (l=0; l<4; l++) {
1375 for (i=0; i<3; i++) {
1379 if ( !
MG_VOK(ppt) )
continue;
1381 if ( ppt->
flag > 1 )
continue;
1383 if ( ismet ) memcpy(mm,&met->
m[6*(pt->
v[iploc])],6*
sizeof(
double));
1399 fprintf(stderr,
"\n ## Error: %s: unable to intersect metrics"
1400 " at point %" MMG5_PRId
".\n",__func__,
1442 double *mm,*nn1,*nn2,rbasis[3][3],ps1,ps2;
1451 memcpy(m,mm,6*
sizeof(
double));
1460 ps1 = ux*nn1[0] + uy*nn1[1] + uz*nn1[2];
1461 ps2 = ux*nn2[0] + uy*nn2[1] + uz*nn2[2];
1462 if ( fabs(ps2)<fabs(ps1) ) {
1474 memcpy(m,mm,6*
sizeof(
double));
1479 memcpy(m,mm,6*
sizeof(
double));
1499 double lambda[3],vp[3][3];
1502 for( int8_t i = 0; i < 3; i++ ) {
1504 lambda[i] = 1./(hext*hext);
1538 double dm[3],dmext[3],vp[3][3],beta;
1547 for( int8_t i = 0; i < 3; i++ ) {
1548 beta =
MG_MAX(beta,dmext[i]/dm[i]);
1550 if( beta > 1.0 + tol ) {
1551 (*ier) = (*ier) | iloc;
1553 if( (*
ier) & iloc ) {
1567 double mr[6],mrext[6],dm[3],dmext[3];
1568 double u[3],r[3][3],*t,*n;
1579 for( int8_t i = 0; i < 3; i++ ) {
1590 dmext[0] = mrext[0];
1591 dmext[1] = mrext[3];
1592 dmext[2] = mrext[5];
1597 for( int8_t i = 0; i < 3; i++ ) {
1598 if( dmext[i] > dm[i]*(1.0 + tol) ) {
1600 (*ier) = (*ier) | iloc;
1604 if( (*
ier) & iloc ) {
1612 double mr[6],mrext[6],mtan[3],mtanext[3],r[3][3];
1613 double dm[3],dmext[3],vp[2][2];
1625 mtanext[0] = mrext[0];
1626 mtanext[1] = mrext[1];
1627 mtanext[2] = mrext[3];
1639 for( int8_t i = 0; i < 2; i++ ) {
1640 if( dmext[i] > dm[i]*(1.0 + tol) ) {
1642 (*ier) = (*ier) | iloc;
1649 dmext[2] = mrext[5];
1650 if( dmext[2] > dm[2]*(1.0 + tol) ) {
1652 (*ier) = (*ier) | iloc;
1655 if( (*
ier) & iloc ) {
1669 mr[2] = mr[4] = 0.0;
1678 double dm[3],dmext[3],vp[3][3];
1687 for( int8_t i = 0; i< 3; i++ ) {
1688 if( dmext[i] > dm[i]*(1.0 + tol) ) {
1690 (*ier) = (*ier) | iloc;
1694 if( (*
ier) & iloc ) {
1731 double u[3],r[3][3],*t,*n;
1742 for( int8_t i = 0; i < 3; i++ ) {
1751 mm[1+ridgedir] = mr[3];
1752 mm[3+ridgedir] = mr[5];
1756 memcpy(mm,m,6*
sizeof(
double));
1781 double m1[6],m2[6],mext1[6],mext2[6];
1783 int8_t ridgedir1,ridgedir2;
1789 ux = p2->
c[0] - p1->
c[0];
1790 uy = p2->
c[1] - p1->
c[1];
1791 uz = p2->
c[2] - p1->
c[2];
1792 l = sqrt(ux*ux+uy*uy+uz*uz);
1818 memcpy(mtmp,m1,6*
sizeof(
double));
1838 memcpy(mtmp,m2,6*
sizeof(
double));
1876 n[0] = dn[0]*ip[0][0]*ip[0][0] + dn[1]*ip[1][0]*ip[1][0] + dn[2]*ip[2][0]*ip[2][0];
1877 n[1] = dn[0]*ip[0][0]*ip[0][1] + dn[1]*ip[1][0]*ip[1][1] + dn[2]*ip[2][0]*ip[2][1];
1878 n[2] = dn[0]*ip[0][0]*ip[0][2] + dn[1]*ip[1][0]*ip[1][2] + dn[2]*ip[2][0]*ip[2][2];
1880 n[3] = dn[0]*ip[0][1]*ip[0][1] + dn[1]*ip[1][1]*ip[1][1] + dn[2]*ip[2][1]*ip[2][1];
1881 n[4] = dn[0]*ip[0][1]*ip[0][2] + dn[1]*ip[1][1]*ip[1][2] + dn[2]*ip[2][1]*ip[2][2];
1883 n[5] = dn[0]*ip[0][2]*ip[0][2] + dn[1]*ip[1][2]*ip[1][2] + dn[2]*ip[2][2]*ip[2][2];
1906 double *mm1,*mm2,m1[6],m2[6],ux,uy,uz;
1907 double l,difsiz,rbasis1[3][3],rbasis2[3][3];
1908 double lambda[3],vp[3][3],beta,mu[3];
1915 ux = p2->
c[0] - p1->
c[0];
1916 uy = p2->
c[1] - p1->
c[1];
1917 uz = p2->
c[2] - p1->
c[2];
1919 mm1 = &met->
m[6*npmaster];
1920 mm2 = &met->
m[6*npslave];
1936 memcpy(m1,mm1,6*
sizeof(
double));
1942 if( !cfg_m2 ) {
return 0; }
1945 memcpy(m2,mm2,6*
sizeof(
double));
1948 l = sqrt(ux*ux+uy*uy+uz*uz);
1979 double ll[3],rr[3][3],llmin;
1984 for( i = 0; i < 3; i++ )
1989 beta = mu[0] - llmin;
1991 if ( fabs(beta) < fabs(llmin-mu[1]) ) {
1992 beta = mu[1] - llmin;
1997 assert ( ll[0]>0. && ll[1]>0. && ll[2]>0. );
1998 mm2[0] = ll[0]*rr[0][0]*rr[0][0] + ll[1]*rr[1][0]*rr[1][0] + ll[2]*rr[2][0]*rr[2][0];
1999 mm2[1] = ll[0]*rr[0][0]*rr[0][1] + ll[1]*rr[1][0]*rr[1][1] + ll[2]*rr[2][0]*rr[2][1];
2000 mm2[2] = ll[0]*rr[0][0]*rr[0][2] + ll[1]*rr[1][0]*rr[1][2] + ll[2]*rr[2][0]*rr[2][2];
2001 mm2[3] = ll[0]*rr[0][1]*rr[0][1] + ll[1]*rr[1][1]*rr[1][1] + ll[2]*rr[2][1]*rr[2][1];
2002 mm2[4] = ll[0]*rr[0][1]*rr[0][2] + ll[1]*rr[1][1]*rr[1][2] + ll[2]*rr[2][1]*rr[2][2];
2003 mm2[5] = ll[0]*rr[0][2]*rr[0][2] + ll[1]*rr[1][2]*rr[1][2] + ll[2]*rr[2][2]*rr[2][2];
2011 mu[0] = m2[0]*rbasis2[0][0]*rbasis2[0][0] + 2. * m2[1]*rbasis2[1][0]*rbasis2[0][0]
2012 + 2. * m2[2]*rbasis2[2][0]*rbasis2[0][0]
2013 + m2[3]*rbasis2[1][0]*rbasis2[1][0] + 2. * m2[4]*rbasis2[2][0]*rbasis2[1][0]
2014 + m2[5]*rbasis2[2][0]*rbasis2[2][0];
2019 mu[1] = m2[0]*rbasis2[0][1]*rbasis2[0][1] + 2. * m2[1]*rbasis2[1][1]*rbasis2[0][1]
2020 + 2. * m2[2]*rbasis2[2][1]*rbasis2[0][1]
2021 + m2[3]*rbasis2[1][1]*rbasis2[1][1] + 2. * m2[4]*rbasis2[2][1]*rbasis2[1][1]
2022 + m2[5]*rbasis2[2][1]*rbasis2[2][1];
2027 mu[2] = m2[0]*rbasis2[0][2]*rbasis2[0][2] + 2. * m2[1]*rbasis2[1][2]*rbasis2[0][2]
2028 + 2. * m2[2]*rbasis2[2][2]*rbasis2[0][2]
2029 + m2[3]*rbasis2[1][2]*rbasis2[1][2] + 2. * m2[4]*rbasis2[2][2]*rbasis2[1][2]
2030 + m2[5]*rbasis2[2][2]*rbasis2[2][2];
2040 mm2[cfg_m2] = mu[1];
2041 mm2[cfg_m2+2] = mu[2];
2046 memcpy(mm2,m2,6*
sizeof(
double));
2079 int i,itv,maxit,
ier;
2080 MMG5_int k,np0,np1,nu,nupv;
2081 static int mmgWarn = 0;
2084 fprintf(stdout,
" ** Anisotropic mesh gradation\n");
2087 for (k=1; k<=
mesh->
np; k++) {
2089 if ( !
MG_VOK(p1) )
continue;
2108 fprintf(stderr,
"\n ## Error: %s: unable to allocate hash table.\n",__func__);
2113 for(k=1 ; k<=
mesh->
ne ; k++) {
2118 for(i=0 ; i<6 ; i++) {
2126 fprintf(stderr,
"\n ## Warning: %s: unable to hash at least one edge"
2133 for (k=1; k<=
mesh->
np; k++)
2144 for (k=0; k<edgeTable.
siz; k++) {
2145 pht = &edgeTable.
item[k];
2148 if ( !pht->
a )
break;
2156 pht = pht->
nxt ? &edgeTable.
item[pht->
nxt] : 0;
2161 if ( p0->
s || p1->
s ) {
2162 pht = pht->
nxt ? &edgeTable.
item[pht->
nxt] : 0;
2178 if ( !mmgWarn && (
ier & 4) ) {
2184 pht = pht->
nxt ? &edgeTable.
item[pht->
nxt] : 0;
2188 }
while ( ++itv < maxit && nu > 0 );
2193 fprintf(stderr,
"\n ## Warning: %s: Non-idempotent metric"
2194 " intersections since iteration %d.\n",__func__,mmgWarn);
2197 fprintf(stdout,
" gradation: %7" MMG5_PRId
" updated, %d iter\n",nupv,itv);
2217 MMG5_int nup,nu,nupv,k,np0,np1,npmaster,npslave;
2220 fprintf(stdout,
" ** Grading required points.\n");
2233 for (k=1; k<=
mesh->
ne; k++) {
2235 if ( !
MG_EOK(pt) )
continue;
2239 for (i=0; i<4; i++) {
2244 for (j=0; j<3; j++) {
2250 if ( MMG5_abs ( p0->
s - p1->
s ) < 2 ) {
2254 else if ( p0->
s > p1->
s ) {
2259 assert ( p1->
s > p0->
s );
2280 while( ++it < maxit && nu > 0 );
2287 for (k=1; k<=
mesh->
ne; k++) {
2289 if ( !
MG_EOK(pt) )
continue;
2290 for (i=0; i<4; i++) {
2297 if ( MMG5_abs ( p0->
s - p1->
s ) < 2 ) {
2301 else if ( p0->
s > p1->
s ) {
2306 assert ( p1->
s > p0->
s );
2322 while( ++itv < maxit && nu > 0 );
2326 fprintf(stdout,
" gradation: %7" MMG5_PRId
" updated, %d iter\n",nup+nupv,it+itv);
2329 fprintf(stdout,
" surface gradation: %7" MMG5_PRId
" updated, %d iter\n"
2330 " volume gradation: %7" MMG5_PRId
" updated, %d iter\n",nup,it,nupv,itv);
int MMG3D_Set_solSize(MMG5_pMesh mesh, MMG5_pSol sol, int typEntity, MMG5_int np, int typSol)
Initialize a solution field.
void MMG5_fillDefmetregSys(MMG5_int k, MMG5_pPoint p0, int i0, MMG5_Bezier b, double r[3][3], double c[3], double *lispoi, double tAA[6], double tAb[3])
int MMG5_solveDefmetregSys(MMG5_pMesh mesh, double r[3][3], double c[3], double tAA[6], double tAb[3], double *m, double isqhmin, double isqhmax, double hausd)
int MMG5_simred3d(MMG5_pMesh mesh, double *m, double *n, double dm[3], double dn[3], double vp[3][3])
void MMG5_gradEigenvreq(double *dm, double *dn, double difsiz, int8_t dir, int8_t *ier)
void MMG5_defUninitSize(MMG5_pMesh mesh, MMG5_pSol met, int8_t ismet)
double MMG5_ridSizeInNormalDir(MMG5_pMesh mesh, int i0, double *bcu, MMG5_Bezier *b, double isqhmin, double isqhmax)
int MMG5_grad2metSurfreq(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, MMG5_int npmaster, MMG5_int npslave)
int MMG5_simred2d(MMG5_pMesh mesh, double *m, double *n, double dm[2], double dn[2], double vp[2][2])
int MMG5_solveDefmetrefSys(MMG5_pMesh mesh, MMG5_pPoint p0, MMG5_int ipref[2], double r[3][3], double c[3], double tAA[6], double tAb[3], double *m, double isqhmin, double isqhmax, double hausd)
double MMG5_ridSizeInTangentDir(MMG5_pMesh mesh, MMG5_pPoint p0, MMG5_int idp, MMG5_int *iprid, double isqhmin, double isqhmax)
static int MMG3D_intextmet(MMG5_pMesh mesh, MMG5_pSol met, int np, double me[6])
int MMG5_moymet(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt, double *m1)
int MMG3D_chk4ridVertices(MMG5_pMesh mesh, MMG5_pTetra pt)
int MMG3D_gradsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_printErrorMat(int8_t symmat, double *m, double *mr)
int MMG3D_printEigenv(double dm[3], double vp[3][3])
static int MMG5_defmetreg(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int kel, int iface, int ip)
static int MMG5_grad2metVol(MMG5_pMesh mesh, MMG5_pSol met, int np1, int np2)
static void MMG5_grad2metVol_setmet(MMG5_pMesh mesh, MMG5_pSol met, int ip, double *m, int8_t ridgedir)
int MMG3D_printMat(int8_t symmat, double *m)
static int MMG5_defmetsin(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int kel, int iface, int ip)
int MMG3D_updatemetreq_ani(double *n, double dn[3], double vp[3][3])
static int MMG5_grad2metVol_getmet(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int ip, double ux, double uy, double uz, double *m, int8_t *ridgedir)
static void MMG3D_gradSimred(MMG5_pMesh mesh, MMG5_pPoint ppt, double m[6], double mext[6], int8_t ridgedir, int8_t iloc, int *ier)
static int MMG5_defmetref(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int kel, int iface, int ip)
int MMG3D_defsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
static void MMG5_grad2metVol_extmet(MMG5_pMesh mesh, MMG5_pPoint ppt, double l, double *m, double *mext)
static int MMG5_defmetvol(MMG5_pMesh mesh, MMG5_pSol met, int8_t ismet)
int MMG3D_gradsizreq_ani(MMG5_pMesh mesh, MMG5_pSol met)
static int MMG5_grad2metVolreq(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt, MMG5_int npmaster, MMG5_int npslave)
static int MMG5_defmetrid(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int kel, int iface, MMG5_int ip)
int MMG5_BezierEdge(MMG5_pMesh mesh, MMG5_int ip0, MMG5_int ip1, double b0[3], double b1[3], int8_t ised, double v[3])
int MMG5_boulevolp(MMG5_pMesh mesh, MMG5_int start, int ip, int64_t *list)
Given a vertex and a tetrahedron, find all tetrahedra in the ball of this vertex.
int MMG5_boulesurfvolp(MMG5_pMesh mesh, MMG5_int start, int ip, int iface, int64_t *listv, int *ilistv, MMG5_int *lists, int *ilists, int isnm)
int MMG5_bouletrid(MMG5_pMesh mesh, MMG5_int start, int iface, int ip, int *il1, MMG5_int *l1, int *il2, MMG5_int *l2, MMG5_int *ip0, MMG5_int *ip1)
int MMG5_eigenv3d(int symmat, double *mat, double lambda[3], double v[3][3])
Find eigenvalues and vectors of a 3x3 matrix.
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int hsiz, MMG5_int hmax)
int MMG5_hashEdge(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
static double MMG5_caltet_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
static double MMG5_lenedg_ani(MMG5_pMesh mesh, MMG5_pSol met, int ia, MMG5_pTetra pt)
static double MMG5_lenedgCoor_ani(double *ca, double *cb, double *sa, double *sb)
inlined Functions
static void MMG5_simredmat(int8_t dim, double *m, double *dm, double *iv)
static double MMG5_lenSurfEdg_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int np0, MMG5_int np1, int8_t isedg)
int MMG5_defsiz_startingMessage(MMG5_pMesh mesh, MMG5_pSol met, const char *funcname)
int MMG3D_set_metricAtPointsOnReqEdges(MMG5_pMesh mesh, MMG5_pSol met, int8_t ismet)
void MMG3D_mark_pointsOnReqEdge_fromTetra(MMG5_pMesh mesh)
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
LIBMMG3D_EXPORT double(* MMG3D_lenedgCoor)(double *ca, double *cb, double *sa, double *sb)
Compute the length of an edge according to the size prescription.
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
void MMG5_tet2tri(MMG5_pMesh mesh, MMG5_int k, int8_t ie, MMG5_Tria *ptt)
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)
double MMG5_caltri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
static const uint8_t MMG5_iprv2[3]
int MMG5_truncate_met3d(MMG5_pSol met, MMG5_int ip, double isqhmin, double isqhmax)
#define MG_EDG_OR_NOM(tag)
int MMG5_rmtr(double r[3][3], double m[6], double mr[6])
int MMG5_invmat33(double m[3][3], double mi[3][3])
#define MG_GET(flag, bit)
static const uint8_t MMG5_inxt2[6]
int MMG5_rotmatrix(double n[3], double r[3][3])
void MMG5_transpose3d(double m[3][3])
#define MG_SIN_OR_NOM(tag)
void MMG5_crossprod3d(double *a, double *b, double *result)
int MMG5_norpts(MMG5_pMesh, MMG5_int, MMG5_int, MMG5_int, double *)
int MMG5_invmat22(double m[2][2], double mi[2][2])
#define MMG5_SAFE_FREE(ptr)
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Local parameters for a specific entity and reference.
Structure to store vertices of an MMG mesh.
Structure to store tetrahedra of an MMG mesh.
Structure to store triangles of a MMG mesh.
Used to hash edges (memory economy compared to MMG5_hgeom).
Structure to store surface vertices of an MMG mesh.
Structure to store additional information for the surface tetrahedra of an MMG mesh.