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.

Fields are also propagated from the input meshes to the resulting Mesh:

  • Only fields that exist on all input meshes with the same name and type are propagated.

  • Node fields (type=’node’) are remapped according to the fused coordinate indices if fuse=True. If multiple meshes contribute to the same fused node, the resulting node field value is averaged. Any np.nan values are ignored in the averaging; if all contributing values at a node are np.nan, the resulting value is np.nan.

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]]