Skip to content

Commit

Permalink
BUG: Correct ordering of components.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwboth committed Nov 5, 2023
1 parent b27fca8 commit b9f3cdb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/darsia/utils/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,13 @@ def to_vtk(
while len(img) < 3:
img.append(np.zeros(target_shape))
assert len(img) == 3, "pyevtk only allows 3 components"
img = tuple(img)
# Flip the directions as part of the conversion
if image.space_dim == 1:
img = tuple(img)
elif image.space_dim == 2:
img = (img[1], img[0], img[2])
elif image.space_dim == 3:
img = (img[1], img[2], img[0])
cellData[name] = img

# Write to VTK
Expand Down

0 comments on commit b9f3cdb

Please sign in to comment.