`FullGridCellList` can't handle `NaN` values and throws unspecific errors
enhancement
See https://github.com/trixi-framework/PointNeighbors.jl/issues/64.
```julia
julia> nhs = GridNeighborhoodSearch{2}(search_radius = 1.0, n_points = 2, cell_list = FullGridCellList(min_corner = (-10.0, -10.0), max_corner = (10.0, 10.0), search_radius = 1.0));
julia> initialize!(nhs, x, x);
ERROR: BoundsError: attempt to access 22×22 LinearIndices{2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}} at index [13, -9223372036854775808]
Stacktrace:
[1] throw_boundserror(A::LinearIndices{2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, I::Tuple{Int64, Int64})
@ Base ./abstractarray.jl:737
[2] checkbounds
@ ./abstractarray.jl:702 [inlined]
[3] _getindex
@ ./abstractarray.jl:1323 [inlined]
[4] getindex
@ ./abstractarray.jl:1291 [inlined]
[5] cell_index
@ /mnt/ssd/home/efaulhab/git/PointNeighbors.jl/src/cell_lists/full_grid.jl:162 [inlined]
[6] push_cell!
@ /mnt/ssd/home/efaulhab/git/PointNeighbors.jl/src/cell_lists/full_grid.jl:124 [inlined]
[7] initialize_grid!(neighborhood_search::GridNeighborhoodSearch{…}, y::Matrix{…})
@ PointNeighbors /mnt/ssd/home/efaulhab/git/PointNeighbors.jl/src/nhs_grid.jl:176
[8] initialize!(neighborhood_search::GridNeighborhoodSearch{…}, x::Matrix{…}, y::Matrix{…})
@ PointNeighbors /mnt/ssd/home/efaulhab/git/PointNeighbors.jl/src/nhs_grid.jl:162
[9] top-level scope
@ REPL[14]:1
Some type information was truncated. Use `show(err)` to see complete types.
```
We want to either make this cell list work with `NaN` values or at least throw an error message that properly explains the problem.
The error message when points are outside the bounding box should also be more specific.
关闭于 2025-01-29 0 条评论