44#define MMG3D_THRES_DEL 1.6
45#define MMG3D_LOPTL_DEL 1.41
46#define MMG3D_LFILTS_DEL 0.7
47#define MMG3D_LFILTL_DEL 0.2
84 int8_t imax,
double lmax,
double lmaxtet,
85 int8_t chkRidTet,MMG5_int *ifilt,MMG5_int *ns,
86 int *warn,int8_t *countMemFailure ) {
101 MMG3D_find_bdyface_from_edge(
mesh,pt,imax,&i,&j,&i1,&i2,&ip1,&ip2,&p0,&p1);
113 double to[3],no1[3],no2[3];
118 int8_t
ier =
MMG3D_build_bezierEdge(
mesh,k,imax,i,j,pxt,ip1,ip2,p0,p1,
119 &ref,&tag,o,to,no1,no2,list,&ilist);
131 assert (
ier==2 &&
"unexpected return value for build_bezierEdge");
143 *warn=1;++(*countMemFailure);
153 if ( met && met->
m ) {
154 ier = MMG5_intmet(
mesh,met,k,imax,ip,0.5);
170 if (
ier == 2 ||
ier < 0 ) {
185 fprintf(stderr,
"\n ## Error: %s: unable to split.\n",__func__);
189 if (
ier == 0 ||
ier == 2 ) {
205 int8_t force_splt = 0;
206 const int8_t fem_mode = 2;
231 else if ( ilist<0 ) {
235 o[0] = 0.5*(p0->
c[0] + p1->
c[0]);
236 o[1] = 0.5*(p0->
c[1] + p1->
c[1]);
237 o[2] = 0.5*(p0->
c[2] + p1->
c[2]);
248 *warn=1;++(*countMemFailure);
254 if ( met && met->
m ) {
255 ier = MMG5_intmet(
mesh,met,k,imax,ip,0.5);
279 ier = MMG3D_PROctreein(
mesh,met,*PROctree,ip,lfilt);
361 int8_t imin,
double lmin,
362 int8_t imax,
double lmax,
double lmaxtet,
363 int8_t chkRidTet,MMG5_int *ifilt,
364 MMG5_int *ns,MMG5_int *nc,
368 int8_t countMemFailure = 0;
371 chkRidTet,ifilt,ns,warn,&countMemFailure);
388 assert ( (
ier==1 ||
ier==3) &&
"Check return val of delone_split");
390 if ( countMemFailure > 10 ) {
391 printf(
" ## Error:%s: too much reallocation errors. Exit program.\n",__func__);
428 MMG5_int ne,MMG5_int* ifilt,MMG5_int* ns,MMG5_int* nc,
int* warn) {
434 double lmaxtet,lmintet;
435 int ier,imaxtet,imintet;
436 int8_t imin,imax,chkRidTet;
437 static int8_t mmgWarn0 = 0;
441 if ( met->
size==6 ) chkRidTet=1;
444 for (k=1; k<=ne; k++) {
447 else if ( pt->
mark < base-2 )
continue;
451 imax = -1; lmax = 0.0;
452 imin = -1; lmin = DBL_MAX;
454 for (ii=0; ii<6; ii++) {
456 len = MMG5_lenedg(
mesh,met,ii,pt);
472 fprintf(stderr,
"\n # Warning: %s: all edges of tetra %" MMG5_PRId
" are"
473 " boundary and required.\n",
483 fprintf(stderr,
"\n # Warning: %s: all edges of tetra %" MMG5_PRId
" are"
484 " boundary and required.\n",
492 lmax,lmax,chkRidTet,ifilt,ns,nc,warn);
509 assert ( (
ier==1 ||
ier==3) &&
"Check return val of delone_split");
518 for (ii=0; ii<6; ii++) {
520 if ( (ii==imintet) && (lmintet <
MMG3D_LOPTS))
continue;
523 len = MMG5_lenedg(
mesh,met,ii,pt);
532 lmax,lmaxtet,chkRidTet,ifilt,ns,nc,warn);
568 MMG5_int nf,nnf,nnm,nm,nw;
583 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
591 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
603 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,0,
mesh->
mark-1);
605 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",
615 fprintf(stdout,
" %8" MMG5_PRId
" improved, %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",nw,nf,nm);
618 while( ++it < maxit && nw+nm+nf > 0 );
624 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter. \n",nnf,nnm,it);
645 MMG5_int ns,nc,ne,nnm,nm,nnf,nf,nnc,nns,nfilt,ifilt;
646 double maxgap,dd,declic,declicsurf;
649 it = nnc = nns = nnf = nnm = nfilt = 0;
654 declicsurf = 1./3.46;
663 if (
ier<=0 )
return -1;
665 else ns = nc = ifilt = 0;
670 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
678 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
692 nm =
MMG5_movtet(
mesh,met,*PROctree,declicsurf,declic,1,1,0,1,1,
mesh->
mark-2);
695 fprintf(stderr,
"\n ## Error: %s: Unable to improve mesh.\n",__func__);
709 if (
mesh->
gap > maxgap/(
double)maxit )
710 mesh->
gap -= maxgap/(double)maxit;
716 fprintf(stdout,
" %8"MMG5_PRId
" filtered, %8" MMG5_PRId
" splitted, %8" MMG5_PRId
" collapsed,"
717 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",ifilt,ns,nc,nf,nm);
720 dd = MMG5_abs(nc-ns);
721 if ( !noptim && (it==5 || ((dd < 5) || (dd < 0.05*
MG_MAX(nc,ns)) || !(ns+nc))) ) {
729 dd = MMG5_abs(nc-ns);
730 if ( dd < 5 || dd < 0.05*
MG_MAX(nc,ns) )
break;
734 while( ++it < maxit && (noptim || nc+ns > 0) );
738 fprintf(stdout,
" %8"MMG5_PRId
" filtered, %8" MMG5_PRId
" splitted, %8" MMG5_PRId
" collapsed,"
739 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter.\n",nfilt,nns,nnc,nnf,nnm, it);
758 MMG5_int nnf,nf,nw,nm,nnm;
778 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
790 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,3,
mesh->
mark-2);
792 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",
807 fprintf(stdout,
" %8" MMG5_PRId
" improved, %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",nw,nf,nm);
810 while( ++it < maxit && nw+nm+nf > 0 );
817 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,3,
mesh->
mark-2);
819 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",__func__);
828 fprintf(stdout,
" %8" MMG5_PRId
" moved\n",nm);
836 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter. \n",nnf,nnm,it);
853 MMG5_int nnf,nf,nw,k,nnm,nm;
862 for (k=1; k<=
mesh->
ne; k++) {
880 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
888 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
900 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,declic,1,1,1,1,0,
mesh->
mark-1);
902 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",__func__);
911 fprintf(stdout,
" %8" MMG5_PRId
" improved, %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",nw,nf,nm);
915 if ( !nw && (!nm || !nf) )
break;
918 while( ++it < maxit && nw+nm+nf > 0 );
924 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,3,
mesh->
mark-2);
926 fprintf(stderr,
"\n ## Error: %s: Unable to improve mesh.\n",__func__);
935 fprintf(stdout,
" %8" MMG5_PRId
" moved\n",nm);
942 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter. \n",nnf,nnm,it);
960 MMG5_int * permNodGlob) {
968 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
974 fprintf(stderr,
"\n ## Error: %s: Unable to improve mesh. Exiting.\n",
984 fprintf(stdout,
" ------------- Delaunay: INITIAL SWAP %7"MMG5_PRId
"\n",nnf);
994 fprintf(stderr,
"\n ## Error: %s: unable to complete mesh. Exit program.\n",
1000 fprintf(stderr,
"\n ## Error: %s:",__func__);
1001 fprintf(stderr,
" unable to allocate a new point in last call of adpspl.\n");
1002 fprintf(stderr,
" ## Check the mesh size or ");
1003 fprintf(stderr,
"increase the maximal authorized memory with the -m option.\n");
1004 fprintf(stderr,
" ## Uncomplete mesh. Exiting\n" );
1036 fprintf(stdout,
" ** MESH ANALYSIS\n");
1039 fprintf(stderr,
"\n ## Non orientable implicit surface before remeshing. Exit program.\n");
1045 fprintf(stdout,
" ** GEOMETRIC MESH\n");
1048 fprintf(stderr,
"\n ## Unable to split mesh. Exiting.\n");
1054 if ( getenv(
"MMG_SAVE_ANATET1") ) {
1055 printf(
" ## WARNING: EXIT AFTER ANATET-1."
1056 " (MMG_SAVE_ANATET1 env variable is exported).\n");
1062 fprintf(stdout,
" ** COMPUTATIONAL MESH\n");
1066 if ( !MMG3D_defsiz(
mesh,met) ) {
1067 fprintf(stderr,
"\n ## Metric undefined. Exit program.\n");
1073 if ( getenv(
"MMG_SAVE_DEFSIZ") ) {
1074 printf(
" ## WARNING: EXIT AFTER DEFSIZ."
1075 " (MMG_SAVE_DEFSIZ env variable is exported).\n");
1082 if ( !MMG3D_gradsiz(
mesh,met) ) {
1083 fprintf(stderr,
"\n ## Gradation problem. Exit program.\n");
1088 MMG3D_gradsizreq(
mesh,met);
1093 if ( getenv(
"MMG_SAVE_GRADSIZ") ) {
1094 printf(
" ## WARNING: EXIT AFTER GRADSIZ."
1095 " (MMG_SAVE_GRADSIZ env variable is exported).\n");
1103 fprintf(stderr,
"\n ## Unable to split mesh. Exiting.\n");
1109 if ( getenv(
"MMG_SAVE_ANATET2") ) {
1110 printf(
" ## WARNING: EXIT AFTER ANATET-2."
1111 " (MMG_SAVE_ANATET2 env variable is exported).\n");
1130 fprintf(stderr,
"\n ## Unable to adapt. Exit program.\n");
1140 fprintf(stderr,
"\n ## Topology of mesh unsuited for fem computations. Exit program.\n");
1149 fprintf(stdout,
"\n ## Warning: %s: Non orientable implicit surface after remeshing.\n",__func__);
void MMG3D_freePROctree(MMG5_pMesh mesh, MMG3D_pPROctree *q)
int MMG3D_addPROctree(MMG5_pMesh mesh, MMG3D_pPROctree q, const MMG5_int no)
int MMG3D_initPROctree(MMG5_pMesh mesh, MMG3D_pPROctree *q, int nv)
int MMG5_coquil(MMG5_pMesh mesh, MMG5_int start, int ia, int64_t *list, int8_t *isbdy)
int MMG5_chkfemtopo(MMG5_pMesh mesh)
int MMG5_delone(MMG5_pMesh mesh, MMG5_pSol sol, MMG5_int ip, int64_t *list, int ilist)
void MMG5_gradation_info(MMG5_pMesh mesh)
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
#define MMG3D_SSWAPIMPROVE
int MMG5_split1b(MMG5_pMesh, MMG5_pSol, int64_t *, int, MMG5_int, int, int8_t, int8_t)
MMG5_int MMG5_swpmsh(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree, int)
MMG5_int MMG5_swptet(MMG5_pMesh mesh, MMG5_pSol met, double, double, MMG3D_pPROctree, int, MMG5_int)
MMG5_int MMG5_movtet(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree, double clickSurf, double clickVol, int moveVol, int improveSurf, int improveVolSurf, int improveVol, int maxit, MMG5_int testmark)
void MMG3D_find_bdyface_from_edge(MMG5_pMesh, MMG5_pTetra, int8_t, int8_t *, int8_t *, int8_t *, int8_t *, MMG5_int *, MMG5_int *, MMG5_pPoint *, MMG5_pPoint *)
int MMG5_anatet(MMG5_pMesh mesh, MMG5_pSol met, int8_t typchk, int patternMode)
int MMG3D_simbulgept(MMG5_pMesh mesh, MMG5_pSol met, int64_t *list, int ilist, MMG5_int)
void MMG3D_delPt(MMG5_pMesh mesh, MMG5_int ip)
int MMG3D_chkmani(MMG5_pMesh mesh)
MMG5_int MMG3D_newPt(MMG5_pMesh mesh, double c[3], uint16_t tag, MMG5_int src)
int MMG3D_optlap(MMG5_pMesh, MMG5_pSol)
int MMG3D_tetraQual(MMG5_pMesh mesh, MMG5_pSol met, int8_t metRidTyp)
void MMG3D_set_geom(MMG5_pMesh, MMG5_pPoint, uint16_t, MMG5_int, MMG5_int, double[3], double[3], double[3])
int MMG3D_outqua(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_dichoto1b(MMG5_pMesh mesh, MMG5_pSol met, int64_t *list, int ret, MMG5_int)
#define MMG3D_POINT_REALLOC(mesh, sol, ip, wantedGap, law, o, tag, src)
int MMG3D_adpcoledg(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree *, MMG5_int, int8_t, double, MMG5_int *)
MMG5_int MMG3D_opttyp(MMG5_pMesh, MMG5_pSol, MMG3D_pPROctree, MMG5_int)
int8_t MMG3D_build_bezierEdge(MMG5_pMesh, MMG5_int, int8_t, int8_t, int8_t, MMG5_pxTetra, MMG5_int, MMG5_int, MMG5_pPoint, MMG5_pPoint, MMG5_int *, uint16_t *, double[3], double[3], double[3], double[3], int64_t *, int *)
int MMG5_scotchCall(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol fields, MMG5_int *permNodGlob)
static int MMG5_adpdel(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree *PROctree, int *warn)
static int MMG5_adpsplcol(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree *PROctree, MMG5_int ne, MMG5_int *ifilt, MMG5_int *ns, MMG5_int *nc, int *warn)
static int MMG5_optet(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree)
int MMG5_mmg3d1_delone(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int *permNodGlob)
static int MMG5_optbad(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree)
static int MMG3D_mmg3d1_delone_splcol(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree *PROctree, MMG5_int k, int8_t imin, double lmin, int8_t imax, double lmax, double lmaxtet, int8_t chkRidTet, MMG5_int *ifilt, MMG5_int *ns, MMG5_int *nc, int *warn)
static int MMG5_optetLES(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree PROctree)
static int MMG3D_mmg3d1_delone_split(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree *PROctree, MMG5_int k, int8_t imax, double lmax, double lmaxtet, int8_t chkRidTet, MMG5_int *ifilt, MMG5_int *ns, int *warn, int8_t *countMemFailure)
static int MMG5_adptet_delone(MMG5_pMesh mesh, MMG5_pSol met, MMG3D_pPROctree *PROctree, MMG5_int *permNodGlob)
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.