Skip to content

Commit 743436c

Browse files
chmerdonpjaap
authored andcommitted
keep check_if_not_in_domain as a bool kwarg
1 parent 2695093 commit 743436c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/cellfinder.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ end
263263
264264
Mutating form of [`interpolate`](@ref)
265265
"""
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)
267267
shuffle = [[2, 1], [3, 1, 2], [4, 1, 2, 3]]
268268

269269
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_
291291
icellstart = 1
292292
for inode_to in 1:nnodes_to
293293
@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
295295
u_to[inode_to] = not_in_domain_value
296296
else
297+
@assert icell_from > 0 "could not find cell for node $inode_to with coordinate $(coord[:, inode_to])"
297298
for i in 1:(dim + 1)
298299
inode_from = cn_from[i, icell_from]
299300
update!(u_to, inode_to, λ_shuffle[i], u_from, inode_from)

0 commit comments

Comments
 (0)