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

Use precompiletools.jl #200

Merged
merged 6 commits into from
Oct 1, 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
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
- `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).
- 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).
- 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).
- 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).
- 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).
- `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).
- PrecompileTools.jl is now used. See [#200](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/200).
- 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).
- `PointLocationHistory` was not marked as public. This has been fixed. See [#198](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/198).
- Fixed an issue with missing docstrings and duplicate docstrings in the documentation. See [#198](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/198).
- `copy` and `deepcopy` are now correctly implemented for `PolygonTree`s and `PolygonHierarchy`s. See [#199](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/199)
Expand Down
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ version = "1.6.0"
AdaptivePredicates = "35492f91-a3bd-45ad-95db-fcad7dcfedb7"
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
ExactPredicates = "429591f6-91af-11e9-00e2-59fbe8cec110"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[compat]
AdaptivePredicates = "1.2"
EnumX = "1.0"
ExactPredicates = "2.2"
PrecompileTools = "1.2"
Random = "1"
Test = "1"
julia = "1.6"
Expand Down
3 changes: 3 additions & 0 deletions src/DelaunayTriangulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ExactPredicates as EP
import AdaptivePredicates as AP
import EnumX
import Random
import PrecompileTools

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

include("precompile.jl")

end
19 changes: 19 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PrecompileTools.@setup_workload begin
p1 = [(0.0, 0.0), (1.0, 0.0), (1.0, 1.0), (0.0, 1.0)]
b1 = [1, 2, 3, 4, 1]

p2 = [(0.25, 0.25), (0.25, 0.75), (0.75, 0.75), (0.75, 0.25)]
p2 = [p1; p2]
b2 = [[[1, 2, 3, 4, 1]], [[5, 6, 7, 8, 5]]]

PrecompileTools.@compile_workload begin
tri = triangulate(p1)
vor = voronoi(tri, clip = true, smooth = true)
refine!(tri)
tri = triangulate(p1; boundary_nodes = b1)
tri = triangulate(p2; boundary_nodes = b2)
circ = CircularArc((1.0, 0.0), (1.0, 0.0), (0.0, 0.0))
tri = triangulate(NTuple{2, Float64}[]; boundary_nodes = [[circ]])
refine!(tri)
end
end
Loading