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

Added collision handler for Huayno OK algorithm #1058

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ErwanH29
Copy link

Integrated the collision detection algorithm from the various SHARED_COLLISION Huayno integrators into the OK integrator.
Note: This collision checker does not detect collisions between two massless particles.

@ErwanH29 ErwanH29 requested a review from a team as a code owner May 29, 2024 13:40
Copy link
Collaborator

@LourensVeen LourensVeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this is effectively the contents of the detect_collisions() function from evolve_shared_collisions.c, copy-pasted into evolve_ok.c. This is unfortunately done quite frequently, but it's not good programming practice.

The point of functions is that they can be called from multiple places in the code, thus avoiding duplication. And that is important, because duplicates will diverge over time. Imagine that someone finds a bug in the original function and submits a fix. Will they know that there's a copy somewhere that should also be fixed?

Perhaps you can modify this to call that function, rather than copy-paste it? If you need to change the function, you'll have to carefully check where else it's called and make sure that those cases will still work as well, of course.

@ErwanH29
Copy link
Author

I made a new file which hosts the collision detection function and with which both evolve_shared_collisions.c and evolve_ok.c call. The algorithm neglects collisions between two massless particles to save computing time at the detriment that perhaps this isn't an assumption that some users would want. If that is a bother I can rewrite the code to include it.

I hope the changes are fine. I tested collisions using either integrators and I don't see a change in performance.

@rieder
Copy link
Member

rieder commented Jun 3, 2024

This PR needs at least a test to show that this collision detection actually works before it can be merged.

@rieder rieder self-requested a review June 3, 2024 08:19
Copy link

stale bot commented Aug 3, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issues that have been around for a while without updates label Aug 3, 2024
@stale stale bot removed the stale Issues that have been around for a while without updates label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants