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

Unit test for find_exit_face function #128

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Fuad-HH
Copy link
Contributor

@Fuad-HH Fuad-HH commented Oct 23, 2024

We discovered that the find_exit_face function in pumipic_adjacency.tpp should not work when the useBcc flag is true. A test case is added here to demonstrate the failed scenario.

Briefly, the function here decides which edge the ray crosses by the index of the minimum of the barycentric coordinates of the ray's destination; this is incorrect. The following picture demonstrates this. Although it has the same destination and the origin is in the same triangle, they will intersect different edges.

image

I have added the failing test case to fix it in the future.

Note: It uses a mesh called square2d4elem.msh and it's added to the pumipic_data repository. It's in this pull request

@jacobmerson
Copy link

@cwsmith @Angelyr The same problem also exists in the 3D implementation of find_exit_face. We are working on an equivalent test case. We do have a working version that uses barycentric coords in 2D. We worked out the math, but not implemented in 3D.

@cwsmith
Copy link
Contributor

cwsmith commented Oct 24, 2024

@Fuad-HH Thanks for the PR.

I haven't looked at the code yet, but could you explain the difference between the arrow and the line segment in the figure?

@Fuad-HH
Copy link
Contributor Author

Fuad-HH commented Oct 24, 2024

@Fuad-HH Thanks for the PR.

I haven't looked at the code yet, but could you explain the difference between the arrow and the line segment in the figure?

To test if the function provides the correct intersected face, I have simulated these two rays in the picture that share the same destination point. The function gives the correct exit face for the left ray and the wrong exit face for the right. We discovered this by looking at the algorithm used to find the exit face here. It uses the destination's barycentric coordinate to find the exit/intersected face. In this test case, these two rays share the same destination but they intersect two different edges. But as expected, the find_exit_face method returns the same exit face for both of them which is incorrect.

More specifics are provided in the header section of the test case.

@Fuad-HH Fuad-HH marked this pull request as draft October 25, 2024 02:05
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.

3 participants