abc
compression_safeguards.safeguards.stencil.abc
Abstract base class for the stencil safeguards.
Classes:
-
StencilSafeguard–Stencil safeguard abstract base class.
StencilSafeguard
Stencil safeguard abstract base class.
Stencil safeguards describe properties that are computed in a neighbourhood around each element, i.e. whether or not an element satisfies the safeguard is coupled to its neighbouring elements.
Methods:
-
compute_check_neighbourhood_for_data_shape–Compute the shape of the data neighbourhood for data of a given shape.
-
check–Check if the
approximationarray upholds the property enforced by this -
check_pointwise–Check which elements in the
approximationarray uphold the neighbourhood -
compute_safe_intervals–Compute the intervals in which the safeguard's guarantees with respect
-
compute_footprint–Compute the footprint of the
footarray, e.g. for expanding data -
compute_inverse_footprint–Compute the inverse footprint of the
footarray, e.g. for expanding
compute_check_neighbourhood_for_data_shape
abstractmethod
compute_check_neighbourhood_for_data_shape(
data_shape: tuple[int, ...],
) -> tuple[dict[BoundaryCondition, NeighbourhoodAxis], ...]
Compute the shape of the data neighbourhood for data of a given shape. Boundary conditions of the same kind are combined, but separate kinds are tracked separately.
An empty dict is returned along dimensions for which the
stencil safeguard does not need to look at adjacent data points.
This method also checks that the data shape is compatible with this stencil safeguard.
| Parameters: |
|---|
| Returns: |
|
|---|
check
check(
data: ndarray[S, dtype[T]],
approximation: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> bool
Check if the approximation array upholds the property enforced by this
safeguard.
| Parameters: |
|
|---|
| Returns: |
|
|---|
check_pointwise
abstractmethod
check_pointwise(
data: ndarray[S, dtype[T]],
approximation: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Check which elements in the approximation array uphold the neighbourhood
property enforced by this safeguard.
| Parameters: |
|
|---|
| Returns: |
|---|
compute_safe_intervals
abstractmethod
compute_safe_intervals(
data: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> IntervalUnion[T, int, int]
Compute the intervals in which the safeguard's guarantees with respect
to the data are upheld.
The returned union of intervals must not have any overlap between the
intervals inside the union. The data must be contained in the union.
| Parameters: |
|
|---|
| Returns: |
|
|---|
compute_footprint
abstractmethod
compute_footprint(
foot: ndarray[S, dtype[bool]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Compute the footprint of the foot array, e.g. for expanding data
points into the pointwise checks that they contribute to.
For stencil safeguards, the footprint usually extends beyond
foot & where.
| Parameters: |
|
|---|
| Returns: |
|---|
compute_inverse_footprint
abstractmethod
compute_inverse_footprint(
foot: ndarray[S, dtype[bool]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Compute the inverse footprint of the foot array, e.g. for expanding
pointwise check fails into the points that could have contributed to
the failures.
For stencil safeguards, the inverse footprint usually extends beyond
foot & where.
| Parameters: |
|
|---|
| Returns: |
|---|