Skip to content

Handeling points outside domain #1077

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lisavdlinde
Copy link

No description provided.

@JordiManyer JordiManyer self-requested a review April 9, 2025 08:34
Copy link
Member

@JordiManyer JordiManyer left a comment

Choose a reason for hiding this comment

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

Hi @lisavdlinde , thanks for the contribution! I do have some comments on the changes though.

  • I've added some comments to the code.
  • Also, please add @notimplementedif searchmethod.accept_points_outside to all functions that potentially allow the user to use the kwarg but which do not take it into consideration. For instance, the evaluation with an array of points.

@@ -314,7 +314,9 @@ function _point_to_cell!(cache, x::Point)
dist ≤ 1000eps(T) && return cell

end

if searchmethod.accept_points_outside == true
Copy link
Member

Choose a reason for hiding this comment

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

Please remove the == true.

@@ -314,7 +314,9 @@ function _point_to_cell!(cache, x::Point)
dist ≤ 1000eps(T) && return cell

end

if searchmethod.accept_points_outside == true
return nothing
Copy link
Member

Choose a reason for hiding this comment

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

This is bad... We are turning a function that always returned an Int into something that sometimes returns a nothing, potentially making the whole thing slower.

I would change it to return 0.

@@ -325,6 +327,9 @@ function evaluate!(cache,f::CellField,x::Point)
@check f === f₀ "Wrong cache"

cell = _point_to_cell!(cache1, x)
if cell == nothing
return nothing
Copy link
Member

Choose a reason for hiding this comment

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

Same here. We are going from a function that returns something consistent to a returning sometimes nothing. I would change to

if iszero(cell)
  return zero(return_type(testitem(cell_f),x))
end

@JordiManyer
Copy link
Member

On top of this:

  • Please pull from master, I just merged some other stuff.
  • Please update the NEWS.md file with the changes
    Thanks!

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