Skip to content

Commit

Permalink
Merge pull request #236 from MmgTools/feature/lag-mode-fix-bdy-edge-test
Browse files Browse the repository at this point in the history
Split internal edges connecting bdy points (mmg3d lag).
  • Loading branch information
Algiane authored Dec 18, 2023
2 parents 0ba9b3d + fb79efb commit ce4b29f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/mmg3d/colver_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ int MMG3D_get_shellEdgeTag_oneDir(MMG5_pMesh mesh,MMG5_int start, MMG5_int na,
* consistent through the edge shell);
*
*/
static inline
int MMG3D_get_shellEdgeTag(MMG5_pMesh mesh,MMG5_int start, int8_t ia,int16_t *tag,MMG5_int *ref) {
MMG5_pTetra pt;
MMG5_pxTetra pxt;
Expand Down
1 change: 1 addition & 0 deletions src/mmg3d/libmmg3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ void MMG3D_coquilFaceSecondLoopInit(MMG5_pMesh mesh,MMG5_int piv,int8_t *iface,i
void MMG5_coquilFaceErrorMessage(MMG5_pMesh mesh, MMG5_int k1, MMG5_int k2);
int16_t MMG5_coquilTravel(MMG5_pMesh,MMG5_int,MMG5_int,MMG5_int*,MMG5_int*,int8_t*,int8_t*);
int16_t MMG5_openCoquilTravel(MMG5_pMesh,MMG5_int,MMG5_int,MMG5_int*,MMG5_int*,int8_t*,int8_t*);
int MMG3D_get_shellEdgeTag(MMG5_pMesh,MMG5_int,int8_t,int16_t*,MMG5_int *);
int MMG5_settag(MMG5_pMesh,MMG5_int,int,int16_t,int);
int MMG5_deltag(MMG5_pMesh,MMG5_int,int,int16_t);
int MMG5_setNmTag(MMG5_pMesh mesh, MMG5_Hash *hash);
Expand Down
22 changes: 19 additions & 3 deletions src/mmg3d/mmg3d3.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,26 @@ static MMG5_int MMG5_spllag(MMG5_pMesh mesh,MMG5_pSol disp,MMG5_pSol met,int itd
p1 = &mesh->point[ip2];

/* Skip the non-internal edges */

// Fast check but incomplete: regular boundary edges may have no tags (bdy
// tags are not added at new edges created during the split of boudary
// faces for example).
if ( pxt && (pxt->tag[i] & MG_BDY) ) continue;

// Slower test but allowing to be sure to detect boundary edges
int16_t tag = 0;
MMG5_int ref = 0;
if ( !MMG3D_get_shellEdgeTag(mesh,k,MMG5_iarf[i][0],&tag,&ref) ) {
fprintf(stderr,"\n ## Warning: %s: 0. unable to get edge info"
" (tetra %d).\n",__func__,MMG3D_indElt(mesh,k));
continue;
}

if( (p0->tag & MG_BDY) && (p1->tag & MG_BDY) ) continue;
if ( tag & MG_BDY ) {
continue;
}

/* Here we are sure to work on a non-boundary edge */
len = (p1->c[0]-p0->c[0])*(p1->c[0]-p0->c[0])
+ (p1->c[1]-p0->c[1])*(p1->c[1]-p0->c[1])
+ (p1->c[2]-p0->c[2])*(p1->c[2]-p0->c[2]);
Expand All @@ -150,11 +165,12 @@ static MMG5_int MMG5_spllag(MMG5_pMesh mesh,MMG5_pSol disp,MMG5_pSol met,int itd
imax = i;
}
}

if ( imax==-1 ) {
if ( !mmgWarn0 ){
mmgWarn0 = 1;
fprintf(stderr,"\n ## Warning: %s: all edges of tetra %" MMG5_PRId " are required"
" or of length null.\n",__func__,k);
fprintf(stderr,"\n ## Warning: %s: No possible edge split in tetra %" MMG5_PRId
".\n",__func__,MMG3D_indElt(mesh,k));
}
continue;
}
Expand Down

0 comments on commit ce4b29f

Please sign in to comment.