Module containing the Meshes class.

Meshes#

class ansys.dpf.post.meshes.Meshes(meshes_container: MeshesContainer)#

Container to hold and interact with a split mesh.

Examples

Selection of a mesh by index or by property values >>> from ansys.dpf import post >>> from ansys.dpf.post.common import elemental_properties as elt_prop >>> from ansys.dpf.post import examples >>> example_path = examples.download_all_kinds_of_complexity() >>> simulation = post.StaticMechanicalSimulation(example_path) >>> # Split by elemental properties and get all resulting meshes >>> meshes_split = simulation.split_mesh_by_properties( … properties=[elt_prop.material, … elt_prop.element_shape] … ) >>> # Select the second mesh by its index (0-based) >>> mesh_1 = meshes_split[1] >>> # Select the mesh for material=1 and elshape=0 >>> mesh_2 = meshes_split[{elt_prop.material: 1, elt_prop.element_shape: 0}]

select(**kwargs)#

Select meshes based on a combination of property values.

Parameters:

**kwargs – A dictionary of property names with associated values to select. If values are not defined for a property, all available values are selected.

Return type:

Optional[Mesh, Meshes]]

Returns:

  • A Mesh when the selection results in a unique mesh,

  • or a Meshes when several are selected,

  • or None when the criteria result in no mesh.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post.common import elemental_properties
>>> from ansys.dpf.post import examples
>>> example_path = examples.download_all_kinds_of_complexity()
>>> simulation = post.StaticMechanicalSimulation(example_path)
>>> # Split by elemental properties and get all resulting meshes
>>> meshes_split = simulation.split_mesh_by_properties(
...     properties=[elemental_properties.material,
...                 elemental_properties.element_shape]
... )
>>> mesh = meshes_split.select(mat=1, elshape=[0, 1])
plot(**kwargs)#

Plots all the Mesh objects in the Meshes.

Parameters:

kwargs – Additional keyword arguments for the plotter. For additional keyword arguments, see help(pyvista.plot).

Return type:

A Plotter instance of the current plotting back-end.

Examples

>>> from ansys.dpf import post
>>> from ansys.dpf.post import examples
>>> from ansys.dpf.post.common import elemental_properties
>>> example_path = examples.download_all_kinds_of_complexity()
>>> simulation = post.StaticMechanicalSimulation(example_path)
>>> meshes = simulation.split_mesh_by_properties(
...    properties=[elemental_properties.material, elemental_properties.element_shape]
... )
>>> meshes.plot()