Skip to content

Commit

Permalink
Merge branch 'develop' into feature/edge-tag-consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Oct 25, 2024
2 parents fe69e60 + d11d85c commit 60b5da1
Show file tree
Hide file tree
Showing 14 changed files with 1,534 additions and 555 deletions.
151 changes: 148 additions & 3 deletions cmake/testing/pmmg_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ IF( BUILD_TESTING )
ENDIF()
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} -C ${CI_DIR} fetch
COMMAND ${GIT_EXECUTABLE} -C ${CI_DIR} checkout 0b1fce5e92fd42514fd75e8542ff67adeb6d77f8
COMMAND ${GIT_EXECUTABLE} -C ${CI_DIR} checkout cd45788c32f6
TIMEOUT 20
WORKING_DIRECTORY ${CI_DIR}
#COMMAND_ECHO STDOUT
Expand Down Expand Up @@ -434,6 +434,124 @@ IF( BUILD_TESTING )
${CI_DIR}/LevelSet/2p_toygeom/cube-distributed-faces-nomat-1edge.mesh -v 10 -hsiz 0.1
-out ${CI_DIR_RESULTS}/update-ref-tag.o.mesh)

# Test to check that when not using -opnbdy option, internal triangles are correctly removed.
# See ParMmg PR#110
add_test( NAME extrainternaltriangles
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 3 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/Cube/internaltriangles-P3.mesh -v 10
-out ${CI_DIR_RESULTS}/internaltriangles-P3.o.mesh)

###############################################################################
#####
##### Tests overlap
#####
###############################################################################
# Test if overlap is created
set(overlapCreation "## Create Overlap.")

add_test( NAME overlap-create
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-create.o.mesh)
set_property(TEST overlap-create
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCreation}")

# Test if overlap is deleted
set(overlapDelete "## Delete Overlap.")

add_test( NAME overlap-delete
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-delete.o.mesh)
set_property(TEST overlap-delete
PROPERTY PASS_REGULAR_EXPRESSION "${overlapDelete}")

# Tests if overlap is created correctly
set(overlapCheckP0P1 "OVERLAP - part 0 sends 74 pts and 257 tetra to part 1")
set(overlapCheckP0P2 "OVERLAP - part 0 sends 29 pts and 110 tetra to part 2")
set(overlapCheckP0P3 "OVERLAP - part 0 sends 61 pts and 204 tetra to part 3")
set(overlapCheckP0P4 "OVERLAP - part 0 sends 28 pts and 66 tetra to part 4")
set(overlapCheckP0 "OVERLAP - part 0 has 433 pts and 1492 tetras after overlap creation")

add_test( NAME overlap-check-P0P1
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-check-P0P1.o.mesh)
set_property(TEST overlap-check-P0P1
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckP0P1}")

add_test( NAME overlap-check-P0P2
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-check-P0P2.o.mesh)
set_property(TEST overlap-check-P0P2
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckP0P2}")

add_test( NAME overlap-check-P0P3
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-check-P0P3.o.mesh)
set_property(TEST overlap-check-P0P3
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckP0P3}")

add_test( NAME overlap-check-P0P4
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-check-P0P4.o.mesh)
set_property(TEST overlap-check-P0P4
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckP0P4}")

add_test( NAME overlap-check-P0
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-check-P0.o.mesh)
set_property(TEST overlap-check-P0
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckP0}")

add_test( NAME overlap-check-P0-met
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-met ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-metric.sol
-out ${CI_DIR_RESULTS}/overlap-check-P0-met.o.mesh)
set_property(TEST overlap-check-P0-met
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckP0}")

# Tests if overlap is deleted correctly
set(overlapCheckDelete "OVERLAP - part 0 has 282 pts and 882 tetras after overlap deletion")
add_test( NAME overlap-check-delete
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-check-delete.o.mesh)
set_property(TEST overlap-check-delete
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckDelete}")

add_test( NAME overlap-check-delete-met
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} 5 $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/5p_cubegeom/3D-cube.mesh -v 10 -nomove -noinsert -noswap -nobalance -niter 1
-ls 0.0
-sol ${CI_DIR}/LevelSet/5p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/overlap-check-delete-met.o.mesh)
set_property(TEST overlap-check-delete-met
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckDelete}")

###############################################################################
#####
##### Test isovalue mode - ls discretization
Expand Down Expand Up @@ -622,6 +740,22 @@ IF( BUILD_TESTING )
TEST ls-DisIn-toygeom-metric-${MODE}-${NP}
PROPERTY PASS_REGULAR_EXPRESSION "${metric-open}")

# Toy geom:: ls_val=0.0 + remesh metric
# TO DEBUG raises lot of warnings
add_test( NAME ls-DisIn-toygeom-metric-ani-${MODE}-${NP}
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} ${NP} $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/${NP}p_toygeom/cube-distributed-${MODE}-nomat-edges.mesh -v 5
-ls 0.0
-sol ${CI_DIR}/LevelSet/${NP}p_toygeom/cube-ls.sol
-met ${CI_DIR}/LevelSet/${NP}p_toygeom/cube-metric-ani.sol
-out ${CI_DIR_RESULTS}/ls-DisIn-toygeom-metric-${MODE}-${NP}.o.mesh)

SET(metric-ani-open "cube-metric-ani.0.sol OPENED")
SET_PROPERTY(
TEST ls-DisIn-toygeom-metric-ani-${MODE}-${NP}
PROPERTY PASS_REGULAR_EXPRESSION "${metric-ani-open}")


# Toy geom:: ls_val=0.0 + no remesh + fields
add_test( NAME ls-DisIn-toygeom-fields-${MODE}-${NP}
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} ${NP} $<TARGET_FILE:${PROJECT_NAME}>
Expand All @@ -647,7 +781,6 @@ IF( BUILD_TESTING )
-field ${CI_DIR}/LevelSet/${NP}p_toygeom/cube-fields.sol
-out ${CI_DIR_RESULTS}/ls-DisIn-toygeom-metric-fields-${MODE}-${NP}.o.mesh)

# TODO :: anisotropic metric

endforeach()
endforeach()
Expand All @@ -673,7 +806,7 @@ IF( BUILD_TESTING )
-sol ${CI_DIR}/LevelSet/${NP}p_cubegeom/3D-cube-ls.sol
-out ${CI_DIR_RESULTS}/ls-DisIn-cubegeom-hisiz-${NP}.o.mesh)

# Complex geom:: ls_val=0.0 + remesh metric
# Complex geom:: ls_val=0.0 + remesh iso metric
add_test( NAME ls-DisIn-cubegeom-metric-${NP}
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} ${NP} $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/${NP}p_cubegeom/3D-cube.mesh -v 5 -niter 5
Expand All @@ -682,6 +815,18 @@ IF( BUILD_TESTING )
-met ${CI_DIR}/LevelSet/${NP}p_cubegeom/3D-cube-metric.sol
-out ${CI_DIR_RESULTS}/ls-DisIn-cubegeom-metric-${NP}.o.mesh)

# Complex geom:: ls_val=0.0 + remesh aniso metric
# Fail with "Assertion failed: (ps > 0. || ps2 > 0." error
# TO DEBUG
#
#dd_test( NAME ls-DisIn-cubegeom-metric-ani-${NP}
# COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} ${NP} $<TARGET_FILE:${PROJECT_NAME}>
# ${CI_DIR}/LevelSet/${NP}p_cubegeom/3D-cube.mesh -v 5 -niter 5
# -ls 0.0
# -sol ${CI_DIR}/LevelSet/${NP}p_cubegeom/3D-cube-ls.sol
# -met ${CI_DIR}/LevelSet/${NP}p_cubegeom/3D-cube-metric-ani.sol
# -out ${CI_DIR_RESULTS}/ls-DisIn-cubegeom-metric-${NP}.o.mesh)

# Complex geom:: ls_val=0.0 + remesh + fields
add_test( NAME ls-DisIn-cubegeom-fields-${NP}
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} ${NP} $<TARGET_FILE:${PROJECT_NAME}>
Expand Down
123 changes: 7 additions & 116 deletions src/analys_pmmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ typedef struct {
MMG5_pxTetra pxt;
MMG5_pPoint ppt;
double n[3];
int16_t tag;
uint16_t tag;
int ie,ifac,iloc,iadj;
int ip,ip1,ip2;
int updloc,updpar;
Expand Down Expand Up @@ -274,8 +274,8 @@ int PMMG_hashNorver_loop( PMMG_pParMesh parmesh,PMMG_hn_loopvar *var,int16_t ski
*/
static inline
int PMMG_hash_nearParEdges( PMMG_pParMesh parmesh,PMMG_hn_loopvar *var ) {
int ia[2],ip[2],j;
int16_t tag;
int ia[2],ip[2],j;
uint16_t tag;

/* Get points */
ia[0] = MMG5_iarf[var->ifac][MMG5_iprv2[var->iloc]];
Expand Down Expand Up @@ -388,7 +388,7 @@ static inline
int PMMG_hashNorver_switch( PMMG_pParMesh parmesh,PMMG_hn_loopvar *var ) {
int idx;
int ia[2],ip[2],j;
int16_t tag;
uint16_t tag;

/* Only process ridge points */
if( !(var->ppt->tag & MG_GEO ) ) return 1;
Expand All @@ -414,7 +414,7 @@ int PMMG_hashNorver_switch( PMMG_pParMesh parmesh,PMMG_hn_loopvar *var ) {
parmesh->int_node_comm->intvalues[2*idx] ){
if( !PMMG_hTagOri( var->hash,
var->ip,ip[j], /* pair (ip,np+ip[j]) */
(int)tag, /* still the same tag */
tag, /* still the same tag */
1 ) ) /* switch color on */
return 0;
}
Expand Down Expand Up @@ -1519,115 +1519,6 @@ int PMMG_hashNorver( PMMG_pParMesh parmesh,MMG5_pMesh mesh,MMG5_HGeom *hash,
return 1;
}

/**
* \param parmesh pointer to the parmesh structure
* \param mesh pointer to the mesh structure
*
* \return 1 if success, 0 if failure.
*
* Compute continuous geometric support (normal and tangent vectors) on
* non-manifold MG_OLDPARBDY points.
*
* \remark Analogous to the MMG3D_nmgeom function, but it only travels on
* old parallel points.
* \remark Normal and tangent vectors on these points are overwritten.
*
*/
int PMMG_update_nmgeom(PMMG_pParMesh parmesh,MMG5_pMesh mesh){
MMG5_pTetra pt;
MMG5_pPoint p0;
MMG5_pxPoint pxp;
int k,base;
int *adja;
double n[3],t[3];
int ip;
int8_t i,j,ier;

for( ip = 1; ip <= mesh->np; ip++ ) {
mesh->point[ip].flag = mesh->base;
}

base = ++mesh->base;
for (k=1; k<=mesh->ne; k++) {
pt = &mesh->tetra[k];
if( !MG_EOK(pt) ) continue;
adja = &mesh->adja[4*(k-1)+1];
for (i=0; i<4; i++) {
if ( adja[i] ) continue;
for (j=0; j<3; j++) {
ip = MMG5_idir[i][j];
p0 = &mesh->point[pt->v[ip]];
if ( p0->flag == base ) continue;
else if ( !(p0->tag & MG_OLDPARBDY) ) continue;
else if ( !(p0->tag & MG_NOM) ) continue;

p0->flag = base;
ier = MMG5_boulenm(mesh,k,ip,i,n,t);

if ( ier < 0 )
return 0;
else if ( !ier ) {
p0->tag |= MG_REQ;
p0->tag &= ~MG_NOSURF;
}
else {
if ( !p0->xp ) {
++mesh->xp;
if(mesh->xp > mesh->xpmax){
MMG5_TAB_RECALLOC(mesh,mesh->xpoint,mesh->xpmax,MMG5_GAP,MMG5_xPoint,
"larger xpoint table",
mesh->xp--;
fprintf(stderr," Exit program.\n");return 0;);
}
p0->xp = mesh->xp;
}
pxp = &mesh->xpoint[p0->xp];
memcpy(pxp->n1,n,3*sizeof(double));
memcpy(p0->n,t,3*sizeof(double));
}
}
}
}
/* Deal with the non-manifold points that do not belong to a surface
* tetra (a tetra that has a face without adjacent)*/
for (k=1; k<=mesh->ne; k++) {
pt = &mesh->tetra[k];
if( !MG_EOK(pt) ) continue;

for (i=0; i<4; i++) {
p0 = &mesh->point[pt->v[i]];
if ( !(p0->tag & MG_OLDPARBDY) ) continue;
else if ( p0->tag & MG_PARBDY || p0->tag & MG_REQ || !(p0->tag & MG_NOM) || p0->xp ) continue;
ier = MMG5_boulenmInt(mesh,k,i,t);
if ( ier ) {
++mesh->xp;
if(mesh->xp > mesh->xpmax){
MMG5_TAB_RECALLOC(mesh,mesh->xpoint,mesh->xpmax,MMG5_GAP,MMG5_xPoint,
"larger xpoint table",
mesh->xp--;
fprintf(stderr," Exit program.\n");return 0;);
}
p0->xp = mesh->xp;
pxp = &mesh->xpoint[p0->xp];
memcpy(p0->n,t,3*sizeof(double));
}
else {
p0->tag |= MG_REQ;
p0->tag &= ~MG_NOSURF;
}
}
}

/*for (k=1; k<=mesh->np; k++) {
p0 = &mesh->point[k];
if ( !(p0->tag & MG_NOM) || p0->xp ) continue;
p0->tag |= MG_REQ;
p0->tag &= ~MG_NOSURF;
}*/

return 1;
}

static inline
uint16_t MMG5_skip_nonOldParBdy ( uint16_t tag ) {
return !(tag & MG_OLDPARBDY);
Expand Down Expand Up @@ -2527,7 +2418,7 @@ int PMMG_setfeatures(PMMG_pParMesh parmesh,MMG5_pMesh mesh,MMG5_HGeom *pHash,MPI
*
* Check all boundary triangles.
*/
int PMMG_analys_tria(PMMG_pParMesh parmesh,MMG5_pMesh mesh) {
int PMMG_analys_tria(PMMG_pParMesh parmesh,MMG5_pMesh mesh, MMG5_int *permtria) {
int ier;

/**--- stage 1: data structures for surface */
Expand Down Expand Up @@ -2562,7 +2453,7 @@ int PMMG_analys_tria(PMMG_pParMesh parmesh,MMG5_pMesh mesh) {
}

/* identify surface mesh */
if ( !MMG5_chkBdryTria(mesh) ) {
if ( !PMMG_chkBdryTria(mesh,permtria) ) {
fprintf(stderr,"\n ## Boundary problem. Exit program.\n");
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/boulep_pmmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ int PMMG_boulen(PMMG_pParMesh parmesh,MMG5_pMesh mesh,int start,int ip,int iface
double dd,l0,l1;
int base,nump,nr,nnm,k,piv,na,nb,adj,nvstart,fstart,aux,ip0,ip1;
int *adja,color;
int16_t tag;
uint16_t tag;
int8_t iopp,ipiv,indb,inda,i,isface;
int8_t indedg[4][4] = { {-1,0,1,2}, {0,-1,3,4}, {1,3,-1,5}, {2,4,5,-1} };

Expand Down
Loading

0 comments on commit 60b5da1

Please sign in to comment.