37#define MMG2D_DEGTOL 5.e-1
50 for (k=1; k<=
mesh->
nt; k++) {
59 len = (p2->
c[0]-p1->
c[0])*(p2->
c[0]-p1->
c[0]) + (p2->
c[1]-p1->
c[1])*(p2->
c[1]-p1->
c[1]);
89 double *v,c[3][2],tau;
97 for (k=1; k<=
mesh->
nt; k++) {
99 if ( !
MG_EOK(pt) )
continue;
101 for (i=0; i<3; i++) {
106 c[i][j] = ppt->
c[j]+tau*v[j];
127 double *v,tau,ctau,c[3][2],ocal,ncal;
135 for (k=1; k<=
mesh->
nt; k++) {
137 if ( !
MG_EOK(pt) )
continue;
139 for (i=0; i<3; i++) {
148 for (i=0; i<3; i++) {
163 for (k=1; k<=
mesh->
np; k++) {
166 if ( !
MG_VOK(ppt) )
continue;
169 for (i=0; i<2; i++) {
170 ppt->
c[i] = ppt->
c[i] + tau*v[i];
194 double hma2,lmax,len;
195 MMG5_int k,ns,ip,ip1,ip2;
196 int8_t i,i1,i2,imax,
ier;
197 static int8_t mmgWarn0=0;
203 for (k=1; k<=
mesh->
nt; k++) {
205 if ( !
MG_EOK(pt) )
continue;
206 if ( pt->
cc != itdeg )
continue;
212 for (i=0; i<3; i++) {
220 len = (p2->
c[0]-p1->
c[0])*(p2->
c[0]-p1->
c[0]) + (p2->
c[1]-p1->
c[1])*(p2->
c[1]-p1->
c[1]);
228 if ( (imax == -1) && (!mmgWarn0) ) {
230 fprintf(stderr,
"\n ## Warning: %s: at least 1 tria whose all edges"
231 " are required or of length null.\n",__func__);
234 if ( lmax < hma2 )
continue;
235 else if (
MG_SIN(pt->
tag[imax]) )
continue;
264 met->
m[ip] = 0.5*(met->
m[ip1]+met->
m[ip2]);
269 disp->
m[2*ip+i] = 0.5*(disp->
m[2*ip1+i]+disp->
m[2*ip2+i]);
298 for (k=1; k<=
mesh->
nt; k++) {
300 if ( !
MG_EOK(pt) )
continue;
301 if ( pt->
cc != itdeg )
continue;
303 for (i=0; i<3; i++) {
306 open = (
mesh->
adja[3*(k-1)+1+i] == 0 ) ? 1 : 0;
319 len = (p2->
c[0]-p1->
c[0])*(p2->
c[0]-p1->
c[0]) + (p2->
c[1]-p1->
c[1])*(p2->
c[1]-p1->
c[1]);
320 if ( len > hmi2 )
continue;
323 if ( ilist > 3 || ( ilist==3 && open ) ) {
327 else if ( ilist == 3 ) {
331 else if ( ilist == 2 ) {
362 for (k=1; k<=
mesh->
nt; k++) {
364 if ( !
MG_EOK(pt) )
continue;
365 if ( pt->
cc != itdeg )
continue;
367 for (i=0; i<3; i++) {
380 while ( ++it < maxit && ns > 0 );
407 for (k=1; k<=
mesh->
np; k++)
414 for(k=1; k<=mesh->nt; k++) {
416 if ( !
MG_EOK(pt) )
continue;
417 if ( pt->
cc != itdeg )
continue;
419 for (i=0; i<3; i++) {
439 while (++it < maxit && nm > 0 );
460 double avlen,tau,hmintmp,hmaxtmp;
461 int itmn,itdc,maxitmn,maxitdc,iit,warn;
462 MMG5_int nspl,nnspl,nnnspl,nc,nnc,nnnc,ns,nns,nnns,nm,nnm,nnnm;
465 MMG5_int k,ninvalidTrias;
473 nnnspl = nnnc = nnns = nnnm = lastt = 0;
476 fprintf(stdout,
" ** LAGRANGIAN MOTION\n");
479 for (k=1; k<=
mesh->
nt; k++)
491 for (itmn=0; itmn<maxitmn; itmn++) {
496 fprintf(stderr,
"\n ## Problem in func. MMG2D_velextLS. Exit program.\n");
500 fprintf(stderr,
"\n ## Error: %s: you need to compile with the USE_ELAS"
501 " CMake's flag set to ON to use the rigidbody movement.\n",__func__);
508 for (itdc=0; itdc<maxitdc; itdc++) {
509 nnspl = nnc = nns = nnm = 0;
514 fprintf(stderr,
"\n *** Stop: impossible to proceed further\n");
520 fprintf(stderr,
"\n ** Impossible motion\n");
526 printf(
" ---> Realized displacement: %f\n",tau);
530 for (iit=0; iit<5; iit++) {
532 nspl = nc = ns = nm = 0;
540 fprintf(stderr,
"\n ## Problem in spllag. Exiting.\n");
547 fprintf(stderr,
"\n ## Problem in coltetlag. Exiting.\n");
559 fprintf(stderr,
" ## Problem in swapeltlag. Exiting.\n");
567 fprintf(stderr,
" ## Problem in moveltlag. Exiting.\n");
573 printf(
" %" MMG5_PRId
" edges splitted, %" MMG5_PRId
" vertices collapsed, %" MMG5_PRId
" elements"
574 " swapped, %" MMG5_PRId
" vertices moved.\n",nspl,nc,ns,nm);
582 printf(
" %" MMG5_PRId
" edges splitted, %" MMG5_PRId
" vertices collapsed, %" MMG5_PRId
" elements"
583 " swapped, %" MMG5_PRId
" vertices moved.\n",nnspl,nnc,nns,nnm);
597 printf(
" ---> Realized displacement: %f\n",tau);
601 printf(
" %" MMG5_PRId
" edges splitted, %" MMG5_PRId
" vertices collapsed, %" MMG5_PRId
" elements"
602 " swapped, %" MMG5_PRId
" vertices moved.\n",nnnspl,nnnc,nnns,nnnm);
616 fprintf(stderr,
"\n ## Problem in identifying singularities. Exit program.\n");
622 fprintf(stderr,
"\n ## Problem in calculating normal vectors. Exit program.\n");
629 printf(
"## Warning: Not enough memory to keep track of"
630 " the invalid triangles.\n");
634 assert ( ninvalidTrias );
640 if ( ninvalidTrias ) {
641 return -ninvalidTrias;
int MMG2D_singul(MMG5_pMesh mesh, MMG5_int ref)
int MMG2D_norver(MMG5_pMesh mesh, MMG5_int ref)
int MMG5_boulet(MMG5_pMesh mesh, MMG5_int start, int ip, MMG5_int *list, int8_t s, int8_t *opn)
int MMG2D_colver(MMG5_pMesh mesh, int ilist, MMG5_int *list)
int MMG2D_chkcol(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t i, MMG5_int *list, int8_t typchk)
int MMG2D_colver3(MMG5_pMesh mesh, MMG5_int *list)
int MMG2D_colver2(MMG5_pMesh mesh, MMG5_int *list)
int MMG2D_movintpt(MMG5_pMesh, MMG5_pSol, int, MMG5_int *, int8_t)
double MMG2D_caltri_iso_3pt(double *a, double *b, double *c)
int MMG2D_chkswp(MMG5_pMesh, MMG5_pSol, MMG5_int, int8_t, int8_t)
MMG5_int MMG2D_chkspl(MMG5_pMesh, MMG5_pSol, MMG5_int, int8_t)
int MMG2D_split1b(MMG5_pMesh, MMG5_int, int8_t, MMG5_int)
void MMG2D_delPt(MMG5_pMesh mesh, MMG5_int ip)
int MMG2D_swapar(MMG5_pMesh, MMG5_int, int8_t)
int MMG2D_velextLS(MMG5_pMesh, MMG5_pSol)
int MMG2D_movedgpt(MMG5_pMesh, MMG5_pSol, int, MMG5_int *, int8_t)
double MMG2D_estavglen(MMG5_pMesh mesh)
MMG5_int MMG2D_chkmovmesh(MMG5_pMesh mesh, MMG5_pSol disp, short t, MMG5_int *triIdx)
MMG5_int MMG2D_spllag(MMG5_pMesh mesh, MMG5_pSol disp, MMG5_pSol met, MMG5_int itdeg, int *warn)
int MMG2D_dispmesh(MMG5_pMesh mesh, MMG5_pSol disp, short t, int itdeg)
MMG5_int MMG2D_movtrilag(MMG5_pMesh mesh, MMG5_pSol met, int itdeg)
int MMG2D_mmg2d9(MMG5_pMesh mesh, MMG5_pSol disp, MMG5_pSol met, MMG5_int **invalidTrias)
static int MMG2D_coleltlag(MMG5_pMesh mesh, MMG5_pSol met, int itdeg)
MMG5_int MMG2D_swpmshlag(MMG5_pMesh mesh, MMG5_pSol met, double crit, int itdeg)
short MMG5_dikmov(MMG5_pMesh mesh, MMG5_pSol disp, short *lastt, short shortmax, MMG5_int chkmovmesh(MMG5_pMesh, MMG5_pSol, short, MMG5_int *))
common functions for lagrangian meshing.
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]
#define MMG5_DEL_MEM(mesh, ptr)
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.