MeshesContainer
#
- class ansys.dpf.core.meshes_container.MeshesContainer(meshes_container=None, server=None)#
Bases:
ansys.dpf.core.collection_base.CollectionBase
[ansys.dpf.core.meshed_region.MeshedRegion
]Represents a meshes container, which contains meshes split on a given space.
- Parameters:
meshes_container (ansys.grpc.dpf.collection_pb2.Collection or) – ansys.dpf.core.MeshesContainer, optional Create a meshes container from a collection message or create a copy from an existing meshes container. The default is
None
.server (ansys.dpf.core.server, optional) – Server with the channel connected to the remote or local instance. The default is
None
, in which case an attempt is made to use the global server.
Overview#
Create a meshed region sub type. |
|
Plot the meshes container with a specific result if fields_container is specified. |
|
Retrieve the meshes at a label space. |
|
Retrieve the mesh at a requested index or label space. |
|
Add or update the mesh at a requested label space. |
Retrieve the mesh at a requested index. |
Import detail#
from ansys.dpf.core.meshes_container import MeshesContainer
Attribute detail#
- MeshesContainer.entries_type#
Method detail#
- MeshesContainer.create_subtype(obj_by_copy)#
Create a meshed region sub type.
- MeshesContainer.plot(fields_container=None, deform_by=None, scale_factor=1.0, **kwargs)#
Plot the meshes container with a specific result if fields_container is specified.
- Parameters:
fields_container (FieldsContainer, optional) – Data to plot. The default is
None
.deform_by (Field, Result, Operator, optional) – Used to deform the plotted mesh. Must output a 3D vector field. Defaults to None.
scale_factor (float, optional) – Scaling factor to apply when warping the mesh. Defaults to 1.0.
**kwargs (optional) – Additional keyword arguments for the plotter. For additional keyword arguments, see
help(pyvista.plot)
.
Examples
>>> from ansys.dpf import core as dpf >>> from ansys.dpf.core import examples >>> model = dpf.Model(examples.find_multishells_rst()) >>> mesh = model.metadata.meshed_region >>> split_mesh_op = dpf.operators.mesh.split_mesh(mesh=mesh, property="mat") >>> meshes_cont = split_mesh_op.eval() >>> disp_op = dpf.operators.result.displacement( ... data_sources = dpf.DataSources(examples.find_multishells_rst()), ... mesh = meshes_cont ... ) >>> disp_fc = disp_op.outputs.fields_container() >>> meshes_cont.plot(disp_fc)
- MeshesContainer.get_meshes(label_space)#
Retrieve the meshes at a label space.
- Parameters:
label_space (dict[str,int]) – Meshes corresponding to a filter (label space) in the input. For example:
{"elshape":1, "body":12}
- Returns:
meshes – Meshes corresponding to the request.
- Return type:
list[MeshedRegion]
- MeshesContainer.get_mesh(label_space_or_index)#
Retrieve the mesh at a requested index or label space.
Raises an exception if the request returns more than one mesh.
- Parameters:
label_space_or_index (dict[str,int] , int) – Scoping of the requested mesh, such as
{"time": 1, "complex": 0}
or the index of the mesh.- Returns:
mesh – Mesh corresponding to the request.
- Return type:
- MeshesContainer.__getitem__(key)#
Retrieve the mesh at a requested index.
- Parameters:
key (int) – Index
- Returns:
mesh – Mesh corresponding to the request.
- Return type:
- MeshesContainer.add_mesh(label_space, mesh)#
Add or update the mesh at a requested label space.
- Parameters:
label_space (dict[str,int]) – Label space of the requested meshes. For example, {“elshape”:1, “body”:12}.
mesh (MeshedRegion) – DPF mesh to add or update.