-
-
Notifications
You must be signed in to change notification settings - Fork 122
Increased diagnostic output and added a few lines of documentation #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
9adff40
9995eb6
219af1f
b1444c5
67d9870
0c583b2
3be1b60
d270498
a90333b
56af1a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
** ============================================================================= | ||
*/ | ||
|
||
|
||
/** | ||
* \file mmg3d/mmg3d.c | ||
* \brief Main file for MMG3D executable: perform 3d mesh adaptation. | ||
|
@@ -538,3 +539,24 @@ int main(int argc,char *argv[]) { | |
/* free mem */ | ||
MMG5_RETURN_AND_FREE(mesh,met,ls,disp,ier); | ||
} | ||
|
||
|
||
|
||
/* -------------------------------------- Mark's hacks --------------------------------------------- */ | ||
|
||
// Print the indices and coordinates of the vertices of one tet. This is to | ||
// inform the user about the location of a problem when the tet index is not | ||
// helpful, for example because it does not correpond to the input or output | ||
// mesh. | ||
// | ||
void MMG5_show_tet_location(MMG5_pMesh mesh, MMG5_pTetra pt, int iel) | ||
{ | ||
fprintf(stderr, " ## tet index %d\n", iel); | ||
for(int j=0; j<4; j++){ | ||
double U[3], *S = mesh->point[pt->v[j]].c; // unscaled and scaled coords | ||
for(int i=0; i<3; i++) U[i] = S[i]*mesh->info.delta + mesh->info.min[i]; | ||
fprintf(stderr, " ## vertex %d at (%f,%f,%f)\n", pt->v[j], U[0], U[1], U[2]); | ||
} | ||
} | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, it can be useful. Just for your information, we also have debugging tools to print the packed indices of tetra and points (which means the indices they will have in the output mesh):
Note that it is useful and trustable only if you save the mesh immediately after calling these functions (because tetra and points indices will be modified if we continue the remeshing so, even if the targetted point/tetra are not touched, the mesh packing will be different). |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -625,16 +625,24 @@ MMG5_int MMG5_swpmsh(MMG5_pMesh mesh,MMG5_pSol met,MMG3D_pPROctree PROctree, int | |
|
||
ret = MMG5_coquilface(mesh,k,i,ia,list,&it1,&it2,0); | ||
ilist = ret / 2; | ||
if ( ret < 0 ) return -1; | ||
if ( ret < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
/* CAUTION: trigger collapse with 2 elements */ | ||
if ( ilist <= 1 ) continue; | ||
ier = MMG5_chkswpbdy(mesh,met,list,ilist,it1,it2,typchk); | ||
if ( ier < 0 ) | ||
if ( ier < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
Comment on lines
+635
to
+636
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
else if ( ier ) { | ||
ier = MMG5_swpbdy(mesh,met,list,ret,it1,PROctree,typchk); | ||
if ( ier > 0 ) ns++; | ||
else if ( ier < 0 ) return -1; | ||
else if ( ier < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
break; | ||
} | ||
} | ||
|
@@ -694,11 +702,17 @@ MMG5_int MMG5_swptet(MMG5_pMesh mesh,MMG5_pSol met,double crit,double declic, | |
} | ||
|
||
nconf = MMG5_chkswpgen(mesh,met,k,i,&ilist,list,crit,typchk); | ||
if ( nconf<0 ) return -1; | ||
if ( nconf<0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
else if ( nconf ) { | ||
ier = MMG5_swpgen(mesh,met,nconf,ilist,list,PROctree,typchk); | ||
if ( ier > 0 ) ns++; | ||
else if ( ier < 0 ) return -1; | ||
else if ( ier < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
break; | ||
} | ||
} | ||
|
@@ -807,34 +821,41 @@ MMG5_int MMG5_movtet(MMG5_pMesh mesh,MMG5_pSol met, MMG3D_pPROctree PROctree, | |
if( !ier ) continue; | ||
else if ( ier>0 ) | ||
ier = MMG5_movbdynompt(mesh,met,PROctree,listv,ilistv,lists,ilists,improveVolSurf); | ||
else | ||
else{ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
} | ||
else if ( ppt->tag & MG_GEO ) { | ||
ier=MMG5_boulesurfvolp(mesh,k,i0,i,listv,&ilistv,lists,&ilists,0); | ||
if ( !ier ) continue; | ||
else if ( ier>0 ) | ||
ier = MMG5_movbdyridpt(mesh,met,PROctree,listv,ilistv,lists,ilists,improveVolSurf); | ||
else | ||
else{ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
else if ( ppt->tag & MG_REF ) { | ||
ier=MMG5_boulesurfvolp(mesh,k,i0,i,listv,&ilistv,lists,&ilists,0); | ||
if ( !ier ) | ||
continue; | ||
else if ( ier>0 ) | ||
ier = MMG5_movbdyrefpt(mesh,met,PROctree,listv,ilistv,lists,ilists,improveVolSurf); | ||
else | ||
else{ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
else { | ||
ier=MMG5_boulesurfvolp(mesh,k,i0,i,listv,&ilistv,lists,&ilists,0); | ||
if ( !ier ) | ||
continue; | ||
else if ( ier<0 ) | ||
else if ( ier<0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
|
||
} | ||
n = &(mesh->xpoint[ppt->xp].n1[0]); | ||
|
||
/* If the orientation of the tetra face is | ||
|
@@ -846,7 +867,10 @@ MMG5_int MMG5_movtet(MMG5_pMesh mesh,MMG5_pSol met, MMG3D_pPROctree PROctree, | |
} | ||
ier = MMG5_movbdyregpt(mesh,met,PROctree,listv,ilistv, | ||
lists,ilists,improveSurf,improveVolSurf); | ||
if (ier < 0 ) return -1; | ||
if (ier < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
else if ( ier ) ns++; | ||
} | ||
} | ||
|
@@ -964,14 +988,18 @@ static int MMG5_coltet(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk) { | |
else { | ||
if ( mesh->adja[4*(k-1)+1+i] ) continue; | ||
if (MMG5_boulesurfvolpNom(mesh,k,ip,i, | ||
list,&ilist,lists,&ilists,&refmin,&refplus,p0->tag & MG_NOM) < 0 ) | ||
list,&ilist,lists,&ilists,&refmin,&refplus,p0->tag & MG_NOM) < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
} | ||
else { | ||
if (MMG5_boulesurfvolp(mesh,k,ip,i, | ||
list,&ilist,lists,&ilists,p0->tag & MG_NOM) < 0 ) | ||
list,&ilist,lists,&ilists,p0->tag & MG_NOM) < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
} | ||
else { | ||
|
@@ -1095,14 +1123,18 @@ static int MMG5_coltet(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk) { | |
else { | ||
if ( mesh->adja[4*(k-1)+1+i] ) continue; | ||
if (MMG5_boulesurfvolpNom(mesh,k,ip,i, | ||
list,&ilist,lists,&ilists,&refmin,&refplus,p0->tag & MG_NOM) < 0 ) | ||
list,&ilist,lists,&ilists,&refmin,&refplus,p0->tag & MG_NOM) < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
} | ||
else { | ||
if (MMG5_boulesurfvolp(mesh,k,ip,i, | ||
list,&ilist,lists,&ilists,p0->tag & MG_NOM) < 0 ) | ||
list,&ilist,lists,&ilists,p0->tag & MG_NOM) < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
} | ||
else { | ||
|
@@ -1134,13 +1166,19 @@ static int MMG5_coltet(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk) { | |
|
||
if ( ilist > 0 ) { | ||
ier = MMG5_colver(mesh,met,list,ilist,iq,typchk); | ||
if ( ier < 0 ) return -1; | ||
if ( ier < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
else if ( ier ) { | ||
MMG3D_delPt(mesh,ier); | ||
break; | ||
} | ||
} | ||
else if (ilist < 0 ) return -1; | ||
else if (ilist < 0 ){ | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
return -1; | ||
} | ||
} | ||
if ( ier ) { | ||
p1->flag = base; | ||
|
@@ -2593,6 +2631,7 @@ MMG3D_anatets_iso(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk) { | |
fprintf(stderr,"\n ## Warning: %s: surfacic pattern: unable to find" | ||
" a valid split for at least 1 point. Point(s) deletion.\n", | ||
__func__ ); | ||
MMG5_show_tet_location(mesh, pt, k); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, keep this in debug mode only (
|
||
mmgWarn2 = 1; | ||
} | ||
|
||
|
@@ -3161,7 +3200,7 @@ int MMG5_anatet(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk, int patternMode) { | |
ier = MMG3D_anatets(mesh,met,typchk); | ||
|
||
if ( ier < 0 ) { | ||
fprintf(stderr,"\n ## Unable to complete surface mesh. Exit program.\n"); | ||
fprintf(stderr,"\n ## Unable to complete surface mesh in MMG5_anatet. Exit program.\n"); | ||
return 0; | ||
} | ||
ns += ier; | ||
|
@@ -3172,7 +3211,7 @@ int MMG5_anatet(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk, int patternMode) { | |
/* analyze internal tetras */ | ||
ier = MMG5_anatetv(mesh,met,typchk); | ||
if ( ier < 0 ) { | ||
fprintf(stderr,"\n ## Unable to complete volume mesh. Exit program.\n"); | ||
fprintf(stderr,"\n ## Unable to complete volume mesh in MMG5_anatet. Exit program.\n"); | ||
return 0; | ||
} | ||
ns += ier; | ||
|
@@ -3188,7 +3227,7 @@ int MMG5_anatet(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk, int patternMode) { | |
if ( !mesh->info.noinsert ) { | ||
nc = MMG5_coltet(mesh,met,typchk); | ||
if ( nc < 0 ) { | ||
fprintf(stderr,"\n ## Unable to collapse mesh. Exiting.\n"); | ||
fprintf(stderr,"\n ## Unable to collapse mesh in MMG5_anatet: nc=%d. Exiting.\n", nc); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we pass here, |
||
return 0; | ||
} | ||
} | ||
|
@@ -3198,14 +3237,14 @@ int MMG5_anatet(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk, int patternMode) { | |
if ( !mesh->info.noswap ) { | ||
ier = MMG5_swpmsh(mesh,met,NULL,typchk); | ||
if ( ier < 0 ) { | ||
fprintf(stderr,"\n ## Unable to improve mesh. Exiting.\n"); | ||
fprintf(stderr,"\n ## Unable to improve mesh in MMG5_anatet. Exiting.\n"); | ||
return 0; | ||
} | ||
nf += ier; | ||
|
||
ier = MMG5_swptet(mesh,met,MMG3D_LSWAPIMPROVE,MMG3D_SWAP06,NULL,typchk,mesh->mark-2); | ||
if ( ier < 0 ) { | ||
fprintf(stderr,"\n ## Unable to improve mesh. Exiting.\n"); | ||
fprintf(stderr,"\n ## Unable to improve mesh in MMG5_anatet. Exiting.\n"); | ||
return 0; | ||
} | ||
nf += ier; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it is not obvious so I prefer to explain this a little: the number of times the message is displayed does not reflect the number of edges for which an error is detected.
The function that may raise this warning is called only:
In consequence:
As the number of warning that is printed is not really meaningful, and as lot of users doesn't need to have the message more than once, I propose to keep this proposition of higher level of verbosity only in debug mode (
-d
command line option of Mmg):