WriteVTK.jl
WriteVTK.jl copied to clipboard
Using push! to create MeshCell vector raises a MethodError.
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