Skip to content

Commit

Permalink
Add num_cells variable to write_attributes() function for SGrids
Browse files Browse the repository at this point in the history
The variable 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.
  • Loading branch information
Siimeloni authored and elrnv committed Sep 4, 2024
1 parent 02d9100 commit c4feb50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,9 @@ mod write_vtk_impl {
EntryPart::Data(e.into()),
)))
})?;

let num_cells = ((dims[0] - 1) * (dims[1] - 1) * (dims[2] - 1)) as usize;
assert_eq!((dims[0] * dims[1] * dims[2]) as usize, num_points);
self.write_attributes::<BO>(data, num_points, 1)?;
self.write_attributes::<BO>(data, num_points, num_cells)?;
}
}

Expand Down

0 comments on commit c4feb50

Please sign in to comment.