Skip to content

Commit 7683739

Browse files
committed
fix bug on HyperRectangle affecting DyadicSplitter
1 parent 4cf6e4f commit 7683739

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/Interpolation/hyperrectangle.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,10 @@ function HyperRectangle(els,cube=false)
194194
if cube # fit a square/cube instead
195195
w = maximum(ub-lb)
196196
xc = (ub + lb) / 2
197-
lb = xc .- w/2
198-
ub = xc .+ w/2
197+
# min/max below helps avoid floating point issues with results with the
198+
# cube not being exactly contained in the original rectangle
199+
lb = min.(xc .- w/2,lb)
200+
ub = max.(xc .+ w/2,ub)
199201
# TODO: return HyperCube instead
200202
end
201203
return HyperRectangle(lb,ub)

test/Trees/clustertree_test.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ end
5656
@test test_cluster_tree(clt)
5757
splitter = WPB.DyadicSplitter(nmax=32)
5858
clt = WPB.ClusterTree(points,splitter)
59-
@test test_cluster_tree(clt) skip=true
59+
@test test_cluster_tree(clt)
6060
end
6161

6262
@testset "3d" begin
@@ -75,7 +75,7 @@ end
7575
@test test_cluster_tree(clt)
7676
splitter = WPB.DyadicSplitter(nmax=32)
7777
clt = WPB.ClusterTree(points,splitter)
78-
@test test_cluster_tree(clt) skip=true
78+
@test test_cluster_tree(clt)
7979
end
8080

8181
@testset "3d + threads" begin
@@ -95,6 +95,6 @@ end
9595
@test test_cluster_tree(clt)
9696
splitter = WPB.DyadicSplitter(nmax=32)
9797
clt = WPB.ClusterTree(points,splitter;threads)
98-
@test test_cluster_tree(clt) skip=true
98+
@test test_cluster_tree(clt)
9999
end
100100
end

0 commit comments

Comments
 (0)