"""Implicit Residual Smoothing (IRSM)"""
from typing import Any
import os
if os.environ.get('__USE_CUDA', '0') == '1':
from cupy import ndarray
else:
from numpy import ndarray
from g3d.flow.operators import G3DMatrixOperator
[docs]
class IRSMOperator(G3DMatrixOperator):
"""Definition of class IRSMOperator, extends G3DMatrixOperator: Implicit Residual SMoothing (IRSM)"""
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.__reset()
def __reset(self) -> None:
pass
[docs]
def nullify(self) -> None:
"""Resets operator settings to default"""
super().nullify()
self.__reset()
def _operator_specific_print(self) -> None:
pass
[docs]
def smooth(self, b: ndarray) -> None:
"""Applies smoothing to specified array
Parameters
----------
b : ndarray :
data array (right-hand side vector Ax=b)
"""
b[0:self._nr] = self.solve(b)