Skip to content

Commit

Permalink
v1.0 (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVandH authored Apr 15, 2024
2 parents ab58263 + bc4fc56 commit baa4fc2
Show file tree
Hide file tree
Showing 700 changed files with 163,439 additions and 23,748 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ jobs:
version:
- '1'
- '1.6'
- '1.7'
- '1.8'
- '1.9'
os:
- ubuntu-latest
arch:
Expand All @@ -34,7 +31,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Julia
uses: julia-actions/setup-julia@v1
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
Expand Down Expand Up @@ -67,7 +64,7 @@ jobs:
statuses: write
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/julia-buildpkg@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/Downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
os: [ubuntu-latest]
package:
- {user: DanielVandH, repo: NaturalNeighbours.jl, group: Downstream}
- {user: DanielVandH, repo: FiniteVolumeMethod.jl, group: Downstream}
- {user: SciML, repo: FiniteVolumeMethod.jl, group: Downstream}

steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
arch: x64
Expand Down
18 changes: 3 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
sw
*.jl.*.cov
*.jl.cov
*.jl.mem
/Manifest.toml
test/Manifest.toml
docs/Manifest.toml
/docs/build/
gmsh-4.9.4-Windows64/
test/gmsh-4.9.4-Windows64/
meshgeometry.geo
gmsh-4.11.1-Windows64/
test/gmsh-4.11.1-Windows64/
meshgeometry.msh
test/simple.ggb
test/basic.ggb
docs/src/triangulations/waste.jl
docs/animation.jl
test/animation.jl
test/tassy.txt
lloyd_animation.mp4
docs/old
flipping_anim.mp4
/.vscode
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Daniel VandenHeuvel <[email protected]>
Copyright (c) 2024 Daniel VandenHeuvel <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
94 changes: 94 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Changelog

## v1.0.0

In addition to the changes below, note that many bugs have been fixed. Feel free to make any issues or PRs if you encounter any problems.

### Added
- Triangulation and refinement of curve-bounded domains has now been added.
- The `Triangulation` struct has some more fields. One of these is `weights`, although this is not to be used just yet; it is possible to computed weighted Delaunay triangulations of convex polygons, but not for general domains currently.
- Where reasonable, default methods for the geometric primitive interfaces have now been added. For example, `getx` now has the default definition `getx(p) = p[1]`.
- You can now use `each_boundary_edge` to iterate over the boundary edges (in no specific order), rather than having to use `keys(get_boundary_edge_map(tri))` as you had to before 1.0.
- The documentation has had a complete overhaul.
- The `retriangulate` function has now been added, allowing for the retriangulation of a given `Triangulation`.
- The function `dist` can now be used for computing the distance between a point and the triangulation, rather than having to use `distance_to_polygon`.
- You can now use `find_polygon` to find what polygon in a provided boundary of a `Triangulation` contains a given point.
- Mesh refinement now, by default, defaults to the diametral lens definition of encroachment rather than the diametral circle definition. You can toggle this behaviour using the `use_lens` keyword in `refine!`.
- Now whenever encroached edges are split during mesh refinement, all free vertices inside that edge's diametral circle will be deleted prior to splitting.

### Breaking
Please note that a lot of these changes that follow are only _technically_ breaking, because I failed to properly specify what the public API was for this package (this has now been corrected in v1.0 and onwards).

- All references to constrained edges are now referred to as _segments_. For example, the field `constrained_edges` is now `interior_segments`, and `all_constrained_edges` is now `all_segments`. The same goes for the associated getters.
- `lock_convex_hull!` will now delete from `interior_segments` field any edges it encounters along the convex hull during locking.
- `add_edge!` is now `add_segment!`.
- `triangulate_convex` no longer accepts the `recompute_centers` keyword.
- `RefinementTargets` is now `RefinementConstraints`.
- `maxiters` is no longer a valid keyword argument of `refine!`. Instead, you should just pass `max_points` appropriately. With this change, the default for `max_points` is no longer `typemax(Int)` but is instead `max(1000, num_solid_vertices(tri))^2`.
- `refine!` no longer returns `statistics(tri)`. It now only returns `tri`. If you want the statistics, just use `statistics(tri)` afterwards.
- `refine!` no longer accepts `max_radius_edge_ratio`. Instead, you must provide `min_angle`. (Internally, it is still `max_radius_edge_ratio` that gets primarily used, but `min_angle` is more interpretable for a user.)
- `lock_convex_hull` is no longer a keyword of argument of `refine!` - if it has to be locked, it will be automatically.
- `edge_indices` has been removed and is now `edge_vertices`.
- `indices` has been removed and is now `triangle_vertices`.
- `initialise_edges` and `initialise_triangles` have been removed. Just use the types instead, e.g. `initialise_edges(::Type{S})` is now just `S()`.
- `is_empty` has been removed. Just use `isempty`.
- `compare_unoriented_edge` is now `compare_unoriented_edges`.
- `initial` and `terminal` are no longer exported. `edge_vertices` is more appropriate for this.
- `geti`, `getj`, `getk` are no longer exported. `triangle_vertices` is more appropriate for this.
- `each_point` and `each_point_index` are no longer exported. You are encougared to rely on `each_solid_vertex` instead. Just note that `each_solid_vertex` is not an ordered iterator.
- `num_points` is no longer exported. You are encouraged to instead use `num_solid_vertices`.
- `remove_duplicate_triangles` has been removed. Just use `sort_triangles` and `unique!`.
- I used to refer to distinct parts of a boundary as `segments`. This is misleading, since it's the first name that I use for constrained edges. So, I now use the term `sections`. For example, `has_multiple_segments` is now `has_multiple_sections`.
- `has_multiple_sections` can no longer be used on the ghost vertex map.
- `getboundarynodes` has been removed. Just use and extend `get_boundary_nodes` instead.
- `BoundaryIndex` is now `GhostVertex`. Similar references to `boundary_index` have been changed to `ghost_vertex`.
- `boundary_map` is now `ghost_vertex_map`.
- `boundary_index_ranges` is now `ghost_vertex_ranges`.
- `integer_type` is removed (exceptfor `Triangulation`s). `number_type` should be used for this.
- Previously, `get_boundary_index` (now called `get_ghost_vertex`) errored if neither of the three arguments was a ghost vertex. Now, if none of the arguments is a ghost vertex, the function returns `k`. Similarly for the two-argument version.
- `rotate_ghost_triangle_to_standard_form` and `rotate_triangle_to_standard_form` are removed. Use `sort_triangle` instead.
- `num_outer_boundary_segments` has been removed.
- Iteration over `Adjacent` and `Adjacent2Vertex` has been removed.
- `Adjacent2Vertex` is now defined by `Adjacent2Vertex{IntType,EdgesType}` rather than `Adjacent2Vertex{IntType,EdgesType,EdgeType}`.
- `clear_empty_points!` is now `clear_empty_vertices!`.
- The fields of `ConvexHull` are now `points` and `vertices` rather than `points` and `indices`. Additionally, the type is now `ConvexHull{PointsType, IntegerType}` instead of `ConvexHull{PointsType, Vector{IntegerType}}`.
- `num_points` is no longer defined on `ConvexHull`s.
- The `boundary_map` (now `ghost_vertex_map`) and `boundary_index_ranges` (now `ghost_vertex_ranges`) are now `Dict`s instead of `OrderedDict`s.
- The constructor `Triangulation(points, triangles, boundary_nodes; kwargs...)` now uses the keyword argument `delete_ghosts` instead of `add_ghost_triangles`, with default `delete_ghosts=false` which is opposite to the previous default `add_ghost_triagnles=false`.
- The function `get_empty_representative_points` has been deleted.
- `get_convex_hull_indices` is now `get_convex_hull_vertices`.
- `min_max` is removed - just use `Base.minmax`.
- `nearest_power_of_two` has been removed.
- `intersection_of_ray_with_boundary` has been removed.
- `identify_side` has been removed.
- `intersection_of_ray_with_edge` has been removed.
- The field names of `TriangulationStatistics` have been renamed to match the new segment terminology, and the field `num_convex_hull_points` is now `num_convex_hull_vertices`.
- `get_total_area` is now `get_area`. The field name `total_area` in `TriangulationStatistics` is now `area`.
- `point_position_relative_to_box` has been removed.
- `is_boundary_edge` has had its definition changed: `is_boundary_edge(tri, i, j)` is now `is_boundary_edge(tri, j, i)`, so that we have consistency with `is_boundary_triangle`.
- `is_outer_boundary_index` is now `is_exterior_ghost_vertex`.
- `is_outer_ghost_triangle` is now `is_exterior_ghost_triangle`.
- `is_outer_ghost_edge` is now `is_exterior_ghost_edge`.
- `is_outer_boundary_node` is now `is_exterior_ghost_vertex`.
- The keyword arguments in `add_ghost_triangles!` and `delete_ghost_triangles!` have been removed.
- The keyword argument `exterior_curve_index` in `triangulate` has been removed. The exterior curves will be automatically computed.
- `peek_triangle_ρ` has been removed, and `triangle_dequeue!` now does a `dequeue_pair!`.
- The keyword `recompute_representative_point` is now `recompute_representative_points` in `triangulate`.
- The keyword `add_ghost_triangles` in `triangulate_rectangle` (and `triangulate_convex`) is now `delete_ghosts` to be consistent with `triangulate`. The default is `delete_ghosts=false`, consistent with the previous default of `add_ghost_triangles=true`.
- `voronoi` now has the signature `voronoi(tri; clip=false, smooth=false, kwargs...)` instead of `voronoi(tri, clip=false)` (note the difference in `clip` as a positional argument to a keyword argument). `centroidal_smooth` is still exported (the `kwargs...` are passed to it), but this can be a good alternative.
- Gmsh support has been removed.
- `get!` is no longer defined on `adjacent2vertex`.
- `Certificate` is no longer exported.
- The arguments to `construct_ghost_vertex_map` (previously `construct_boundary_map`), `construct_boundary_edge_map`, and `construct_ghost_vertex_ranges` (previously `construct_boundary_index_ranges`) are now positional.
- `get_vertices` is no longer exported.
- `map_boundary_index` is now `map_ghost_vertex`.
- `polylabel` is no longer an alias for `pole_of_inaccessibility`.
- `convert_to_boundary_edge` is now `convert_to_edge_adjoining_ghost_vertex`.
- References to a `point_order` are now an `insertion_order`.
- `add_boundary_information!` is no longer exported.
- `balanced_power_of_two_quarternary_split` has been removed.
- To provide a custom constraint for triangulation, you now need to provide a constraint of the form `(tri::Triangulation, T::Triangle) -> Bool` with the keyword argument `custom_constraint`, where the returned result is `true` if the triangle `T` should be refined and `false` otherwise.
- `is_triangle_seditious` no longer has the unused argument `ρ` at the end of its signature.
- It is no longer possible to use `delete_point!` on points that are on the boundary or adjoin segments. It is too finicky, and for constrained triangulations you shouldn't be doing those operations anyway. For unconstrained triangulations, deleting a point on the boundary might be reasonable but it is difficult and `delete_point!` will not update the convex hull field of the triangulation for you either. The previous implementation did work sometimes, but it required playing around with how ghost triangles are interpreted and was unfortunately not reliable. PRs to address this are welcome, but it would need some careful thought and highly extensive testing (e.g. thousands of random tests for random triangulations, especially triangulations with very skinny or very large triangles on the boundary; triangulations with many collinearities such as from `triangulate_rectangle`; triangulations with holes; and triangulations with disjoint domains).
- `is_positively_oriented` now only accepts integers for the second argument, to avoid issues with misleading results when testing triangles.
- Some methods like `get_right_boundary_node` have now been defined only for `Triangulation`s, instead of lowering to a more complicated method that uses the `adjacent` field and other fields like we used to.
7 changes: 1 addition & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
name = "DelaunayTriangulation"
uuid = "927a84f5-c5f4-47a5-9785-b46e178433df"
authors = ["Daniel VandenHeuvel <[email protected]>"]
version = "0.8.12"
version = "1.0.0"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
ExactPredicates = "429591f6-91af-11e9-00e2-59fbe8cec110"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SimpleGraphs = "55797a34-41de-5266-9ec1-32ac4eb504d3"

[compat]
DataStructures = "0.18"
EnumX = "1.0"
ExactPredicates = "2.2"
SimpleGraphs = "0.8"
julia = "1"
Random = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
Loading

2 comments on commit baa4fc2

@DanielVandH
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

In addition to the changes below, note that many bugs have been fixed. Feel free to make any issues or PRs if you encounter any problems.

Added

  • Triangulation and refinement of curve-bounded domains has now been added.
  • The Triangulation struct has some more fields. One of these is weights, although this is not to be used just yet; it is possible to computed weighted Delaunay triangulations of convex polygons, but not for general domains currently.
  • Where reasonable, default methods for the geometric primitive interfaces have now been added. For example, getx now has the default definition getx(p) = p[1].
  • You can now use each_boundary_edge to iterate over the boundary edges (in no specific order), rather than having to use keys(get_boundary_edge_map(tri)) as you had to before 1.0.
  • The documentation has had a complete overhaul.
  • The retriangulate function has now been added, allowing for the retriangulation of a given Triangulation.
  • The function dist can now be used for computing the distance between a point and the triangulation, rather than having to use distance_to_polygon.
  • You can now use find_polygon to find what polygon in a provided boundary of a Triangulation contains a given point.
  • Mesh refinement now, by default, defaults to the diametral lens definition of encroachment rather than the diametral circle definition. You can toggle this behaviour using the use_lens keyword in refine!.
  • Now whenever encroached edges are split during mesh refinement, all free vertices inside that edge's diametral circle will be deleted prior to splitting.

Breaking

Please note that a lot of these changes that follow are only technically breaking, because I failed to properly specify what the public API was for this package (this has now been corrected in v1.0 and onwards).

  • All references to constrained edges are now referred to as segments. For example, the field constrained_edges is now interior_segments, and all_constrained_edges is now all_segments. The same goes for the associated getters.
  • lock_convex_hull! will now delete from interior_segments field any edges it encounters along the convex hull during locking.
  • add_edge! is now add_segment!.
  • triangulate_convex no longer accepts the recompute_centers keyword.
  • RefinementTargets is now RefinementConstraints.
  • maxiters is no longer a valid keyword argument of refine!. Instead, you should just pass max_points appropriately. With this change, the default for max_points is no longer typemax(Int) but is instead max(1000, num_solid_vertices(tri))^2.
  • refine! no longer returns statistics(tri). It now only returns tri. If you want the statistics, just use statistics(tri) afterwards.
  • refine! no longer accepts max_radius_edge_ratio. Instead, you must provide min_angle. (Internally, it is still max_radius_edge_ratio that gets primarily used, but min_angle is more interpretable for a user.)
  • lock_convex_hull is no longer a keyword of argument of refine! - if it has to be locked, it will be automatically.
  • edge_indices has been removed and is now edge_vertices.
  • indices has been removed and is now triangle_vertices.
  • initialise_edges and initialise_triangles have been removed. Just use the types instead, e.g. initialise_edges(::Type{S}) is now just S().
  • is_empty has been removed. Just use isempty.
  • compare_unoriented_edge is now compare_unoriented_edges.
  • initial and terminal are no longer exported. edge_vertices is more appropriate for this.
  • geti, getj, getk are no longer exported. triangle_vertices is more appropriate for this.
  • each_point and each_point_index are no longer exported. You are encougared to rely on each_solid_vertex instead. Just note that each_solid_vertex is not an ordered iterator.
  • num_points is no longer exported. You are encouraged to instead use num_solid_vertices.
  • remove_duplicate_triangles has been removed. Just use sort_triangles and unique!.
  • I used to refer to distinct parts of a boundary as segments. This is misleading, since it's the first name that I use for constrained edges. So, I now use the term sections. For example, has_multiple_segments is now has_multiple_sections.
  • has_multiple_sections can no longer be used on the ghost vertex map.
  • getboundarynodes has been removed. Just use and extend get_boundary_nodes instead.
  • BoundaryIndex is now GhostVertex. Similar references to boundary_index have been changed to ghost_vertex.
  • boundary_map is now ghost_vertex_map.
  • boundary_index_ranges is now ghost_vertex_ranges.
  • integer_type is removed (exceptfor Triangulations). number_type should be used for this.
  • Previously, get_boundary_index (now called get_ghost_vertex) errored if neither of the three arguments was a ghost vertex. Now, if none of the arguments is a ghost vertex, the function returns k. Similarly for the two-argument version.
  • rotate_ghost_triangle_to_standard_form and rotate_triangle_to_standard_form are removed. Use sort_triangle instead.
  • num_outer_boundary_segments has been removed.
  • Iteration over Adjacent and Adjacent2Vertex has been removed.
  • Adjacent2Vertex is now defined by Adjacent2Vertex{IntType,EdgesType} rather than Adjacent2Vertex{IntType,EdgesType,EdgeType}.
  • clear_empty_points! is now clear_empty_vertices!.
  • The fields of ConvexHull are now points and vertices rather than points and indices. Additionally, the type is now ConvexHull{PointsType, IntegerType} instead of ConvexHull{PointsType, Vector{IntegerType}}.
  • num_points is no longer defined on ConvexHulls.
  • The boundary_map (now ghost_vertex_map) and boundary_index_ranges (now ghost_vertex_ranges) are now Dicts instead of OrderedDicts.
  • The constructor Triangulation(points, triangles, boundary_nodes; kwargs...) now uses the keyword argument delete_ghosts instead of add_ghost_triangles, with default delete_ghosts=false which is opposite to the previous default add_ghost_triagnles=false.
  • The function get_empty_representative_points has been deleted.
  • get_convex_hull_indices is now get_convex_hull_vertices.
  • min_max is removed - just use Base.minmax.
  • nearest_power_of_two has been removed.
  • intersection_of_ray_with_boundary has been removed.
  • identify_side has been removed.
  • intersection_of_ray_with_edge has been removed.
  • The field names of TriangulationStatistics have been renamed to match the new segment terminology, and the field num_convex_hull_points is now num_convex_hull_vertices.
  • get_total_area is now get_area. The field name total_area in TriangulationStatistics is now area.
  • point_position_relative_to_box has been removed.
  • is_boundary_edge has had its definition changed: is_boundary_edge(tri, i, j) is now is_boundary_edge(tri, j, i), so that we have consistency with is_boundary_triangle.
  • is_outer_boundary_index is now is_exterior_ghost_vertex.
  • is_outer_ghost_triangle is now is_exterior_ghost_triangle.
  • is_outer_ghost_edge is now is_exterior_ghost_edge.
  • is_outer_boundary_node is now is_exterior_ghost_vertex.
  • The keyword arguments in add_ghost_triangles! and delete_ghost_triangles! have been removed.
  • The keyword argument exterior_curve_index in triangulate has been removed. The exterior curves will be automatically computed.
  • peek_triangle_ρ has been removed, and triangle_dequeue! now does a dequeue_pair!.
  • The keyword recompute_representative_point is now recompute_representative_points in triangulate.
  • The keyword add_ghost_triangles in triangulate_rectangle (and triangulate_convex) is now delete_ghosts to be consistent with triangulate. The default is delete_ghosts=false, consistent with the previous default of add_ghost_triangles=true.
  • voronoi now has the signature voronoi(tri; clip=false, smooth=false, kwargs...) instead of voronoi(tri, clip=false) (note the difference in clip as a positional argument to a keyword argument). centroidal_smooth is still exported (the kwargs... are passed to it), but this can be a good alternative.
  • Gmsh support has been removed.
  • get! is no longer defined on adjacent2vertex.
  • Certificate is no longer exported.
  • The arguments to construct_ghost_vertex_map (previously construct_boundary_map), construct_boundary_edge_map, and construct_ghost_vertex_ranges (previously construct_boundary_index_ranges) are now positional.
  • get_vertices is no longer exported.
  • map_boundary_index is now map_ghost_vertex.
  • polylabel is no longer an alias for pole_of_inaccessibility.
  • convert_to_boundary_edge is now convert_to_edge_adjoining_ghost_vertex.
  • References to a point_order are now an insertion_order.
  • add_boundary_information! is no longer exported.
  • balanced_power_of_two_quarternary_split has been removed.
  • To provide a custom constraint for triangulation, you now need to provide a constraint of the form (tri::Triangulation, T::Triangle) -> Bool with the keyword argument custom_constraint, where the returned result is true if the triangle T should be refined and false otherwise.
  • is_triangle_seditious no longer has the unused argument ρ at the end of its signature.
  • It is no longer possible to use delete_point! on points that are on the boundary or adjoin segments. It is too finicky, and for constrained triangulations you shouldn't be doing those operations anyway. For unconstrained triangulations, deleting a point on the boundary might be reasonable but it is difficult and delete_point! will not update the convex hull field of the triangulation for you either. The previous implementation did work sometimes, but it required playing around with how ghost triangles are interpreted and was unfortunately not reliable. PRs to address this are welcome, but it would need some careful thought and highly extensive testing (e.g. thousands of random tests for random triangulations, especially triangulations with very skinny or very large triangles on the boundary; triangulations with many collinearities such as from triangulate_rectangle; triangulations with holes; and triangulations with disjoint domains).
  • is_positively_oriented now only accepts integers for the second argument, to avoid issues with misleading results when testing triangles.
  • Some methods like get_right_boundary_node have now been defined only for Triangulations, instead of lowering to a more complicated method that uses the adjacent field and other fields like we used to.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/104964

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.0 -m "<description of version>" baa4fc29f0537a84fccc79c9360c1efbc3d5d6ea
git push origin v1.0.0

Please sign in to comment.