50 double *tabl,n[3],*nptr,lm1,lm2,dd,nx,ny,nz,res0,res;
55 for (k=1; k<=
mesh->
nt; k++) {
57 if ( !
MG_EOK(pt) )
continue;
60 if ( !ppt->
s ) ppt->
s = k;
82 while ( it++ < nit ) {
84 for (k=1; k<=
mesh->
np; k++) {
86 if ( !
MG_VOK(ppt) )
continue;
94 if ( pt->
v[1] == k ) i = 1;
95 else if ( pt->
v[2] == k ) i = 2;
101 for (i=1; i<=ilist; i++) {
120 dd = nx*nx + ny*ny + nz*nz;
140 tabl[iad+0] = nptr[0] + lm1 * (nx - nptr[0]);
141 tabl[iad+1] = nptr[1] + lm1 * (ny - nptr[1]);
142 tabl[iad+2] = nptr[2] + lm1 * (nz - nptr[2]);
148 for (k=1; k<=
mesh->
np; k++) {
151 if ( !
MG_VOK(ppt) )
continue;
155 if ( !iel )
continue;
159 if ( pt->
v[1] == k ) i = 1;
160 else if ( pt->
v[2] == k ) i = 2;
166 for (i=1; i<=ilist; i++) {
167 iad = 3*(list[i]-1) + 1;
172 dd = nx*nx + ny*ny + nz*nz;
182 n[0] = tabl[iad+0] - lm2 * (nx - tabl[iad+0]);
183 n[1] = tabl[iad+1] - lm2 * (ny - tabl[iad+1]);
184 n[2] = tabl[iad+2] - lm2 * (nz - tabl[iad+2]);
196 res += (nptr[0]-n[0])*(nptr[0]*n[0]) + (nptr[1]-n[1])*(nptr[1]*n[1]) + (nptr[2]-n[2])*(nptr[2]*n[2]);
204 if ( it == 1 ) res0 = res;
205 if ( res0 >
MMG5_EPSD ) res = res / res0;
207 fprintf(stdout,
" iter %5d res %.3E\r",it,res);
210 if ( it > 1 && res <
MMG5_EPS )
break;
214 for (k=1; k<=
mesh->
np; ++k) {
221 fprintf(stdout,
" %" MMG5_PRId
" normals regularized: %.3e\n",nn,res);
int MMG5_regnor(MMG5_pMesh mesh)
int MMG5_boulep(MMG5_pMesh mesh, MMG5_int start, int ip, MMG5_int *adja, MMG5_int *list, MMG5_int *tlist)
#define MMG5_SAFE_CALLOC(ptr, size, type, law)
#define MMG5_SAFE_FREE(ptr)
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.
Structure to store surface vertices of an MMG mesh.