Skip to content

Commit

Permalink
Add MG_BDY tag setting before interpolation along boundary edges.
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Dec 19, 2023
1 parent ffe6fc2 commit d2bf05b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/mmg3d/mmg3d1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,14 @@ int MMG3D_splsurfedge( MMG5_pMesh mesh,MMG5_pSol met,MMG5_int k,
int16_t tag;
int8_t j,i,i1,i2;

assert ( pxt == &mesh->xtetra[pt->xt] );
assert ( pxt == &mesh->xtetra[pt->xt] && "suitable xtetra assignation" );

assert ( ((pxt->ftag[MMG5_ifar[imax][0]] & MG_BDY) || (pxt->ftag[MMG5_ifar[imax][1]] & MG_BDY) )
&& "Boundary edge has to be splitted from a boundary face" );

/* Mark the edge as MG_BDY to avoid wrong evaluation as an internal edge by
* the interpolation function (see intmet_ani) */
pxt->tag[imax] |= MG_BDY;

/* proceed edges according to lengths */
MMG3D_find_bdyface_from_edge(mesh,pt,imax,&i,&j,&i1,&i2,&ip1,&ip2,&p0,&p1);
Expand Down Expand Up @@ -2348,6 +2355,10 @@ MMG3D_anatets_iso(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk) {
ppt = &mesh->point[ip];

assert ( met );

// Add MG_BDY tag before interpolation
pxt->tag[ia] |= MG_BDY;

if ( met->m ) {
if ( typchk == 1 && (met->size>1) )
ier = MMG3D_intmet33_ani(mesh,met,k,ia,ip,0.5);
Expand Down Expand Up @@ -2418,7 +2429,7 @@ MMG3D_anatets_iso(MMG5_pMesh mesh,MMG5_pSol met,int8_t typchk) {
}
else if ( MG_EDG(ptt.tag[j]) && !(ptt.tag[j] & MG_NOM) ) {
/* Point at the interface of 2 boundary faces belonging to different
* tetra : Point has alredy been created from another tetra so we have
* tetra : Point has already been created from another tetra so we have
* to store the tangent and the second normal at edge */
ier = MMG3D_bezierInt(&pb,&uv[j][0],o,no,to);
assert(ier);
Expand Down
4 changes: 4 additions & 0 deletions src/mmg3d/mmg3d1_delone.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ int MMG3D_mmg3d1_delone_split(MMG5_pMesh mesh, MMG5_pSol met,
}

ier = 1;

/* Mark edge as bdy to avoid issue in intmet */
pxt->tag[imax] |= MG_BDY;

if ( met && met->m ) {
ier = MMG5_intmet(mesh,met,k,imax,ip,0.5);
}
Expand Down
2 changes: 1 addition & 1 deletion src/mmg3d/mmg3d1_pattern.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static MMG5_int MMG5_adpspl(MMG5_pMesh mesh,MMG5_pSol met, int* warn) {
else {
/* Case of an internal face */

/* Skip only boundary edges but try to trat internal edges connecting bdy
/* Skip only boundary edges but try to treat internal edges connecting bdy
* points */
int8_t isbdy;
ilist = MMG5_coquil(mesh,k,imax,list,&isbdy);
Expand Down
19 changes: 19 additions & 0 deletions src/mmg3d/swap_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,26 @@ int MMG5_chkswpbdy(MMG5_pMesh mesh, MMG5_pSol met, int64_t *list,int ilist,
ppt0->c[1] = 0.5*(p0->c[1] + p1->c[1]);
ppt0->c[2] = 0.5*(p0->c[2] + p1->c[2]);

#ifndef NDEBUG
/* Security check: ensure that the edge is boundary */
int16_t tag = 0;
MMG5_int ref = 0;
if ( !MMG3D_get_shellEdgeTag(mesh,list[0]/6,list[0]%6,&tag,&ref) ) {
fprintf(stderr,"\n ## Warning: %s: 0. unable to get edge info"
" (tetra %d).\n",__func__,MMG3D_indElt(mesh,list[0]/6));
return 0;
}
assert ( (tag & MG_BDY) && "Edge should be boundary but is not");
#endif

if ( met->m ) {
pt = &mesh->tetra[list[0]/6];
assert ( pt->xt && "Boundary edge interpolated from non-boundary face");

/* Mark edge as boundary to ensure suitable detection of bdy edge during
* interpolation */
mesh->xtetra[pt->xt].tag[list[0]%6] |= MG_BDY;

if ( typchk == 1 && (met->size>1) ) {
if ( MMG3D_intmet33_ani(mesh,met,list[0]/6,list[0]%6,0,0.5) <= 0 )
return 0;
Expand Down

0 comments on commit d2bf05b

Please sign in to comment.