PyVista-backend#
Module that uses pyvista to import grids (requires pyvista, through its helpers).
- io4dolfinx.backends.pyvista.backend.get_default_backend_args(arguments: dict[str, Any] | None) dict[str, Any][source]#
Get default backend arguments given a set of input arguments.
- Parameters:
arguments – Input backend arguments
- Returns:
"gdim": Geometric dimension of the mesh,3. VTK points have three coordinates; with a smallergdimthe others are dropped, and must be zero."dtype": Floating point type of the mesh coordinates,Nonefor the type in the file
- Return type:
The arguments, with defaults for
- io4dolfinx.backends.pyvista.backend.read_cell_data(filename: Path | str, name: str, comm: Comm, time: str | float | None, backend_args: dict[str, Any] | None) tuple[ndarray[tuple[Any, ...], dtype[int64]], ndarray][source]#
Read data from the cells of a mesh.
- Parameters:
filename – Path to file
name – Name of cell data
comm – Communicator to launch IO on.
time – The time stamp
backend_args – The backend arguments
- Returns:
A tuple (topology, data), where topology holds the input node indices of each cell and data the data of each cell, on rank 0
- io4dolfinx.backends.pyvista.backend.read_function_names(filename: Path | str, comm: Comm, backend_args: dict[str, Any] | None) list[str][source]#
Read all function names from a file.
- Parameters:
filename – Path to file
comm – MPI communicator to launch IO on.
backend_args – Arguments to backend
- Returns:
The names of the point data, then of the cell data.
- io4dolfinx.backends.pyvista.backend.read_mesh_data(filename: Path | str, comm: Comm, time: str | float | None = None, read_from_partition: bool = False, backend_args: dict[str, Any] | None = None) ReadMeshData[source]#
Read mesh data from file.
Unstructured grids, and structured, rectilinear and image grids, are read. All data is read on rank 0.
- Parameters:
filename – Path to file to read from
comm – MPI communicator used in storage
time – Time stamp associated with the mesh to read
read_from_partition – Whether to read partition information
backend_args – Arguments to backend, see
get_default_backend_args()
- Returns:
Internal data structure for the mesh data read from file
- io4dolfinx.backends.pyvista.backend.read_point_data(filename: Path | str, name: str, comm: Comm, time: float | str | None, backend_args: dict[str, Any] | None) tuple[ndarray, int][source]#
Read data from the nodes of a mesh.
- Parameters:
filename – Path to file
name – Name of point data
comm – Communicator to launch IO on.
time – The time stamp
backend_args – The backend arguments
- Returns:
The data on rank 0, of shape
(num_points, num_components), and the global start of the data on this process,0
- io4dolfinx.backends.pyvista.backend.write_data(filename: Path | str, array_data: ArrayData, comm: Comm, time: str | float | None, mode: FileMode, backend_args: dict[str, Any] | None)[source]#
Write a 2D-array to file (distributed across proceses with MPI).
- Parameters:
filename – Path to file
array_data – Data to write to file
comm – MPI communicator to open the file with
time – Time stamp
mode – Append or write
backend_args – The backend arguments