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);
149 if ( met && met->
m ) {
150 ier = MMG5_intmet(
mesh,met,k,imax,ip,0.5);
166 if (
ier == 2 ||
ier < 0 ) {
181 fprintf(stderr,
"\n ## Error: %s: unable to split.\n",__func__);
185 if (
ier == 0 ||
ier == 2 ) {
201 int8_t force_splt = 0;
202 const int8_t fem_mode = 2;
227 else if ( ilist<0 ) {
231 o[0] = 0.5*(p0->
c[0] + p1->
c[0]);
232 o[1] = 0.5*(p0->
c[1] + p1->
c[1]);
233 o[2] = 0.5*(p0->
c[2] + p1->
c[2]);
244 *warn=1;++(*countMemFailure);
250 if ( met && met->
m ) {
251 ier = MMG5_intmet(
mesh,met,k,imax,ip,0.5);
275 ier = MMG3D_PROctreein(
mesh,met,*PROctree,ip,lfilt);
357 int8_t imin,
double lmin,
358 int8_t imax,
double lmax,
double lmaxtet,
359 int8_t chkRidTet,MMG5_int *ifilt,
360 MMG5_int *ns,MMG5_int *nc,
364 int8_t countMemFailure = 0;
367 chkRidTet,ifilt,ns,warn,&countMemFailure);
384 assert ( (
ier==1 ||
ier==3) &&
"Check return val of delone_split");
386 if ( countMemFailure > 10 ) {
387 printf(
" ## Error:%s: too much reallocation errors. Exit program.\n",__func__);
424 MMG5_int ne,MMG5_int* ifilt,MMG5_int* ns,MMG5_int* nc,
int* warn) {
430 double lmaxtet,lmintet;
431 int ier,imaxtet,imintet;
432 int8_t imin,imax,chkRidTet;
433 static int8_t mmgWarn0 = 0;
437 if ( met->
size==6 ) chkRidTet=1;
440 for (k=1; k<=ne; k++) {
443 else if ( pt->
mark < base-2 )
continue;
447 imax = -1; lmax = 0.0;
448 imin = -1; lmin = DBL_MAX;
450 for (ii=0; ii<6; ii++) {
452 len = MMG5_lenedg(
mesh,met,ii,pt);
468 fprintf(stderr,
"\n # Warning: %s: all edges of tetra %" MMG5_PRId
" are"
469 " boundary and required.\n",
479 fprintf(stderr,
"\n # Warning: %s: all edges of tetra %" MMG5_PRId
" are"
480 " boundary and required.\n",
488 lmax,lmax,chkRidTet,ifilt,ns,nc,warn);
505 assert ( (
ier==1 ||
ier==3) &&
"Check return val of delone_split");
514 for (ii=0; ii<6; ii++) {
516 if ( (ii==imintet) && (lmintet <
MMG3D_LOPTS))
continue;
519 len = MMG5_lenedg(
mesh,met,ii,pt);
528 lmax,lmaxtet,chkRidTet,ifilt,ns,nc,warn);
564 MMG5_int nf,nnf,nnm,nm,nw;
579 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
587 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
599 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,0,
mesh->
mark-1);
601 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",
611 fprintf(stdout,
" %8" MMG5_PRId
" improved, %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",nw,nf,nm);
614 while( ++it < maxit && nw+nm+nf > 0 );
620 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter. \n",nnf,nnm,it);
641 MMG5_int ns,nc,ne,nnm,nm,nnf,nf,nnc,nns,nfilt,ifilt;
642 double maxgap,dd,declic,declicsurf;
645 it = nnc = nns = nnf = nnm = nfilt = 0;
650 declicsurf = 1./3.46;
659 if (
ier<=0 )
return -1;
661 else ns = nc = ifilt = 0;
666 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
674 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
688 nm =
MMG5_movtet(
mesh,met,*PROctree,declicsurf,declic,1,1,0,1,1,
mesh->
mark-2);
691 fprintf(stderr,
"\n ## Error: %s: Unable to improve mesh.\n",__func__);
705 if (
mesh->
gap > maxgap/(
double)maxit )
706 mesh->
gap -= maxgap/(double)maxit;
712 fprintf(stdout,
" %8"MMG5_PRId
" filtered, %8" MMG5_PRId
" splitted, %8" MMG5_PRId
" collapsed,"
713 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",ifilt,ns,nc,nf,nm);
716 dd = MMG5_abs(nc-ns);
717 if ( !noptim && (it==5 || ((dd < 5) || (dd < 0.05*
MG_MAX(nc,ns)) || !(ns+nc))) ) {
725 dd = MMG5_abs(nc-ns);
726 if ( dd < 5 || dd < 0.05*
MG_MAX(nc,ns) )
break;
730 while( ++it < maxit && (noptim || nc+ns > 0) );
734 fprintf(stdout,
" %8"MMG5_PRId
" filtered, %8" MMG5_PRId
" splitted, %8" MMG5_PRId
" collapsed,"
735 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter.\n",nfilt,nns,nnc,nnf,nnm, it);
754 MMG5_int nnf,nf,nw,nm,nnm;
774 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
786 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,3,
mesh->
mark-2);
788 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",
803 fprintf(stdout,
" %8" MMG5_PRId
" improved, %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",nw,nf,nm);
806 while( ++it < maxit && nw+nm+nf > 0 );
813 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,3,
mesh->
mark-2);
815 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",__func__);
824 fprintf(stdout,
" %8" MMG5_PRId
" moved\n",nm);
832 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter. \n",nnf,nnm,it);
849 MMG5_int nnf,nf,nw,k,nnm,nm;
858 for (k=1; k<=
mesh->
ne; k++) {
876 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
884 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
896 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,declic,1,1,1,1,0,
mesh->
mark-1);
898 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh.\n",__func__);
907 fprintf(stdout,
" %8" MMG5_PRId
" improved, %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved\n",nw,nf,nm);
911 if ( !nw && (!nm || !nf) )
break;
914 while( ++it < maxit && nw+nm+nf > 0 );
920 nm =
MMG5_movtet(
mesh,met,PROctree,
MMG3D_MAXKAL,
MMG3D_MAXKAL,1,1,1,1,3,
mesh->
mark-2);
922 fprintf(stderr,
"\n ## Error: %s: Unable to improve mesh.\n",__func__);
931 fprintf(stdout,
" %8" MMG5_PRId
" moved\n",nm);
938 " %8" MMG5_PRId
" swapped, %8" MMG5_PRId
" moved, %d iter. \n",nnf,nnm,it);
956 MMG5_int * permNodGlob) {
964 fprintf(stderr,
"\n ## Error: %s: unable to improve mesh. Exiting.\n",
970 fprintf(stderr,
"\n ## Error: %s: Unable to improve mesh. Exiting.\n",
980 fprintf(stdout,
" ------------- Delaunay: INITIAL SWAP %7"MMG5_PRId
"\n",nnf);
990 fprintf(stderr,
"\n ## Error: %s: unable to complete mesh. Exit program.\n",
996 fprintf(stderr,
"\n ## Error: %s:",__func__);
997 fprintf(stderr,
" unable to allocate a new point in last call of adpspl.\n");
998 fprintf(stderr,
" ## Check the mesh size or ");
999 fprintf(stderr,
"increase the maximal authorized memory with the -m option.\n");
1000 fprintf(stderr,
" ## Uncomplete mesh. Exiting\n" );
1032 fprintf(stdout,
" ** MESH ANALYSIS\n");
1035 fprintf(stderr,
"\n ## Non orientable implicit surface. Exit program.\n");
1041 fprintf(stdout,
" ** GEOMETRIC MESH\n");
1044 fprintf(stderr,
"\n ## Unable to split mesh. Exiting.\n");
1050 if ( getenv(
"MMG_SAVE_ANATET1") ) {
1051 printf(
" ## WARNING: EXIT AFTER ANATET-1."
1052 " (MMG_SAVE_ANATET1 env variable is exported).\n");
1058 fprintf(stdout,
" ** COMPUTATIONAL MESH\n");
1062 if ( !MMG3D_defsiz(
mesh,met) ) {
1063 fprintf(stderr,
"\n ## Metric undefined. Exit program.\n");
1069 if ( getenv(
"MMG_SAVE_DEFSIZ") ) {
1070 printf(
" ## WARNING: EXIT AFTER DEFSIZ."
1071 " (MMG_SAVE_DEFSIZ env variable is exported).\n");
1078 if ( !MMG3D_gradsiz(
mesh,met) ) {
1079 fprintf(stderr,
"\n ## Gradation problem. Exit program.\n");
1084 MMG3D_gradsizreq(
mesh,met);
1089 if ( getenv(
"MMG_SAVE_GRADSIZ") ) {
1090 printf(
" ## WARNING: EXIT AFTER GRADSIZ."
1091 " (MMG_SAVE_GRADSIZ env variable is exported).\n");
1099 fprintf(stderr,
"\n ## Unable to split mesh. Exiting.\n");
1105 if ( getenv(
"MMG_SAVE_ANATET2") ) {
1106 printf(
" ## WARNING: EXIT AFTER ANATET-2."
1107 " (MMG_SAVE_ANATET2 env variable is exported).\n");
1126 fprintf(stderr,
"\n ## Unable to adapt. Exit program.\n");
1136 fprintf(stderr,
"\n ## Topology of mesh unsuited for fem computations. Exit program.\n");
1147 fprintf(stderr,
"\n ## Non orientable implicit surface. Exit program.\n");
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 for the mmg3d library.
#define MMG3D_SSWAPIMPROVE
void MMG3D_set_geom(MMG5_pMesh, MMG5_pPoint, int16_t, MMG5_int, MMG5_int, double[3], double[3], double[3])
MMG5_int MMG3D_newPt(MMG5_pMesh mesh, double c[3], int16_t tag, MMG5_int src)
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)
int MMG3D_optlap(MMG5_pMesh, MMG5_pSol)
int MMG3D_tetraQual(MMG5_pMesh mesh, MMG5_pSol met, int8_t metRidTyp)
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 *, int16_t *, double[3], double[3], double[3], double[3], int64_t *, int *)
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)
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 points of a MMG mesh.
Structure to store the surface tetrahedra of a MMG mesh.