Mercurial > repos > public > sbplib_julia
changeset 1796:4d55ac2892a2 feature/grids/curvilinear
Improve plotting of grids so that it can handle embedded grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 01 Oct 2024 11:24:40 +0200 |
parents | a38911d39682 |
children | a6deaf70862b |
files | ext/DiffinitiveMakieExt.jl src/Grids/mapped_grid.jl |
diffstat | 2 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ext/DiffinitiveMakieExt.jl Tue Oct 01 11:04:22 2024 +0200 +++ b/ext/DiffinitiveMakieExt.jl Tue Oct 01 11:24:40 2024 +0200 @@ -33,12 +33,12 @@ ## Grids -Makie.convert_arguments(::Type{<:Scatter}, g::Grid) = (reshape(map(Point,g),:),) # (map(Point,collect(g)[:]),) -function Makie.convert_arguments(::Type{<:Lines}, g::Grid{<:Any,2}) +Makie.convert_arguments(::Type{<:Scatter}, g::Grid) = (reshape(map(Point,g),:),) +function Makie.convert_arguments(::Type{<:Lines}, g::Grid{<:AbstractVector}) M = collect(g) function cat_with_NaN(a,b) - vcat(a,[@SVector[NaN,NaN]],b) + vcat(a,[@SVector fill(NaN, coordinate_size(g))],b) end xlines = reduce(cat_with_NaN, eachrow(M)) @@ -47,7 +47,7 @@ return (cat_with_NaN(xlines,ylines),) end -Makie.plot!(plot::Plot(Grid{<:Any,2})) = lines!(plot, plot.attributes, plot[1]) +Makie.plot!(plot::Plot(Grid)) = lines!(plot, plot.attributes, plot[1]) ## Grid functions
--- a/src/Grids/mapped_grid.jl Tue Oct 01 11:04:22 2024 +0200 +++ b/src/Grids/mapped_grid.jl Tue Oct 01 11:24:40 2024 +0200 @@ -72,8 +72,6 @@ boundary_identifiers(g::MappedGrid) = boundary_identifiers(g.logical_grid) boundary_indices(g::MappedGrid, id::TensorGridBoundary) = boundary_indices(g.logical_grid, id) -# Review: Error when calling plot(boundary_grid(g, id)) -# Currently need to collect first, i.e., plot(collect(boundary_grid(g, id))) function boundary_grid(g::MappedGrid, id::TensorGridBoundary) b_indices = boundary_indices(g.logical_grid, id)