43 double *a,*b,*c,abx,aby,abz,acx,acy,acz,det,n[3];
45 a =
mesh->point[ptt->
v[0]].c;
46 b =
mesh->point[ptt->
v[1]].c;
47 c =
mesh->point[ptt->
v[2]].c;
58 n[0] = aby*acz - abz*acy;
59 n[1] = abz*acx - abx*acz;
60 n[2] = abx*acy - aby*acx;
61 det = n[0]*n[0] + n[1]*n[1] + n[2]*n[2];
63 return 0.5*sqrt(det) ;
79 if ( abs(
mesh->info.imprim) > 5 ||
mesh->info.ddebug )
80 fprintf(stdout,
" ** Defining %stropic map\n",(met->
size==1)?
"iso":
"aniso");
82 if (
mesh->info.hmax < 0.0 ) {
83 fprintf(stderr,
"\n ## Error: %s: negative hmax value.\n",funcname);
98 if (
mesh->info.imprim > 0 ) {
99 if (
mesh->info.hgrad > 0. ) {
100 fprintf(stdout,
"\n -- GRADATION : %8f ",
101 exp(
mesh->info.hgrad) );
102 if (
mesh->info.hgradreq > 0. ) {
103 fprintf(stdout,
"(%8f)",exp(
mesh->info.hgradreq));
105 fprintf(stdout,
"\n");
108 if (
mesh->info.hgradreq > 0. ) {
109 fprintf(stdout,
"\n -- GRADATION : DISABLED (%8f)\n",exp(
mesh->info.hgradreq));
135 p0 = &
mesh->point[ip0];
136 p1 = &
mesh->point[ip1];
139 for ( j=0; j<
mesh->dim; ++j ) {
140 dist = p1->
c[j]-p0->
c[j];
147 met->
m[met->
size*ip0] += len;
148 met->
m[met->
size*ip1] += len;
172 for ( k=1; k<=
mesh->np; k++ ) {
173 p0 = &
mesh->point[k];
174 if ( !
MG_VOK(p0) )
continue;
176 if ( !p0->
s )
continue;
184 if (
mesh->info.ddebug || (
mesh->info.imprim > 4) ) {
185 printf(
"\n -- SIZEMAP CORRECTION : overwritten of sizes at required vertices\n");
207 MMG5_int k,ip0,ip1,iad0,iad1;
210 for ( k=1; k<=
mesh->nt; k++ ) {
212 if ( !
MG_EOK(pt) )
continue;
214 for ( i=0; i<3; ++i ) {
220 iad0 = met->
size*ip0;
221 iad1 = met->
size*ip1;
223 for ( j=0; j<met->
size; ++j ) {
225 met->
m[ iad0 + j ] = 0.;
226 met->
m[ iad1 + j ] = 0.;
249 for ( k=1; k<=
mesh->np; k++ ) {
250 ppt = &
mesh->point[k];
255 for ( k=1; k<=
mesh->nt; k++ ) {
257 if ( !
MG_EOK(pt) ) {
continue; }
259 for ( i=0; i<3; ++i ) {
281 double hgrad,ll,h1,h2,hn,val;
287 if ( abs(
mesh->info.imprim) > 5 ||
mesh->info.ddebug ) {
288 fprintf(stdout,
" ** Grading mesh\n");
293 for ( k=1; k<=
mesh->np; k++ ) {
298 hgrad =
mesh->info.hgrad;
306 for (k=1; k<=
mesh->nt; k++) {
308 if ( !
MG_EOK(pt) )
continue;
310 for (i=0; i<3; i++) {
315 p1 = &
mesh->point[ip1];
316 p2 = &
mesh->point[ip2];
320 if ( p1->
s || p2->
s )
continue;
323 for ( j=0; j<
mesh->dim; ++j ) {
324 val = p2->
c[j]-p1->
c[j];
353 while ( ++it < maxit && nu > 0 );
355 if ( abs(
mesh->info.imprim) > 4 ) {
356 fprintf(stdout,
" gradation: %7"MMG5_PRId
" updated, %d iter.\n",nup,it);
375 double hgrad,ll,h1,h2,hn,ux,uy;
377 MMG5_int k,ip1,ip2,ipmaster,ipslave;
381 if ( abs(
mesh->info.imprim) > 5 ||
mesh->info.ddebug ) {
382 fprintf(stdout,
" ** Grading required points.\n");
385 if (
mesh->info.hgrad < 0. ) {
391 hgrad =
mesh->info.hgradreq;
397 for (k=1; k<=
mesh->nt; k++) {
403 for (i=0; i<3; i++) {
408 p1 = &
mesh->point[ip1];
409 p2 = &
mesh->point[ip2];
411 if ( MMG5_abs ( p1->
s - p2->
s ) < 2 ) {
415 else if ( p1->
s > p2->
s ) {
420 assert ( p2->
s > p1->
s );
425 ux = p2->
c[0]-p1->
c[0];
426 uy = p2->
c[1]-p1->
c[1];
430 h1 = met->
m[ipmaster];
431 h2 = met->
m[ipslave];
447 met->
m[ipslave] = hn;
448 mesh->point[ipslave].s =
mesh->point[ipmaster].s - 1;
454 while ( ++it < maxit && nu > 0 );
456 if ( abs(
mesh->info.imprim) > 4 && nup ) {
457 fprintf(stdout,
" gradation (required): %7d updated, %d iter.\n",nup,it);
void MMG5_gradation_info(MMG5_pMesh mesh)
double MMG5_surftri_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
int MMG5_sum_reqEdgeLengthsAtPoint(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int ip0, MMG5_int ip1)
void MMG5_mark_pointsOnReqEdge_fromTria(MMG5_pMesh mesh)
int MMG5_reset_metricAtReqEdges_surf(MMG5_pMesh mesh, MMG5_pSol met, int8_t ismet)
int MMG5_gradsiz_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_compute_meanMetricAtMarkedPoints_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_defsiz_startingMessage(MMG5_pMesh mesh, MMG5_pSol met, const char *funcname)
int MMG5_gradsizreq_iso(MMG5_pMesh mesh, MMG5_pSol met)
static const uint8_t MMG5_iprv2[3]
static const uint8_t MMG5_inxt2[6]