Skip to content

VTK field algorithms write every node of VTK's higher-order cells - #343

Open
berkgeveci wants to merge 1 commit into
Kitware:mainfrom
berkgeveci:vis/vtk-field-wrappers-higher-order
Open

berkgeveci wants to merge 1 commit into
Kitware:mainfrom
berkgeveci:vis/vtk-field-wrappers-higher-order

Conversation

@berkgeveci

Copy link
Copy Markdown
Collaborator

Found by running VTK's own Python tests with Tack's algorithms in place of VTK's filters (quadraticQuadDeriv.py).

The bug: the VTK algorithms that add fields -- Elevation, Gradients, Project and the rest, and RunningStatistics, TimeDerivative -- write their fields onto a shallow copy of the input. They wrote Tack's values straight into VTK's point data, which holds only on linear cells. On VTK's higher-order cells (quadratic, biquadratic, Lagrange):

  • an order-2 field's values went in Tack's node order, not VTK's: Elevation came out scrambled, and Gradients of it gave (-35.7, 102.6, 0) where (10, 0, 0) is right;
  • values on Tack's points are at the corners, and VTK's points include the edge middles: a 1193-point grid got an array of 1193 tuples of 1227 components.

The fix: the higher-order import records which node of its H1 space each VTK point is (_lagrange.VTK_NODES, on the topology). Before a point field goes onto the VTK points, the writers put it into that space (project: exact for an H1 field of that order or below and for values on the corners) and give each VTK point its node's value. A copy of the dataset on another device finds the record through the dataset kept for the VTK one. An integer field on the points is refused there: it has no value at an edge's middle.

Tested on hand-made quad8 cells with a curved edge and a tet10: the elevation of each node's own position at all VTK points and its gradient constant; another device; the integer field refused; RunningStatistics on quad8 cells. On VTK's Disc_QuadraticQuads, Disc_BiQuadraticQuads and quadraticTetra01 the elevation is exact at every node and the gradient within 5e-6 (VTK's test asks 1e-4). VTK tests 345 passed on the 9.7.1 wheel, 361 on a local VTK master; MPI tests; quick tier 3059 passed.

🤖 Generated with Claude Code

The algorithms that add fields wrote Tack's values straight into VTK's point
data. On VTK's higher-order cells that put an order-2 field's values in Tack's
node order, not VTK's (Elevation scrambled, its Gradients wrong), and values on
Tack's points, the corners, where VTK's points include the edge middles (a
1193-point grid got an array of 1193 tuples of 1227 components). The import
now records which node of its space each VTK point is, and the writers put a
point field into that space (project) and give each VTK point its node's value.
Found running VTK's quadraticQuadDeriv.py on Tack.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant