Skip to content

Commit

Permalink
Update Mmg tag to not check PARBDYBDY consistency + update doc + add …
Browse files Browse the repository at this point in the history
…a consistency check at end of analysis.
  • Loading branch information
Algiane committed Oct 22, 2024
1 parent c97fe45 commit ddfc4da
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ IF ( DOWNLOAD_MMG )

EXTERNALPROJECT_ADD ( Mmg
GIT_REPOSITORY https://github.com/MmgTools/mmg.git
GIT_TAG 668f6752cb69d5f5256d52093735e8ff84188e7a
GIT_TAG 86de8073a91e3d1b03ea3bc6a839db2b9fd1d6e3
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
CMAKE_ARGS ${MMG_ARGS} -DUSE_ELAS=OFF ${COMPILER_CFG} ${FLAGS_CFG}
${SCOTCH_CFG} ${VTK_CFG} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand Down
38 changes: 31 additions & 7 deletions src/analys_pmmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "parmmg.h"
#include "libmmg3d.h"
#include "mmgexterns_private.h"

/**
* \param ppt pointer toward the point structure
Expand Down Expand Up @@ -2121,15 +2122,27 @@ int PMMG_setfeatures(PMMG_pParMesh parmesh,MMG5_pMesh mesh,MMG5_HGeom *pHash,MPI
- MG_NOM, MG_OPNBDY and MG_GEO will be analyzed after (this analysis
should be consistent through the procs);
- MG_REQ and MG_NOSURF tags are already dealed too;
- OLDPARBDY, PARBDY, PARBDYBDY and OVERLAP are related to ParMmg and
- OLDPARBDY, PARBDY and OVERLAP are related to ParMmg and
should be consistent.
It left us with:
- the MG_REF tag that may be not consistent (if, on a
partition, the edge belongs to only PARBDY faces (non PARBDYBDY), it is
partition, the edge belongs to only PARBDY faces (non PARBDYBDY),
it is
not marked as REF, while it may be marked as ref if it belongs to a
true boundary and is provided as a user ref edge between triangles with
same references on another partition.)
true boundary and is provided as a user ref edge between triangles
with same references on another partition.)
- the MG_PARBDYBDY tag that may be inconsistent between trias due to
the call of PMMG_parbdyTria: for a physical boundary triangle
at partition interface. On the domain with lower ref, the
PARBDYPARBDY tag is removed from edges (to ensure the tria
orientation during analysis, the tria will be looked from one rank
only, the rank that owned the domain with higer ref). If the edge
also belongs to another boundary triangle, it will still have
the PARBDYBDY tag on this triangle.
We don't want to synchronize this specific tag as it is used for
the parallel analysis (for example in hashNorver_loop to loop
on well oriented true boundary faces).
*/
tag = ptr->tag[i] & MG_REF;
intvalues[idx] |= tag;
Expand Down Expand Up @@ -2202,7 +2215,6 @@ int PMMG_setfeatures(PMMG_pParMesh parmesh,MMG5_pMesh mesh,MMG5_HGeom *pHash,MPI
if ( intvalues[idx] & MG_REF ) {
ptr->tag[i] |= MG_REF;
}

}
}

Expand Down Expand Up @@ -2999,7 +3011,8 @@ int PMMG_analys(PMMG_pParMesh parmesh,MMG5_pMesh mesh,MPI_Comm comm) {
#warning Luca: check that parbdy are skipped
MMG5_chkVertexConnectedDomains(mesh);

/* build hash table for geometric edges */
/* build hash table for geometric edges: gather tag infos from edges and
* triangles and store these infos in tria. Skip non PARBDYBDY // edges. */
if ( !mesh->na && !MMG5_hGeom(mesh) ) {
fprintf(stderr,"\n ## Hashing problem (0). Exit program.\n");
PMMG_edge_comm_free( parmesh );
Expand All @@ -3013,7 +3026,7 @@ int PMMG_analys(PMMG_pParMesh parmesh,MMG5_pMesh mesh,MPI_Comm comm) {
return 0;
}

/* Update edges tags and references for xtetras */
/* Update MG_REQ and MG_NOSURF edges tags as well as references for xtetras */
if ( !MMG5_bdryUpdate(mesh) ) {
fprintf(stderr,"\n ## Boundary problem. Exit program.\n");
PMMG_edge_comm_free( parmesh );
Expand Down Expand Up @@ -3063,5 +3076,16 @@ int PMMG_analys(PMMG_pParMesh parmesh,MMG5_pMesh mesh,MPI_Comm comm) {

if ( mesh->nprism ) MMG5_DEL_MEM(mesh,mesh->adjapr);

#ifndef NDEBUG
MMG5_int i;
for ( i=0; i<parmesh->ngrp; ++i ) {

if ( !MMG5_chkmsh(parmesh->listgrp[i].mesh,1,1) ) {
fprintf(stderr," ## Problem. Invalid mesh.\n");
return 0;
}
}
#endif

return 1;
}
13 changes: 11 additions & 2 deletions src/tag_pmmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ void PMMG_updateTagRef_node(PMMG_pParMesh parmesh, MMG5_pMesh mesh) {
* Check if faces on a parallel communicator connect elements with different
* references, and tag them as a "true" boundary (thus PARBDYBDY).
*
* \remark: Edge tags are not updated along faces with the PARBDYBDY tag as
* it is not sufficient to maintain the consistency of PARBDYBDY tags through the mesh.
* Morover, even if we manage to have consistent tags inside one mesh, we will
* still have to synchronize the edge tags through the partition interfaces. In consequence,
* the PARBDYBDY tags may be not consistent throught the entire remeshing process.
*/
int PMMG_parbdySet( PMMG_pParMesh parmesh ) {
PMMG_pGrp grp;
Expand Down Expand Up @@ -635,8 +640,8 @@ int PMMG_parbdySet( PMMG_pParMesh parmesh ) {
if( seenFace[idx] != 1 ) continue;

/* Tag face as "true" boundary if its ref is different (or if triangle has
* a non nul ref in openbdy mode), delete reference if it is only a
* parallel boundary */
* a non nul ref in opnbdy mode), delete reference if it is only a
* parallel boundary. */
if ( (mesh->info.opnbdy && pxt->ref[ifac]>0) ) {
pxt->ftag[ifac] |= MG_PARBDYBDY;
for( i = 0; i < 3; i++)
Expand Down Expand Up @@ -835,6 +840,10 @@ int PMMG_parbdyTria( PMMG_pParMesh parmesh ) {
ptt->v[1] = ib;
ptt->v[2] = ic;
} else {
/* The boundary will belong to one partition only, for the other
* partition, the triangle will be considered as simply parallel. This
* means that the PARBDYBDY triangle tags may be not consistent from
* here. */
ptt->tag[0] &= ~MG_PARBDYBDY;
ptt->tag[1] &= ~MG_PARBDYBDY;
ptt->tag[2] &= ~MG_PARBDYBDY;
Expand Down

0 comments on commit ddfc4da

Please sign in to comment.