mesh.Mesh.reorder#

Mesh.reorder(order='nodes')#

Reorder the elements of a Mesh.

Parameters#

order: array_like or str

If an array, it is a permutation of the numbers in np.arange(self.n_elems()), specifying the requested order of the elements.

order can also be one of the following predefined strings:

  • ‘nodes’: order the elements in increasing node number order.

  • ‘random’: number the elements in a random order.

  • ‘reverse’: number the elements in reverse order.

Returns#

Mesh

A Mesh equivalent with self but with the elements ordered as specified.

Examples#

>>> coords = Coords([[1.0, 0.0, 0.0],
...                  [0.0, 0.0, 0.0],
...                  [2.0, 1.0, 0.0],
...                  [2.0, 0.0, 0.0],
...                  [1.0, 1.0, 0.0]])
>>> elems = [[1,0],[4,2],[0,3],[0,4]]
>>> M = Mesh(coords,elems,eltype='line2')
>>> M1 = M.reorder()
>>> print(M1.coords)
[[1. 0. 0.]
 [0. 0. 0.]
 [2. 1. 0.]
 [2. 0. 0.]
 [1. 1. 0.]]
>>> print(M1.elems)
[[1 0]
 [0 3]
 [0 4]
 [4 2]]