Source code for

Provides support for mypy type checking of the package

.. codeauthor:: David Zwicker <>

from typing import TYPE_CHECKING, Literal, Protocol, Tuple, Union

import numpy as np
from numpy.typing import ArrayLike  # @UnusedImport

    from ..grids.base import GridBase  # @UnusedImport

Real = Union[int, float]
Number = Union[Real, complex]
NumberOrArray = Union[Number, np.ndarray]
FloatNumerical = Union[float, np.ndarray]
BackendType = Literal["auto", "numpy", "numba"]

[docs]class OperatorType(Protocol): """an operator that acts on an array""" def __call__(self, arr: np.ndarray, out: np.ndarray) -> None: ...
[docs]class OperatorFactory(Protocol): """a factory function that creates an operator for a particular grid""" def __call__(self, grid: "GridBase", **kwargs) -> OperatorType: ...
[docs]class AdjacentEvaluator(Protocol): def __call__( self, arr_1d: np.ndarray, i_point: int, bc_idx: Tuple[int, ...] ) -> float: ...
[docs]class CellVolume(Protocol): def __call__(self, *args: int) -> float: ...
[docs]class GhostCellSetter(Protocol): def __call__(self, data_full: np.ndarray, args=None) -> None: ...
[docs]class VirtualPointEvaluator(Protocol): def __call__(self, arr: np.ndarray, idx: Tuple[int, ...], args=None) -> float: ...