reverse

Contents

reverse#

Mesh.reverse()[source]#

Return a new Mesh with the axis order reversed (MSB to LSB).

Useful for converting between C-order and F-order axis conventions, where the first physical axis becomes the last numpy axis or vice versa.

Returns:
outMesh

A new Mesh with the same ndim but with the bit order of code reversed so that what was the MSB becomes the LSB.

Examples

>>> from psi_io.mesh import Mesh
>>> m = Mesh.parse(0b100, ndim=3)   # HALF, MAIN, MAIN
>>> str(m.reverse())
'MAIN, MAIN, HALF'
>>> str(Mesh.parse(0b110, ndim=3).reverse())
'MAIN, HALF, HALF'