mesh.Mesh.reverse_line_mesh#
- Mesh.reverse_line_mesh()#
Reverse the orientation of a single continuous
line2Mesh.This method reverses the order of nodes along a polyline represented by
line2elements. The effect is that the start point becomes the end point, and vice versa. The method only works for meshes that:Use the
line2element type.Form exactly one connected chain of elements.
Have no branching points (i.e., each interior node is shared by exactly two elements).
If the mesh contains multiple disconnected chains or branching paths, a
ValueErroris raised.Returns#
- Mesh
A new
Meshinstance representing the same geometry but with reversed node ordering along the polyline.
Examples#
>>> L = Mesh(eltype='line2').subdivide(3) >>> R = L.reverse_line_mesh() >>> print(L.coords[0], L.coords[-1]) [0. 0. 0.] [1. 0. 0.] >>> print(R.coords[0], R.coords[-1]) [1. 0. 0.] [0. 0. 0.]