Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/io4dolfinx/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_default_backend_args(self, arguments: dict[str, Any] | None) -> dict[str
def write_attributes(
self,
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
attributes: dict[str, np.ndarray],
backend_args: dict[str, Any] | None,
Expand All @@ -93,7 +93,7 @@ def write_attributes(
def read_attributes(
self,
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
backend_args: dict[str, Any] | None,
) -> dict[str, Any]:
Expand All @@ -112,7 +112,7 @@ def read_attributes(
def read_timestamps(
self,
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
function_name: str,
backend_args: dict[str, Any] | None,
) -> npt.NDArray[np.float64 | str]: # type: ignore[type-var]
Expand All @@ -131,7 +131,7 @@ def read_timestamps(
def write_mesh(
self,
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
mesh: MeshData,
backend_args: dict[str, Any] | None,
mode: FileMode,
Expand All @@ -152,7 +152,7 @@ def write_mesh(
def write_meshtags(
self,
filename: str | Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
data: MeshTagsData,
backend_args: dict[str, Any] | None,
):
Expand All @@ -168,7 +168,7 @@ def write_meshtags(
def read_mesh_data(
self,
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: str | float | None,
read_from_partition: bool,
backend_args: dict[str, Any] | None,
Expand All @@ -189,7 +189,7 @@ def read_mesh_data(
def read_meshtags_data(
self,
filename: str | Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
backend_args: dict[str, Any] | None,
) -> MeshTagsData:
Expand All @@ -208,7 +208,7 @@ def read_meshtags_data(
def read_dofmap(
self,
filename: str | Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
backend_args: dict[str, Any] | None,
) -> dolfinx.graph.AdjacencyList:
Expand All @@ -227,7 +227,7 @@ def read_dofmap(
def read_dofs(
self,
filename: str | Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
time: float,
backend_args: dict[str, Any] | None,
Expand All @@ -248,7 +248,7 @@ def read_dofs(
"""

def read_cell_perms(
self, comm: MPI.Intracomm, filename: Path | str, backend_args: dict[str, Any] | None
self, comm: MPI.Comm, filename: Path | str, backend_args: dict[str, Any] | None
) -> npt.NDArray[np.uint32]:
"""
Read cell permutation from file with given communicator,
Expand All @@ -267,7 +267,7 @@ def read_cell_perms(
def write_function(
self,
filename: Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
u: FunctionData,
time: float,
mode: FileMode,
Expand All @@ -285,7 +285,7 @@ def write_function(
"""

def read_legacy_mesh(
self, filename: Path | str, comm: MPI.Intracomm, group: str
self, filename: Path | str, comm: MPI.Comm, group: str
) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.floating], str | None]:
"""Read in the mesh topology, geometry and (optionally) cell type from a
legacy DOLFIN HDF5-file.
Expand Down Expand Up @@ -320,7 +320,7 @@ def snapshot_checkpoint(

def read_hdf5_array(
self,
comm: MPI.Intracomm,
comm: MPI.Comm,
filename: Path | str,
group: str,
backend_args: dict[str, Any] | None,
Expand All @@ -344,7 +344,7 @@ def read_point_data(
self,
filename: Path | str,
name: str,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: str | float | None,
backend_args: dict[str, Any] | None,
) -> tuple[np.ndarray, int]:
Expand All @@ -362,7 +362,7 @@ def read_point_data(
...

def read_function_names(
self, filename: Path | str, comm: MPI.Intracomm, backend_args: dict[str, Any] | None
self, filename: Path | str, comm: MPI.Comm, backend_args: dict[str, Any] | None
) -> list[str]:
"""Read all function names from a file.

Expand All @@ -380,7 +380,7 @@ def read_cell_data(
self,
filename: Path | str,
name: str,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: str | float | None,
backend_args: dict[str, Any] | None,
) -> tuple[npt.NDArray[np.int64], np.ndarray]:
Expand All @@ -403,7 +403,7 @@ def write_data(
self,
filename: Path | str,
array_data: ArrayData,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: str | float | None,
mode: FileMode,
backend_args: dict[str, Any] | None,
Expand Down
34 changes: 17 additions & 17 deletions src/io4dolfinx/backends/adios2/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def convert_file_mode(mode: FileMode) -> adios2.Mode: # type: ignore[override]

def write_attributes(
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
attributes: dict[str, np.ndarray],
backend_args: dict[str, Any] | None = None,
Expand Down Expand Up @@ -86,7 +86,7 @@ def write_attributes(

def read_attributes(
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
backend_args: dict[str, Any] | None = None,
) -> dict[str, np.ndarray]:
Expand Down Expand Up @@ -122,7 +122,7 @@ def read_attributes(

def read_timestamps(
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
function_name: str,
backend_args: dict[str, Any] | None = None,
) -> npt.NDArray[np.float64 | str]: # type: ignore[type-var]
Expand Down Expand Up @@ -169,7 +169,7 @@ def read_timestamps(

def write_mesh(
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
mesh: MeshData,
backend_args: dict[str, Any] | None = None,
mode: FileMode = FileMode.write,
Expand Down Expand Up @@ -277,7 +277,7 @@ def write_mesh(

def read_mesh_data(
filename: Path | str,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: str | float | None = 0.0,
read_from_partition: bool = False,
backend_args: dict[str, Any] | None = None,
Expand Down Expand Up @@ -409,7 +409,7 @@ def read_mesh_data(

def write_meshtags(
filename: str | Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
data: MeshTagsData,
backend_args: dict[str, Any] | None = None,
):
Expand Down Expand Up @@ -462,7 +462,7 @@ def write_meshtags(


def read_meshtags_data(
filename: str | Path, comm: MPI.Intracomm, name: str, backend_args: dict[str, Any] | None = None
filename: str | Path, comm: MPI.Comm, name: str, backend_args: dict[str, Any] | None = None
) -> MeshTagsData:
"""Read mesh tags from file.

Expand Down Expand Up @@ -600,7 +600,7 @@ def read_meshtags_data(


def read_dofmap(
filename: str | Path, comm: MPI.Intracomm, name: str, backend_args: dict[str, Any] | None = None
filename: str | Path, comm: MPI.Comm, name: str, backend_args: dict[str, Any] | None = None
) -> dolfinx.graph.AdjacencyList:
"""Read the dofmap of a function with a given name.

Expand Down Expand Up @@ -641,7 +641,7 @@ def read_dofmap(

def read_dofs(
filename: str | Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
name: str,
time: float,
backend_args: dict[str, Any] | None = None,
Expand Down Expand Up @@ -698,7 +698,7 @@ def read_dofs(


def read_cell_perms(
comm: MPI.Intracomm, filename: Path | str, backend_args: dict[str, Any] | None = None
comm: MPI.Comm, filename: Path | str, backend_args: dict[str, Any] | None = None
) -> npt.NDArray[np.uint32]:
"""
Read cell permutation from file with given communicator,
Expand Down Expand Up @@ -733,7 +733,7 @@ def read_cell_perms(


def read_hdf5_array(
comm: MPI.Intracomm,
comm: MPI.Comm,
filename: Path | str,
group: str,
backend_args: dict[str, Any] | None = None,
Expand All @@ -758,7 +758,7 @@ def read_hdf5_array(

def write_function(
filename: Path,
comm: MPI.Intracomm,
comm: MPI.Comm,
u: FunctionData,
time: float = 0.0,
mode: FileMode = FileMode.append,
Expand Down Expand Up @@ -854,7 +854,7 @@ def write_function(


def read_legacy_mesh(
filename: Path | str, comm: MPI.Intracomm, group: str
filename: Path | str, comm: MPI.Comm, group: str
) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.floating], str | None]:
"""Read in the mesh topology, geometry and (optionally) cell type from a
legacy DOLFIN HDF5-file.
Expand Down Expand Up @@ -970,7 +970,7 @@ def snapshot_checkpoint(


def read_function_names(
filename: Path | str, comm: MPI.Intracomm, backend_args: dict[str, Any] | None
filename: Path | str, comm: MPI.Comm, backend_args: dict[str, Any] | None
) -> list[str]:
"""Read all function names from a file.

Expand All @@ -988,7 +988,7 @@ def read_function_names(
def read_point_data(
filename: Path | str,
name: str,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: float | str | None,
backend_args: dict[str, Any] | None,
) -> tuple[np.ndarray, int]:
Expand All @@ -1010,7 +1010,7 @@ def read_point_data(
def read_cell_data(
filename: Path | str,
name: str,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: str | float | None,
backend_args: dict[str, Any] | None,
) -> tuple[npt.NDArray[np.int64], np.ndarray]:
Expand All @@ -1033,7 +1033,7 @@ def read_cell_data(
def write_data(
filename: Path | str,
array_data: ArrayData,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: str | float | None,
mode: FileMode,
backend_args: dict[str, Any] | None,
Expand Down
9 changes: 4 additions & 5 deletions src/io4dolfinx/backends/adios2/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
from mpi4py import MPI

import adios2
import dolfinx.cpp.graph
import dolfinx.graph
import numpy as np
import numpy.typing as npt

from io4dolfinx.utils import compute_local_range, valid_function_types
from ...utils import compute_local_range, valid_function_types


def resolve_adios_scope(adios2):
Expand Down Expand Up @@ -60,7 +59,7 @@ def ADIOSFile(
engine: str,
mode: adios2.Mode,
io_name: str,
comm: MPI.Intracomm | None = None,
comm: MPI.Comm | None = None,
):
io = adios.DeclareIO(io_name)
io.SetEngine(engine)
Expand Down Expand Up @@ -118,7 +117,7 @@ def check_variable_exists(

def read_adjacency_list(
adios: adios2.ADIOS,
comm: MPI.Intracomm,
comm: MPI.Comm,
filename: Path | str,
data_name: str,
offsets_name: str,
Expand Down Expand Up @@ -221,7 +220,7 @@ def read_array(
filename: Path | str,
array_name: str,
engine: str,
comm: MPI.Intracomm,
comm: MPI.Comm,
time: float = 0.0,
time_name: str = "",
legacy: bool = False,
Expand Down
Loading