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

fix: robust point location for degenerate configurations #3202

Merged
merged 42 commits into from
Aug 5, 2024

Conversation

sframba
Copy link
Contributor

@sframba sframba commented Jul 2, 2024

This PR adds a new method to determine if a point lies inside or outsilde a (convex) polyhedral cell.
Compared to the current method, the new implementation is slower, but handles gracefully the degenerate conditions of points lying on mesh vertices, edges and faces. It does so by:

  • Triangulating each face of a cell in a consistent manner, by always choosing the lowest global-id vertex as root;
  • Ordering each triangle again using global ids, so that the edges and vertices are encountered in a consistent order across MPI ranks;
  • Computing the winding number (an integer) subtended by each triangle;
  • If the point lies on a vertex, edge or face, this will be found consistently by all ranks, whatever the cell from which the face/edge/vertex is seen. This is true because the order in which the vertices are traversed (and thus the result of the calculation) is exactly the same no matter the originating cell or MPI rank;
  • Finally, if a degenerate condition is found, the {face,edge,vertex}-to-element maps of the host element are used to choose consistently a single representative element. The adjacent element with the lowest global ID is chosen, ensuring general consistency across MPI ranks.

The only ambiguity left is when the point lies on a face/edge/vertex that is a boundary for an MPI rank, but an interior face/edge/vertex for another rank. In this case, both ranks will claim the point. However, at least one of them will consider the point to belong to a ghost element. This is a desirable outcome, since the desired behaviour in this case can be different according to the specific application (e.g., sources vs. receivers for the seismic wave case). This outcome leaves the choice to the caller method on how to handle this case, using ghost rank information.

The new point location algorithm is used for wave propagation kernels, fixing issue 3104 and issue 2888.

@sframba sframba added type: bug Something isn't working flag: requires rebaseline Requires rebaseline branch in integratedTests labels Jul 2, 2024
@sframba sframba requested a review from acitrain July 2, 2024 11:08
@sframba sframba self-assigned this Jul 2, 2024
@sframba sframba requested a review from Bertbk July 2, 2024 11:08
@sframba sframba changed the title Point location robust to degenerate configurations Robust point location for degenerate configurations Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 73.66771% with 84 lines in your changes missing coverage. Please review.

Project coverage is 55.92%. Comparing base (b31d792) to head (71f5930).
Report is 77 commits behind head on develop.

Files with missing lines Patch % Lines
...omponents/mesh/utilities/ComputationalGeometry.hpp 68.00% 48 Missing ⚠️
...rderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp 0.00% 19 Missing ⚠️
...n/anisotropic/AcousticVTIWaveEquationSEMKernel.hpp 0.00% 16 Missing ⚠️
...condOrderEqn/isotropic/AcousticWaveEquationSEM.cpp 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3202      +/-   ##
===========================================
+ Coverage    55.89%   55.92%   +0.03%     
===========================================
  Files         1042     1042              
  Lines        88731    88923     +192     
===========================================
+ Hits         49599    49733     +134     
- Misses       39132    39190      +58     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sframba sframba added ci: run integrated tests Allows to run the integrated tests in GEOS CI and removed flag: requires rebaseline Requires rebaseline branch in integratedTests labels Jul 3, 2024
@sframba sframba added flag: ready for review ci: run CUDA builds Allows to triggers (costly) CUDA jobs labels Jul 4, 2024
@sframba sframba requested review from wrtobin and CusiniM July 4, 2024 07:26
@sframba sframba added the flag: requires rebaseline Requires rebaseline branch in integratedTests label Jul 4, 2024
@sframba sframba requested a review from rrsettgast as a code owner July 10, 2024 06:34
@sframba
Copy link
Contributor Author

sframba commented Aug 3, 2024

@rrsettgast Is it good to go? If so, could you please add your review?

@rrsettgast rrsettgast merged commit 23acc39 into develop Aug 5, 2024
22 checks passed
@rrsettgast rrsettgast deleted the feature/robustInsideOutside branch August 5, 2024 06:25
rrsettgast pushed a commit that referenced this pull request Sep 17, 2024
* implemented method based on winding number

* using element global index for element choice in degenerate cases

* added global id criterion for points coincident with vertices, as well

* using base discretization for precomputing src/rcv

* enabled for high orders. Also removed extra high-order nodes where not needed
---------

Co-authored-by: Aurelien <[email protected]>
Co-authored-by: acitrain <[email protected]>
rrsettgast pushed a commit that referenced this pull request Sep 17, 2024
* implemented method based on winding number

* using element global index for element choice in degenerate cases

* added global id criterion for points coincident with vertices, as well

* using base discretization for precomputing src/rcv

* enabled for high orders. Also removed extra high-order nodes where not needed
---------

Co-authored-by: Aurelien <[email protected]>
Co-authored-by: acitrain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI flag: ready for review flag: requires rebaseline Requires rebaseline branch in integratedTests type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants