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;
59 ppt = &
mesh->point[pt->
v[i]];
60 if ( !ppt->
s ) ppt->
s = k;
82 while ( it++ < nit ) {
84 for (k=1; k<=
mesh->np; k++) {
85 ppt = &
mesh->point[k];
86 if ( !
MG_VOK(ppt) )
continue;
92 pt = &
mesh->tria[iel];
94 if ( pt->
v[1] == k ) i = 1;
95 else if ( pt->
v[2] == k ) i = 2;
101 for (i=1; i<=ilist; i++) {
102 p0 = &
mesh->point[list[i]];
107 pxp = &
mesh->xpoint[p0->
xp];
120 dd = nx*nx + ny*ny + nz*nz;
131 pxp = &
mesh->xpoint[ppt->
xp];
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++) {
149 ppt = &
mesh->point[k];
151 if ( !
MG_VOK(ppt) )
continue;
155 if ( !iel )
continue;
157 pt = &
mesh->tria[iel];
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]);
189 pxp = &
mesh->xpoint[ppt->
xp];
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;
206 if (
mesh->info.imprim < -1 ||
mesh->info.ddebug ) {
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) {
215 mesh->point[k].s = 0;
218 if (
mesh->info.imprim < -1 ||
mesh->info.ddebug ) fprintf(stdout,
"\n");
220 if ( abs(
mesh->info.imprim) > 4 )
221 fprintf(stdout,
" %" MMG5_PRId
" normals regularized: %.3e\n",nn,res);
int MMG5_boulep(MMG5_pMesh mesh, MMG5_int start, int ip, MMG5_int *adja, MMG5_int *list, MMG5_int *tlist)