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

allow to change the append and compress argument of vtk_grid in writeVTK #56

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions src/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ exports grid and optional provided data as a vtk file
- `grid`: grid

Each '(key, value)' pair adds another data entry to the vtk file via WriteVTK functionality.

For the arguments 'append' and 'compress', see documentation of vtk_grid of WriteVTK.
"""
function writeVTK(filename::String, grid::ExtendableGrid{Tc, Ti}; kwargs...) where {Tc, Ti}
function writeVTK(filename::String, grid::ExtendableGrid{Tc, Ti}; append = false, compress = false, kwargs...) where {Tc, Ti}
ncells = num_cells(grid) # get number of cells in grid
coords = grid[Coordinates] # get coordinates
cells = grid[CellNodes] # get cell-node list
Expand All @@ -31,7 +33,7 @@ function writeVTK(filename::String, grid::ExtendableGrid{Tc, Ti}; kwargs...) whe
vtk_cells[icell] = MeshCell(VTKCellType(cell_geo[icell]), view(cells, :, icell))
end

vtk_grid(filename, coords, vtk_cells) do vtk
vtk_grid(filename, coords, vtk_cells, append = append, compress = compress) do vtk
for (key, value) in kwargs
vtk[String(key)] = value
end
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ end
sha256(f)
end |> bytes2hex

@test sha_code == "f7e86e426aa6673699bd470f6db328a177eabdee74c71cfa6a855a2507b4f1bb"
@test sha_code == "9596c59f6b0870dd4a42a7a48725c2257f260757e15cc5ac433e5e8e235659d9"
end


Expand Down
Loading