41#define MMG5_DEGTOL 1.e-1
56 for (k=1; k<=
mesh->
ne; k++) {
65 len = (p2->
c[0] - p1->
c[0])*(p2->
c[0] - p1->
c[0])
66 + (p2->
c[1] - p1->
c[1])*(p2->
c[1] - p1->
c[1])
67 + (p2->
c[2] - p1->
c[2])*(p2->
c[2] - p1->
c[2]);
87 vp[i] = (1.0-t)*v1[i] + t*v2[i];
108 double len,lmax,o[3],hma2;
111 MMG5_int src,ns,k,ip,ip1,ip2,iadr;
114 static int8_t mmgWarn0 = 0;
120 for (k=1; k<=
mesh->
ne; k++) {
125 if ( pt->
mark != itdeg )
continue;
130 for (i=0; i<6; i++) {
143 if ( pxt && (pxt->
tag[i] &
MG_BDY) )
continue;
149 fprintf(stderr,
"\n ## Warning: %s: 0. unable to get edge info"
159 len = (p1->
c[0]-p0->
c[0])*(p1->
c[0]-p0->
c[0])
160 + (p1->
c[1]-p0->
c[1])*(p1->
c[1]-p0->
c[1])
161 + (p1->
c[2]-p0->
c[2])*(p1->
c[2]-p0->
c[2]);
172 fprintf(stderr,
"\n ## Warning: %s: No possible edge split in tetra %" MMG5_PRId
178 if ( lmax < hma2 )
continue;
192 if ( !ilist )
continue;
193 else if ( ilist<0 )
return -1;
204 o[0] = 0.5*(p0->
c[0] + p1->
c[0]);
205 o[1] = 0.5*(p0->
c[1] + p1->
c[1]);
206 o[2] = 0.5*(p0->
c[2] + p1->
c[2]);
221 "larger displacement",
230 double,
"larger displacement",
243 if ( !MMG5_intmet(
mesh,met,k,imax,ip,0.5) ) {
251 iadr = disp->
size*ip1;
253 iadr = disp->
size*ip2;
255 iadr = disp->
size*ip;
267 fprintf(stderr,
"\n ## Error: %s: unable to split.\n",__func__);
297 int ilist,it,maxit,
ier;
298 MMG5_int k,nconf,ns,nns;
307 for (k=1; k<=
mesh->
ne; k++) {
310 if ( pt->
mark != itdeg )
continue;
312 for (i=0; i<6; i++) {
316 if ( pxt->
edg[i] || pxt->
tag[i] )
continue;
321 if ( nconf<0 )
return -1;
325 else if (
ier < 0 )
return -1;
332 while ( ++it < maxit && ns > 0 );
349 MMG5_int k,nm,nnm,base;
355 for (k=1; k<=
mesh->
np; k++)
364 for (k=1; k<=
mesh->
ne; k++) {
367 if ( pt->
mark != itdeg )
continue;
370 for (i=0; i<4; i++) {
372 if ( ppt->
flag == base )
continue;
376 if ( !ilistv )
continue;
390 while( ++it < maxit && nm > 0 );
408 double ll,ux,uy,uz,hmi2;
411 MMG5_int k,nc,nnm,base;
413 int8_t i,j,ip,iq,isnm;
420 for (k=1; k<=
mesh->
np; k++)
423 for (k=1; k<=
mesh->
ne; k++) {
427 if ( pt->
mark != itdeg )
continue;
429 for (i=0; i<4; i++) {
431 for (j=0; j<3; j++) {
434 assert( 0<=ip && ip<4 &&
"unexpected local index for vertex");
435 assert( 0<=iq && iq<4 &&
"unexpected local index for vertex");
439 tag0 = p0->
tag & ~MG_OLDPARBDY;
440 tag1 = p1->
tag & ~MG_OLDPARBDY;
441 if ( p0->
flag == base )
continue;
443 else if ( (p0->
tag &
MG_REQ) || (tag0 > tag1) )
continue;
446 ux = p1->
c[0] - p0->
c[0];
447 uy = p1->
c[1] - p0->
c[1];
448 uz = p1->
c[2] - p0->
c[2];
449 ll = ux*ux + uy*uy + uz*uz;
451 if ( ll > hmi2 )
continue;
459 if (
ier < 0 )
return -1;
465 else if ( ilist < 0 )
return -1;
495 double *v,c[4][3],tau;
504 for (k=1; k<=
mesh->
ne; k++) {
506 if ( !
MG_EOK(pt) )
continue;
508 for (i=0; i<4; i++) {
513 c[i][j] = ppt->
c[j]+tau*v[j];
534 double *v,tau,ctau,c[4][3],ocal,ncal;
542 for (k=1; k<=
mesh->
ne; k++) {
544 if ( !
MG_EOK(pt) )
continue;
546 for (i=0; i<4; i++) {
555 for (i=0; i<4; i++) {
570 for (k=1; k<=
mesh->
np; k++) {
573 if ( !
MG_VOK(ppt) )
continue;
576 for (i=0; i<3; i++) {
577 ppt->
c[i] = ppt->
c[i] + tau*v[i];
603 double avlen,tau,hmintmp,hmaxtmp;
604 int itdc,itmn,maxitmn,maxitdc,iit,warn;
605 MMG5_int nspl,ns,nm,nc,k;
606 MMG5_int nns,nnm,nnc,nnspl,nnns,nnnm,nnnc,nnnspl;
607 MMG5_int ninvalidTets;
617 nnnspl = nnnc = nnns = nnnm = lastt = 0;
620 fprintf(stdout,
" ** LAGRANGIAN MOTION\n");
623 for (k=1; k<=
mesh->
ne; k++)
635 for (itmn=0; itmn<maxitmn; itmn++) {
640 fprintf(stderr,
"\n ## Problem in func. MMG5_velextLS. Exit program.\n");
644 fprintf(stderr,
"\n ## Error: %s: you need to compile with the USE_ELAS"
645 " CMake's flag set to ON to use the rigidbody movement.\n",__func__);
652 for (itdc=0; itdc<maxitdc; itdc++) {
653 nnspl = nnc = nns = nnm = 0;
658 fprintf(stderr,
"\n *** Stop: impossible to proceed further\n");
664 fprintf(stderr,
"\n ** Impossible motion\n");
670 printf(
" ---> Realized displacement: %f\n",tau);
674 for ( iit=0; iit<5; iit++) {
676 nspl = nc = ns = nm = 0;
683 fprintf(stderr,
"\n ## Problem in spllag. Exiting.\n");
690 fprintf(stderr,
"\n ## Problem in coltetlag. Exiting.\n");
702 fprintf(stderr,
"\n ## Problem in swaptetlag. Exiting.\n");
710 fprintf(stderr,
"\n ## Problem in movtetlag. Exiting.\n");
715 printf(
" %" MMG5_PRId
" edges splitted, %" MMG5_PRId
" vertices collapsed, %" MMG5_PRId
" elements"
716 " swapped, %" MMG5_PRId
" vertices moved.\n",nspl,nc,ns,nm);
724 printf(
" %" MMG5_PRId
" edges splitted, %" MMG5_PRId
" vertices collapsed, %" MMG5_PRId
" elements"
725 " swapped, %" MMG5_PRId
" vertices moved.\n",nnspl,nnc,nns,nnm);
739 printf(
" ---> Realized displacement: %f\n",tau);
743 printf(
" %"MMG5_PRId
" edges splitted, %"MMG5_PRId
" vertices collapsed,"
744 " %"MMG5_PRId
" elements swapped, %"MMG5_PRId
" vertices moved.\n",
745 nnnspl,nnnc,nnns,nnnm);
756 printf(
"## Warning: Not enough memory to keep track of"
757 " the invalid tetrahedron.\n");
761 assert ( ninvalidTets );
768 if ( ninvalidTets ) {
769 return -ninvalidTets;
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_coquil(MMG5_pMesh mesh, MMG5_int start, int ia, int64_t *list, int8_t *isbdy)
int MMG3D_get_shellEdgeTag(MMG5_pMesh mesh, MMG5_int start, int8_t ia, uint16_t *tag, MMG5_int *ref)
MMG5_int MMG5_colver(MMG5_pMesh mesh, MMG5_pSol met, int64_t *list, int ilist, int8_t indq, int8_t typchk)
int MMG5_chkcol_int(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int k, int8_t iface, int8_t iedg, int64_t *list, int ilist, int8_t typchk)
static double MMG5_caltet_iso_4pt(double *a, double *b, double *c, double *d)
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
int MMG5_split1b(MMG5_pMesh, MMG5_pSol, int64_t *, int, MMG5_int, int, int8_t, int8_t)
MMG5_int MMG5_chkswpgen(MMG5_pMesh, MMG5_pSol, MMG5_int, int, int *, int64_t *, double, int8_t)
int MMG5_velextLS(MMG5_pMesh, MMG5_pSol)
void MMG3D_delPt(MMG5_pMesh mesh, MMG5_int ip)
MMG5_int MMG3D_newPt(MMG5_pMesh mesh, double c[3], uint16_t tag, MMG5_int src)
int MMG5_swpgen(MMG5_pMesh, MMG5_pSol, MMG5_int, int, int64_t *, MMG3D_pPROctree, int8_t)
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
#define MMG3D_POINT_REALLOC(mesh, sol, ip, wantedGap, law, o, tag, src)
int MMG5_movintpt_iso(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree, int64_t *, int, int)
#define MMG3D_LSWAPIMPROVE
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)
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.
static int MMG5_intdispvol(double *v1, double *v2, double *vp, double t)
static MMG5_int MMG5_spllag(MMG5_pMesh mesh, MMG5_pSol disp, MMG5_pSol met, int itdeg, int *warn)
int MMG5_dispmesh(MMG5_pMesh mesh, MMG5_pSol disp, short t, int itdeg)
static MMG5_int MMG5_coltetlag(MMG5_pMesh mesh, MMG5_pSol met, int itdeg)
MMG5_int MMG5_chkmovmesh(MMG5_pMesh mesh, MMG5_pSol disp, short t, MMG5_int *tetIdx)
MMG5_int MMG5_swptetlag(MMG5_pMesh mesh, MMG5_pSol met, double crit, MMG3D_pPROctree PROctree, int itdeg)
double MMG5_estavglen(MMG5_pMesh mesh)
MMG5_int MMG5_movtetlag(MMG5_pMesh mesh, MMG5_pSol met, int itdeg)
int MMG5_mmg3d3(MMG5_pMesh mesh, MMG5_pSol disp, MMG5_pSol met, MMG5_int **invalidTets)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define MMG5_ADD_MEM(mesh, size, message, law)
#define MMG5_SAFE_REALLOC(ptr, prevSize, newSize, type, message, law)
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]
#define MMG5_DEL_MEM(mesh, ptr)
#define MMG5_SAFE_RECALLOC(ptr, prevSize, newSize, type, message, law)
Structure to store vertices of an MMG mesh.
Structure to store tetrahedra of an MMG mesh.
Structure to store additional information for the surface tetrahedra of an MMG mesh.