WriteVTK.jl icon indicating copy to clipboard operation
WriteVTK.jl copied to clipboard

Using push! to create MeshCell vector raises a MethodError.

Open OndrejKincl opened this issue 1 year ago • 2 comments

Isn't it strange that in this code, the function test1() raises MethodError, but test2() works normally? I would expect them to do the same thing.

module simple_test

using WriteVTK
using StaticArrays

function test1()
    points = [rand(SVector{3, Float64}) for _ in 1:4]
    cell = MeshCell(PolyData.Polys(), (1, 2, 3, 4))
    polys = []
    push!(polys, cell)
    vtk_grid("my_vtp_file", points, polys)
end

function test2()
    points = [rand(SVector{3, Float64}) for _ in 1:4]
    cell = MeshCell(PolyData.Polys(), (1, 2, 3, 4))
    polys = [cell]
    vtk_grid("my_vtp_file", points, polys)
end

end

OndrejKincl avatar Feb 02 '24 15:02 OndrejKincl