Skip to content

CompositeMesh

CompositeMesh

CompositeMesh(user_name: str, mesh: UnstructuredGrid, region: Optional[RegionBase] = None, *, ndof: int = 6, element_tag: int = 0, material_tag: int = 0, section_tag: int = 0)

Bases: MeshPart

PyVista-based composite structural mesh part wrapping custom node/element collections.

This class wraps an arbitrary PyVista UnstructuredGrid containing custom element, node, material, or section tag metadata. It bypasses regular parametric mesh generation and participates directly in model assembly.

Note
  • Bypasses standard material assignment methods since material details are typically already baked into the composite grid metadata.
Example
import pyvista as pv
from femora.core.model import Model

model = Model()
# Create an arbitrary unstructured grid
grid = pv.UnstructuredGrid()
# Create composite mesh part
composite = model.meshpart.general.composite(
    user_name="structural_shell",
    mesh=grid,
    ndof=6,
)
print(composite.tag)

Create a composite structural mesh part.

Parameters:

Name Type Description Default
user_name str

Unique user-defined name for this mesh part.

required
mesh UnstructuredGrid

Custom PyVista UnstructuredGrid representing the mesh structure.

required
region Optional[RegionBase]

Physical Region where this mesh part is added.

None
ndof int

Number of degrees of freedom per node.

6
element_tag int

Default fallback OpenSees element tag.

0
material_tag int

Default fallback OpenSees material tag.

0
section_tag int

Default fallback OpenSees section tag.

0

Raises:

Type Description
TypeError

If mesh is not a PyVista UnstructuredGrid.

Methods:

generate_mesh

generate_mesh() -> pv.UnstructuredGrid

Return the wrapped PyVista mesh directly.

Returns:

Type Description
UnstructuredGrid

pv.UnstructuredGrid: The wrapped unstructured grid.