Skip to content

Commit

Permalink
Correct optimization introduced in PR #78
Browse files Browse the repository at this point in the history
  • Loading branch information
ericneiva committed Apr 3, 2024
1 parent b492a2a commit 2150c80
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/AlgoimUtils/AlgoimUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,20 @@ function compute_normal_displacement(
end

function compute_normal_displacement!(
cell_to_points,
cache,
cps::AbstractVector{<:Point},
phi::AlgoimCallLevelSetFunction,
fun,
dt::Float64,
Ω::Triangulation)
# Note that cps must be (scalar) DoF-numbered, not lexicographic-numbered
if isnothing(cell_to_points)
if isnothing(cache)
searchmethod = KDTreeSearch()
cache1 = _point_to_cell_cache(searchmethod,Ω)
x_to_cell(x) = _point_to_cell!(cache1, x)
point_to_cell = lazy_map(x_to_cell, cps)
cell_to_points, _ = make_inverse_table(point_to_cell, num_cells(Ω))
cache = _point_to_cell_cache(searchmethod,Ω)
end
x_to_cell(x) = _point_to_cell!(cache, x)
point_to_cell = lazy_map(x_to_cell, cps)
cell_to_points, _ = make_inverse_table(point_to_cell, num_cells(Ω))
cell_to_xs = lazy_map(Broadcasting(Reindex(cps)), cell_to_points)
cell_point_xs = CellPoint(cell_to_xs, Ω, PhysicalDomain())
fun_xs = evaluate(fun,cell_point_xs)
Expand All @@ -355,7 +355,7 @@ function compute_normal_displacement!(
disps[pt] = dt * val
end
end
disps, cell_to_points
disps, cache
end

signed_distance::Function,x,y) = sign(φ(y))*norm(x-y)
Expand Down

0 comments on commit 2150c80

Please sign in to comment.