dolfinx.plot#

Support functions for plotting.

Functions

_(V[, entities])

Create VTK mesh topology based on the degree-of-freedom coordinates.

vtk_mesh()

Create VTK mesh topology data for mesh entities.

dolfinx.plot.overload(func)[source]#

Decorator for overloaded functions/methods.

In a stub file, place two or more stub definitions for the same function in a row, each decorated with @overload.

For example:

@overload
def utf8(value: None) -> None: ...
@overload
def utf8(value: bytes) -> bytes: ...
@overload
def utf8(value: str) -> bytes: ...

In a non-stub file (i.e. a regular .py file), do the same but follow it with an implementation. The implementation should not be decorated with @overload:

@overload
def utf8(value: None) -> None: ...
@overload
def utf8(value: bytes) -> bytes: ...
@overload
def utf8(value: str) -> bytes: ...
def utf8(value):
    ...  # implementation goes here

The overloads for a function can be retrieved at runtime using the get_overloads() function.

dolfinx.plot.vtk_mesh(V: FunctionSpace, entities: ndarray[tuple[Any, ...], dtype[int32]] | None = None)[source]#
dolfinx.plot.vtk_mesh(msh: mesh.Mesh, dim: int | None = None, entities: npt.NDArray[np.int32] | None = None)
dolfinx.plot.vtk_mesh(V: fem.FunctionSpace, entities: npt.NDArray[np.int32] | None = None)

Create VTK mesh topology data for mesh entities.

The vertex indices in the returned topology array are the indices for the associated entry in the mesh geometry.

Parameters:
  • msh – Mesh to extract data from.

  • dim – Topological dimension of entities to extract.

  • entities – Entities to extract. Extract all if None.

Returns:

Topology, type for each cell, and geometry in VTK-ready format.