Skip to content

Commit 871ac22

Browse files
authored
Remove cache structs and use Tuples, allocating only when necessary (#21)
1 parent e6a89ab commit 871ac22

14 files changed

+2019
-782
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AdaptivePredicates"
22
uuid = "35492f91-a3bd-45ad-95db-fcad7dcfedb7"
33
authors = ["Valentin Churavy <v.churavy@gmail.com> and Daniel VandenHeuvel <danj.vandenheuvel@gmail.com"]
4-
version = "1.1.1"
4+
version = "1.2.0"
55

66
[compat]
77
julia = "1.6"

src/AdaptivePredicates.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
module AdaptivePredicates
22

3+
@static if isdefined(Base, :Memory)
4+
const Vec{T} = Memory{T}
5+
else
6+
const Vec{T} = Vector{T}
7+
end
8+
39
include("init.jl")
4-
include("caches.jl")
510
include("macros.jl")
611
include("arithmetic.jl")
712
include("predicates.jl")
@@ -10,4 +15,8 @@ export orient2, orient3, incircle, insphere
1015
export orient2p, orient3p, incirclep, inspherep
1116
export orient2fast, orient3fast, incirclefast, inspherefast
1217

18+
if VERSION v"1.11.0-DEV.469"
19+
eval(Meta.parse("public orient3adapt_cache, incircleadapt_cache, insphereexact_cache"))
20+
end
21+
1322
end # module

src/arithmetic.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@inline setindex!!(tup::Tuple, value, index) = @inbounds Base.setindex(tup, value, index)
1+
@inline setindex!!(tup::Tuple, value, index) = @inbounds index > length(tup) ? tup : Base.setindex(tup, value, index)
22
@inline setindex!!(vec::AbstractVector, value, index) = @inbounds Base.setindex!(vec, value, index)
3-
@inline safe_getindex(e, eindex, elen) = eindex elen ? @inbounds(e[eindex]) : zero(eltype(e)) # Shewchuk's code is relying on undefined behaviour from out-of-bounds access where we call this. We need to be careful.
3+
@inline safe_getindex(e, eindex, elen) = (eindex elen && eindex length(e)) ? @inbounds(e[eindex]) : zero(eltype(e)) # Shewchuk's code is relying on undefined behaviour from out-of-bounds access where we call this. We need to be careful.
44

55
function grow_expansion(elen, e, b, h)
66
@inbounds begin
@@ -197,8 +197,8 @@ function fast_expansion_sum_zeroelim(elen, e, flen, f, h)
197197
fnow = f[1]
198198
eindex = findex = 1
199199
if (fnow > enow) == (fnow > -enow)
200-
Q = enow
201-
eindex += 1
200+
Q = enow
201+
eindex += 1
202202
enow = safe_getindex(e, eindex, elen)
203203
else
204204
Q = fnow

src/caches.jl

Lines changed: 0 additions & 300 deletions
This file was deleted.

0 commit comments

Comments
 (0)