From 503e37ea7934eed477ea6d9c89d8fa4a81650404 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 24 Jul 2024 12:46:58 +1000 Subject: [PATCH 1/2] Added vtk kwargs --- src/Visualization.jl | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/src/Visualization.jl b/src/Visualization.jl index 6a8b0d81..9f79d346 100644 --- a/src/Visualization.jl +++ b/src/Visualization.jl @@ -33,7 +33,8 @@ end function Visualization.visualization_data( model::DistributedDiscreteModel{Dc}, filebase::AbstractString; - labels=get_face_labeling(model)) where Dc + labels=get_face_labeling(model) +) where Dc cell_gids = get_cell_gids(model) vd = map(local_views(model),partition(cell_gids),labels.labels) do model,gids,labels @@ -57,7 +58,8 @@ function Visualization.visualization_data( order=-1, nsubcells=-1, celldata=nothing, - cellfields=nothing) + cellfields=nothing +) trians = trian.trians cell_gids = get_cell_gids(trian.model) @@ -145,8 +147,13 @@ end function Visualization.write_vtk_file( parts::AbstractArray, - grid::AbstractArray{<:Grid}, filebase; celldata, nodaldata) - pvtk = Visualization.create_vtk_file(parts,grid,filebase;celldata=celldata,nodaldata=nodaldata) + grid::AbstractArray{<:Grid}, filebase; celldata, nodaldata, + compress=false,append=true,ascii=false,vtkversion=:default + ) + pvtk = Visualization.create_vtk_file( + parts,grid,filebase;celldata=celldata,nodaldata=nodaldata, + compress=compress,append=append,ascii=ascii,vtkversion=vtkversion + ) map(vtk_save,pvtk) end @@ -154,33 +161,47 @@ function Visualization.create_vtk_file( parts::AbstractArray, grid::AbstractArray{<:Grid}, filebase; - celldata, nodaldata) + celldata, nodaldata, + compress=false,append=true,ascii=false,vtkversion=:default +) nparts = length(parts) map(parts,grid,celldata,nodaldata) do part,g,c,n Visualization.create_pvtk_file( g,filebase; part=part,nparts=nparts, - celldata=c,nodaldata=n) + celldata=c,nodaldata=n, + compress=compress,append=append,ascii=ascii,vtkversion=vtkversion + ) end end const DistributedModelOrTriangulation = Union{DistributedDiscreteModel,DistributedTriangulation} -function Visualization.writevtk(arg::DistributedModelOrTriangulation,args...;kwargs...) +function Visualization.writevtk( + arg::DistributedModelOrTriangulation,args...; + compress=false,append=true,ascii=false,vtkversion=:default,kwargs... +) parts=get_parts(arg) map(visualization_data(arg,args...;kwargs...)) do visdata write_vtk_file( - parts,visdata.grid,visdata.filebase,celldata=visdata.celldata,nodaldata=visdata.nodaldata) + parts,visdata.grid,visdata.filebase,celldata=visdata.celldata,nodaldata=visdata.nodaldata, + compress=compress, append=append, ascii=ascii, vtkversion=vtkversion + ) end end -function Visualization.createvtk(arg::DistributedModelOrTriangulation,args...;kwargs...) +function Visualization.createvtk( + arg::DistributedModelOrTriangulation,args...; + compress=false,append=true,ascii=false,vtkversion=:default,kwargs... +) v = visualization_data(arg,args...;kwargs...) parts=get_parts(arg) @notimplementedif length(v) != 1 visdata = first(v) Visualization.create_vtk_file( - parts,visdata.grid,visdata.filebase,celldata=visdata.celldata,nodaldata=visdata.nodaldata) + parts,visdata.grid,visdata.filebase,celldata=visdata.celldata,nodaldata=visdata.nodaldata, + compress=compress, append=append, ascii=ascii, vtkversion=vtkversion + ) end struct DistributedPvd{T<:AbstractArray} From 23bfc2f57a7e30161c924aaf48158486f205302a Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Wed, 14 Aug 2024 09:34:18 +1000 Subject: [PATCH 2/2] Updated NEWS --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 65ba24de..329a887a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Added kwargs for VTK encoding options. Since PR[#156](https://github.com/gridap/GridapDistributed.jl/pull/156). + ### Fixed - Fixed distributed interpolators for Vector-Valued FESpaces. Since PR[#152](https://github.com/gridap/GridapDistributed.jl/pull/152).