Skip to content
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

Add in mesh quality check at the start of MMG5_adptet_delone. #108

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/mmg3d/mmg3d1_delone.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ int8_t ddb;
#define MMG3D_LOPTLMMG5_DEL 1.41
#define MMG3D_LOPTSMMG5_DEL 0.6

#define MMG5_RETURN_AND_PACK(mesh,met,sol,val)do \
{ \
if ( !MMG3D_packMesh(mesh,met,sol) ) { \
mesh->npi = mesh->np; \
mesh->nti = mesh->nt; \
mesh->nai = mesh->na; \
mesh->nei = mesh->ne; \
mesh->xt = 0; \
if ( met ) { met->npi = met->np; } \
if ( sol ) { sol->npi = sol->np; } \
return MMG5_STRONGFAILURE; \
} \
_LIBMMG5_RETURN(mesh,met,sol,val); \
}while(0)

/* Decomment this part to debug */
//int MMG_npuiss,MMG_nvol,MMG_npres,MMG_npd;

Expand Down Expand Up @@ -1249,6 +1264,7 @@ MMG5_adptet_delone(MMG5_pMesh mesh,MMG5_pSol met,MMG3D_pPROctree *PROctree,
int * permNodGlob) {
int nnf,ns,nf;
int warn;
MMG5_pSol sol=NULL; // unused

/*initial swap*/
if ( !mesh->info.noswap ) {
Expand All @@ -1273,6 +1289,11 @@ MMG5_adptet_delone(MMG5_pMesh mesh,MMG5_pSol met,MMG3D_pPROctree *PROctree,
MMG3D_outqua(mesh,met);
}

if ( !MMG3D_outqua(mesh,met) ) {
if ( !MMG5_unscaleMesh(mesh,met,NULL) ) _LIBMMG5_RETURN(mesh,met,sol,MMG5_STRONGFAILURE);
MMG5_RETURN_AND_PACK(mesh,met,sol,MMG5_LOWFAILURE);
}

/* Iterative mesh modifications */
warn = 0;

Expand Down