mesh.Mesh.concatenate#

classmethod Mesh.concatenate(meshes, fuse=True, **kargs)#

Concatenate a list of Meshes of the same eltype.

Parameters#

meshes: list of Mesh

A list of Meshes all having the same eltype.

fuse: bool

If True, the resulting concatenation will be fused.

**kargs:

Optional extra parameters for the fuse() operation.

Notes#

If any of the meshes has property numbers, the resulting mesh will inherit the properties. In that case, any meshes without properties will be assigned property 0. If all meshes are without properties, so will be the result.

Important

Meshes can also be concatenated using the ‘+’ symbol. E.g. M = M0 + M1. Please note that using the concatenate method is much more efficient if you need to add more than two Meshes. So Mesh.concatenate([A,B,C,D]) is faster than A+B+C+D, as this avoids multiple fuse operations.

Examples#

>>> M0 = Mesh(eltype='quad4')
>>> M1 = M0.translate([1.0,0.0,0.0])
>>> M = Mesh.concatenate([M0,M1])
>>> print(M.coords)
[[0.  0.  0.]
 [1.  0.  0.]
 [1.  1.  0.]
 [0.  1.  0.]
 [2.  0.  0.]
 [2.  1.  0.]]
>>> print(M.elems)
[[0 1 2 3]
 [1 4 5 2]]

Concatenate Meshes using the same Coords block

>>> M0 = Mesh(M.coords, M.elems[:1])
>>> M1 = Mesh(M.coords, M.elems[1:])
>>> M2 = Mesh.concatenate([M0,M1])
>>> id(M.coords) == id(M2.coords)
False
>>> M2 = Mesh.concatenate([M0,M1], fuse=False)
>>> id(M.coords) == id(M2.coords)
True