|
263 | 263 |
|
264 | 264 | Mutating form of [`interpolate`](@ref) |
265 | 265 | """ |
266 | | -function interpolate!(u_to::AbstractArray, grid_to, u_from::AbstractArray, grid_from; eps = 1.0e-14, not_in_domain_value = NaN, trybrute = true) |
| 266 | +function interpolate!(u_to::AbstractArray, grid_to, u_from::AbstractArray, grid_from; eps = 1.0e-14, not_in_domain_value = nothing, check_if_not_in_domain = isnothing(not_in_domain_value), trybrute = true) |
267 | 267 | shuffle = [[2, 1], [3, 1, 2], [4, 1, 2, 3]] |
268 | 268 |
|
269 | 269 | update!(u_to::AbstractVector, inode_to, λ, u_from::AbstractVector, inode_from) = u_to[inode_to] += λ * u_from[inode_from] |
@@ -291,9 +291,10 @@ function interpolate!(u_to::AbstractArray, grid_to, u_from::AbstractArray, grid_ |
291 | 291 | icellstart = 1 |
292 | 292 | for inode_to in 1:nnodes_to |
293 | 293 | @views icell_from = gFindLocal!(λ, cf, coord[:, inode_to]; icellstart, eps, trybrute) |
294 | | - if icell_from <= 0 |
| 294 | + if icell_from <= 0 && !check_if_not_in_domain |
295 | 295 | u_to[inode_to] = not_in_domain_value |
296 | 296 | else |
| 297 | + @assert icell_from > 0 "could not find cell for node $inode_to with coordinate $(coord[:, inode_to])" |
297 | 298 | for i in 1:(dim + 1) |
298 | 299 | inode_from = cn_from[i, icell_from] |
299 | 300 | update!(u_to, inode_to, λ_shuffle[i], u_from, inode_from) |
|
0 commit comments