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

Modification of tag transmission from edges to faces in analysis #277

Merged
merged 5 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/mmg3d/analys_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,10 @@ int MMG3D_analys(MMG5_pMesh mesh) {
/* define geometry for non manifold points */
if ( !MMG3D_nmgeom(mesh) ) return 0;

#ifndef NDEBUG
MMG3D_chkfacetags(mesh);
#endif

#ifdef USE_POINTMAP
/* Initialize source point with input index */
MMG5_int ip;
Expand Down
28 changes: 28 additions & 0 deletions src/mmg3d/chkmsh_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,31 @@
}
}

/**
* \param mesh pointer to the mesh
*
* Check that faces do not have nonsensical tags (MG_GEO, MG_NOM, MG_CRN).
*
*/
void MMG3D_chkfacetags(MMG5_pMesh mesh) {
MMG5_pTetra pt;
MMG5_pxTetra pxt;
MMG5_int k;
int i, tag;

for (k=1; k<=mesh->ne; k++) {
pt = &mesh->tetra[k];
if ( !MG_EOK(pt) ) continue;
if ( !pt->xt ) continue;

pxt = &mesh->xtetra[pt->xt];
for (i=0; i<4; i++) {
tag = pxt->ftag[i];
assert(!(tag & (MG_GEO | MG_NOM | MG_CRN)) && "Nonsensical tag on face");

Check warning on line 328 in src/mmg3d/chkmsh_3d.c

View check run for this annotation

Codecov / codecov/patch

src/mmg3d/chkmsh_3d.c#L328

Added line #L328 was not covered by tests
}
}
}

/**
* \param mesh pointer to the mesh
* \param ppt pointer to unconsistent point
Expand Down Expand Up @@ -483,6 +508,9 @@
/* Check edge tag consistency (between xtetra) */
MMG3D_chkmeshedgestags(mesh);

/* Check that faces do not have nonsensical tags*/
MMG3D_chkfacetags(mesh);

/* Check point tags consistency with edge tag */
MMG3D_chkpointtag(mesh);

Expand Down
38 changes: 35 additions & 3 deletions src/mmg3d/hash_3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,17 @@
pxt = &mesh->xtetra[pt->xt];
pxt->ref[i] = ptt->ref;
pxt->ftag[i] |= MG_BDY;
pxt->ftag[i] |= (ptt->tag[0] & ptt->tag[1] & ptt->tag[2]);

/* Store tags that are common to the 3 edges of the triangles */
tag = (ptt->tag[0] & ptt->tag[1] & ptt->tag[2]);

/* Remove infos that make no sense along faces */
tag &= ~MG_GEO;
tag &= ~MG_NOM;
assert( !(tag & MG_CRN) && "MG_CRN tag has no sense along edges" );

Check warning on line 2024 in src/mmg3d/hash_3d.c

View check run for this annotation

Codecov / codecov/patch

src/mmg3d/hash_3d.c#L2024

Added line #L2024 was not covered by tests

/* Assign tag to the face */
pxt->ftag[i] |= tag;
}
}
}
Expand Down Expand Up @@ -2047,7 +2057,19 @@
pxt = &mesh->xtetra[mesh->xt];
pxt->ref[i] = ptt->ref;
pxt->ftag[i] |= MG_BDY;
pxt->ftag[i] |= (ptt->tag[0] & ptt->tag[1] & ptt->tag[2]);

/* here we may wrongfully add MG_REF and/or MG_BDY face tags to internal triangles
in opnbdy mode */
/* Store tags that are common to the 3 edges of the triangles */
tag = (ptt->tag[0] & ptt->tag[1] & ptt->tag[2]);

/* Remove infos that make no sense along faces */
tag &= ~MG_GEO;
tag &= ~MG_NOM;
assert( !(tag & MG_CRN) && "MG_CRN tag has no sense along edges" );

Check warning on line 2069 in src/mmg3d/hash_3d.c

View check run for this annotation

Codecov / codecov/patch

src/mmg3d/hash_3d.c#L2069

Added line #L2069 was not covered by tests

/* Assign tag to the face */
pxt->ftag[i] |= tag;
}
}
}
Expand Down Expand Up @@ -2208,7 +2230,17 @@
pxp = &mesh->xprism[mesh->xpr];
pxp->ref[i] = ptt->ref;
pxp->ftag[i] |= MG_BDY;
pxp->ftag[i] |= (ptt->tag[0] & ptt->tag[1] & ptt->tag[2]);

/* Store tags that are common to the 3 edges of the triangles */
tag = (ptt->tag[0] & ptt->tag[1] & ptt->tag[2]);

/* Remove infos that make no sense along faces */
tag &= ~MG_GEO;
tag &= ~MG_NOM;
assert( !(tag & MG_CRN) && "MG_CRN tag has no sense along edges" );

Check warning on line 2240 in src/mmg3d/hash_3d.c

View check run for this annotation

Codecov / codecov/patch

src/mmg3d/hash_3d.c#L2240

Added line #L2240 was not covered by tests

/* Assign tag to the face */
pxp->ftag[i] |= tag;

for (j=0; j<3; j++) {
pxp->tag[MMG5_iarf[i][j]] |= pxp->ftag[i] | ptt->tag[j];
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 @@ -466,6 +466,7 @@ MMG5_int MMG3D_indPt(MMG5_pMesh mesh,MMG5_int kp);
void MMG5_printTetra(MMG5_pMesh mesh,char* fileName);
void MMG3D_chkpointtag(MMG5_pMesh mesh);
void MMG3D_chkmeshedgestags(MMG5_pMesh mesh);
void MMG3D_chkfacetags(MMG5_pMesh mesh);
int MMG3D_chk_shellEdgeTag(MMG5_pMesh mesh,MMG5_int start, int8_t ia,int16_t tag,MMG5_int ref);

#ifdef USE_SCOTCH
Expand Down