54 double gv[2],area,detloc,step,lambda[3],o[3],no[3],to[3],uv[2];
55 double calold,calnew,caltmp;
56 MMG5_int k,iel,kel,nump,nbeg,nend;
59 static int8_t mmgErr0=0,mmgErr1=0;
75 iel = list[ilist-1] / 3;
76 i0 = list[ilist-1] % 3;
81 if ( nbeg != nend )
return 0;
93 for (k=0; k<ilist; k++) {
96 if ( !MMG5_bezierCP(
mesh,pt,&pb,1) )
return 0;
102 fprintf(stderr,
"\n ## Warning: %s: unable to compute optimal position for at least"
103 " 1 point.\n",__func__ );
111 area = lispoi[1]*gv[1] - lispoi[2]*gv[0];
114 for (k=0; k<ilist; k++) {
115 detloc = gv[0]*lispoi[3*(k+1)+2] - gv[1]*lispoi[3*(k+1)+1];
116 if ( detloc >= 0.0 ) {
121 if ( k == ilist )
return 0;
124 for (k=ilist-1; k>=0; k--) {
125 detloc = lispoi[3*k+1]*gv[1] - lispoi[3*k+2]*gv[0];
126 if ( detloc >= 0.0 ) {
131 if ( k == -1 )
return 0;
135 area = - gv[1]*(lispoi[3*(kel+1)+1] - lispoi[3*(kel)+1]) \
136 + gv[0]*(lispoi[3*(kel+1)+2] - lispoi[3*(kel)+2]);
141 area = lispoi[3*(kel)+1]*(lispoi[3*(kel+1)+2] - lispoi[3*(kel)+2]) \
142 - lispoi[3*(kel)+2 ]*(lispoi[3*(kel+1)+1] - lispoi[3*(kel)+1]);
149 area = lispoi[3*kel+1]*lispoi[3*(kel+1)+2] - lispoi[3*kel+2]*lispoi[3*(kel+1)+1];
152 lambda[1] = lispoi[3*(kel+1)+2]*gv[0] - lispoi[3*(kel+1)+1]*gv[1];
153 lambda[2] = -lispoi[3*(kel)+2]*gv[0] + lispoi[3*(kel)+1]*gv[1];
156 lambda[0] = 1.0 - lambda[1] - lambda[2];
163 ier = MMG5_bezierCP(
mesh,pt,&pb,1);
167 fprintf(stderr,
"\n ## Warning: %s: function MMG5_bezierCP return 0.\n",
179 else if ( i0 == 1 ) {
192 fprintf(stderr,
" ## Warning: %s: function MMGS_bezierInt return 0.\n",
212 calold = calnew = DBL_MAX;
213 for (k= 0; k<ilist; k++) {
222 calold =
MG_MIN(calold,caltmp);
229 calnew =
MG_MIN(calnew,caltmp);
231 if ( calold <
MMG5_EPSOK && calnew <= calold )
return 0;
233 else if ( calnew < 0.3*calold )
return 0;
246 memcpy(m0,&met->
m[0],6*
sizeof(
double));
256 double *m0,*m00,step,l1old,l2old,ll1old,ll2old;
257 double lam0,lam1,lam2,o[3],nn1[3],nn2[3],to[3],mo[6];
258 double l1new,l2new,calold,calnew;
259 MMG5_int it,it1,it2,ip,ip0,ip1,ip2,k,iel;
260 int8_t voy1,voy2,isrid,isrid1,isrid2,i0,i1,i2;
261 static int8_t mmgWarn0 = 0;
271 for (k=0; k<ilist; k++) {
285 else if ( it1 && !it2 ) {
286 if ( ip1 != pt->
v[i2] ) {
293 else if ( it1 && it2 && (pt->
v[i2] != ip1) && (pt->
v[i2] != ip2) ) {
296 fprintf(stderr,
"\n ## Warning: %s: at least 1 point at the"
297 " intersection of 3 ridge edges\n",__func__);
310 else if ( it1 && !it2 ) {
311 if ( ip1 != pt->
v[i1] ) {
318 else if ( it1 && it2 && (pt->
v[i1] != ip1) && (pt->
v[i1] != ip2) ) {
321 fprintf(stderr,
"\n ## Warning: %s: at least 1 point at the"
322 " intersection of 3 ridge edges\n",__func__);
339 l1old = MMG5_lenSurfEdg(
mesh,met,ip0,ip1,1);
340 l2old = MMG5_lenSurfEdg(
mesh,met,ip0,ip2,1);
342 if ( (!l1old) || (!l2old) )
return 0;
344 if ( l1old < l2old ) {
362 lam0 = (1.0-step)*(1.0-step);
363 lam1 = 2.0*step*(1.0-step);
367 ll1old = l1old*l1old;
368 ll2old = l2old*l2old;
370 if ( l2old > l1old ) {
427 memcpy(m00,mo,6*
sizeof(
double));
430 l1new = MMG5_lenSurfEdg(
mesh,met,0,ip1,1);
431 l2new = MMG5_lenSurfEdg(
mesh,met,0,ip2,1);
433 if ( (!l1new) || (!l2new) )
return 0;
435 if ( fabs(l2new -l1new) >= fabs(l2old -l1old) ) {
440 for (k=0; k<ilist; k++) {
450 if ( (calnew < 0.001) && (calnew<calold) ) {
454 else if ( calnew < 0.3*calold ) {
479 memcpy(m0,mo,6*
sizeof(
double));
int MMG5_elementWeight(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt, MMG5_pPoint p0, MMG5_Bezier *pb, double r[3][3], double gv[2])
int movintpt_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int *list, int ilist)
int movridpt_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int *list, int ilist)
int MMGS_surfballRotation(MMG5_pMesh mesh, MMG5_pPoint p0, MMG5_int *list, int ilist, double r[3][3], double *lispoi, double n[3])
int MMGS_bezierInt(MMG5_pBezier pb, double uv[2], double o[3], double no[3], double to[3])
int MMG5_intridmet(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int ip1, MMG5_int ip2, double s, double v[3], double mr[6])
int MMGS_moveTowardPoint(MMG5_pMesh mesh, MMG5_pPoint p0, MMG5_pPoint p, double llold, double lam0, double lam1, double lam2, double nn1[3], double nn2[3], double to[3])
double caleltsig_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int iel)
int MMGS_paramDisp(MMG5_pMesh, MMG5_int, int8_t, MMG5_int, MMG5_int, double, double[3])
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.
Structure to store surface vertices of an MMG mesh.