From ac0f0ff15af6c3cd30c973bb8f78748bb305d78e Mon Sep 17 00:00:00 2001 From: Algiane Date: Wed, 8 Nov 2017 11:32:51 +0100 Subject: [PATCH] Error correction in the MMG3D_Set_tetrahedron API function when a tetrahedron is provided with a wrong orientation. --- CMakeLists.txt | 2 +- src/mmg3d/API_functions_3d.c | 2 +- src/mmg3d/libmmg3d.c | 5 +++-- src/mmg3d/mmg3d.h | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 515597a42..9e46e7f48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ MARK_AS_ADVANCED ( CI_DIR ) ############################################################################### SET (CMAKE_RELEASE_VERSION_MAJOR "5" ) SET (CMAKE_RELEASE_VERSION_MINOR "3" ) -SET (CMAKE_RELEASE_VERSION_PATCH "4" ) +SET (CMAKE_RELEASE_VERSION_PATCH "5" ) SET (CMAKE_RELEASE_DATE "Apr. 10, 2017" ) SET (CMAKE_RELEASE_VERSION diff --git a/src/mmg3d/API_functions_3d.c b/src/mmg3d/API_functions_3d.c index b60859b8e..451a81cbf 100644 --- a/src/mmg3d/API_functions_3d.c +++ b/src/mmg3d/API_functions_3d.c @@ -503,7 +503,7 @@ int MMG3D_Set_tetrahedron(MMG5_pMesh mesh, int v0, int v1, int v2, int v3, int r mesh->point[pt->v[3]].tag &= ~MG_NUL; vol = _MMG5_orvol(mesh->point,pt->v); - if ( vol <= _MMG5_EPSD2 ) { + if ( fabs(vol) <= _MMG5_EPSD2 ) { fprintf(stderr,"\n ## Error: %s: tetrahedron %d has volume null.\n", __func__,pos); for ( ip=0; ip<4; ip++ ) { diff --git a/src/mmg3d/libmmg3d.c b/src/mmg3d/libmmg3d.c index f008c3cb8..38bacb80a 100644 --- a/src/mmg3d/libmmg3d.c +++ b/src/mmg3d/libmmg3d.c @@ -525,6 +525,9 @@ int MMG3D_mmg3dlib(MMG5_pMesh mesh,MMG5_pSol met) { _MMG3D_Set_commonFunc(); + + _MMG5_warnOrientation(mesh); + /** Free topologic tables (adja, xpoint, xtetra) resulting from a previous * run */ _MMG3D_Free_topoTables(mesh); @@ -597,8 +600,6 @@ int MMG3D_mmg3dlib(MMG5_pMesh mesh,MMG5_pSol met) { _MMG5_warnScotch(mesh); #endif - _MMG5_warnOrientation(mesh); - chrono(OFF,&(ctim[1])); printim(ctim[1].gdif,stim); if ( mesh->info.imprim ) diff --git a/src/mmg3d/mmg3d.h b/src/mmg3d/mmg3d.h index 67d90ea88..81c50d980 100644 --- a/src/mmg3d/mmg3d.h +++ b/src/mmg3d/mmg3d.h @@ -464,12 +464,12 @@ static inline void _MMG5_warnOrientation(MMG5_pMesh mesh) { if ( mesh->xt ) { if ( mesh->xt != mesh->ne ) { - fprintf(stderr," ## Warning: %s: %d tetra on %d reoriented.\n", + fprintf(stderr,"\n ## Warning: %s: %d tetra on %d reoriented.\n", __func__,mesh->xt,mesh->ne); fprintf(stderr," Your mesh may be non-conform.\n"); } else { - fprintf(stderr," ## Warning: %s: all tetra reoriented.\n",__func__); + fprintf(stderr,"\n ## Warning: %s: all tetra reoriented.\n",__func__); } } mesh->xt = 0;