Skip to content
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

Fix default #37

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "NaturalNeighbours"
uuid = "f16ad982-4edb-46b1-8125-78e5a8b5a9e6"
authors = ["Daniel VandenHeuvel <[email protected]>"]
version = "1.3.4"
version = "1.3.5"

[deps]
ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e"
Expand Down
6 changes: 3 additions & 3 deletions src/interpolation/interpolate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct Triangle{D} <: AbstractInterpolator{D}
allow_cache::Bool
s::Dict{NTuple{3,Int},NTuple{9,Float64}}
end
Triangle{D}(; allow_cache=false) where {D} = Triangle{D}(allow_cache, Dict{NTuple{3,Int},Float64}())
Triangle{D}(; allow_cache=true) where {D} = Triangle{D}(allow_cache, Dict{NTuple{3,Int},Float64}())
Base.empty!(method::Triangle) = empty!(method.s)

function populate_cache!(method::Triangle, tri::Triangulation)
Expand Down Expand Up @@ -116,8 +116,8 @@ Interpolate using a piecewise linear interpolant over the underlying triangulati

If you only ever call the scalar-argument version of the interpolant, no caching will
be done even with `allow_cache = true`.
""" Triangle(; allow_cache=false) = Triangle{0}(; allow_cache)
Triangle(d; allow_cache=false) = Triangle(; allow_cache)
""" Triangle(; allow_cache=true) = Triangle{0}(; allow_cache)
Triangle(d; allow_cache=true) = Triangle(; allow_cache)
@doc """
Nearest()

Expand Down
6 changes: 3 additions & 3 deletions test/interpolation/basic_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ end

@testset "Testing Triangle()'s cache" begin
tri = triangulate(rand(2, 50))
method = Triangle()
method2 = Triangle(; allow_cache=true)
method2 = Triangle()
method = Triangle(; allow_cache=false)
s = Dict{NTuple{3,Int},NTuple{9,Float64}}()
for T in each_solid_triangle(tri)
V = DelaunayTriangulation.sort_triangle(T)
Expand All @@ -197,4 +197,4 @@ end
@test sum(s[V]) ≈ 1.0
end
@test method2.s == s # make sure that method2 knows to regenerate the cache
end
end
Loading