52 double logh,logs,*ma,*mb,ux,uy,d1,d2,dd,rap,dh;
53 double tail,coef,ma1[3],mb1[3],m[3],dd1,dd2;
54 double SQRT3DIV2=0.8660254037844386;
56 MMG5_int ncor,nc,k,iadr,a,b;
58 static int8_t mmgWarn = 0;
61 fprintf(stdout,
" ** Grading mesh\n");
74 fprintf(stderr,
"\n ## Error: %s: unable to allocate hash table.\n",__func__);
79 for(k=1 ; k<=
mesh->
nt ; k++) {
84 for(i=0 ; i<3 ; i++) {
96 fprintf(stderr,
"\n ## Warning: %s: unable to hash at least one edge"
104 for (k=1; k<=
mesh->
np; k++)
111 for (k=0; k<edgeTable.
siz; k++) {
112 pht = &edgeTable.
item[k];
115 if ( !pht->
a )
break;
126 pht = pht->
nxt ? &edgeTable.
item[pht->
nxt] : 0;
131 ux = p2->
c[0] - p1->
c[0];
132 uy = p2->
c[1] - p1->
c[1];
134 d1 = ma[0]*ux*ux + ma[2]*uy*uy + 2.0*ma[1]*ux*uy;
136 if ( d1 < 0.0 ) d1 = 0.0;
139 d2 = mb[0]*ux*ux + mb[2]*uy*uy+ 2.0*mb[1]*ux*uy;
141 if ( d2 < 0.0 ) d2 = 0.0;
159 tail = (dd1+dd2+4*sqrt(0.5*(d1+d2))) / 6.0;
160 coef = log(rap) / tail;
166 coef = exp(tail*logh);
171 coef = 1.0 / (coef*coef);
172 for (i=0; i<3; i++) {
173 ma1[i] = coef * ma[i];
174 mb1[i] = coef * mb[i];
178 for (i=0; i<3; i++) ma[i] = m[i];
181 for (i=0; i<3; i++) ma[i] = SQRT3DIV2 * (ma[i]+mb1[i]);
184 for (i=0; i<3; i++) mb[i] = m[i];
187 for (i=0; i<3; i++) mb[i] = SQRT3DIV2 * (mb[i]+ma1[i]);
193 pht = pht->
nxt ? &edgeTable.
item[pht->
nxt] : 0;
197 }
while ( nc && ++itour < maxtou );
201 fprintf(stdout,
" gradation: %7" MMG5_PRId
" updated, %d iter.\n",ncor,itour);
MMG5_pMesh MMG5_pSol * sol
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)
void MMG5_mark_pointsOnReqEdge_fromTria(MMG5_pMesh mesh)
static const int MMG2D_iare[3][2]
MMG5_int MMG2D_indElt(MMG5_pMesh mesh, MMG5_int kel)
int lissmet_ani(MMG5_pMesh mesh, MMG5_pSol sol)
#define MMG5_SAFE_FREE(ptr)
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 triangles of a MMG mesh.
Used to hash edges (memory economy compared to MMG5_hgeom).