pystella/derivs.py
def expand_stencil(f, coefs):
    """
    Expands a stencil over a field.

    :arg f: A :class:`~pystella.Field`.

    :arg coefs: A :class:`dict` whose values are the coefficients of the stencil
        at an offset given by the key. The keys must be 3-:class:`tuple`\\ s, and the
        values may be :mod:`pymbolic` expressions or constants.

    Example:

    .. doctest::

        >>> f = ps.Field("f", offset="h")
        >>> coefs = {(1, 0, 0): 1, (-1, 0, 0): -1}
        >>> stencil = ps.derivs.expand_stencil(f, coefs)
        >>> print(ps.index_fields(stencil))
        f[i + h + 1, j + h, k + h] + (-1)*f[i + h + -1, j + h, k + h]
    """

    return sum([c * shift_fields(f, shift=offset) for offset, c in coefs.items()])

    Expands a stencil over a field.

    :arg f: A :class:`~pystella.Field`.

    :arg coefs: A :class:`dict` whose values are the coefficients of the stencil
        at an offset given by the key. The keys must be 3-:class:`tuple`\\ s, and the
        values may be :mod:`pymbolic` expressions or constants.

    Example:

    .. doctest::

        >>> f = ps.Field("f", offset="h")
        >>> coefs = {(1, 0, 0): 1, (-1, 0, 0): -1}
        >>> stencil = ps.derivs.expand_stencil(f, coefs)
        >>> print(ps.index_fields(stencil))
        f[i + h + 1, j + h, k + h] + (-1)*f[i + h + -1, j + h, k + h]
    
Expands a stencil over a field.
Expands a stencil over a field .
def expand_stencil(f, coefs):
    return sum([c * shift_fields(f, shift=offset) for offset, c in coefs.items()])
def expand_stencil ( f , coefs ) : return sum ( [ c * shift_fields ( f , shift = offset ) for offset , c in coefs . items ( ) ] )
Expands a stencil over a field.
Expands a stencil over a field .
"""
    Expands a stencil over a field.

    :arg f: A :class:`~pystella.Field`.

    :arg coefs: A :class:`dict` whose values are the coefficients of the stencil
        at an offset given by the key. The keys must be 3-:class:`tuple`\\ s, and the
        values may be :mod:`pymbolic` expressions or constants.

    Example:

    .. doctest::

        >>> f = ps.Field("f", offset="h")
        >>> coefs = {(1, 0, 0): 1, (-1, 0, 0): -1}
        >>> stencil = ps.derivs.expand_stencil(f, coefs)
        >>> print(ps.index_fields(stencil))
        f[i + h + 1, j + h, k + h] + (-1)*f[i + h + -1, j + h, k + h]
    """
f
None
coefs
A :class:`dict` whose values are the coefficients of the stencil
at an offset given by the key. The keys must be 3-:class:`tuple`\\ s, and the
values may be :mod:`pymbolic` expressions or constants.






A : class : ` dict ` whose values are the coefficients of the stencil at an offset given by the key . The keys must be 3 - : class : ` tuple ` \\ s and the values may be : mod : ` pymbolic ` expressions or constants .