fmmgen/generator.py
def generate_L2P_operators(order, symbols, L_dict, potential=True, field=True):
    """
    generate_L2P_operators(order, symbols, index_dict):

    Generates potential and field calculation operators for the Fast
    Multipole Method up to order.

    Input:
    order, int:
        Maximum order of multipole expansion

    symbols, list:
        List of sympy symbol type objects which define coordinate labels.

    index_dict:
        Forward mapping dictionary between monomials of symbols and array
        indices, generated by generate_mappings or otherwise.

    Output:
    list:
        List of symbolic field calculation operators from local expansions up to
        order.

    Example:
    >>> order = 1
    >>> x, y, z = sp.symbols('x y z')
    >>> map, _ = generate_mappings(order, (x, y, z))
    >>> generate_L2P_operators(order, (x, y, z), map)
    [x*L[1, 0] + y*L[2, 0] + z*L[3, 0] + L[0, 0], -L[1, 0], -L[2, 0], -L[3, 0]]
    """
    x, y, z = symbols

    terms = []

    if potential:
        V = phi_deriv(order, symbols, L_dict, deriv=(0, 0, 0))
        terms.append(V)

    if field:
        Fx = -phi_deriv(order, symbols, L_dict, deriv=(1, 0, 0))
        Fy = -phi_deriv(order, symbols, L_dict, deriv=(0, 1, 0))
        Fz = -phi_deriv(order, symbols, L_dict, deriv=(0, 0, 1))
        terms.append(Fx)
        terms.append(Fy)
        terms.append(Fz)
    return terms

    generate_L2P_operators(order, symbols, index_dict):

    Generates potential and field calculation operators for the Fast
    Multipole Method up to order.

    Input:
    order, int:
        Maximum order of multipole expansion

    symbols, list:
        List of sympy symbol type objects which define coordinate labels.

    index_dict:
        Forward mapping dictionary between monomials of symbols and array
        indices, generated by generate_mappings or otherwise.

    Output:
    list:
        List of symbolic field calculation operators from local expansions up to
        order.

    Example:
    >>> order = 1
    >>> x, y, z = sp.symbols('x y z')
    >>> map, _ = generate_mappings(order, (x, y, z))
    >>> generate_L2P_operators(order, (x, y, z), map)
    [x*L[1, 0] + y*L[2, 0] + z*L[3, 0] + L[0, 0], -L[1, 0], -L[2, 0], -L[3, 0]]
    
generate_L2P_operators(order, symbols, index_dict):
Generates potential and field calculation operators for the Fast
Multipole Method up to order.

order, int:
Maximum order of multipole expansion

symbols, list:
List of sympy symbol type objects which define coordinate labels.

Forward mapping dictionary between monomials of symbols and array
indices, generated by generate_mappings or otherwise.

List of symbolic field calculation operators from local expansions up to
order.
generate_L2P_operators ( order symbols index_dict ) : Generates potential and field calculation operators for the Fast Multipole Method up to order . order int : Maximum order of multipole expansion symbols list : List of sympy symbol type objects which define coordinate labels . Forward mapping dictionary between monomials of symbols and array indices generated by generate_mappings or otherwise . List of symbolic field calculation operators from local expansions up to order .
def generate_L2P_operators(order, symbols, L_dict, potential=True, field=True):
    x, y, z = symbols
    terms = []
    if potential:
        V = phi_deriv(order, symbols, L_dict, deriv=(0, 0, 0))
        terms.append(V)
    if field:
        Fx = -phi_deriv(order, symbols, L_dict, deriv=(1, 0, 0))
        Fy = -phi_deriv(order, symbols, L_dict, deriv=(0, 1, 0))
        Fz = -phi_deriv(order, symbols, L_dict, deriv=(0, 0, 1))
        terms.append(Fx)
        terms.append(Fy)
        terms.append(Fz)
    return terms
def generate_L2P_operators ( order , symbols , L_dict , potential = True , field = True ) : x , y , z = symbols terms = [ ] if potential : V = phi_deriv ( order , symbols , L_dict , deriv = ( 0 , 0 , 0 ) ) terms . append ( V ) if field : Fx = - phi_deriv ( order , symbols , L_dict , deriv = ( 1 , 0 , 0 ) ) Fy = - phi_deriv ( order , symbols , L_dict , deriv = ( 0 , 1 , 0 ) ) Fz = - phi_deriv ( order , symbols , L_dict , deriv = ( 0 , 0 , 1 ) ) terms . append ( Fx ) terms . append ( Fy ) terms . append ( Fz ) return terms
generate_L2P_operators(order, symbols, index_dict):
Generates potential and field calculation operators for the Fast
Multipole Method up to order.
generate_L2P_operators ( order symbols index_dict ) : Generates potential and field calculation operators for the Fast Multipole Method up to order .
"""
    generate_L2P_operators(order, symbols, index_dict):

    Generates potential and field calculation operators for the Fast
    Multipole Method up to order.

    Input:
    order, int:
        Maximum order of multipole expansion

    symbols, list:
        List of sympy symbol type objects which define coordinate labels.

    index_dict:
        Forward mapping dictionary between monomials of symbols and array
        indices, generated by generate_mappings or otherwise.

    Output:
    list:
        List of symbolic field calculation operators from local expansions up to
        order.

    Example:
    >>> order = 1
    >>> x, y, z = sp.symbols('x y z')
    >>> map, _ = generate_mappings(order, (x, y, z))
    >>> generate_L2P_operators(order, (x, y, z), map)
    [x*L[1, 0] + y*L[2, 0] + z*L[3, 0] + L[0, 0], -L[1, 0], -L[2, 0], -L[3, 0]]
    """
order
symbols
L_dict
potential
field
examples
None