elrnv / vtkio

Visualization ToolKit (VTK) file parser and writer
Apache License 2.0
56 stars 13 forks source link

Add `num_cells` variable to `write_attributes()` function for SGrids #49

Closed Siimeloni closed 2 months ago

Siimeloni commented 2 months ago

Like described in this Issue, the variable num_cells contained a constant 1, which led to problems when writing attributes to a vtk file. The value is now calculated using the dimensions of the SGrid.

The value is necessary because it is written to the line

CELL_DATA <value>

of the vtk file, which ParaView uses to get the count of attribute values when loading a file. The value has to be equal to the cell count of the SGrid.

SwishSwushPow commented 2 months ago

Since I will be tackling this PR from now on I just wanted to chime in and ask if there are any other changes required to get this merged. :)

elrnv commented 2 months ago

Nope, this great! Thank you @Siimeloni for this PR and @MrMuetze for the ping! Fixes #48