hybridmesh.HybridMesh.to_meshes#

HybridMesh.to_meshes(compact=True)#

Convert the HybridMesh into a list of Mesh objects, one per block.

Fields defined on the HybridMesh are transferred to each resulting Mesh. When compact=True, node fields are remapped consistently with the compacted node set.

Parameters#

compactbool, optional

If True (default), each Mesh will only include the nodes used by its elements (using the mesh.Mesh.compact() method). If False, the full HybridMesh coordinates are retained for all Meshes.

Returns#

mesheslist of Mesh

A list of Mesh objects corresponding to the blocks in the HybridMesh.

Examples#

>>> coords = Coords([[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0.5,0.5,1]])
>>> edges = [[0,1],[1,2]]
>>> faces = [[0,1,4],[1,2,4]]
>>> H = HybridMesh(coords, elems=[edges, faces], eltypes=['line2','tri3'])
>>> meshes = H.to_meshes()
>>> [m.n_elems() for m in meshes]
[2, 2]
>>> [m.n_coords() for m in meshes]
[3, 4]
>>> [m.eltype.name for m in meshes]
['Line2', 'Tri3']
>>> meshes_full = H.to_meshes(compact=False)
>>> [m.n_coords() for m in meshes_full]
[5, 5]