59 for (k=1; k<=
mesh->
ne; k++) {
61 if( !
MG_EOK(pt) )
continue;
63 if ( !metRidTyp && met->
size == 6 && met->
m ) {
66 else if ( !(met && met->
m) ) {
77 for ( i=0; i<4; ++i ) {
86 if ( i < 4 && pt->qual < minqual ) {
110 double cal,abx,aby,abz,acx,acy,acz,adx,ady,adz;
111 double bcx,bcy,bcz,bdx,bdy,bdz,cdx,cdy,cdz;
112 double h1,h2,h3,h4,h5,h6,det,vol,rap,v1,v2,v3,num;
115 int iad0,iad1,iad2,iad3;
123 iad0 = met->
size * ip[0];
124 iad1 = met->
size * ip[1];
125 iad2 = met->
size * ip[2];
126 iad3 = met->
size * ip[3];
130 mm[k] = 0.25 * (met->
m[iad0+k]+met->
m[iad1+k]+met->
m[iad2+k]+met->
m[iad3+k]);
162 v1 = acy*adz - acz*ady;
163 v2 = acz*adx - acx*adz;
164 v3 = acx*ady - acy*adx;
165 vol = abx * v1 + aby * v2 + abz * v3;
166 if ( vol <= 0. )
return 0.0;
168 det = mm[0] * ( mm[3]*mm[5] - mm[4]*mm[4]) \
169 - mm[1] * ( mm[1]*mm[5] - mm[2]*mm[4]) \
170 + mm[2] * ( mm[1]*mm[4] - mm[2]*mm[3]);
174 det = sqrt(det) * vol;
177 h1 = mm[0]*abx*abx + mm[3]*aby*aby + mm[5]*abz*abz
178 + 2.0*(mm[1]*abx*aby + mm[2]*abx*abz + mm[4]*aby*abz);
179 h2 = mm[0]*acx*acx + mm[3]*acy*acy + mm[5]*acz*acz
180 + 2.0*(mm[1]*acx*acy + mm[2]*acx*acz + mm[4]*acy*acz);
181 h3 = mm[0]*adx*adx + mm[3]*ady*ady + mm[5]*adz*adz
182 + 2.0*(mm[1]*adx*ady + mm[2]*adx*adz + mm[4]*ady*adz);
183 h4 = mm[0]*bcx*bcx + mm[3]*bcy*bcy + mm[5]*bcz*bcz
184 + 2.0*(mm[1]*bcx*bcy + mm[2]*bcx*bcz + mm[4]*bcy*bcz);
185 h5 = mm[0]*bdx*bdx + mm[3]*bdy*bdy + mm[5]*bdz*bdz
186 + 2.0*(mm[1]*bdx*bdy + mm[2]*bdx*bdz + mm[4]*bdy*bdz);
187 h6 = mm[0]*cdx*cdx + mm[3]*cdy*cdy + mm[5]*cdz*cdz
188 + 2.0*(mm[1]*cdx*cdy + mm[2]*cdx*cdz + mm[4]*cdy*cdz);
191 rap = h1 + h2 + h3 + h4 + h5 + h6;
192 num = sqrt(rap) * rap;
222 double* lmin,
double* lmax, MMG5_int* ned, MMG5_int* amin,
223 MMG5_int* bmin, MMG5_int* amax,
224 MMG5_int* bmax, MMG5_int* nullEdge, int8_t metRidTyp,
225 double** bd_in, MMG5_int hl[9] )
232 int8_t ia,i0,i1,
ier,i;
233 static double bd[9]= {0.0, 0.3, 0.6, 0.7071, 0.9, 1.3, 1.4142, 2.0, 5.0};
236 memset(hl,0,9*
sizeof(MMG5_int));
241 *amin = *amax = *bmin = *bmax = 0;
244 if ( (!met) || (!met->
m) ) {
257 for(k=1; k<=
mesh->
ne; k++) {
259 if ( !
MG_EOK(pt) )
continue;
261 for(ia=0; ia<6; ia++) {
268 fprintf(stderr,
" ## Error: %s: function MMG5_hashEdge return 0\n",
276 for(k=1; k<=
mesh->
ne; k++) {
278 if ( !
MG_EOK(pt) )
continue;
280 for(i=0 ; i<4 ; i++) {
288 for(ia=0; ia<6; ia++) {
297 if ( (!metRidTyp) && met->
size==6 && met->
m ) {
307 len = MMG5_lenedg(
mesh,met,ia,pt);
317 if( len < (*lmin) ) {
323 if ( len > (*lmax) ) {
331 if ( bd[i] <= len && len < bd[i+1] ) {
336 if( i == 8 ) hl[8]++;
358 double avlen, lmin, lmax;
359 MMG5_int ned, nullEdge;
360 MMG5_int amin, bmin, amax, bmax, hl[9];
364 &bmin, &amax, &bmax, &nullEdge, metRidTyp, &bd, hl ) )
369 amax, bmax, lmax,nullEdge, &bd[0], &hl[0],1);
393 double *min,MMG5_int *iel,MMG5_int *good,MMG5_int *med,MMG5_int his[5],
int imprim) {
397 static int8_t mmgWarn0=0;
400 for (k=1; k<=
mesh->
ne; k++) {
402 if( !
MG_EOK(pt) )
continue;
410 (*min) = (*avg) = 0.0;
413 (*med) = (*good) = 0;
415 for (k=0; k<5; k++) his[k] = 0;
418 for (k=1; k<=
mesh->
ne; k++) {
427 fprintf(stderr,
" ## Warning: %s: at least 1 negative volume.\n",
431 if ( rap > (*min) ) {
435 if ( rap < 0.9 ) (*med)++;
436 if ( rap < 0.6 ) (*good)++;
439 (*max) =
MG_MIN((*max),rap);
477 MMG5_int good,MMG5_int med,MMG5_int his[5],MMG5_int nrid,
int optimLES,
480 fprintf(stdout,
"\n -- MESH QUALITY");
482 fprintf(stdout,
" (LES)");
483 fprintf(stdout,
" %" MMG5_PRId
"\n",ne);
485 fprintf(stdout,
" BEST %8.6f AVRG. %8.6f WRST. %8.6f (%" MMG5_PRId
")\n",
486 max,avg / ne,min,iel);
489 nrid,optimLES,imprim) );
511 MMG5_int good,MMG5_int med,MMG5_int his[5],MMG5_int nrid,
int optimLES,
514 const double les_ticks[6] = {0,0.6,0.9,0.93,0.99,1};
517 if ( abs(imprim) >= 3 ){
520 fprintf(stdout,
" HISTOGRAMM:");
521 fprintf(stdout,
" %6.2f %% < 0.6\n",100.0*((
float)good/(
float)ne));
522 if ( abs(imprim) > 3 ) {
523 fprintf(stdout,
" %6.2f %% < 0.9\n",100.0*( (
float)med/(
float)ne));
525 assert ( min >= max );
526 for ( i=0; i<5; ++i ) {
527 if ( max < les_ticks[i+1] && min >= les_ticks[i] ) {
528 fprintf(stdout,
" %5.2f < Q < %5.2f %7"MMG5_PRId
" %6.2f %%\n",
529 les_ticks[i],les_ticks[i+1],his[i],
530 100.*((
float)his[i]/(
float)ne));
538 fprintf(stdout,
" HISTOGRAMM:");
539 fprintf(stdout,
" %6.2f %% > 0.12\n",100.0*((
float)good/(
float)ne));
540 if ( abs(imprim) > 3 ) {
541 fprintf(stdout,
" %6.2f %% > 0.5\n",100.0*( (
float)med/(
float)ne));
542 imax =
MG_MIN(4,(
int)(5.*max));
543 for (i=imax; i>=(int)(5*min); i--) {
544 fprintf(stdout,
" %5.1f < Q < %5.1f %7"MMG5_PRId
" %6.2f %%\n",
545 i/5.,i/5.+0.2,his[i],100.*((
float)his[i]/(
float)ne));
548 fprintf(stdout,
"\n ## WARNING: %" MMG5_PRId
" TETRA WITH 4 RIDGES POINTS:"
549 " UNABLE TO COMPUTE ANISO QUALITY.\n",nrid);
576 double *min,MMG5_int *iel,MMG5_int *good,MMG5_int *med,MMG5_int his[5],
int imprim) {
581 static int8_t mmgWarn0 = 0;
584 for (k=1; k<=
mesh->
ne; k++) {
586 if( !
MG_EOK(pt) )
continue;
589 if ( met->
size == 6) {
598 if ( imprim <= 0 )
return;
601 (*max) = (*avg) = 0.0;
603 (*med) = (*good) = 0;
605 for (k=0; k<5; k++) his[k] = 0;
608 for (k=1; k<=
mesh->
ne; k++) {
617 fprintf(stderr,
" ## Warning: %s: at least 1 negative volume\n",
621 if ( rap < (*min) ) {
625 if ( rap > 0.5 ) (*med)++;
626 if ( rap > 0.12 ) (*good)++;
629 (*max) =
MG_MAX((*max),rap);
630 ir =
MG_MIN(4,(
int)(5.0*rap));
648 double rapmin,rapmax,rapavg;
650 MMG5_int med,good,iel,ne,his[5];
652 ne = iel = good = med = 0;
653 for ( k=0; k<5; ++k ) {
697 double *min,MMG5_int *iel,MMG5_int *good,MMG5_int *med,MMG5_int his[5],
698 MMG5_int *nrid,
int imprim) {
704 static int8_t mmgWarn0 = 0;
707 for (k=1; k<=
mesh->
ne; k++) {
709 if( !
MG_EOK(pt) )
continue;
717 (*max) = (*avg) = 0.0;
719 (*med) = (*good) = 0;
721 for (k=0; k<5; k++) his[k] = 0;
723 nex = ok = (*nrid) = 0;
724 for (k=1; k<=
mesh->
ne; k++) {
733 fprintf(stderr,
" ## Warning: %s: at least 1 negative volume\n",
741 for(i=0 ; i<4 ; i++) {
753 if ( rap < (*min) ) {
757 if ( rap > 0.5 ) (*med)++;
758 if ( rap > 0.12 ) (*good)++;
761 (*max) =
MG_MAX((*max),rap);
762 ir =
MG_MIN(4,(
int)(5.0*rap));
781 double rapmin,rapmax,rapavg;
784 MMG5_int med,good,iel,ne,nrid;
786 nrid = ne = iel = good = med = 0;
787 for ( k=0; k<5; ++k ) {
827 int ia,ipa,ipb,lon,l;
829 int lenint,loc,nedel,longen;
830 double dned,dnface,dnint,w,lenavg,lent[6];
831 double dnpdel,dnadd,leninv,dnaddloc,dnpdelloc;
838 pdel = (MMG5_int*) calloc(
mesh->
np+1,
sizeof(MMG5_int));
854 for (k=1; k<=
mesh->
ne; k++) {
856 if ( !
MG_EOK(pt) )
continue;
861 for(ib=0 ; ib<6 ; ib++) {
864 lent[ib] = MMG5_lenedg(
mesh,
sol,ib,pt);
865 if ( lent[ib]==0 ) nv--;
869 lenavg /= (double)nv;
878 for (ia=0; ia<6; ia++) {
891 for (l=1; l<lon; l++)
892 if ( list[l] < 6*k )
break;
906 if(ddebug) printf(
"len %e\n",len);
910 lenint = ((int) len);
911 if(fabs(lenint -len) > 0.5) lenint++;
916 dnface = (lenint+2)*(lenint+1) / 2. - 3 - 3*dned;
918 dnint = (lenint+3)*(lenint+2)*(lenint+1) / 6. - 4 - 4*dnface - 6*dned;
924 dnaddloc = dned + lon*(2*dnface/3. + dnint/6.);
933 dnaddloc = dned / lon + 2*dnface/3.;
935 dnaddloc = dned / lon ;
942 dnaddloc = 0.2*dnaddloc;
944 dnaddloc = dnaddloc*0.3 + dnaddloc;
945 else if(len < 6 && len>3)
946 dnaddloc = 0.7*dnaddloc;
951 }
else if(len > 2.8) {
965 }
else if(len > 1.41) {
973 }
else if(len < 0.6) {
977 if(pt->
v[ipa]<pt->
v[ipb]) {
978 if(!pdel[pt->
v[ipa]]) {
980 dnpdelloc = (leninv - 1.)/leninv;
988 }
else if(!pdel[pt->
v[ipb]]) {
990 dnpdelloc = (leninv - 1.)/leninv;
1000 if(!pdel[pt->
v[ipb]]) {
1002 dnpdelloc = (leninv - 1.)/leninv;
1010 }
else if(!pdel[pt->
v[ipa]]) {
1012 dnpdelloc = (leninv - 1.)/leninv;
1028 if(ddebug) printf(
"on ajoute %e\n",dnaddloc);
1032 if(ddebug) printf(
"on soustrait %d\n",nedel);
1041 weightelt[k] = 10*w;
1045 nptot += (long) dnadd - (
long) dnpdel;
1047 fprintf(stdout,
" ** ESTIMATION OF THE FINAL NUMBER OF NODES : %ld \n",nptot);
1049 fprintf(stdout,
" ** %lf ADD DEL %lf\n",dnadd,dnpdel);
MMG5_pMesh MMG5_pSol * sol
int MMG5_coquil(MMG5_pMesh mesh, MMG5_int start, int ia, int64_t *list, int8_t *isbdy)
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int hsiz, MMG5_int hmax)
int MMG5_hashEdge(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
int MMG5_hashPop(MMG5_Hash *hash, MMG5_int a, MMG5_int b)
static double MMG5_caltet_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
static double MMG5_lenedg33_ani(MMG5_pMesh mesh, MMG5_pSol met, int ia, MMG5_pTetra pt)
static double MMG5_orcal(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int iel)
API headers and documentation for the mmg3d library, for volumetric meshes in 3D.
static const uint8_t MMG5_iare[6][2]
vertices of extremities of the edges of the tetra
int MMG5_minQualCheck(MMG5_int iel, double minqual, double alpha)
void MMG5_displayLengthHisto(MMG5_pMesh, MMG5_int, double *, MMG5_int, MMG5_int, double, MMG5_int, MMG5_int, double, int, double *, MMG5_int *, int8_t)
double MMG5_orvol(MMG5_pPoint point, MMG5_int *v)
#define MMG5_SAFE_FREE(ptr)
#define MMG5_DEL_MEM(mesh, ptr)
int MMG3D_prilen(MMG5_pMesh mesh, MMG5_pSol met, int8_t metRidTyp)
void MMG3D_computeLESqua(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int *ne, double *max, double *avg, double *min, MMG5_int *iel, MMG5_int *good, MMG5_int *med, MMG5_int his[5], int imprim)
int MMG3D_displayQualHisto(MMG5_int ne, double max, double avg, double min, MMG5_int iel, MMG5_int good, MMG5_int med, MMG5_int his[5], MMG5_int nrid, int optimLES, int imprim)
void MMG3D_computeOutqua(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int *ne, double *max, double *avg, double *min, MMG5_int *iel, MMG5_int *good, MMG5_int *med, MMG5_int his[5], MMG5_int *nrid, int imprim)
int MMG3D_displayQualHisto_internal(MMG5_int ne, double max, double avg, double min, MMG5_int iel, MMG5_int good, MMG5_int med, MMG5_int his[5], MMG5_int nrid, int optimLES, int imprim)
int MMG3D_computePrilen(MMG5_pMesh mesh, MMG5_pSol met, double *avlen, double *lmin, double *lmax, MMG5_int *ned, MMG5_int *amin, MMG5_int *bmin, MMG5_int *amax, MMG5_int *bmax, MMG5_int *nullEdge, int8_t metRidTyp, double **bd_in, MMG5_int hl[9])
int MMG5_countelt(MMG5_pMesh mesh, MMG5_pSol sol, double *weightelt, long *npcible)
void MMG3D_computeInqua(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int *ne, double *max, double *avg, double *min, MMG5_int *iel, MMG5_int *good, MMG5_int *med, MMG5_int his[5], int imprim)
int MMG3D_tetraQual(MMG5_pMesh mesh, MMG5_pSol met, int8_t metRidTyp)
double MMG5_caltet33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTetra pt)
int MMG3D_outqua(MMG5_pMesh mesh, MMG5_pSol met)
int MMG3D_inqua(MMG5_pMesh mesh, MMG5_pSol met)
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Structure to store vertices of an MMG mesh.
Structure to store tetrahedra of an MMG mesh.