Skip to content

Commit

Permalink
Enable value snapping in distributed ls discretization mode only when…
Browse files Browse the repository at this point in the history
… PMMG_SNAPVAL environment variable is defined (implementation is in progress).
  • Loading branch information
Algiane committed Oct 30, 2024
1 parent 6c00cae commit 3e0ec64
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 @@ -1895,22 +1895,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");

if ( dev_snap ) {
if ( !PMMG_create_overlap(parmesh,parmesh->info.read_comm) ) {
/* To avoid deadlocks in snpval_ls */
MPI_Abort(parmesh->comm,PMMG_TMPFAILURE);

Check warning on line 1905 in src/ls_pmmg.c

View check run for this annotation

Codecov / codecov/patch

src/ls_pmmg.c#L1905

Added line #L1905 was not covered by tests
}

/** \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;
}
/** \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");

Check warning on line 1910 in src/ls_pmmg.c

View check run for this annotation

Codecov / codecov/patch

src/ls_pmmg.c#L1910

Added line #L1910 was not covered by tests
/* To avoid deadlocks in parbdyTria */
ier = 0;

Check warning on line 1912 in src/ls_pmmg.c

View check run for this annotation

Codecov / codecov/patch

src/ls_pmmg.c#L1912

Added line #L1912 was not covered by tests
}

/* Delete overlap */
if ( !PMMG_delete_overlap(parmesh,parmesh->info.read_comm) ) {
fprintf(stderr,"\n ## Impossible to delete overlap. Exit program.\n");
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;

Check warning on line 1918 in src/ls_pmmg.c

View check run for this annotation

Codecov / codecov/patch

src/ls_pmmg.c#L1917-L1918

Added lines #L1917 - L1918 were not covered by tests
}
}

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

0 comments on commit 3e0ec64

Please sign in to comment.