54 double mid[2],o[2],no[2],calnew,caltmp,tp,to,t,calseuil;
55 MMG5_int ip,jel,*adja,npinit;
58 int8_t i1,i2,j,j1,j2,
ier,isv;
81 mid[0] = s*(p1->
c[0]+p2->
c[0]);
82 mid[1] = s*(p1->
c[1]+p2->
c[1]);
90 printf(
" ## Error: unable to allocate a new point.\n");
94 }
while (
mesh->
np>npinit );
return -1;,
100 MMG2D_intmet(
mesh,met,k,i,ip,s);
112 calnew =
MG_MIN(calnew,caltmp);
114 pt0->
v[i1] = ip; pt0->
v[i2] = pt->
v[i2];
116 calnew =
MG_MIN(calnew,caltmp);
123 calnew =
MG_MIN(calnew,caltmp);
125 pt0->
v[j1] = pt1->
v[j1] ; pt0->
v[j2] = ip;
127 calnew =
MG_MIN(calnew,caltmp);
134 if ( (calnew < calseuil) ) {
143 if ( !
ier )
return 0;
149 printf(
" ## Error: unable to allocate a new point.\n");
153 }
while (
mesh->
np>npinit );
return -1;,
157 MMG2D_intmet(
mesh,met,k,i,ip,s);
174 ppt->
c[0] = mid[0] + t*(o[0] - mid[0]);
175 ppt->
c[1] = mid[1] + t*(o[1] - mid[1]);
182 calnew =
MG_MIN(calnew,caltmp);
184 pt0->
v[i1] = ip; pt0->
v[i2] = pt->
v[i2];
186 calnew =
MG_MIN(calnew,caltmp);
193 calnew =
MG_MIN(calnew,caltmp);
195 pt0->
v[j1] = pt1->
v[j1] ; pt0->
v[j2] = ip;
197 calnew =
MG_MIN(calnew,caltmp);
204 if ( t == tp )
break;
210 if ( (it == maxit-2) && !isv )
215 while ( ++it < maxit );
219 ppt->
c[0] = mid[0] + to*(o[0] - mid[0]);
220 ppt->
c[1] = mid[1] + to*(o[1] - mid[1]);
246 MMG5_int *adja,iel,jel,kel,mel;
247 int8_t i1,i2,m,j,j1,j2;
252 printf(
" ## Error: unable to allocate a new element.\n");
254 printf(
" Exit program.\n");
return 0);
285 mesh->
adja[3*(k-1)+1+i1] = 3*iel+i2;
286 mesh->
adja[3*(iel-1)+1+i2] = 3*k+i1;
288 mesh->
adja[3*(mel-1)+1+m] = 3*iel+i1;
294 printf(
" ## Error: unable to allocate a new element.\n");
296 printf(
" Exit program.\n");
return 0);
308 memcpy(&
mesh->
adja[3*(kel-1)+1],&
mesh->
adja[3*(jel-1)+1],3*
sizeof(MMG5_int));
322 mesh->
adja[3*(jel-1)+1+j2] = 3*kel+j1;
323 mesh->
adja[3*(kel-1)+1+j1] = 3*jel+j2;
325 mesh->
adja[3*(mel-1)+1+m] = 3*kel+j2;
327 mesh->
adja[3*(iel-1)+1+i] = 3*kel+j;
328 mesh->
adja[3*(kel-1)+1+j] = 3*iel+i;
355 tau[0] = 0; tau[1] = 1; tau[2] = 2;
357 switch ( pt->
flag ) {
359 tau[0] = 1; tau[1] = 2; tau[2] = 0;
363 tau[0] = 2; tau[1] = 0; tau[2] = 1;
367 pt0->
v[tau[2]] = vx[tau[0]];
371 pt0->
v[tau[2]] = pt->
v[tau[2]];
372 pt0->
v[tau[1]] = vx[tau[0]];
399 tau[0] = 0; tau[1] = 1; tau[2] = 2;
401 switch ( pt->
flag ) {
403 tau[0] = 1; tau[1] = 2; tau[2] = 0;
407 tau[0] = 2; tau[1] = 0; tau[2] = 1;
416 if ( pt->
edg[tau[0]] > 0 )
417 p0->
ref = pt->
edg[tau[0]];
422 printf(
" ## Error: unable to allocate a new element.\n");
424 printf(
" Exit program.\n");
return 0);
432 pt->
v[tau[2]] = vx[tau[0]];
433 pt1->
v[tau[1]] = vx[tau[0]];
440 pt1->
edg[tau[2]] = 0;
466 tau[0] = 0; tau[1] = 1; tau[2] = 2;
468 switch ( pt->
flag ) {
470 tau[0] = 1; tau[1] = 2; tau[2] = 0;
474 tau[0] = 2; tau[1] = 0; tau[2] = 1;
478 pt0->
v[tau[1]] = vx[tau[2]] ; pt0->
v[tau[2]] = vx[tau[1]];
482 pt0->
v[tau[1]] = pt->
v[tau[1]] ; pt0->
v[tau[2]] = pt->
v[tau[2]];
483 pt0->
v[tau[0]] = vx[tau[2]];
487 pt0->
v[tau[0]] = vx[tau[1]] ; pt0->
v[tau[1]] = vx[tau[2]];
514 tau[0] = 0; tau[1] = 1; tau[2] = 2;
516 switch ( pt->
flag ) {
518 tau[0] = 1; tau[1] = 2; tau[2] = 0;
522 tau[0] = 2; tau[1] = 0; tau[2] = 1;
532 if ( pt->
edg[tau[1]] > 0 )
533 p1->
ref = pt->
edg[tau[1]];
535 if ( pt->
edg[tau[2]] > 0 )
536 p2->
ref = pt->
edg[tau[2]];
541 printf(
" ## Error: unable to allocate a new element.\n");
543 printf(
" Exit program.\n");
return 0);
550 printf(
" ## Error: unable to allocate a new element.\n");
552 printf(
" Exit program.\n");
return 0);
564 pt->
v[tau[1]] = vx[tau[2]] ; pt->
v[tau[2]] = vx[tau[1]];
565 pt1->
v[tau[0]] = vx[tau[2]];
566 pt2->
v[tau[0]] = vx[tau[1]]; pt2->
v[tau[1]] = vx[tau[2]];
573 pt1->
edg[tau[1]] = 0;
600 pt0->
v[1] = vx[2] ; pt0->
v[2] = vx[1];
604 pt0->
v[0] = vx[2] ; pt0->
v[1] = pt->
v[1]; pt0->
v[2] = vx[0];
608 pt0->
v[0] = vx[1] ; pt0->
v[1] = vx[0]; pt0->
v[2] = pt->
v[2];
612 pt0->
v[1] = vx[2]; pt0->
v[2] = vx[0];
633 MMG5_int iel,jel,kel;
643 if ( pt->
edg[0] > 0 )
646 if ( pt->
edg[1] > 0 )
649 if ( pt->
edg[2] > 0 )
655 printf(
" ## Error: unable to allocate a new element.\n");
657 printf(
" Exit program.\n");
return 0);
666 printf(
" ## Error: unable to allocate a new element.\n");
668 printf(
" Exit program.\n");
return 0);
676 printf(
" ## Error: unable to allocate a new element.\n");
678 printf(
" Exit program.\n");
return 0);
690 pt->
v[1] = vx[2] ; pt->
v[2] = vx[1];
691 pt1->
v[0] = vx[2] ; pt1->
v[2] = vx[0];
692 pt2->
v[0] = vx[1]; pt2->
v[1] = vx[0];
693 pt3->
v[0] = vx[1] ; pt3->
v[1] = vx[2] ; pt3->
v[2] = vx[0];
706 pt3->
edg[0] = pt3->
edg[1] = pt3->
edg[2] = 0;
724 MMG5_int *adja,iel1,iel2,jel0,jel2;
725 MMG5_int ip0,ip1,ip2;
743 if ( (cal < calseuil) ) {
748 if ( (cal < calseuil) ) {
753 if ( (cal < calseuil) ) {
760 printf(
" ## Error: unable to allocate a new element.\n");
762 printf(
" Exit program.\n");
return 0);
767 printf(
" ## Error: unable to allocate a new element.\n");
769 printf(
" Exit program.\n");
return 0);
779 int8_t jel1 = adja[1] / 3;
780 int8_t j1 = adja[1] % 3;
787 memcpy(&
mesh->
adja[3*(iel1-1)+1],&
mesh->
adja[3*(k-1)+1],3*
sizeof(MMG5_int));
790 memcpy(&
mesh->
adja[3*(iel2-1)+1],&
mesh->
adja[3*(k-1)+1],3*
sizeof(MMG5_int));
808 assert(
mesh->
adja[3*(k-1)+1+1] == 3*jel1+j1);
810 assert(
mesh->
adja[3*(jel1-1)+1+j1] == 3*k+1);
814 mesh->
adja[3*(iel1-1)+1+2] = 3*jel2+j2;
816 mesh->
adja[3*(jel2-1)+1+j2] = 3*iel1+2;
818 mesh->
adja[3*(iel2-1)+1+0] = 3*jel0+j0;
820 mesh->
adja[3*(jel0-1)+1+j0] = 3*iel2+0;
829 mesh->
adja[3*(iel1-1)+1+0] = 3*iel2+2;
830 mesh->
adja[3*(iel2-1)+1+2] = 3*iel1+0;
MMG5_pMesh MMG5_pSol * sol
int MMG2D_bezierCurv(MMG5_pMesh mesh, MMG5_int k, int8_t i, double s, double *o, double *no)
#define MMG2D_POINT_REALLOC(mesh, sol, ip, wantedGap, law, o, tag)
double MMG2D_quickcal(MMG5_pMesh, MMG5_pTria)
MMG5_int MMG2D_newPt(MMG5_pMesh mesh, double c[2], uint16_t tag)
#define MMG2D_TRIA_REALLOC(mesh, jel, wantedGap, law)
void MMG2D_delPt(MMG5_pMesh mesh, MMG5_int ip)
MMG5_int MMG2D_newElt(MMG5_pMesh mesh)
double MMG2D_quickarea(double a[2], double b[2], double c[2])
#define MMG5_INCREASE_MEM_MESSAGE()
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]
int MMG2D_split1(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, MMG5_int vx[3])
int MMG2D_split1_sim(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, MMG5_int vx[3])
int MMG2D_split2(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, MMG5_int vx[3])
int MMG2D_split3(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, MMG5_int vx[3])
int MMG2D_split1b(MMG5_pMesh mesh, MMG5_int k, int8_t i, MMG5_int ip)
MMG5_int MMG2D_chkspl(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i)
int MMG2D_split2_sim(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, MMG5_int vx[3])
int MMG2D_split3_sim(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int k, MMG5_int vx[3])
int MMG2D_splitbar(MMG5_pMesh mesh, MMG5_int k, MMG5_int ip)
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.