WriteVTK.jl icon indicating copy to clipboard operation
WriteVTK.jl copied to clipboard

Pending work VTK parallel file formats

Open amartinhuertas opened this issue 3 years ago • 2 comments

cc @jipolanco @fredrikekre @fverdugo

Some context on this issue:

  • Related to PR https://github.com/jipolanco/WriteVTK.jl/pull/90
  • See https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf, from page 16 till the end for details on VTK parallel file formats.

Let me register here the tasks which are pending from PR #90 so that we do not lose track of them:

  • [ ] Extend current pvtk_grid API such that it is ALSO able to handle PImageData, PRectilinearGrid, and PStructuredGrid parallel formats as well. These formats have extra global and piece-wise attributes whose values have to be provided (to pvtk_grid I would say) apart from the attributes of the local portions. For example, WholeExtent (global) and Extent (piece-wise), respectively.
  • [ ] Develop the remaining code to support parallel file formats different from PUnstructuredGrid. This is a minor dev. E.g., the fact that PRectilinearGrid uses the <PCoordinates> XML element, instead of the <PPoints> one.
  • [ ] Test all parallel file formats different from PUnstructuredGrid.

amartinhuertas avatar Oct 21 '21 22:10 amartinhuertas

I started the work here for PRectilinear and PStructuredGrid (but not yet PImageData): https://github.com/corentin-dev/WriteVTK.jl/commit/49259fa562781e3d0e42256bdbc1056d2523b306

Do you have any idea how WholeExtent can be computed in the case of an MPI computation?

Is there any offset to add to Extent?

corentin-dev avatar Jan 13 '22 20:01 corentin-dev

An example, not yet MPI:

using WriteVTK

nx,ny,nz = 128,128,128

x = Array(LinRange(0.,1.,nx))
y = Array(LinRange(0.,1.,ny))
z = Array(LinRange(0.,1.,nz))

x3 = repeat(x,1,ny,nz)
y3 = repeat(reshape(y,1,ny,1),nx,1,nz)
z3 = repeat(reshape(z,1,1,nz),nx,ny,1)

field = zeros(nx,ny,nz)
@. field = sin(2π*x) * sin(2π*y) * sin(2π*z)

vtkfile_ps = pvtk_grid("test-parallel", x3, y3, z3; part = 1, nparts = 1)
vtkfile_ps["field_point"] = field
vtkfile_ps["field_cell", VTKCellData()] = field[1:end-1,1:end-1,1:end-1]
vtk_save(vtkfile_ps)

vtkfile_pr = pvtk_grid("test-parallel", x, y, z; part = 1, nparts = 1)
vtkfile_pr["field_point"] = field
vtkfile_pr["field_cell", VTKCellData()] = field[1:end-1,1:end-1,1:end-1]
vtk_save(vtkfile_pr)

corentin-dev avatar Jan 13 '22 20:01 corentin-dev