56 for (k=1; k<=
mesh->
np; k++) {
58 if ( !
MG_VOK(ppt) )
continue;
71 fprintf(stderr,
"\n ## Error: %s: unable to scale mesh:"
72 " Check that your mesh contains non-zero points and "
73 "valid elements.\n",__func__);
120 fprintf(stderr,
"\n ## Error: %s: unexpected case (negative user setted"
121 " hmin).\n",__func__);
128 fprintf(stderr,
"\n ## Error: %s: unexpected case (negative user setted"
129 " hmax).\n",__func__);
149 double v[3][3],lambda[3],*m;
151 static int8_t mmgWarn = 0;
153 m = &met->
m[(MMG5_int)met->
size*ip];
157 fprintf(stderr,
"\n ## Warning: %s: Unable to diagonalize at least"
158 " 1 metric.\n",__func__);
164 for (i=0; i<3; i++) {
167 fprintf(stderr,
"\n ## Warning: %s: at least 1 wrong metric "
168 "(eigenvalues : %e %e %e).\n",__func__,lambda[0],
169 lambda[1],lambda[2]);
174 lambda[i]=
MG_MIN(isqhmin,lambda[i]);
175 lambda[i]=
MG_MAX(isqhmax,lambda[i]);
178 m[0] = v[0][0]*v[0][0]*lambda[0] + v[1][0]*v[1][0]*lambda[1]
179 + v[2][0]*v[2][0]*lambda[2];
180 m[1] = v[0][0]*v[0][1]*lambda[0] + v[1][0]*v[1][1]*lambda[1]
181 + v[2][0]*v[2][1]*lambda[2];
182 m[2] = v[0][0]*v[0][2]*lambda[0] + v[1][0]*v[1][2]*lambda[1]
183 + v[2][0]*v[2][2]*lambda[2];
184 m[3] = v[0][1]*v[0][1]*lambda[0] + v[1][1]*v[1][1]*lambda[1]
185 + v[2][1]*v[2][1]*lambda[2];
186 m[4] = v[0][1]*v[0][2]*lambda[0] + v[1][1]*v[1][2]*lambda[1]
187 + v[2][1]*v[2][2]*lambda[2];
188 m[5] = v[0][2]*v[0][2]*lambda[0] + v[1][2]*v[1][2]*lambda[1]
189 + v[2][2]*v[2][2]*lambda[2];
209 static int8_t mmgWarn0 = 0;
214 for (k=1; k<=
mesh->
np; k++) {
219 for (k=1; k<=
mesh->
np; k++) {
230 if ( met->
m[k] <= 0 ) {
233 fprintf(stderr,
"\n ## Error: %s: at least 1 wrong metric.\n",
268 for (k=1; k<=
mesh->
np; k++) {
279 for (i=0; i<met->
size; i++) {
280 met->
m[iadr+i] *= dd;
284 ier = MMG5_solTruncature_ani(
mesh, met);
315 for (k=1; k<=
mesh->
np; k++) {
334 for (k=1; k<=
mesh->
np; k++) {
346 fprintf(stdout,
" After truncature computation: hmin %lf (user setted %d)\n"
347 " hmax %lf (user setted %d)\n",
368 double isqhmin, isqhmax;
369 double lambda[2],vp[2][2];
382 for (k=1; k<=
mesh->
np; k++) {
389 assert (lambda[0] > 0. && lambda[1] > 0. &&
"Negative eigenvalue");
391 isqhmin =
MG_MAX(isqhmin,lambda[0]);
392 isqhmin =
MG_MAX(isqhmin,lambda[1]);
394 isqhmax =
MG_MIN(isqhmax,lambda[0]);
395 isqhmax =
MG_MIN(isqhmax,lambda[1]);
413 for (k=1; k<=
mesh->
np; k++) {
418 met->
m[iadr] = met->
m[iadr+2] = isqhmax;
427 met->
m[iadr] = vp[0][0]*vp[0][0]*lambda[0] + vp[1][0]*vp[1][0]*lambda[1];
428 met->
m[iadr+1] = vp[0][0]*vp[0][1]*lambda[0] + vp[1][0]*vp[1][1]*lambda[1];
429 met->
m[iadr+2] = vp[0][1]*vp[0][1]*lambda[0] + vp[1][1]*vp[1][1]*lambda[1];
435 fprintf(stdout,
" After truncature computation: hmin %lf (user setted %d)\n"
436 " hmax %lf (user setted %d)\n",
456 double isqhmin, isqhmax, isqhmaxcoe;
457 double lambda[3],vp[3][3];
471 for (k=1; k<=
mesh->
np; k++) {
480 fprintf(stdout,
" ## Warning: %s: %d: non diagonalizable metric."
481 " Impose hmax size at point\n",__func__,__LINE__);
482 met->
m[iadr+0] = FLT_MIN;
485 met->
m[iadr+3] = FLT_MIN;
487 met->
m[iadr+5] = FLT_MIN;
490 assert ( lambda[0] > 0. && lambda[1] > 0. && lambda[2] > 0.
491 &&
"Negative eigenvalue");
497 for ( j=0; j<3; ++j ) {
498 if ( isfinite(lambda[j]) && fabs(lambda[j]-isqhmaxcoe) >
MMG5_EPS ) {
499 isqhmax =
MG_MIN(isqhmax,lambda[j]);
500 isqhmin =
MG_MAX(isqhmin,lambda[j]);
522 for (k=1; k<=
mesh->
np; k++) {
524 if ( !
MG_VOK(ppt) )
continue;
529 met->
m[iadr] = isqhmax;
532 met->
m[iadr+3] = isqhmax;
534 met->
m[iadr+5] = isqhmax;
540 fprintf(stdout,
" After truncature computation: hmin %lf (user setted %d)\n"
541 " hmax %lf (user setted %d)\n",
575 assert ( !(
sol &&
sol->m) );
583 for (k=1; k<=
mesh->
np; k++) {
585 if ( !
MG_VOK(ppt) )
continue;
619 if ( (!hsizOrOptim) && (!(met && met->
np)) ) {
623 fprintf(stderr,
"\n ## Error: %s: Exit program.\n",__func__);
629 for ( k=
sol->size; k<sol->size*(
mesh->
np+1); k++ ) {
656 if ( (!met) || (met && !met->
np) || (!met->
m) ) {
660 if ( met->
size == 1 ) {
673 fprintf(stderr,
"\n ## Error: %s: unexpected metric size (%d)\n",__func__,met->
size);
698 for (k=1; k<=
mesh->
np; k++) {
700 if ( !
MG_VOK(ppt) )
continue;
701 for ( i=0; i<
mesh->
dim; ++i ) {
735 for (k=1; k<=
mesh->
np; k++) {
737 if ( !
MG_VOK(ppt) )
continue;
739 for (i=0; i<
sol->size; i++)
sol->m[iadr+i] *= dd;
751 if ( !(met && met->
np && met->
m) )
return 1;
756 for (k=1; k<=
mesh->
np; k++) {
758 if ( !
MG_VOK(ppt) )
continue;
764 for (k=1; k<=
mesh->
np; k++) {
766 if ( !
MG_VOK(ppt) )
continue;
767 for (i=0; i<met->
size; i++) met->
m[met->
size*k+i] *= dd;
771 fprintf(stderr,
"\n ## Error: %s: unexpected metric size (%d)\n",__func__,met->
size);
int MMG5_Set_defaultTruncatureSizes(MMG5_pMesh mesh, int8_t sethmin, int8_t sethmax)
MMG5_pMesh MMG5_pSol * sol
if(!ier) exit(EXIT_FAILURE)
int MMG5_eigensym(double m[3], double lambda[2], double vp[2][2])
int MMG5_eigenv3d(int symmat, double *mat, double lambda[3], double v[3][3])
Find eigenvalues and vectors of a 3x3 matrix.
int MMG5_scale_meshAndSol(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol, double *dd)
int MMG5_3dSolTruncature_ani(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_boundingBox(MMG5_pMesh mesh)
int MMG5_scaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol)
int MMG5_scale_tensorMetric(MMG5_pMesh mesh, MMG5_pSol met, double dd)
void MMG5_check_hminhmax(MMG5_pMesh mesh, int8_t sethmin, int8_t sethmax)
int MMG5_truncate_met3d(MMG5_pSol met, MMG5_int ip, double isqhmin, double isqhmax)
int MMG5_unscaleMesh(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pSol sol)
int MMG5_solTruncature_iso(MMG5_pMesh mesh, MMG5_pSol met)
int MMG5_scale_scalarMetric(MMG5_pMesh mesh, MMG5_pSol met, double dd)
int MMG5_check_setted_hminhmax(MMG5_pMesh mesh)
int MMG5_2dSolTruncature_ani(MMG5_pMesh mesh, MMG5_pSol met)
Local parameters for a specific entity and reference.
Structure to store vertices of an MMG mesh.