Fix bug in mesh refinement with multiple points - #416
Open
santisoler wants to merge 7 commits into
Open
Conversation
Fix how the total number of iterations are defined in `insert_cells` to extend the support to multiple points even if a single int is passed to `levels`.
jcapriot
reviewed
Jul 8, 2026
| diagonal_balance = self._diagonal_balance | ||
| cdef bool diag_balance = diagonal_balance | ||
|
|
||
| cdef int_t n_iters = max(ls.size, cs.shape[0]) |
Member
There was a problem hiding this comment.
I would just repeat a single integer up to the number of points. Otherwise this would allow you to pass more levels than points and cause a memory error.
Member
Author
There was a problem hiding this comment.
Thanks @jcapriot! Yes, I agree. I polished the code a bit.
The _check_first_dim_broadcast(points=points, levels=levels) will ensure that there cannot be more levels than points (unless a single point is passed). I added an extra error message when a single point and multiple levels are passed, just to let the user know that there might be something off in their inputs.
santisoler
marked this pull request as ready for review
July 8, 2026 16:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Patch
insert_cellsto consider multiple points: fix how the total number of iterations are defined ininsert_cellsto extend the support to multiple points even if a single int is passed tolevels. Update docs of the method.Closes #415