Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type instability in vtk_save? #116

Closed
jlchan opened this issue Feb 14, 2023 · 1 comment · Fixed by #117
Closed

Type instability in vtk_save? #116

jlchan opened this issue Feb 14, 2023 · 1 comment · Fixed by #117

Comments

@jlchan
Copy link

jlchan commented Feb 14, 2023

Thanks for maintaining this package!

I ran into a type instability in vtk_save recently when working with an unstructured grid data type. Here is a MWE:

using WriteVTK
cells = [MeshCell(VTKCellTypes.VTK_LAGRANGE_TRIANGLE, [1, 2, 3])]
vtkfile = vtk_grid("test", [-1, -1, 1], [-1, 1, -1], cells)
@code_warntype vtk_save(vtkfile)

The output of @code_warntype is
Screen Shot 2023-02-14 at 3 23 05 PM

Any idea if this can be made type stable?

@jipolanco
Copy link
Member

jipolanco commented Feb 15, 2023

I'm not really sure why assertions sometimes are flagged as non-inferred by @code_warntype, but I believe this is completely harmless and doesn't impact performance. But I can provide a workaround for this if it helps.

In any case, I really think this is not what is causing the type instability that you're seeing in jlchan/StartUpDG.jl#87, since the return type of vtk_save (Vector{String}) is correctly inferred.

jipolanco added a commit that referenced this issue Feb 15, 2023
jipolanco added a commit that referenced this issue Feb 15, 2023
* Workaround "type instability" in vtk_save

Fixes #116

* Bump version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants