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

Recover export for non-Grid grid types #1113

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Export/VTK.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,19 @@
cell.nodes[27], # interior
]

function create_vtk_griddata(grid::Grid{dim, C, T}) where {dim, C, T}
function create_vtk_griddata(grid::AbstractGrid{sdim}) where {sdim}

Check warning on line 117 in src/Export/VTK.jl

View check run for this annotation

Codecov / codecov/patch

src/Export/VTK.jl#L117

Added line #L117 was not covered by tests
cls = WriteVTK.MeshCell[]
for cell in getcells(grid)
celltype = cell_to_vtkcell(typeof(cell))
push!(cls, WriteVTK.MeshCell(celltype, nodes_to_vtkorder(cell)))
end
coords = reshape(reinterpret(T, getnodes(grid)), (dim, getnnodes(grid)))
T = get_coordinate_eltype(grid)
nodes_flat = reinterpret(T, getnodes(grid))
coords = reshape(nodes_flat, (sdim, getnnodes(grid)))

Check warning on line 125 in src/Export/VTK.jl

View check run for this annotation

Codecov / codecov/patch

src/Export/VTK.jl#L123-L125

Added lines #L123 - L125 were not covered by tests
return coords, cls
end

function create_vtk_grid(filename::AbstractString, grid::Grid{dim, C, T}; kwargs...) where {dim, C, T}
function create_vtk_grid(filename::AbstractString, grid::AbstractGrid; kwargs...)

Check warning on line 129 in src/Export/VTK.jl

View check run for this annotation

Codecov / codecov/patch

src/Export/VTK.jl#L129

Added line #L129 was not covered by tests
coords, cls = create_vtk_griddata(grid)
return WriteVTK.vtk_grid(filename, coords, cls; kwargs...)
end
Expand Down