The mesh module#
Overview#
Process coordinate-based mesh data stored in pandas objects.
Mesh data describe quantities distributed over a geometrical body, for
example stress in MPa on finite-element nodes. A plain mesh is any
pandas.DataFrame with coordinate columns x and y and
optionally z. A full finite-element mesh additionally carries a
pandas.MultiIndex with the levels element_id and node_id so
that node-element connectivity is known.
The module registers the plain_mesh and mesh DataFrame accessors used
by mesh algorithms throughout pyLife. Coordinates are expected in mm.
See also
pylife.mesh.meshsignal.PlainMeshAccess point-cloud coordinates without connectivity.
pylife.mesh.meshsignal.MeshAccess node-element connectivity in finite- element meshes.
Examples
Create a connected triangular mesh and read its coordinate columns.
>>> import pandas as pd
>>> index = pd.MultiIndex.from_tuples(
... [(1, 10), (1, 11), (1, 12)], names=["element_id", "node_id"]
... )
>>> mesh = pd.DataFrame({"x": [0.0, 1.0, 0.0], "y": [0.0, 0.0, 1.0]}, index=index)
>>> mesh.mesh.coordinates
x y
element_id node_id
1 10 0.0 0.0
11 1.0 0.0
12 0.0 1.0