Skip to content

Commit 8606710

Browse files
authored
Use precompiletools.jl (#200)
1 parent c9a8090 commit 8606710

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

NEWS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
- `orientation_markers` now uses `uniquetol` instead of `unique` for the final set of markers (it already did it for the intermediate markers). See [#195](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/195).
88
- For large `Tuple`s, functions like `eval_fnc_at_het_tuple_two_elements` are problematic and allocate more than their non-type-stable counterparts. To get around this, for `Tuple`s of length `N > 32`, the non-type-stable version is used. See [#195](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/195).
99
- Fixed issue with `use_barriers` when a ghost edge is selected at random during point location. See [#196](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/196).
10-
- Introduced the (currently internal) function `get_positive_curve_indices` for finding curves with positive orientation in a `Triangulation`. [#196](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/196).
10+
- Introduced the (currently internal) function `get_positive_curve_indices` for finding curves with positive orientation in a `Triangulation`. See [#196](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/196).
1111
- `is_exterior_curve`, `is_interior_curve`, `num_exterior_curves`, and `is_disjoint` are now defined based on `get_positive_curve_indices` rather than `get_exterior_curve_indices`. See [#196](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/196).
12+
- PrecompileTools.jl is now used. See [#200](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/200).
13+
- Introduced the (currently internal) function `get_positive_curve_indices` for finding curves with positive orientation in a `Triangulation`. [#196](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/196).
1214
- `PointLocationHistory` was not marked as public. This has been fixed. See [#198](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/198).
1315
- Fixed an issue with missing docstrings and duplicate docstrings in the documentation. See [#198](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/198).
1416
- `copy` and `deepcopy` are now correctly implemented for `PolygonTree`s and `PolygonHierarchy`s. See [#199](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/199)

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ version = "1.6.0"
77
AdaptivePredicates = "35492f91-a3bd-45ad-95db-fcad7dcfedb7"
88
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
99
ExactPredicates = "429591f6-91af-11e9-00e2-59fbe8cec110"
10+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
1011
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1112

1213
[compat]
1314
AdaptivePredicates = "1.2"
1415
EnumX = "1.0"
1516
ExactPredicates = "2.2"
17+
PrecompileTools = "1.2"
1618
Random = "1"
1719
Test = "1"
1820
julia = "1.6"

src/DelaunayTriangulation.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ExactPredicates as EP
66
import AdaptivePredicates as AP
77
import EnumX
88
import Random
9+
import PrecompileTools
910

1011
abstract type AbstractPredicateKernel end # needs to be defined early for use in data_structures.jl
1112
const PredicateCacheType = Union{Nothing, <:Tuple}
@@ -19,4 +20,6 @@ include("validation.jl")
1920
include("exports.jl")
2021
include("public.jl")
2122

23+
include("precompile.jl")
24+
2225
end

src/precompile.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
PrecompileTools.@setup_workload begin
2+
p1 = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]
3+
b1 = [1, 2, 3, 4, 1]
4+
5+
p2 = [(0.25, 0.25), (0.25, 0.75), (0.75, 0.75), (0.75, 0.25)]
6+
p2 = [p1; p2]
7+
b2 = [[[1, 2, 3, 4, 1]], [[5, 6, 7, 8, 5]]]
8+
9+
PrecompileTools.@compile_workload begin
10+
tri = triangulate(p1)
11+
vor = voronoi(tri, clip = true, smooth = true)
12+
refine!(tri)
13+
tri = triangulate(p1; boundary_nodes = b1)
14+
tri = triangulate(p2; boundary_nodes = b2)
15+
circ = CircularArc((1.0, 0.0), (1.0, 0.0), (0.0, 0.0))
16+
tri = triangulate(NTuple{2, Float64}[]; boundary_nodes = [[circ]])
17+
refine!(tri)
18+
end
19+
end

0 commit comments

Comments
 (0)