Skip to content

Commit 41ad8d4

Browse files
authored
Merge branch 'JuliaGeometry:master' into JRC_addGreinerHormann
2 parents e391960 + 54c872f commit 41ad8d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+372
-111
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
env:
5555
FLOAT_TYPE: ${{ matrix.float }}
5656
- uses: julia-actions/julia-processcoverage@v1
57-
- uses: codecov/codecov-action@v4
57+
- uses: codecov/codecov-action@v5
5858
with:
5959
file: lcov.info
6060
token: ${{ secrets.CODECOV_TOKEN }}

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Meshes"
22
uuid = "eacbb407-ea5a-433e-ab97-5258b1ca43fa"
33
authors = ["Júlio Hoffimann and contributors"]
4-
version = "0.52.0"
4+
version = "0.52.6"
55

66
[deps]
77
Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"
@@ -18,6 +18,7 @@ ScopedValues = "7e506255-f358-4e82-b7e4-beb19740aa63"
1818
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1919
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2020
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
21+
TiledIteration = "06e1c1a7-607b-532d-9fad-de7d9aa2abac"
2122
TransformsBase = "28dd2a49-a57a-4bfb-84ca-1a49db9b96b8"
2223
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
2324

@@ -37,6 +38,7 @@ ScopedValues = "1.2"
3738
SparseArrays = "1.9"
3839
StaticArrays = "1.0"
3940
StatsBase = "0.33, 0.34"
41+
TiledIteration = "0.5"
4042
TransformsBase = "1.6"
4143
Unitful = "1.17"
4244
julia = "1.9"

docs/src/algorithms/neighborsearch.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ point of reference. This can be performed with search methods:
1010

1111
```@docs
1212
NeighborSearchMethod
13+
BoundedNeighborSearchMethod
1314
search
1415
search!
1516
searchdists

ext/grid.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function vizgridfallback!(plot, M, pdim, edim)
6363
# decide whether or not to reverse connectivity list
6464
rfunc = Makie.@lift _reverse($grid)
6565

66-
verts = Makie.@lift map(asmakie, vertices($grid))
66+
verts = Makie.@lift map(asmakie, eachvertex($grid))
6767
quads = Makie.@lift [GB.QuadFace($rfunc(indices(e))) for e in elements(topology($grid))]
6868

6969
dims = Makie.@lift size($grid)

ext/mesh.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function vizmesh!(plot, ::Type{<:𝔼}, ::Val{2}, ::Val)
6464
dim = embeddim($mesh)
6565
nvert = nvertices($mesh)
6666
nelem = nelements($mesh)
67-
verts = vertices($mesh)
67+
verts = eachvertex($mesh)
6868
topo = topology($mesh)
6969
elems = elements(topo)
7070

ext/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ asmakie(multis::AbstractVector{<:Multi}) = mapreduce(m -> asmakie.(parent(m)), v
3434

3535
function asmakie(poly::Polygon)
3636
rs = rings(poly)
37-
outer = [asmakie(p) for p in vertices(first(rs))]
37+
outer = map(asmakie, eachvertex(rs[1]))
3838
if hasholes(poly)
39-
inners = map(i -> [asmakie(p) for p in vertices(rs[i])], 2:length(rs))
39+
inners = map(i -> map(asmakie, eachvertex(rs[i])), 2:length(rs))
4040
Makie.Polygon(outer, inners)
4141
else
4242
Makie.Polygon(outer)

src/Meshes.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ using Distances: Haversine, SphericalAngle
2020
using Distances: evaluate, result_type
2121
using Rotations: Rotation, QuatRotation, Angle2d
2222
using Rotations: rotation_between
23+
using TiledIteration: TileIterator
2324
using CoordRefSystems: Basic, Projected, Geographic
2425
using NearestNeighbors: KDTree, BallTree
2526
using NearestNeighbors: knn, inrange
@@ -220,6 +221,7 @@ export
220221
vertex,
221222
vertices,
222223
nvertices,
224+
eachvertex,
223225
rings,
224226
segments,
225227
angles,
@@ -312,6 +314,7 @@ export
312314
vertex,
313315
vertices,
314316
nvertices,
317+
eachvertex,
315318
element,
316319
elements,
317320
nelements,

src/boundingboxes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function boundingbox end
1313
# FALLBACKS
1414
# ----------
1515

16-
boundingbox(p::Polytope) = _pboxes(vertices(p))
16+
boundingbox(p::Polytope) = _pboxes(eachvertex(p))
1717

1818
boundingbox(p::Primitive) = boundingbox(boundary(p))
1919

@@ -78,7 +78,7 @@ boundingbox(g::TransformedGrid{<:Any,<:Any,<:OrthoRegularGrid}) = boundingbox(pa
7878
boundingbox(g::TransformedGrid{<:Any,<:Any,<:OrthoRectilinearGrid}) =
7979
boundingbox(parent(g)) |> transform(g) |> boundingbox
8080

81-
boundingbox(m::Mesh) = _pboxes(vertices(m))
81+
boundingbox(m::Mesh) = _pboxes(eachvertex(m))
8282

8383
# ----------------
8484
# IMPLEMENTATIONS

src/coarsening/regular.jl

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,43 @@ RegularCoarsening(factors::Vararg{Int,N}) where {N} = RegularCoarsening(factors)
2222

2323
function coarsen(grid::OrthoRegularGrid, method::RegularCoarsening)
2424
factors = fitdims(method.factors, paramdim(grid))
25-
RegularGrid(minimum(grid), maximum(grid), dims=size(grid) factors)
25+
dims = _coarsesize(grid, factors)
26+
RegularGrid(minimum(grid), maximum(grid), dims=dims)
2627
end
2728

2829
function coarsen(grid::RectilinearGrid, method::RegularCoarsening)
2930
factors = fitdims(method.factors, paramdim(grid))
30-
dims = vsize(grid)
31-
rngs = ntuple(i -> 1:factors[i]:dims[i], paramdim(grid))
31+
inds = _coarseinds(grid, factors)
3232
xyzₛ = xyz(grid)
33-
xyzₜ = ntuple(i -> xyzₛ[i][rngs[i]], paramdim(grid))
33+
xyzₜ = ntuple(i -> xyzₛ[i][inds[i]], paramdim(grid))
3434
RectilinearGrid{manifold(grid),crs(grid)}(xyzₜ)
3535
end
3636

3737
function coarsen(grid::StructuredGrid, method::RegularCoarsening)
3838
factors = fitdims(method.factors, paramdim(grid))
39-
dims = vsize(grid)
40-
rngs = ntuple(i -> 1:factors[i]:dims[i], paramdim(grid))
39+
inds = _coarseinds(grid, factors)
4140
XYZₛ = XYZ(grid)
42-
XYZₜ = ntuple(i -> XYZₛ[i][rngs...], paramdim(grid))
41+
XYZₜ = ntuple(i -> XYZₛ[i][inds...], paramdim(grid))
4342
StructuredGrid{manifold(grid),crs(grid)}(XYZₜ)
4443
end
4544

4645
coarsen(grid::TransformedGrid, method::RegularCoarsening) =
4746
TransformedGrid(coarsen(parent(grid), method), transform(grid))
47+
48+
# -----------------
49+
# HELPER FUNCTIONS
50+
# -----------------
51+
52+
function _coarsesize(grid, factors)
53+
dims = size(grid)
54+
axes = ntuple(i -> 1:dims[i], paramdim(grid))
55+
size(TileIterator(axes, factors))
56+
end
57+
58+
_coarsevsize(grid, factors) = _coarsesize(grid, factors) .+ .!isperiodic(grid)
59+
60+
function _coarseinds(grid, factors)
61+
dims = vsize(grid)
62+
tdims = _coarsevsize(grid, factors)
63+
ntuple(i -> floor.(Int, range(start=1, stop=dims[i], length=tdims[i])), paramdim(grid))
64+
end

src/discretization.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ function discretize(polygon::Polygon, method::BoundaryTriangulationMethod)
105105

106106
# handle degenerate polygons
107107
if nvertices(cpoly) == 1
108-
v = first(vertices(cpoly))
109-
points = [v, v, v]
108+
points = fill(vertex(cpoly, 1), 3)
110109
connec = [connect((1, 2, 3))]
111110
return SimpleMesh(points, connec)
112111
end
@@ -153,8 +152,8 @@ function discretize(polygon::Polygon, method::BoundaryTriangulationMethod)
153152
end
154153

155154
function discretizewithin(ring::Ring, method::BoundaryTriangulationMethod)
156-
# collect vertices to get rid of static containers
157-
points = collect(vertices(ring))
155+
# retrieve vertices of ring
156+
points = collect(eachvertex(ring))
158157

159158
# discretize within 2D ring with given method
160159
ring2D = Ring(_proj2D(manifold(ring), points))
@@ -198,7 +197,7 @@ function simplexify(chain::Chain)
198197
np = nvertices(chain) + isclosed(chain)
199198
ip = isperiodic(chain)
200199

201-
points = collect(vertices(chain))
200+
points = collect(eachvertex(chain))
202201
topo = GridTopology((np - 1,), ip)
203202

204203
SimpleMesh(points, topo)

0 commit comments

Comments
 (0)