Muscat.Bridges.PyVistaBridge module¶
- PlotMesh(mesh: Mesh | DataSet, tagsAsFields: bool = False, scalars=None, show_edges=None, cpos=None, show_scalar_bar=None, **pyVista_Plotter_options)[source]¶
Plot a mesh using PyVista, the user can press “n” to plot the next field and “c” to cycle thro the components in the field.
- Parameters:
mesh (Mesh, vtk mesh or a pyvista mesh) – the mesh to be plotted
tagsAsFields (bool, optional) – if True the tags of the mesh (in the case of a Muscat Mesh) are converted to fields, by default False
pyVista_Plotter_options – All the rest of the kwargs are passed to the pyvista Plotter (like theme and other options)
Examples
Simply show the plot of a mesh.
>>> from Muscat.Containers.MeshCreationTools import CreateDisk >>> from pyvista.plotting.themes import DarkTheme >>> from Muscat.Simple import PlotMesh
Mesh creation, and fill some synthetic data
>>> mesh=CreateDisk() >>> mesh.nodeFields = {'x': mesh.nodes[:, 0].flatten(), 'Pos': mesh.nodes}
Plot the mesh
>>> PlotMesh(n, theme=DarkTheme())
- ReadMeshWithPyVista(filename, fieldsAsTags=False) Mesh [source]¶
Function to delegate directly the reading of the file to Pyvista https://docs.pyvista.org/api/utilities/_autosummary/pyvista.read.html and then cast pyvista mesh to muscat mesh