58 double *m,n[3],isqhmin,isqhmax,b0[3],b1[3],ps1,tau[3];
59 double ntau2,gammasec[3];
60 double c[3],kappa,maxkappa,alpha,hausd,hausd_v;
61 MMG5_int list[
MMGS_LMAX+2],k,iel,idp,init_s;
77 if ( ilist < 1 )
return 0;
80 for (k=0; k<ilist; k++) {
96 tau[0] = 3.0*(b0[0] - p0->
c[0]);
97 tau[1] = 3.0*(b0[1] - p0->
c[1]);
98 tau[2] = 3.0*(b0[2] - p0->
c[2]);
99 ntau2 = tau[0]*tau[0] + tau[1]*tau[1] + tau[2]*tau[2];
102 gammasec[0] = 6.0*p0->
c[0] - 12.0*b0[0] + 6.0*b1[0];
103 gammasec[1] = 6.0*p0->
c[1] - 12.0*b0[1] + 6.0*b1[1];
104 gammasec[2] = 6.0*p0->
c[2] - 12.0*b0[2] + 6.0*b1[2];
109 ps1 = gammasec[0]*tau[0] + gammasec[1]*tau[1] + gammasec[2]*tau[2];
110 c[0] = gammasec[0] - ps1*tau[0]*ntau2;
111 c[1] = gammasec[1] - ps1*tau[1]*ntau2;
112 c[2] = gammasec[2] - ps1*tau[2]*ntau2;
114 kappa = ntau2 * sqrt(c[0]*c[0] + c[1]*c[1] + c[2]*c[2]);
134 maxkappa =
MG_MAX(kappa/hausd,maxkappa);
137 isqhmin = 1.0 / (isqhmin*isqhmin);
138 isqhmax = 1.0 / (isqhmax*isqhmax);
140 alpha = 1.0 / 8.0 * maxkappa;
141 alpha =
MG_MIN(alpha,isqhmin);
142 alpha =
MG_MAX(alpha,isqhmax);
145 memset(m,0,6*
sizeof(
double));
146 m[0] = m[3] = m[5] = alpha;
178 MMG5_int k,iel,idp,*list,list1[
MMGS_LMAX+2];
179 int ilist1,ilist2,ilist;
180 MMG5_int list2[
MMGS_LMAX+2],iprid[2],isloc;
182 double *m,isqhmin,isqhmax,*n1,*n2,*n,*t,trot[2],u[2];
183 double r[3][3],lispoi[3*
MMGS_LMAX+1],ux,uy,uz,det,bcu[3];
186 static int8_t mmgWarn0=0;
211 isqhmin = 1.0 / (isqhmin*isqhmin);
212 isqhmax = 1.0 / (isqhmax*isqhmax);
219 memset(m,0,6*
sizeof(
double));
226 ier =
bouletrid(
mesh,it,ip,&ilist1,list1,&ilist2,list2,&iprid[0],&iprid[1]);
230 fprintf(stderr,
"\n ## Error: %s: unable to compute the two balls at at"
231 " least 1 ridge point.\n",__func__);
240 for (i=0; i<2; i++) {
255 for (k=0; k<ilist; k++) {
262 ux = p1->
c[0] - p0->
c[0];
263 uy = p1->
c[1] - p0->
c[1];
264 uz = p1->
c[2] - p0->
c[2];
266 lispoi[3*k+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
267 lispoi[3*k+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
268 lispoi[3*k+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
276 ux = p2->
c[0] - p0->
c[0];
277 uy = p2->
c[1] - p0->
c[1];
278 uz = p2->
c[2] - p0->
c[2];
280 lispoi[3*ilist+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
281 lispoi[3*ilist+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
282 lispoi[3*ilist+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
288 trot[0] = r[0][0]*t[0] + r[0][1]*t[1] + r[0][2]*t[2];
289 trot[1] = r[1][0]*t[0] + r[1][1]*t[1] + r[1][2]*t[2];
295 for (k=0; k<ilist; k++) {
296 detg = lispoi[3*k+1]*u[1] - lispoi[3*k+2]*u[0];
297 detd = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
298 if ( detg > 0.0 && detd > 0.0 )
break;
306 for (k=0; k<ilist; k++) {
307 detg = lispoi[3*k+1]*u[1] - lispoi[3*k+2]*u[0];
308 detd = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
309 if ( detg > 0.0 && detd > 0.0 )
break;
312 if ( k == ilist )
continue;
317 if ( !MMG5_bezierCP(
mesh,pt,&b,1) )
continue;
320 detg = lispoi[3*k+1]*u[1] - lispoi[3*k+2]*u[0];
321 detd = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
327 bcu[1] = u[0]*lispoi[3*(k+1)+2] - u[1]*lispoi[3*(k+1)+1];
329 assert(bcu[1] <= 1.0);
330 bcu[2] = 1.0 - bcu[1];
357 MMG5_int list[
MMGS_LMAX+2],k,iel,ipref[2],idp,isloc;
359 double *m,isqhmin,isqhmax,*n,r[3][3],lispoi[3*
MMGS_LMAX+1];
360 double ux,uy,uz,det2d,intm[3],c[3];
361 double tAA[6],tAb[3],hausd;
363 static int8_t mmgWarn0=0;
365 ipref[0] = ipref[1] = 0;
377 assert ( n[0]*n[0] + n[1]*n[1] + n[2]*n[2] >
MMG5_EPSD2 );
384 for (k=0; k<ilist; k++) {
395 ipref[0] = pt->
v[i2];
397 else if ( !ipref[1] && (pt->
v[i2] != ipref[0]) ) {
398 ipref[1] = pt->
v[i2];
400 else if ( (pt->
v[i2] != ipref[0]) && (pt->
v[i2] != ipref[1]) ) {
403 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
404 " non singular point at intersection of 3 ref edges.\n",
413 ipref[0] = pt->
v[i1];
415 else if ( !ipref[1] && (pt->
v[i1] != ipref[0]) ) {
416 ipref[1] = pt->
v[i1];
418 else if ( (pt->
v[i1] != ipref[0]) && (pt->
v[i1] != ipref[1]) ) {
421 fprintf(stderr,
"\n ## Warning: %s: at least 1 metric not computed:"
422 " non singular point at intersection of 3 ref edges.\n",
429 ux = p1->
c[0] - p0->
c[0];
430 uy = p1->
c[1] - p0->
c[1];
431 uz = p1->
c[2] - p0->
c[2];
433 lispoi[3*k+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
434 lispoi[3*k+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
435 lispoi[3*k+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
439 lispoi[3*ilist+1] = lispoi[1];
440 lispoi[3*ilist+2] = lispoi[2];
441 lispoi[3*ilist+3] = lispoi[3];
444 for (k=0; k<ilist-1; k++) {
445 det2d = lispoi[3*k+1]*lispoi[3*(k+1)+2] - lispoi[3*k+2]*lispoi[3*(k+1)+1];
450 det2d = lispoi[3*(ilist-1)+1]*lispoi[3*0+2] - lispoi[3*(ilist-1)+2]*lispoi[3*0+1];
454 assert(ipref[0] && ipref[1]);
461 memset(intm,0x00,3*
sizeof(
double));
462 memset(tAA,0x00,6*
sizeof(
double));
463 memset(tAb,0x00,3*
sizeof(
double));
469 for (k=0; k<ilist; k++) {
475 MMG5_bezierCP(
mesh,pt,&b,1);
507 isqhmin = 1.0 / (isqhmin*isqhmin);
508 isqhmax = 1.0 / (isqhmax*isqhmax);
511 isqhmin,isqhmax,hausd);
530 double r[3][3],
double *lispoi,
double n[3]) {
533 double ux,uy,uz,area;
538 assert ( n[0]*n[0] + n[1]*n[1] + n[2]*n[2] >
MMG5_EPSD2 );
546 for (k=0; k<ilist; k++) {
553 ux = p1->
c[0] - p0->
c[0];
554 uy = p1->
c[1] - p0->
c[1];
555 uz = p1->
c[2] - p0->
c[2];
557 lispoi[3*k+1] = r[0][0]*ux + r[0][1]*uy + r[0][2]*uz;
558 lispoi[3*k+2] = r[1][0]*ux + r[1][1]*uy + r[1][2]*uz;
559 lispoi[3*k+3] = r[2][0]*ux + r[2][1]*uy + r[2][2]*uz;
563 lispoi[3*ilist+1] = lispoi[1];
564 lispoi[3*ilist+2] = lispoi[2];
565 lispoi[3*ilist+3] = lispoi[3];
568 for (k=0; k<ilist-1; k++) {
569 area = lispoi[3*k+1]*lispoi[3*(k+1)+2] - lispoi[3*k+2]*lispoi[3*(k+1)+1];
574 area = lispoi[3*(ilist-1)+1]*lispoi[3*0+2] - lispoi[3*(ilist-1)+2]*lispoi[3*0+1];
598 MMG5_int list[
MMGS_LMAX+2],iel,idp,isloc;
601 double c[3],isqhmin,isqhmax;
602 double tAA[6],tAb[3],hausd;
625 memset(tAA,0x00,6*
sizeof(
double));
626 memset(tAb,0x00,3*
sizeof(
double));
632 for (k=0; k<ilist; k++) {
639 MMG5_bezierCP(
mesh,pt,&b,1);
670 isqhmin = 1.0 / (isqhmin*isqhmin);
671 isqhmax = 1.0 / (isqhmax*isqhmax);
699 dummy_n[0] = dummy_n[1] = dummy_n[2] = 0.;
742 static int8_t mmgErr=0;
748 for (k=1; k<=
mesh->
np; k++) {
778 for (k=1; k<=
mesh->
nt; k++) {
780 if ( !
MG_EOK(pt) || pt->
ref < 0 )
continue;
782 for (i=0; i<3; i++) {
785 if ( ismet ) memcpy(mm,&met->
m[6*(pt->
v[i])],6*
sizeof(
double));
796 else if ( ppt->
tag )
continue;
803 fprintf(stderr,
"\n ## Error: %s: unable to intersect metrics"
804 " at point %" MMG5_PRId
".\n",__func__,
842 fprintf(stdout,
" ** Anisotropic mesh gradation\n");
848 for (k=1; k<=
mesh->
np; k++) {
850 if ( !
MG_VOK(p1) )
continue;
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.
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)
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_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)
MMG5_int MMG5_gradsiz_ani(MMG5_pMesh mesh, MMG5_pSol met, int *it)
double MMG5_ridSizeInTangentDir(MMG5_pMesh mesh, MMG5_pPoint p0, MMG5_int idp, MMG5_int *iprid, double isqhmin, double isqhmax)
static int MMG5_defmetreg(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int it, int ip)
int MMGS_gradsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
static int MMGS_intextmet(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int np, double me[6])
int MMGS_defsiz_ani(MMG5_pMesh mesh, MMG5_pSol met)
static int MMG5_defmetrid(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int it, int ip)
int MMGS_surfballRotation(MMG5_pMesh mesh, MMG5_pPoint p0, MMG5_int *list, int ilist, double r[3][3], double *lispoi, double n[3])
static int MMG5_defmetsin(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int it, int ip)
static int MMG5_defmetref(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int it, int ip)
void MMG5_bezierEdge(MMG5_pMesh mesh, MMG5_int i0, MMG5_int i1, double b0[3], double b1[3], int8_t isrid, double v[3])
int MMG5_boulet(MMG5_pMesh mesh, MMG5_int start, int ip, MMG5_int *list, int8_t s, int8_t *opn)
int bouletrid(MMG5_pMesh mesh, MMG5_int start, MMG5_int ip, int *il1, MMG5_int *l1, int *il2, MMG5_int *l2, MMG5_int *ip0, MMG5_int *ip1)
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 MMGS_set_metricAtPointsOnReqEdges(MMG5_pMesh mesh, MMG5_pSol met, int8_t ismet)
API headers and documentation for the mmgs library.
double MMG5_caltri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]
int MMG5_nortri(MMG5_pMesh mesh, MMG5_pTria pt, double *n)
int MMG5_rotmatrix(double n[3], double r[3][3])
Local parameters for a specific entity and reference.
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.