Repository navigation
Pad VTKHDF vector/tensors - #116
Merged
Merged
Conversation
jorgensd
force-pushed
the
dokken/vtkhdf-pad-3d
branch
from
November 18, 2026 15:39
7911e0b to
dcfe169
Compare
jorgensd
force-pushed
the
dokken/vtkhdf-pad-3d
branch
from
November 18, 2026 18:34
d357739 to
4a510cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on the VTKHDF time-steps PR (
dokken/vtkhdf-read-timestamps).VTK reads arrays with 3 components as vectors and arrays with 9 components as tensors. The VTKHDF backend stored vectors with as many components as the function has (2 in 2D), and could not write tensors at all. ParaView therefore could not use a 2D velocity for glyphs or Warp By Vector.
ValueShapeof the array's metadata group,/io4dolfinx/<mesh>/<Point|Cell>Data/<name>, which VTK ignores. io4dolfinx strips the padding on read and restores the shape. A vector of length 1 now reads back as a vector, not a scalar.write_point_datanow writes tensor-valued functions. Before, it failed with "elements have different value dimensions".ValueErrorbefore anything is written.Other changes
io4dolfinx.utilsgetsvtk_components,pad_for_vtkandstrip_vtk_padding.ArrayDatagets an optionalvalue_shape, whichwrite_point_dataandwrite_cell_datafill from the function.create_geometry_function_space(mesh, N, value_shape=None)builds tensor-valued spaces.read_value_shape, whichread_point_dataandread_cell_datause when present (vtkhdf and vtkhdf-serial). It is not part of theIOBackendprotocol, so the other backends need no change.docs/backends/vtkhdf.rst.Testing
34 new tests in
tests/test_vtkhdf.py:33 of them fail without this PR. The one that passes checks that unpadded DOLFINx vectors still read as before. The full suite passes in serial and on 4 MPI ranks.
🤖 Generated with Claude Code