Skip to content

Remove fuzz from Point Search, Return Face ID alongside Element ID#308

Draft
matthew-mccall wants to merge 7 commits intoSCOREC:developfrom
matthew-mccall:remove-fuzz
Draft

Remove fuzz from Point Search, Return Face ID alongside Element ID#308
matthew-mccall wants to merge 7 commits intoSCOREC:developfrom
matthew-mccall:remove-fuzz

Conversation

@matthew-mccall
Copy link
Copy Markdown
Collaborator

This pull request updates the mesh field adapters and point search logic to consistently use face_idx instead of elem_idx for identifying mesh elements, and removes the use of the fuzz parameter from 2D triangle-bounding box intersection logic. The changes improve clarity and correctness in how mesh faces are referenced and streamline the intersection checking code.

Mesh element indexing consistency:

  • Updated all relevant functors and evaluation routines in mesh_fields_adapter.h and mesh_fields_adapter2.h to use face_idx instead of elem_idx when referencing mesh faces, ensuring consistent and correct indexing throughout the codebase. [1] [2] [3] [4] [5] [6]

Point search and intersection logic simplification:

  • Removed the fuzz parameter from the triangle-bounding box intersection logic, refactored the bbox_verts_within_triangle function into a more general bbox_verts_within_simplex, and updated all related calls and functors accordingly. This simplifies the logic and reduces unnecessary parameters. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Other improvements:

  • Added missing <cmath> include in point_search.cpp to ensure mathematical functions are available.
  • Ensured that element count arrays are zero-initialized before accumulation to prevent undefined behavior.

…nding tests for triangle edge distance calculation.
…n and corresponding `construct_intersection_map` overloads for simplification. Refactor related grid search logic and adjust formatting for consistency.

Replace `is_barycentric_inside_with_tolerance` with `Omega_h::is_barycentric_inside` in point search logic for simplified tolerance handling. Remove unused function implementation.

Replace `element_id` with `face_id` across point search logic for improved entity identification consistency. Refactor tolerance checks and neighbor-cell fallback in `GridPointSearch2D`. Update related tests and adapt internal structures.

Add compatibility mode to `GridPointSearch2D` for callers expecting face-based IDs. Update edge classification logic with min/max tracking and refine distance-based hierarchy.

Add inflation radius to grid cell bounding boxes in 2D/3D intersection map construction for tolerance handling. Refactor candidate filtering logic in `GridPointSearch2D`. Add overloads for backward compatibility.
# Conflicts:
#	src/pcms/localization/point_search.cpp
#	src/pcms/transfer/adj_search.cpp
…x_verts_within_simplex` to replace it. Eliminate `fuzz` parameter in 2D intersection logic for simplification.
…ine splits in `distance_from_line` implementation.
@jacobmerson
Copy link
Copy Markdown
Collaborator

Offiline discussion: this is generally moving in the right direction. However, we need to update downstream code to work with dim/id data instead of the element id. To do this we should add a function that computes the "owning" element based on the dim/id information.

@Angelyr can you point us to the function that you wrote to compute the "owner" from the dim/id?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants