Skip to content

Commit

Permalink
Merge pull request #133 from MmgTools/feature/disable_snap_val
Browse files Browse the repository at this point in the history
Disable value snapping (implementation in progress)
  • Loading branch information
Algiane authored Oct 31, 2024
2 parents 5b590aa + 3e0ec64 commit 1b12dbc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 15 deletions.
21 changes: 20 additions & 1 deletion cmake/testing/pmmg_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,10 @@ IF( BUILD_TESTING )
-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}")
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCreation}"
)

# Test if overlap is deleted
set(overlapDelete " Delete Overlap")
Expand Down Expand Up @@ -552,6 +554,23 @@ IF( BUILD_TESTING )
set_property(TEST overlap-check-delete-met
PROPERTY PASS_REGULAR_EXPRESSION "${overlapCheckDelete}")


# Temporary while snapval implementation is in progress and enabled only
# when the PMMG_SNAPVAL environment variable is defined
set_tests_properties(
overlap-check-P0
overlap-check-P0-met
overlap-check-P0P1
overlap-check-P0P2
overlap-check-P0P3
overlap-check-P0P4
overlap-check-delete
overlap-check-delete-met
overlap-create
overlap-delete
PROPERTIES ENVIRONMENT "PMMG_SNAPVAL=1"
)

###############################################################################
#####
##### Test isovalue mode - ls discretization
Expand Down
34 changes: 20 additions & 14 deletions src/ls_pmmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2055,22 +2055,28 @@ int PMMG_ls(PMMG_pParMesh parmesh) {
MPI_Abort(parmesh->comm,PMMG_TMPFAILURE);
}

if ( !PMMG_create_overlap(parmesh,parmesh->info.read_comm) ) {
/* To avoid deadlocks in snpval_ls */
MPI_Abort(parmesh->comm,PMMG_TMPFAILURE);
}
/* Implementation in progress: call this part of code only when the
* PMMG_SNAPVAL environment variable is enabled */
const char* dev_snap = getenv("PMMG_SNAPVAL");

/** \todo TODO :: Snap values of level set function if needed */
if ( !PMMG_snpval_ls(parmesh,parmesh->info.read_comm) ) {
fprintf(stderr,"\n ## Problem with implicit function. Exit program.\n");
/* To avoid deadlocks in parbdyTria */
ier = 0;
}
if ( dev_snap ) {
if ( !PMMG_create_overlap(parmesh,parmesh->info.read_comm) ) {
/* To avoid deadlocks in snpval_ls */
MPI_Abort(parmesh->comm,PMMG_TMPFAILURE);
}

/* Delete overlap */
if ( !PMMG_delete_overlap(parmesh,parmesh->info.read_comm) ) {
fprintf(stderr,"\n ## Impossible to delete overlap. Exit program.\n");
ier = 0;
/** \todo TODO :: Snap values of level set function if needed */
if ( !PMMG_snpval_ls(parmesh,parmesh->info.read_comm) ) {
fprintf(stderr,"\n ## Problem with implicit function. Exit program.\n");
/* To avoid deadlocks in parbdyTria */
ier = 0;
}

/* Delete overlap */
if ( !PMMG_delete_overlap(parmesh,parmesh->info.read_comm) ) {
fprintf(stderr,"\n ## Impossible to delete overlap. Exit program.\n");
ier = 0;
}
}

/* Create table of adjacency for tetra */
Expand Down

0 comments on commit 1b12dbc

Please sign in to comment.