make sure failed neighbor list searches trigger exhaustive searches #1830
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1827
So, I slipped up slightly when removing recursion. I had assumed that if we try to iterate through neighbor lists, it will always touch the variable
i_cellin find_cell_inner. Well, that's actually not true, since it's possible that the neighbor lists are empty, which in that case, i_cell will never be affected. As a result of this, we were never forming neighbor lists.The fix to this is simple. If we're attempting a cell search based on neighbor lists, we should always return false if we failed to find the right cell in the neighbor list. This will cause an exhaustive search to happen, the result of which will be appended to the neighbor list.
Here is a simple 5x5 checkerboard input done directly using surfaces, so that the impact of neighbor lists is fairly high. On my computer, I saw the tracking rate go from around 190 kp/s to around 240 kp/s.