-
Notifications
You must be signed in to change notification settings - Fork 102
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
base: master
Are you sure you want to change the base?
Handeling points outside domain #1077
Conversation
…deling_points_outside_domain
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
On top of this:
|
No description provided.