mesh.Mesh.replicate#
- Mesh.replicate(n, dir=0, step=1.0)#
Create copies at regular distances along a straight line.
Parameters#
- n: int
Number of copies to create
- dir: int (0,1,2) or float array_like (3,)
The translation vector. If an int, it specifies a global axis and the translation is in the direction of that axis: 0 (X-axis), 1 (Y-axis) and 2 (Z-axis).
- step: float
If
diris an int, this is the length of the translation. Else, it is a multiplying factor applied to the translation vector.
Returns#
- Mesh
A Mesh with the concatenation of n copies of the original. Each copy is equal to the previous one translated over a distance
step * length(dir)in the directiondir. The first of the copies is equal to the original.
Important
Use
replicate_multi()when multiple replications operations are needed. This is more efficient as this avoids multiple fuse operations.Examples#
>>> M = Mesh(eltype='line2') >>> print(M) Mesh: n_nodes: 2, n_elems: 1, plexitude: 2, level: 1, eltype: line2 BBox: [0. 0. 0.], [1. 0. 0.] Size: [1. 0. 0.] Length: 1.0 >>> M1 = M.replicate(3, dir=0, step=1.0) >>> print(M1.report(full=True)) Mesh: n_nodes: 4, n_elems: 3, plexitude: 2, level: 1, eltype: line2 BBox: [0. 0. 0.], [3. 0. 0.] Size: [3. 0. 0.] Length: 3.0 Coords: [[0. 0. 0.] [1. 0. 0.] [2. 0. 0.] [3. 0. 0.]] Elems: [[0 1] [1 2] [2 3]]