Ferrite-FEM / FerriteViz.jl

Plot your Ferrite.jl data
https://ferrite-fem.github.io/FerriteViz.jl/
MIT License
31 stars 9 forks source link

CairoMakie broken #118

Open termi-official opened 9 months ago

termi-official commented 9 months ago

Thanks @KnutAM for reporting this.

The MWE is

using Ferrite, Tensors
import CairoMakie # errors 
# import GLMakie # works 
import FerriteViz as Viz

grid = generate_grid(Quadrilateral, (30,30))
dh = DofHandler(grid)
add!(dh, :u, Lagrange{RefQuadrilateral,1}()^2)
#add!(dh, :p, Lagrange{RefQuadrilateral,1}())
close!(dh)

u = zeros(ndofs(dh))
#apply_analytical!(u, dh, :p, x -> sinpi(2*x[1])*cospi(2*x[2]))
apply_analytical!(u, dh, :u, x -> Vec(sinpi(2*x[1]), cospi(2*x[2])))

plt = Viz.MakiePlotter(dh, u)
Viz.solutionplot(plt, field=:u)

which throws

Error showing value of type Makie.FigureAxisPlot:
ERROR: TypeError: in typeassert, expected Vector{GeometryBasics.Point{2, Float32}}, got a value of type ShaderAbstractions.Buffer{GeometryBasics.Point{2, Float32}, Vector{GeometryBasics.Point{2, Float32}}}

We should be able to fix this with more dispatches.

koehlerson commented 9 months ago

@SimonDanisch help. I think the ShaderAbstractions.Buffer was previously converted somewhere in the pipeline to something that CairoMakie could digest. Is there an easy convert function we can provide for CairoMakie ?