Skip to content

Using push! to create MeshCell vector raises a MethodError. #133

@OndrejKincl

Description

@OndrejKincl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions